From owner-dev-commits-src-all@freebsd.org Mon Apr 5 01:10:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 839B15BD096; Mon, 5 Apr 2021 01:10: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 4FDCJp3Brlz4kd4; Mon, 5 Apr 2021 01:10: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 5F9C57A58; Mon, 5 Apr 2021 01:10: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 1351Aon4039831; Mon, 5 Apr 2021 01:10:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1351AoCC039830; Mon, 5 Apr 2021 01:10:50 GMT (envelope-from git) Date: Mon, 5 Apr 2021 01:10:50 GMT Message-Id: <202104050110.1351AoCC039830@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: ea444392bb5b - main - readelf: return error in case of invalid file 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: ea444392bb5b351c930f28a02a4e68f51b25ba69 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 01:10:50 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=ea444392bb5b351c930f28a02a4e68f51b25ba69 commit ea444392bb5b351c930f28a02a4e68f51b25ba69 Author: Ed Maste AuthorDate: 2021-04-05 01:01:28 +0000 Commit: Ed Maste CommitDate: 2021-04-05 01:01:28 +0000 readelf: return error in case of invalid file GNU readelf exits with an error for a number of invalid file cases. Previously ELF Tool Chain readelf always exited with 0. Now we exit 1 upon detecting an error with one or more input files, but in any case all of them are processed. This should catch common failure cases. We still do not report an error for some types of malformed ELF files, but this is consistent with GNU readelf. PR: 252727 Reviewed by: jkoshy, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29377 --- contrib/elftoolchain/readelf/readelf.c | 36 +++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c index 022c9e9066ab..81e6897cf3cd 100644 --- a/contrib/elftoolchain/readelf/readelf.c +++ b/contrib/elftoolchain/readelf/readelf.c @@ -285,7 +285,7 @@ static const char *elf_osabi(unsigned int abi); static const char *elf_type(unsigned int type); static const char *elf_ver(unsigned int ver); static const char *dt_type(unsigned int mach, unsigned int dtype); -static void dump_ar(struct readelf *re, int); +static bool dump_ar(struct readelf *re, int); static void dump_arm_attributes(struct readelf *re, uint8_t *p, uint8_t *pe); static void dump_attributes(struct readelf *re); static uint8_t *dump_compatibility_tag(uint8_t *p, uint8_t *pe); @@ -315,7 +315,7 @@ static void dump_dwarf_ranges_foreach(struct readelf *re, Dwarf_Die die, Dwarf_Addr base); static void dump_dwarf_str(struct readelf *re); static void dump_eflags(struct readelf *re, uint64_t e_flags); -static void dump_elf(struct readelf *re); +static bool dump_elf(struct readelf *re); static void dump_flags(struct flag_desc *fd, uint64_t flags); static void dump_dyn_val(struct readelf *re, GElf_Dyn *dyn, uint32_t stab); static void dump_dynamic(struct readelf *re); @@ -7211,18 +7211,18 @@ unload_sections(struct readelf *re) } } -static void +static bool dump_elf(struct readelf *re) { /* Fetch ELF header. No need to continue if it fails. */ if (gelf_getehdr(re->elf, &re->ehdr) == NULL) { warnx("gelf_getehdr failed: %s", elf_errmsg(-1)); - return; + return (false); } if ((re->ec = gelf_getclass(re->elf)) == ELFCLASSNONE) { warnx("gelf_getclass failed: %s", elf_errmsg(-1)); - return; + return (false); } if (re->ehdr.e_ident[EI_DATA] == ELFDATA2MSB) { re->dw_read = _read_msb; @@ -7266,6 +7266,7 @@ dump_elf(struct readelf *re) dump_dwarf(re); if (re->options & ~RE_H) unload_sections(re); + return (true); } static void @@ -7311,7 +7312,7 @@ dump_dwarf(struct readelf *re) dwarf_finish(re->dbg, &de); } -static void +static bool dump_ar(struct readelf *re, int fd) { Elf_Arsym *arsym; @@ -7362,14 +7363,14 @@ dump_ar(struct readelf *re, int fd) } if (elf_rand(re->ar, SARMAG) != SARMAG) { warnx("elf_rand() failed: %s", elf_errmsg(-1)); - return; + return (false); } } process_members: if ((re->options & ~RE_C) == 0) - return; + return (true); cmd = ELF_C_READ; while ((re->elf = elf_begin(fd, cmd, re->ar)) != NULL) { @@ -7389,11 +7390,14 @@ process_members: elf_end(re->elf); } re->elf = re->ar; + return (true); } -static void +static bool dump_object(struct readelf *re, int fd) { + bool rv = false; + if ((re->flags & DISPLAY_FILENAME) != 0) printf("\nFile: %s\n", re->filename); @@ -7407,10 +7411,10 @@ dump_object(struct readelf *re, int fd) warnx("Not an ELF file."); goto done; case ELF_K_ELF: - dump_elf(re); + rv = dump_elf(re); break; case ELF_K_AR: - dump_ar(re, fd); + rv = dump_ar(re, fd); break; default: warnx("Internal: libelf returned unknown elf kind."); @@ -7418,6 +7422,7 @@ dump_object(struct readelf *re, int fd) done: elf_end(re->elf); + return (rv); } static void @@ -7765,7 +7770,7 @@ main(int argc, char **argv) fileargs_t *fa; struct readelf *re, re_storage; unsigned long si; - int fd, opt, i; + int fd, opt, i, exit_code; char *ep; re = &re_storage; @@ -7906,16 +7911,19 @@ main(int argc, char **argv) err(1, "Unable to enter capability mode"); } + exit_code = EXIT_SUCCESS; for (i = 0; i < argc; i++) { re->filename = argv[i]; fd = fileargs_open(fa, re->filename); if (fd < 0) { warn("open %s failed", re->filename); + exit_code = EXIT_FAILURE; } else { - dump_object(re, fd); + if (!dump_object(re, fd)) + exit_code = EXIT_FAILURE; close(fd); } } - exit(EXIT_SUCCESS); + exit(exit_code); } From owner-dev-commits-src-all@freebsd.org Mon Apr 5 01:19:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 759A55BCF64; Mon, 5 Apr 2021 01:19: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 4FDCW12k8Zz4lMh; Mon, 5 Apr 2021 01:19: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 4F033787B; Mon, 5 Apr 2021 01:19: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 1351JftM045309; Mon, 5 Apr 2021 01:19:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1351JfH3045308; Mon, 5 Apr 2021 01:19:41 GMT (envelope-from git) Date: Mon, 5 Apr 2021 01:19:41 GMT Message-Id: <202104050119.1351JfH3045308@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: 7a606f280a3e - main - nfsd: make the server repeat CB_RECALL every couple of seconds 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: 7a606f280a3e174dcdd12736b7b976903809eb9c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 01:19:41 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=7a606f280a3e174dcdd12736b7b976903809eb9c commit 7a606f280a3e174dcdd12736b7b976903809eb9c Author: Rick Macklem AuthorDate: 2021-04-05 01:15:54 +0000 Commit: Rick Macklem CommitDate: 2021-04-05 01:15:54 +0000 nfsd: make the server repeat CB_RECALL every couple of seconds Commit 01ae8969a9ee stopped the NFSv4.1/4.2 server from implicitly binding the back channel to a new TCP connection so that it conforms to RFC5661, for NFSv4.1/4.2. An effect of this for the Linux NFS client is that it will do a BindConnectionToSession when it sees NFSV4SEQ_CBPATHDOWN set in a sequence reply. This will fix the back channel, but the first attempt at a callback like CB_RECALL will already have failed. Without this patch, a CB_RECALL will not be retried and that can result in a 5 minute delay until the delegation times out. This patch modifies the code so that it will retry the CB_RECALL every couple of seconds, often avoiding the 5 minute delay. This is not critical for correct behaviour, but avoids the 5 minute delay for the case where the Linux client re-binds the back channel via BindConnectionToSession. MFC after: 2 weeks --- sys/fs/nfs/nfsrvstate.h | 2 ++ sys/fs/nfsserver/nfs_nfsdstate.c | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/sys/fs/nfs/nfsrvstate.h b/sys/fs/nfs/nfsrvstate.h index 2d60e8e8141f..427d5b132281 100644 --- a/sys/fs/nfs/nfsrvstate.h +++ b/sys/fs/nfs/nfsrvstate.h @@ -220,6 +220,7 @@ struct nfsstate { time_t expiry; time_t limit; u_int64_t compref; + time_t last; } deleg; } ls_un; struct nfslockfile *ls_lfp; /* Back pointer */ @@ -238,6 +239,7 @@ struct nfsstate { #define ls_delegtime ls_un.deleg.expiry #define ls_delegtimelimit ls_un.deleg.limit #define ls_compref ls_un.deleg.compref +#define ls_lastrecall ls_un.deleg.last /* * Nfs lock structure. diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 1cf0dcee99e9..fa7bb3ba9f56 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -3070,6 +3070,7 @@ tryagain: new_deleg->ls_clp = clp; new_deleg->ls_filerev = filerev; new_deleg->ls_compref = nd->nd_compref; + new_deleg->ls_lastrecall = 0; LIST_INSERT_HEAD(&lfp->lf_deleg, new_deleg, ls_file); LIST_INSERT_HEAD(NFSSTATEHASH(clp, new_deleg->ls_stateid), new_deleg, ls_hash); @@ -3191,6 +3192,7 @@ tryagain: new_deleg->ls_clp = clp; new_deleg->ls_filerev = filerev; new_deleg->ls_compref = nd->nd_compref; + new_deleg->ls_lastrecall = 0; nfsrv_writedelegcnt++; LIST_INSERT_HEAD(&lfp->lf_deleg, new_deleg, ls_file); LIST_INSERT_HEAD(NFSSTATEHASH(clp, @@ -3261,6 +3263,7 @@ tryagain: new_deleg->ls_clp = clp; new_deleg->ls_filerev = filerev; new_deleg->ls_compref = nd->nd_compref; + new_deleg->ls_lastrecall = 0; LIST_INSERT_HEAD(&lfp->lf_deleg, new_deleg, ls_file); LIST_INSERT_HEAD(NFSSTATEHASH(clp, new_deleg->ls_stateid), new_deleg, ls_hash); @@ -3339,6 +3342,7 @@ tryagain: new_deleg->ls_clp = clp; new_deleg->ls_filerev = filerev; new_deleg->ls_compref = nd->nd_compref; + new_deleg->ls_lastrecall = 0; LIST_INSERT_HEAD(&lfp->lf_deleg, new_deleg, ls_file); LIST_INSERT_HEAD(NFSSTATEHASH(clp, @@ -5265,7 +5269,8 @@ nfsrv_delegconflict(struct nfsstate *stp, int *haslockp, NFSPROC_T *p, * - check to see if the delegation has expired * - if so, get the v4root lock and then expire it */ - if (!(stp->ls_flags & NFSLCK_DELEGRECALL)) { + if ((stp->ls_flags & NFSLCK_DELEGRECALL) == 0 || stp->ls_lastrecall < + time_uptime) { /* * - do a recall callback, since not yet done * For now, never allow truncate to be set. To use @@ -5280,11 +5285,14 @@ nfsrv_delegconflict(struct nfsstate *stp, int *haslockp, NFSPROC_T *p, * will be extended when ops are done on the delegation * stateid, up to the timelimit.) */ - stp->ls_delegtime = NFSD_MONOSEC + (2 * nfsrv_lease) + - NFSRV_LEASEDELTA; - stp->ls_delegtimelimit = NFSD_MONOSEC + (6 * nfsrv_lease) + - NFSRV_LEASEDELTA; - stp->ls_flags |= NFSLCK_DELEGRECALL; + if ((stp->ls_flags & NFSLCK_DELEGRECALL) == 0) { + stp->ls_delegtime = NFSD_MONOSEC + (2 * nfsrv_lease) + + NFSRV_LEASEDELTA; + stp->ls_delegtimelimit = NFSD_MONOSEC + (6 * + nfsrv_lease) + NFSRV_LEASEDELTA; + stp->ls_flags |= NFSLCK_DELEGRECALL; + } + stp->ls_lastrecall = time_uptime + 1; /* * Loop NFSRV_CBRETRYCNT times while the CBRecall replies From owner-dev-commits-src-all@freebsd.org Mon Apr 5 08:02:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 296E05C60B5; Mon, 5 Apr 2021 08:02: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 4FDNRp0MJYz3Q5l; Mon, 5 Apr 2021 08:02: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 F224F1558B; Mon, 5 Apr 2021 08:02: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 13582TmL018003; Mon, 5 Apr 2021 08:02:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13582Ti9018002; Mon, 5 Apr 2021 08:02:29 GMT (envelope-from git) Date: Mon, 5 Apr 2021 08:02:29 GMT Message-Id: <202104050802.13582Ti9018002@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 361e95018002 - main - iflib: add support for netmap offsets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 361e950180025b72cf78a41a3563d32f9beb0b05 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 08:02:30 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=361e950180025b72cf78a41a3563d32f9beb0b05 commit 361e950180025b72cf78a41a3563d32f9beb0b05 Author: Vincenzo Maffione AuthorDate: 2021-04-05 07:54:47 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-05 07:54:47 +0000 iflib: add support for netmap offsets Follow-up change to a6d768d845c173823785c71bb18b40074e7a8998. This change adds iflib support for netmap offsets, enabling applications to use offsets on any driver backed by iflib. --- sys/net/iflib.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index f6cf1233a3b5..6dbaff556a15 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -914,13 +914,16 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init) nic_i_first = nic_i; for (i = 0; n > 0 && i < IFLIB_MAX_RX_REFRESH; n--, i++) { struct netmap_slot *slot = &ring->slot[nm_i]; - void *addr = PNMB(na, slot, &fl->ifl_bus_addrs[i]); + uint64_t paddr; + void *addr = PNMB(na, slot, &paddr); MPASS(i < IFLIB_MAX_RX_REFRESH); if (addr == NETMAP_BUF_BASE(na)) /* bad buf */ return netmap_ring_reinit(kring); + fl->ifl_bus_addrs[i] = paddr + + nm_get_offset(kring, slot); fl->ifl_rxd_idxs[i] = nic_i; if (__predict_false(init)) { @@ -1038,6 +1041,7 @@ iflib_netmap_txsync(struct netmap_kring *kring, int flags) for (n = 0; nm_i != head; n++) { struct netmap_slot *slot = &ring->slot[nm_i]; + uint64_t offset = nm_get_offset(kring, slot); u_int len = slot->len; uint64_t paddr; void *addr = PNMB(na, slot, &paddr); @@ -1053,7 +1057,7 @@ iflib_netmap_txsync(struct netmap_kring *kring, int flags) if (nic_i_start < 0) nic_i_start = nic_i; - pi.ipi_segs[seg_idx].ds_addr = paddr; + pi.ipi_segs[seg_idx].ds_addr = paddr + offset; pi.ipi_segs[seg_idx].ds_len = len; if (len) { pkt_len += len; @@ -1081,7 +1085,7 @@ iflib_netmap_txsync(struct netmap_kring *kring, int flags) __builtin_prefetch(&txq->ift_sds.ifsd_m[nic_i + 1]); __builtin_prefetch(&txq->ift_sds.ifsd_map[nic_i + 1]); - NM_CHECK_ADDR_LEN(na, addr, len); + NM_CHECK_ADDR_LEN_OFF(na, len, offset); if (slot->flags & NS_BUF_CHANGED) { /* buffer has changed, reload map */ @@ -1289,7 +1293,7 @@ iflib_netmap_attach(if_ctx_t ctx) bzero(&na, sizeof(na)); na.ifp = ctx->ifc_ifp; - na.na_flags = NAF_BDG_MAYSLEEP | NAF_MOREFRAG; + na.na_flags = NAF_BDG_MAYSLEEP | NAF_MOREFRAG | NAF_OFFSETS; MPASS(ctx->ifc_softc_ctx.isc_ntxqsets); MPASS(ctx->ifc_softc_ctx.isc_nrxqsets); From owner-dev-commits-src-all@freebsd.org Mon Apr 5 08:04:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 613915C6324; Mon, 5 Apr 2021 08:04: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 4FDNTx26czz3QLv; Mon, 5 Apr 2021 08: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 3A1CF15416; Mon, 5 Apr 2021 08: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 13584LrV018409; Mon, 5 Apr 2021 08: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 13584L9G018408; Mon, 5 Apr 2021 08:04:21 GMT (envelope-from git) Date: Mon, 5 Apr 2021 08:04:21 GMT Message-Id: <202104050804.13584L9G018408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: 75b13b151c9e - stable/13 - netmap: iflib: add nm_config callback MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 75b13b151c9e3d8fd71eab3578d4a83b067dadf6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 08:04:21 -0000 The branch stable/13 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=75b13b151c9e3d8fd71eab3578d4a83b067dadf6 commit 75b13b151c9e3d8fd71eab3578d4a83b067dadf6 Author: Vincenzo Maffione AuthorDate: 2021-03-29 09:26:12 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-05 08:04:00 +0000 netmap: iflib: add nm_config callback This per-driver callback is invoked by netmap when it wants to align the number of TX/RX netmap rings and/or the number of TX/RX netmap slots to the actual state configured in the hardware. The alignment happens when netmap mode is switched on (with no active netmap file descriptors for that netmap port), or when collecting netmap port information. MFC after: 1 week (cherry picked from commit 21d0c01226eb979556d6d792ec58eb54012fbc24) --- sys/net/iflib.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 9f3eff555728..788cc51822a1 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -829,6 +829,26 @@ iflib_netmap_register(struct netmap_adapter *na, int onoff) return (status); } +static int +iflib_netmap_config(struct netmap_adapter *na, struct nm_config_info *info) +{ + if_t ifp = na->ifp; + if_ctx_t ctx = ifp->if_softc; + iflib_rxq_t rxq = &ctx->ifc_rxqs[0]; + iflib_fl_t fl = &rxq->ifr_fl[0]; + + info->num_tx_rings = ctx->ifc_softc_ctx.isc_ntxqsets; + info->num_rx_rings = ctx->ifc_softc_ctx.isc_nrxqsets; + info->num_tx_descs = iflib_num_tx_descs(ctx); + info->num_rx_descs = iflib_num_rx_descs(ctx); + info->rx_buf_maxsize = fl->ifl_buf_size; + nm_prinf("txr %u rxr %u txd %u rxd %u rbufsz %u", + info->num_tx_rings, info->num_rx_rings, info->num_tx_descs, + info->num_rx_descs, info->rx_buf_maxsize); + + return 0; +} + static int netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init) { @@ -1279,6 +1299,7 @@ iflib_netmap_attach(if_ctx_t ctx) na.nm_rxsync = iflib_netmap_rxsync; na.nm_register = iflib_netmap_register; na.nm_intr = iflib_netmap_intr; + na.nm_config = iflib_netmap_config; na.num_tx_rings = ctx->ifc_softc_ctx.isc_ntxqsets; na.num_rx_rings = ctx->ifc_softc_ctx.isc_nrxqsets; return (netmap_attach(&na)); From owner-dev-commits-src-all@freebsd.org Mon Apr 5 08:09:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68B555C6684; Mon, 5 Apr 2021 08:09: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 4FDNc021Ykz3QmW; Mon, 5 Apr 2021 08:09: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 36DD815594; Mon, 5 Apr 2021 08:09: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 13589aS3019305; Mon, 5 Apr 2021 08:09:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13589aJm019304; Mon, 5 Apr 2021 08:09:36 GMT (envelope-from git) Date: Mon, 5 Apr 2021 08:09:36 GMT Message-Id: <202104050809.13589aJm019304@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: 8d415b19409b - stable/12 - netmap: iflib: add nm_config callback MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 8d415b19409b7709193b2f045d75a6b3bdeaf290 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 08:09:36 -0000 The branch stable/12 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=8d415b19409b7709193b2f045d75a6b3bdeaf290 commit 8d415b19409b7709193b2f045d75a6b3bdeaf290 Author: Vincenzo Maffione AuthorDate: 2021-03-29 09:26:12 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-05 08:05:16 +0000 netmap: iflib: add nm_config callback This per-driver callback is invoked by netmap when it wants to align the number of TX/RX netmap rings and/or the number of TX/RX netmap slots to the actual state configured in the hardware. The alignment happens when netmap mode is switched on (with no active netmap file descriptors for that netmap port), or when collecting netmap port information. MFC after: 1 week (cherry picked from commit 21d0c01226eb979556d6d792ec58eb54012fbc24) --- sys/net/iflib.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index f99b076cf0d3..1976852209a1 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -835,6 +835,26 @@ iflib_netmap_register(struct netmap_adapter *na, int onoff) return (status); } +static int +iflib_netmap_config(struct netmap_adapter *na, struct nm_config_info *info) +{ + if_t ifp = na->ifp; + if_ctx_t ctx = ifp->if_softc; + iflib_rxq_t rxq = &ctx->ifc_rxqs[0]; + iflib_fl_t fl = &rxq->ifr_fl[0]; + + info->num_tx_rings = ctx->ifc_softc_ctx.isc_ntxqsets; + info->num_rx_rings = ctx->ifc_softc_ctx.isc_nrxqsets; + info->num_tx_descs = iflib_num_tx_descs(ctx); + info->num_rx_descs = iflib_num_rx_descs(ctx); + info->rx_buf_maxsize = fl->ifl_buf_size; + nm_prinf("txr %u rxr %u txd %u rxd %u rbufsz %u", + info->num_tx_rings, info->num_rx_rings, info->num_tx_descs, + info->num_rx_descs, info->rx_buf_maxsize); + + return 0; +} + static int netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring *kring, bool init) { @@ -1286,6 +1306,7 @@ iflib_netmap_attach(if_ctx_t ctx) na.nm_rxsync = iflib_netmap_rxsync; na.nm_register = iflib_netmap_register; na.nm_intr = iflib_netmap_intr; + na.nm_config = iflib_netmap_config; na.num_tx_rings = ctx->ifc_softc_ctx.isc_ntxqsets; na.num_rx_rings = ctx->ifc_softc_ctx.isc_nrxqsets; return (netmap_attach(&na)); From owner-dev-commits-src-all@freebsd.org Mon Apr 5 08:44:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECC595C72A6; Mon, 5 Apr 2021 08:44: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 4FDPMk6G5fz3j2B; Mon, 5 Apr 2021 08:44: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 C85AD15E8E; Mon, 5 Apr 2021 08:44: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 1358i2EO074343; Mon, 5 Apr 2021 08:44:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1358i2Ga074342; Mon, 5 Apr 2021 08:44:02 GMT (envelope-from git) Date: Mon, 5 Apr 2021 08:44:02 GMT Message-Id: <202104050844.1358i2Ga074342@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: c5f88140d0e8 - stable/13 - cnv(9): Use a proper manual page section 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c5f88140d0e83c77ae8b25fc1e2b09e14a49c8a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 08:44:03 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c5f88140d0e83c77ae8b25fc1e2b09e14a49c8a5 commit c5f88140d0e83c77ae8b25fc1e2b09e14a49c8a5 Author: Gordon Bergling AuthorDate: 2021-01-27 17:18:17 +0000 Commit: Gordon Bergling CommitDate: 2021-04-05 08:43:32 +0000 cnv(9): Use a proper manual page section (cherry picked from commit 8dba3dd846cf60c9014f81b099058a9023477096) --- share/man/man9/cnv.9 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man9/cnv.9 b/share/man/man9/cnv.9 index 737a1b2fb518..eaae3f7156ab 100644 --- a/share/man/man9/cnv.9 +++ b/share/man/man9/cnv.9 @@ -166,7 +166,7 @@ resources. If an element of the given cookie has the wrong type or does not exist, the program is aborted. -.Sh EXAMPLE +.Sh EXAMPLES The following example demonstrates how to deal with cnvlist API. .Bd -literal int type; From owner-dev-commits-src-all@freebsd.org Mon Apr 5 08:53:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDEDB5C72EA; Mon, 5 Apr 2021 08:53: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 4FDPZ44pKTz3jST; Mon, 5 Apr 2021 08:53: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 9684215E46; Mon, 5 Apr 2021 08:53: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 1358r0Cc087960; Mon, 5 Apr 2021 08:53:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1358r023087959; Mon, 5 Apr 2021 08:53:00 GMT (envelope-from git) Date: Mon, 5 Apr 2021 08:53:00 GMT Message-Id: <202104050853.1358r023087959@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 95a466b20d92 - stable/13 - VOP_BMAP(9): Remove obsolete comma 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 95a466b20d92e8016058ec8bad46b63ca06dc60d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 08:53:00 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=95a466b20d92e8016058ec8bad46b63ca06dc60d commit 95a466b20d92e8016058ec8bad46b63ca06dc60d Author: Gordon Bergling AuthorDate: 2021-01-27 17:20:04 +0000 Commit: Gordon Bergling CommitDate: 2021-04-05 08:52:40 +0000 VOP_BMAP(9): Remove obsolete comma (cherry picked from commit 8a2f9dff2b9393503f63902c6ba7802efd8d6e49) --- share/man/man9/VOP_BMAP.9 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man9/VOP_BMAP.9 b/share/man/man9/VOP_BMAP.9 index 7ddb2b52c7ca..02869838274b 100644 --- a/share/man/man9/VOP_BMAP.9 +++ b/share/man/man9/VOP_BMAP.9 @@ -75,7 +75,7 @@ The vnode will be locked on entry and should remain locked on return. .Sh RETURN VALUES Zero is returned on success, otherwise an error code is returned. .Sh SEE ALSO -.Xr vnode 9 , +.Xr vnode 9 .Sh HISTORY A .Fn bmap From owner-dev-commits-src-all@freebsd.org Mon Apr 5 11:44:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 576555B46A8; Mon, 5 Apr 2021 11:44: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 4FDTMc1lLPz3vpb; Mon, 5 Apr 2021 11:44: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 2C07D18409; Mon, 5 Apr 2021 11:44: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 135BiCnj039480; Mon, 5 Apr 2021 11:44:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 135BiCpe039479; Mon, 5 Apr 2021 11:44:12 GMT (envelope-from git) Date: Mon, 5 Apr 2021 11:44:12 GMT Message-Id: <202104051144.135BiCpe039479@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: 829a69db855b - main - pf: change pf_route so pf only runs when packets enter and leave the stack. 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: 829a69db855b48ff7e8242b95e193a0783c489d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 11:44:12 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=829a69db855b48ff7e8242b95e193a0783c489d9 commit 829a69db855b48ff7e8242b95e193a0783c489d9 Author: Kristof Provost AuthorDate: 2021-04-02 10:23:42 +0000 Commit: Kristof Provost CommitDate: 2021-04-05 07:57:06 +0000 pf: change pf_route so pf only runs when packets enter and leave the stack. before this change pf_route operated on the semantic that pf runs when packets go over an interface, so when pf_route changed which interface the packet was on it would run pf_test again. this change changes (restores) the semantic that pf is only supposed to run when packets go in or out of the network stack, even if route-to is responsibly for short circuiting past the network stack. just to be clear, for normal packets (ie, those not touched by route-to/reply-to/dup-to), there isn't a difference between running pf when packets enter or leave the stack, or having pf run when a packet goes over an interface. the main reason for this change is that running the same packet through pf multiple times creates confusion for the state table. by default, pf states are floating, meaning that packets are matched to states regardless of which interface they're going over. if a packet leaving on em0 is rerouted out em1, both traversals will end up using the same state, which at best will make the accounting look weird, or at worst fail some checks in the state and get dropped. another reason for this commit is is to make handling of the changes that route-to makes consistent with other changes that are made to packet. eg, when nat is applied to a packet, we don't run pf_test again with the new addresses. the main caveat with this diff is you can't have one rule that pushes a packet out a different interface, and then have a rule on that second interface that NATs the packet. i'm not convinced this ever worked reliably or was used much anyway, so we don't think it's a big concern. discussed with many, with special thanks to bluhm@, sashan@ and sthen@ for weathering most of that pain. ok claudio@ sashan@ jmatthew@ Obtained from: OpenBSD MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29554 --- sys/netpfil/pf/pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 50bf4b3871c5..5b41be4ad683 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -5549,7 +5549,7 @@ pf_route(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, if (ifp == NULL) goto bad; - if (oifp != ifp) { + if (dir == PF_IN) { if (pf_test(PF_OUT, 0, ifp, &m0, inp) != PF_PASS) goto bad; else if (m0 == NULL) @@ -5738,7 +5738,7 @@ pf_route6(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, if (ifp == NULL) goto bad; - if (oifp != ifp) { + if (dir == PF_IN) { if (pf_test6(PF_OUT, PFIL_FWD, ifp, &m0, inp) != PF_PASS) goto bad; else if (m0 == NULL) From owner-dev-commits-src-all@freebsd.org Mon Apr 5 11:44:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7590B5B4952; Mon, 5 Apr 2021 11: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 4FDTMd2jNMz3vmS; Mon, 5 Apr 2021 11: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 4E8761832C; Mon, 5 Apr 2021 11: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 135BiDah039505; Mon, 5 Apr 2021 11: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 135BiDYr039504; Mon, 5 Apr 2021 11:44:13 GMT (envelope-from git) Date: Mon, 5 Apr 2021 11:44:13 GMT Message-Id: <202104051144.135BiDYr039504@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: f4c02909167b - main - pf: Add static DTrace probe points 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: f4c02909167b6f791df470afddfe31cabf009c4d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 11:44:13 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f4c02909167b6f791df470afddfe31cabf009c4d commit f4c02909167b6f791df470afddfe31cabf009c4d Author: Kristof Provost AuthorDate: 2021-04-02 13:53:34 +0000 Commit: Kristof Provost CommitDate: 2021-04-05 07:57:06 +0000 pf: Add static DTrace probe points These two have proven to be useful during debugging. We may as well keep them permanently. Others will be added as their utility becomes clear. Reviewed by: gnn MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29555 --- sys/netpfil/pf/pf.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 5b41be4ad683..4b11122df544 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -112,6 +113,15 @@ __FBSDID("$FreeBSD$"); #define DPFPRINTF(n, x) if (V_pf_status.debug >= (n)) printf x +SDT_PROVIDER_DEFINE(pf); +SDT_PROBE_DEFINE4(pf, ip, test, done, "int", "int", "struct pf_krule *", + "struct pf_state *"); +SDT_PROBE_DEFINE4(pf, ip, test6, done, "int", "int", "struct pf_krule *", + "struct pf_state *"); +SDT_PROBE_DEFINE5(pf, ip, state, lookup, "struct pfi_kkif *", + "struct pf_state_key_cmp *", "int", "struct pf_pdesc *", + "struct pf_state *"); + /* * Global variables */ @@ -326,6 +336,7 @@ VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); #define STATE_LOOKUP(i, k, d, s, pd) \ do { \ (s) = pf_find_state((i), (k), (d)); \ + SDT_PROBE5(pf, ip, state, lookup, i, k, d, pd, (s)); \ if ((s) == NULL) \ return (PF_DROP); \ if (PACKET_LOOPED(pd)) \ @@ -6318,6 +6329,8 @@ done: if (s) PF_STATE_UNLOCK(s); + SDT_PROBE4(pf, ip, test, done, action, reason, r, s); + return (action); } #endif /* INET */ @@ -6726,6 +6739,8 @@ done: (mtag = m_tag_find(m, PF_REASSEMBLED, NULL)) != NULL) action = pf_refragment6(ifp, m0, mtag); + SDT_PROBE4(pf, ip, test6, done, action, reason, r, s); + return (action); } #endif /* INET6 */ From owner-dev-commits-src-all@freebsd.org Mon Apr 5 13:51:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A45625B9EFC; Mon, 5 Apr 2021 13:51: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 4FDXC34B8xz4Zxd; Mon, 5 Apr 2021 13:51: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 80D9A19B37; Mon, 5 Apr 2021 13:51: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 135Dpxtn028092; Mon, 5 Apr 2021 13:51:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 135Dpxr7028091; Mon, 5 Apr 2021 13:51:59 GMT (envelope-from git) Date: Mon, 5 Apr 2021 13:51:59 GMT Message-Id: <202104051351.135Dpxr7028091@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d3f2c31b43b7 - stable/13 - traceroute6: Fix Capsicum rights for rcvsock 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d3f2c31b43b726ffbb180a42cee4b9f00c5ad5ed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 13:51:59 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d3f2c31b43b726ffbb180a42cee4b9f00c5ad5ed commit d3f2c31b43b726ffbb180a42cee4b9f00c5ad5ed Author: Mark Johnston AuthorDate: 2021-04-01 13:58:32 +0000 Commit: Mark Johnston CommitDate: 2021-04-05 13:51:56 +0000 traceroute6: Fix Capsicum rights for rcvsock - Always use distinct sockets for send and recv - Limit rights on the recv socket For ICMP6 we were using the same socket for both send and receive, and we limited rights on the socket such that it's impossible to receive anything. PR: 254623 Diagnosed by: Zhenlei Huang Reviewed by: oshogbo Differential Revision: https://reviews.freebsd.org/D29523 (cherry picked from commit b8ae450f05e62a851f444edaf7db2506ff99aa37) --- usr.sbin/traceroute6/traceroute6.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index 7663283a6c44..8449a9861302 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -578,8 +578,6 @@ main(int argc, char *argv[]) */ switch (useproto) { case IPPROTO_ICMPV6: - sndsock = rcvsock; - break; case IPPROTO_NONE: case IPPROTO_SCTP: case IPPROTO_TCP: @@ -928,7 +926,6 @@ main(int argc, char *argv[]) * namespaces (e.g filesystem) is restricted (see capsicum(4)). * We must connect(2) our socket before this point. */ - if (caph_enter_casper() < 0) { fprintf(stderr, "caph_enter_casper: %s\n", strerror(errno)); exit(1); @@ -940,6 +937,12 @@ main(int argc, char *argv[]) strerror(errno)); exit(1); } + cap_rights_init(&rights, CAP_RECV); + if (caph_rights_limit(rcvsock, &rights) < 0) { + fprintf(stderr, "caph_rights_limit rcvsock: %s\n", + strerror(errno)); + exit(1); + } /* * Main loop From owner-dev-commits-src-all@freebsd.org Mon Apr 5 14:24:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FED65BAE8E; Mon, 5 Apr 2021 14:24: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 4FDXw16dVgz4dSd; Mon, 5 Apr 2021 14:24: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 D55961A5CF; Mon, 5 Apr 2021 14:24: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 135EO1Gg071321; Mon, 5 Apr 2021 14:24:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 135EO1jg071320; Mon, 5 Apr 2021 14:24:01 GMT (envelope-from git) Date: Mon, 5 Apr 2021 14:24:01 GMT Message-Id: <202104051424.135EO1jg071320@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: 3b20b988e0f1 - main - Add some general notes about scripted installations. 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: 3b20b988e0f14740eb135ad5d56520b8cb94f429 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 14:24:02 -0000 The branch main has been updated by nwhitehorn: URL: https://cgit.FreeBSD.org/src/commit/?id=3b20b988e0f14740eb135ad5d56520b8cb94f429 commit 3b20b988e0f14740eb135ad5d56520b8cb94f429 Author: Nathan Whitehorn AuthorDate: 2021-04-05 14:10:34 +0000 Commit: Nathan Whitehorn CommitDate: 2021-04-05 14:23:41 +0000 Add some general notes about scripted installations. --- usr.sbin/bsdinstall/bsdinstall.8 | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/usr.sbin/bsdinstall/bsdinstall.8 b/usr.sbin/bsdinstall/bsdinstall.8 index e9f7dd808f73..556bafdd3881 100644 --- a/usr.sbin/bsdinstall/bsdinstall.8 +++ b/usr.sbin/bsdinstall/bsdinstall.8 @@ -450,6 +450,19 @@ Default: .El .Sh SCRIPTING .Nm +supports unattended, or minimally-attended, installations using scripting. +This can be used with either modified physical installation media or with +.Xr diskless 8 +installations over the network; information on preparing such media can be +found in +.Sx BUILDING AUTOMATIC INSTALL MEDIA +.Pp +Scripted installations follow an essentially identical path to interactive +installations, though with some minor feature differences (for example, +scripted installations do not support fetching of remote distribution files +since scripted installations normally install the same files and the distributions +can be added directly to the installation media). +.Nm scripts consist of two parts: a .Em preamble and a From owner-dev-commits-src-all@freebsd.org Mon Apr 5 14:24:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26B715BAFD4; Mon, 5 Apr 2021 14:24: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 4FDXw30SGYz4dVV; Mon, 5 Apr 2021 14:24: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 EBC4819EFA; Mon, 5 Apr 2021 14:24: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 135EO2w5071346; Mon, 5 Apr 2021 14:24:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 135EO2TI071345; Mon, 5 Apr 2021 14:24:02 GMT (envelope-from git) Date: Mon, 5 Apr 2021 14:24:02 GMT Message-Id: <202104051424.135EO2TI071345@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: b8639a1098a7 - main - Tweak language involving ZFS installation; no content changes. 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: b8639a1098a70e8ca8ec5880d2337fed04e4243a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 14:24:03 -0000 The branch main has been updated by nwhitehorn: URL: https://cgit.FreeBSD.org/src/commit/?id=b8639a1098a70e8ca8ec5880d2337fed04e4243a commit b8639a1098a70e8ca8ec5880d2337fed04e4243a Author: Nathan Whitehorn AuthorDate: 2021-04-05 14:23:00 +0000 Commit: Nathan Whitehorn CommitDate: 2021-04-05 14:23:41 +0000 Tweak language involving ZFS installation; no content changes. --- usr.sbin/bsdinstall/bsdinstall.8 | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/usr.sbin/bsdinstall/bsdinstall.8 b/usr.sbin/bsdinstall/bsdinstall.8 index 556bafdd3881..ee23fb4cecc4 100644 --- a/usr.sbin/bsdinstall/bsdinstall.8 +++ b/usr.sbin/bsdinstall/bsdinstall.8 @@ -477,7 +477,8 @@ exits. The two parts are separated by the usual script header (#!), which also sets the interpreter for the setup script. .Pp -A typical bsdinstall script looks like this: +A typical bsdinstall script, using the default filesystem layout and the UFS +filesystem, looks like this: .Bd -literal -offset indent PARTITIONS=DEFAULT DISTRIBUTIONS="kernel.txz base.txz" @@ -488,11 +489,12 @@ sysrc sshd_enable=YES pkg install puppet .Ed .Pp -For a ZFS scripted installation, the script looks like this: +For a scripted installation involving a ZFS pool spanning multiple disks, +the script instead looks like this: .Bd -literal -offset indent DISTRIBUTIONS="kernel.txz base.txz" export ZFSBOOT_VDEV_TYPE=stripe -export ZFSBOOT_DISKS=ada0 +export ZFSBOOT_DISKS="ada0 ada1" export nonInteractive="YES" #!/bin/sh @@ -529,6 +531,7 @@ the preamble can contain a variable which is passed to the .Cm scriptedpart target to control disk setup. +.Pp Alternatively, to use .Cm zfsboot @@ -537,12 +540,13 @@ instead of the preamble can contain the variable .Ev ZFSBOOT_DATASETS instead of -.Ev PARTITIONS , -and setting the variables +.Ev PARTITIONS +(see below). +If using .Cm zfsboot, the variables .Ev ZFSBOOT_DISKS and .Ev ZFSBOOT_VDEV_TYPE -to create the pool of disks for the base system. +must be set to create the pool of disks for the base system. Usually, for a mirrored booting disk, this two variables looks like this: .Bd -literal -offset indent ZFSBOOT_DISKS="ada0 ada1" @@ -551,7 +555,7 @@ ZFSBOOT_VDEV_TYPE=mirror .Pp Remember to export all the variables for the .Cm zfsboot -command, otherwise it will not get set. +command, otherwise installation will fail. .Ss SETUP SCRIPT Following the preamble is an optional shell script, beginning with a #! declaration. @@ -563,15 +567,17 @@ Note that newly configured system services, e.g., networking have not been started in the installed system at this time and only installation host services are available. .Ss ZFS DATASETS -The +If using +.Cm zfsboot +in an installation script, the .Cm zfsboot -partitioning takes the +partitioning tool takes the .Ev ZFSBOOT_DATASETS -variable to create the datasets on the base system. -This variable can get pretty huge if the pool contains a lot of datasets. +variable to create the ZFS datasets on the base system. +This variable definition can become large if the pool contains many datasets. The default value of the .Ev ZFSBOOT_DATASETS -looks like this: +is: .Bd -literal -offset indent # DATASET OPTIONS (comma or space separated; or both) @@ -603,11 +609,11 @@ looks like this: /var/tmp setuid=off .Ed .Pp -The first column if the dataset to be created on the top of the +The first column is the name of the dataset to be created as part of the .Ev ZFSBOOT_POOL_NAME -and the rest of the columns are the options to be set on each dataset. -The options must be written on a coma or space separated list, or both. -And everything behind a pound/hash character is ignored as a comment. +pool and the remainder of each line contains the options to be set on each dataset. +If multiple options are given, they can be separated by either commas or whitespace; +everything following a pound/hash character is ignored as a comment. .Ss BUILDING AUTOMATIC INSTALL MEDIA If building automatic install media, use tar to extract a release ISO: .Dl mkdir release-media @@ -629,3 +635,5 @@ first appeared in .Fx 9.0 . .Sh AUTHORS .An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org +.An Devin Teske Aq Mt dteske@FreeBSD.org +.An Allan Jude Aq Mt allanjude@FreeBSD.org From owner-dev-commits-src-all@freebsd.org Mon Apr 5 14:40:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BF385BB913; Mon, 5 Apr 2021 14:40: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 4FDYHF14vTz4fPV; Mon, 5 Apr 2021 14:40: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 163581A351; Mon, 5 Apr 2021 14:40: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 135EeepU095178; Mon, 5 Apr 2021 14:40:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 135EeeTZ095177; Mon, 5 Apr 2021 14:40:40 GMT (envelope-from git) Date: Mon, 5 Apr 2021 14:40:40 GMT Message-Id: <202104051440.135EeeTZ095177@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 5a898b2b78ce - main - Set PCIe device's Max_Payload_Size to match PCIe root's. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a898b2b78ce04d608bbaaa0813424b11f921ae7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 14:40:41 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=5a898b2b78ce04d608bbaaa0813424b11f921ae7 commit 5a898b2b78ce04d608bbaaa0813424b11f921ae7 Author: Alexander Motin AuthorDate: 2021-04-05 14:34:40 +0000 Commit: Alexander Motin CommitDate: 2021-04-05 14:34:40 +0000 Set PCIe device's Max_Payload_Size to match PCIe root's. Usually on boot the MPS is already configured by BIOS. But we've found that on hot-plug it is not true at least for our Supermicro X11 boards. As result, mismatch between root's configuration of 256 bytes and device's default of 128 bytes cause problems for some devices, while others seem to work fine. MFC after: 1 month Sponsored by: iXsystems, Inc. --- sys/dev/pci/pci.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index ab19d13fc13a..ef138e926b6f 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -4267,6 +4267,45 @@ pci_create_iov_child_method(device_t bus, device_t pf, uint16_t rid, } #endif +/* + * For PCIe device set Max_Payload_Size to match PCIe root's. + */ +static void +pcie_setup_mps(device_t dev) +{ + struct pci_devinfo *dinfo = device_get_ivars(dev); + device_t root; + uint16_t rmps, mmps, mps; + + if (dinfo->cfg.pcie.pcie_location == 0) + return; + root = pci_find_pcie_root_port(dev); + if (root == NULL) + return; + /* Check whether the MPS is already configured. */ + rmps = pcie_read_config(root, PCIER_DEVICE_CTL, 2) & + PCIEM_CTL_MAX_PAYLOAD; + mps = pcie_read_config(dev, PCIER_DEVICE_CTL, 2) & + PCIEM_CTL_MAX_PAYLOAD; + if (mps == rmps) + return; + /* Check whether the device is capable of the root's MPS. */ + mmps = (pcie_read_config(dev, PCIER_DEVICE_CAP, 2) & + PCIEM_CAP_MAX_PAYLOAD) << 5; + if (rmps > mmps) { + /* + * The device is unable to handle root's MPS. Limit root. + * XXX: We should traverse through all the tree, applying + * it to all the devices. + */ + pcie_adjust_config(root, PCIER_DEVICE_CTL, + PCIEM_CTL_MAX_PAYLOAD, mmps, 2); + } else { + pcie_adjust_config(dev, PCIER_DEVICE_CTL, + PCIEM_CTL_MAX_PAYLOAD, rmps, 2); + } +} + static void pci_add_child_clear_aer(device_t dev, struct pci_devinfo *dinfo) { @@ -4354,6 +4393,7 @@ pci_add_child(device_t bus, struct pci_devinfo *dinfo) pci_cfg_restore(dev, dinfo); pci_print_verbose(dinfo); pci_add_resources(bus, dev, 0, 0); + pcie_setup_mps(dev); pci_child_added(dinfo->cfg.dev); if (pci_clear_aer_on_attach) From owner-dev-commits-src-all@freebsd.org Mon Apr 5 15:35:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 900445BCED6; Mon, 5 Apr 2021 15:35: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 4FDZVQ3Dgsz4k0h; Mon, 5 Apr 2021 15:35: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 603361B042; Mon, 5 Apr 2021 15:35: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 135FZQkv070250; Mon, 5 Apr 2021 15:35:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 135FZQ9H070249; Mon, 5 Apr 2021 15:35:26 GMT (envelope-from git) Date: Mon, 5 Apr 2021 15:35:26 GMT Message-Id: <202104051535.135FZQ9H070249@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: 16e549ebe2ab - main - Merge the QorIQ GPIO drivers between arm and powerpc 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: 16e549ebe2ab5dbc43b78856ee9932f14867be20 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 15:35:26 -0000 The branch main has been updated by jhibbits: URL: https://cgit.FreeBSD.org/src/commit/?id=16e549ebe2ab5dbc43b78856ee9932f14867be20 commit 16e549ebe2ab5dbc43b78856ee9932f14867be20 Author: Justin Hibbits AuthorDate: 2021-04-05 15:35:15 +0000 Commit: Justin Hibbits CommitDate: 2021-04-05 15:35:15 +0000 Merge the QorIQ GPIO drivers between arm and powerpc Summary: They're nearly identical, so don't use two copies. Merge the newer driver into the older one, and move it to a common location. Add the Semihalf and associated copyrights in addition to mine, since it's a non-trivial amount of code merged. Reviewed By: mw Differential Revision: https://reviews.freebsd.org/D29520 --- sys/arm64/conf/GENERIC | 1 - sys/arm64/qoriq/ls1046_gpio.c | 498 ------------------------- sys/conf/files.arm64 | 2 +- sys/conf/files.powerpc | 2 +- sys/{powerpc/mpc85xx => dev/gpio}/qoriq_gpio.c | 153 +++++++- 5 files changed, 153 insertions(+), 503 deletions(-) diff --git a/sys/arm64/conf/GENERIC b/sys/arm64/conf/GENERIC index bb790a1b6df9..cf137417fbc5 100644 --- a/sys/arm64/conf/GENERIC +++ b/sys/arm64/conf/GENERIC @@ -182,7 +182,6 @@ device gpio device gpioled device fdt_pinctrl device gpioregulator -device ls1046_gpio # LS1046A GPIO controller device mv_gpio # Marvell GPIO controller device mvebu_pinctrl # Marvell Pinmux Controller device pl061 # Arm PL061 GPIO controller diff --git a/sys/arm64/qoriq/ls1046_gpio.c b/sys/arm64/qoriq/ls1046_gpio.c deleted file mode 100644 index 4992d059a0ee..000000000000 --- a/sys/arm64/qoriq/ls1046_gpio.c +++ /dev/null @@ -1,498 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2020 Alstom Group. - * Copyright (c) 2020 Semihalf. - * - * 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 - -#include "gpio_if.h" - -/* constants */ -enum { - DIRECTION = 0x0, - OPEN_DRAIN = 0x4, - DATA = 0x8, - INT_EV = 0xC, - INT_MASK = 0x10, - INT_CTRL = 0x14 -}; - -#define PIN_COUNT 32 -#define DEFAULT_CAPS \ - (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ - GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL) -#define GPIO(n) (1 << (31 - (n))) - -struct gpio_res { - int mem_rid; - struct resource *mem_res; -}; - -/* software context */ -struct gpio_softc { - device_t dev; - device_t busdev; - struct gpio_res res; - struct gpio_pin setup[PIN_COUNT]; - struct mtx mutex; -}; - -#define QORIQ_GPIO_LOCK(_sc) mtx_lock_spin(&(_sc)->mutex) -#define QORIQ_GPIO_UNLOCK(_sc) mtx_unlock_spin(&(_sc)->mutex) -#define QORIQ_GPIO_ASSERT_LOCKED(_sc) mtx_assert(&(_sc)->mutex, MA_OWNED) - -/* prototypes */ -/* helpers */ -static bool qoriq_make_gpio_res(device_t, struct gpio_res*); -static uint32_t qoriq_gpio_reg_read(device_t, uint32_t); -static void qoriq_gpio_reg_write(device_t, uint32_t, uint32_t); -static void qoriq_gpio_set(device_t, uint32_t, uint32_t, uint32_t); -static int qoriq_gpio_configure(device_t, uint32_t, uint32_t); - -/* GPIO API */ -static int qoriq_gpio_probe(device_t); -static int qoriq_gpio_attach(device_t); -static device_t qoriq_gpio_get_bus(device_t); -static int qoriq_gpio_pin_max(device_t, int*); -static int qoriq_gpio_pin_getname(device_t, uint32_t, char*); -static int qoriq_gpio_pin_getflags(device_t, uint32_t, uint32_t*); -static int qoriq_gpio_pin_setflags(device_t, uint32_t, uint32_t); -static int qoriq_gpio_pin_getcaps(device_t, uint32_t, uint32_t*); -static int qoriq_gpio_pin_get(device_t, uint32_t, uint32_t*); -static int qoriq_gpio_pin_set(device_t, uint32_t, uint32_t); -static int qoriq_gpio_pin_toggle(device_t, uint32_t); -static int qoriq_gpio_map_gpios(device_t, phandle_t, phandle_t, - int, pcell_t*, uint32_t*, uint32_t*); -static int qoriq_gpio_pin_access_32(device_t, uint32_t, uint32_t, uint32_t, - uint32_t*); -static int qoriq_gpio_pin_config_32(device_t, uint32_t, uint32_t, uint32_t*); - -static device_method_t qoriq_gpio_methods[] = { - DEVMETHOD(device_probe, qoriq_gpio_probe), - DEVMETHOD(device_attach, qoriq_gpio_attach), - - /* GPIO protocol */ - DEVMETHOD(gpio_get_bus, qoriq_gpio_get_bus), - DEVMETHOD(gpio_pin_max, qoriq_gpio_pin_max), - DEVMETHOD(gpio_pin_getname, qoriq_gpio_pin_getname), - DEVMETHOD(gpio_pin_getflags, qoriq_gpio_pin_getflags), - DEVMETHOD(gpio_pin_setflags, qoriq_gpio_pin_setflags), - DEVMETHOD(gpio_pin_getcaps, qoriq_gpio_pin_getcaps), - DEVMETHOD(gpio_pin_get, qoriq_gpio_pin_get), - DEVMETHOD(gpio_pin_set, qoriq_gpio_pin_set), - DEVMETHOD(gpio_pin_toggle, qoriq_gpio_pin_toggle), - DEVMETHOD(gpio_map_gpios, qoriq_gpio_map_gpios), - DEVMETHOD(gpio_pin_access_32, qoriq_gpio_pin_access_32), - DEVMETHOD(gpio_pin_config_32, qoriq_gpio_pin_config_32), - - DEVMETHOD_END -}; - -static driver_t gpio_driver = { - "gpio", - qoriq_gpio_methods, - sizeof(struct gpio_softc), -}; - -static devclass_t gpio_devclass; - -DRIVER_MODULE(gpio, simplebus, gpio_driver, gpio_devclass, 0, 0); -MODULE_VERSION(gpio, 1); - -/* - * helpers - */ -static bool -qoriq_make_gpio_res(device_t dev, struct gpio_res *out) -{ - - out->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - &out->mem_rid, RF_ACTIVE | RF_SHAREABLE); - - return (out->mem_res == NULL); -} - -static uint32_t -qoriq_gpio_reg_read(device_t dev, uint32_t reg) -{ - struct gpio_softc *sc = device_get_softc(dev); - uint32_t result; - - QORIQ_GPIO_ASSERT_LOCKED(sc); - result = bus_read_4(sc->res.mem_res, reg); - - return be32toh(result); -} - -static void -qoriq_gpio_reg_write(device_t dev, uint32_t reg, uint32_t val) -{ - struct gpio_softc *sc = device_get_softc(dev); - - QORIQ_GPIO_ASSERT_LOCKED(sc); - val = htobe32(val); - - bus_write_4(sc->res.mem_res, reg, val); - bus_barrier(sc->res.mem_res, reg, 4, BUS_SPACE_BARRIER_READ | - BUS_SPACE_BARRIER_WRITE); -} - -static void -qoriq_gpio_set(device_t dev, uint32_t reg, uint32_t pin, uint32_t set) -{ - uint32_t val; - - set = set != 0; - val = (qoriq_gpio_reg_read(dev, reg) & ~(1U << pin)) | (set << pin); - qoriq_gpio_reg_write(dev, reg, val); -} - -static int -qoriq_gpio_configure(device_t dev, uint32_t pin, uint32_t flags) -{ - struct gpio_softc *sc = device_get_softc(dev); - uint32_t newflags; - - if (pin >= PIN_COUNT) - return (EINVAL); - - /* - * Pin cannot function as input and output at the same time. - * The same applies to open-drain and push-pull functionality. - */ - if (((flags & GPIO_PIN_INPUT) && (flags & GPIO_PIN_OUTPUT)) || - ((flags & GPIO_PIN_OPENDRAIN) && (flags & GPIO_PIN_PUSHPULL))) - return (EINVAL); - - QORIQ_GPIO_ASSERT_LOCKED(sc); - - if (flags & GPIO_PIN_INPUT) { - newflags = GPIO_PIN_INPUT; - qoriq_gpio_set(dev, DIRECTION, pin, 0); - } - - if (flags & GPIO_PIN_OUTPUT) { - newflags = GPIO_PIN_OUTPUT; - qoriq_gpio_set(dev, DIRECTION, pin, 1); - - if (flags & GPIO_PIN_OPENDRAIN) { - newflags |= GPIO_PIN_OPENDRAIN; - qoriq_gpio_set(dev, OPEN_DRAIN, pin, 1); - } else { - newflags |= GPIO_PIN_PUSHPULL; - qoriq_gpio_set(dev, OPEN_DRAIN, pin, 0); - } - } - - sc->setup[pin].gp_flags = newflags; - - return (0); -} - -/* GPIO API */ -static int -qoriq_gpio_probe(device_t dev) -{ - - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (!ofw_bus_is_compatible(dev, "fsl,qoriq-gpio")) - return (ENXIO); - - device_set_desc(dev, "Integrated GPIO Controller"); - - return (BUS_PROBE_DEFAULT); -} - -static int -qoriq_gpio_attach(device_t dev) -{ - struct gpio_softc *sc = device_get_softc(dev); - int i; - - if (qoriq_make_gpio_res(dev, &sc->res)) - return (ENXIO); - - for (i = 0; i < PIN_COUNT; i++) - sc->setup[i].gp_caps = DEFAULT_CAPS; - - sc->dev = dev; - - sc->busdev = gpiobus_attach_bus(dev); - if (sc->busdev == NULL) - return (ENXIO); - - return (0); -} - -static device_t -qoriq_gpio_get_bus(device_t dev) -{ - struct gpio_softc *softc = device_get_softc(dev); - - return (softc->busdev); -} - -static int -qoriq_gpio_pin_max(device_t dev, int *maxpin) -{ - - if (maxpin == NULL) - return (EINVAL); - - *maxpin = PIN_COUNT - 1; - - return (0); -} - -static int -qoriq_gpio_pin_getname(device_t dev, uint32_t pin, char *name) -{ - - if (name == NULL || pin >= PIN_COUNT) - return (EINVAL); - - snprintf(name, GPIOMAXNAME, "pin %d", pin); - - return (0); -} - -static int -qoriq_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *pflags) -{ - struct gpio_softc *sc = device_get_softc(dev); - - if (pflags == NULL || pin >= PIN_COUNT) - return (EINVAL); - - QORIQ_GPIO_LOCK(sc); - *pflags = sc->setup[pin].gp_flags; - QORIQ_GPIO_UNLOCK(sc); - - return (0); -} - -static int -qoriq_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) -{ - struct gpio_softc *sc = device_get_softc(dev); - int ret; - - if (pin >= PIN_COUNT) - return (EINVAL); - - /* Check for unwanted flags. */ - QORIQ_GPIO_LOCK(sc); - - if ((flags & sc->setup[pin].gp_caps) != flags) { - QORIQ_GPIO_UNLOCK(sc); - return (EINVAL); - } - - ret = qoriq_gpio_configure(dev, pin, flags); - - QORIQ_GPIO_UNLOCK(sc); - - return (ret); -} - -static int -qoriq_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) -{ - struct gpio_softc *sc = device_get_softc(dev); - - if (caps == NULL || pin >= PIN_COUNT) - return (EINVAL); - - QORIQ_GPIO_LOCK(sc); - *caps = sc->setup[pin].gp_caps; - QORIQ_GPIO_UNLOCK(sc); - - return (0); -} - -static int -qoriq_gpio_pin_get(device_t dev, uint32_t pin, uint32_t *value) -{ - struct gpio_softc *sc = device_get_softc(dev); - - if (value == NULL || pin >= PIN_COUNT) - return (EINVAL); - - QORIQ_GPIO_LOCK(sc); - *value = (qoriq_gpio_reg_read(dev, DATA) & GPIO(pin)) != 0; - QORIQ_GPIO_UNLOCK(sc); - - return (0); -} - -static int -qoriq_gpio_pin_set(device_t dev, uint32_t pin, uint32_t value) -{ - struct gpio_softc *sc = device_get_softc(dev); - - if (pin >= PIN_COUNT) - return (EINVAL); - - QORIQ_GPIO_LOCK(sc); - qoriq_gpio_set(dev, DATA, pin, value); - QORIQ_GPIO_UNLOCK(sc); - - return (0); -} - -static int -qoriq_gpio_pin_toggle(device_t dev, uint32_t pin) -{ - struct gpio_softc *sc; - uint32_t value; - - if (pin >= PIN_COUNT) - return (EINVAL); - - sc = device_get_softc(dev); - - QORIQ_GPIO_LOCK(sc); - value = qoriq_gpio_reg_read(dev, DATA) ^ (1 << pin); - qoriq_gpio_reg_write(dev, DATA, value); - QORIQ_GPIO_UNLOCK(sc); - - return (0); -} - -static int -qoriq_gpio_map_gpios(device_t bus, phandle_t dev, phandle_t gparent, int gcells, - pcell_t *gpios, uint32_t *pin, uint32_t *flags) -{ - struct gpio_softc *sc = device_get_softc(bus); - int err; - - if (gpios[0] >= PIN_COUNT) - return (EINVAL); - - QORIQ_GPIO_LOCK(sc); - err = qoriq_gpio_configure(bus, gpios[0], gpios[1]); - QORIQ_GPIO_UNLOCK(sc); - - if (err != 0) - return (err); - - *pin = gpios[0]; - *flags = gpios[1]; - - return (0); -} - -static int -qoriq_gpio_pin_access_32(device_t dev, uint32_t first_pin, uint32_t clear_pins, - uint32_t change_pins, uint32_t *orig_pins) -{ - struct gpio_softc *sc; - uint32_t hwstate; - - sc = device_get_softc(dev); - - if (first_pin != 0) - return (EINVAL); - - QORIQ_GPIO_LOCK(sc); - hwstate = qoriq_gpio_reg_read(dev, DATA); - qoriq_gpio_reg_write(dev, DATA, (hwstate & ~clear_pins) ^ change_pins); - QORIQ_GPIO_UNLOCK(sc); - - if (orig_pins != NULL) - *orig_pins = hwstate; - - return (0); -} - -static int -qoriq_gpio_pin_config_32(device_t dev, uint32_t first_pin, uint32_t num_pins, - uint32_t *pin_flags) -{ - uint32_t dir, odr, mask, reg; - struct gpio_softc *sc; - uint32_t newflags[32]; - int i; - - if (first_pin != 0 || num_pins > PIN_COUNT) - return (EINVAL); - - sc = device_get_softc(dev); - - dir = odr = mask = 0; - - for (i = 0; i < num_pins; i++) { - newflags[i] = 0; - mask |= (1 << i); - - if (pin_flags[i] & GPIO_PIN_INPUT) { - newflags[i] = GPIO_PIN_INPUT; - dir &= ~(1 << i); - } else { - newflags[i] = GPIO_PIN_OUTPUT; - dir |= (1 << i); - - if (pin_flags[i] & GPIO_PIN_OPENDRAIN) { - newflags[i] |= GPIO_PIN_OPENDRAIN; - odr |= (1 << i); - } else { - newflags[i] |= GPIO_PIN_PUSHPULL; - odr &= ~(1 << i); - } - } - } - - QORIQ_GPIO_LOCK(sc); - - reg = (qoriq_gpio_reg_read(dev, DIRECTION) & ~mask) | dir; - qoriq_gpio_reg_write(dev, DIRECTION, reg); - - reg = (qoriq_gpio_reg_read(dev, OPEN_DRAIN) & ~mask) | odr; - qoriq_gpio_reg_write(dev, OPEN_DRAIN, reg); - - for (i = 0; i < num_pins; i++) - sc->setup[i].gp_flags = newflags[i]; - - QORIQ_GPIO_UNLOCK(sc); - - return (0); -} diff --git a/sys/conf/files.arm64 b/sys/conf/files.arm64 index 4bf3350cac29..d7809bfb3d68 100644 --- a/sys/conf/files.arm64 +++ b/sys/conf/files.arm64 @@ -169,6 +169,7 @@ dev/dwc/if_dwc_if.m optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_ dev/gpio/pl061.c optional pl061 gpio dev/gpio/pl061_acpi.c optional pl061 gpio acpi dev/gpio/pl061_fdt.c optional pl061 gpio fdt +dev/gpio/qoriq_gpio.c optional SOC_NXP_LS gpio fdt dev/hwpmc/hwpmc_arm64.c optional hwpmc dev/hwpmc/hwpmc_arm64_md.c optional hwpmc @@ -494,7 +495,6 @@ tegra210_xusb.fw optional tegra210_xusb_fw \ # NXP arm/freescale/vybrid/vf_i2c.c optional vf_i2c iicbus SOC_NXP_LS -arm64/qoriq/ls1046_gpio.c optional ls1046_gpio gpio fdt SOC_NXP_LS arm64/qoriq/qoriq_dw_pci.c optional pci fdt SOC_NXP_LS arm64/qoriq/qoriq_therm.c optional pci fdt SOC_NXP_LS arm64/qoriq/qoriq_therm_if.m optional pci fdt SOC_NXP_LS diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 347abee153d2..19c97c34fa86 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -24,6 +24,7 @@ dev/adb/adb_if.m optional adb dev/adb/adb_buttons.c optional adb dev/agp/agp_apple.c optional agp powermac dev/fb/fb.c optional sc +dev/gpio/qoriq_gpio.c optional mpc85xx gpio dev/hwpmc/hwpmc_e500.c optional hwpmc dev/hwpmc/hwpmc_mpc7xxx.c optional hwpmc dev/hwpmc/hwpmc_power8.c optional hwpmc @@ -186,7 +187,6 @@ powerpc/mpc85xx/mpc85xx_gpio.c optional mpc85xx gpio powerpc/mpc85xx/platform_mpc85xx.c optional mpc85xx powerpc/mpc85xx/pci_mpc85xx.c optional pci mpc85xx powerpc/mpc85xx/pci_mpc85xx_pcib.c optional pci mpc85xx -powerpc/mpc85xx/qoriq_gpio.c optional mpc85xx gpio powerpc/ofw/ofw_machdep.c standard powerpc/ofw/ofw_pcibus.c optional pci powerpc/ofw/ofw_pcib_pci.c optional pci diff --git a/sys/powerpc/mpc85xx/qoriq_gpio.c b/sys/dev/gpio/qoriq_gpio.c similarity index 68% rename from sys/powerpc/mpc85xx/qoriq_gpio.c rename to sys/dev/gpio/qoriq_gpio.c index 7abae276e8d1..82bd6cd9a72b 100644 --- a/sys/powerpc/mpc85xx/qoriq_gpio.c +++ b/sys/dev/gpio/qoriq_gpio.c @@ -1,4 +1,6 @@ /*- + * Copyright (c) 2020 Alstom Group. + * Copyright (c) 2020 Semihalf. * Copyright (c) 2015 Justin Hibbits * All rights reserved. * @@ -52,6 +54,8 @@ __FBSDID("$FreeBSD$"); #define MAXPIN (31) #define VALID_PIN(u) ((u) >= 0 && (u) <= MAXPIN) +#define DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ + GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL) #define GPIO_LOCK(sc) mtx_lock(&(sc)->sc_mtx) #define GPIO_UNLOCK(sc) mtx_unlock(&(sc)->sc_mtx) @@ -66,12 +70,14 @@ __FBSDID("$FreeBSD$"); #define GPIO_GPIER 0xc #define GPIO_GPIMR 0x10 #define GPIO_GPICR 0x14 +#define GPIO_GPIBE 0x18 struct qoriq_gpio_softc { device_t dev; device_t busdev; struct mtx sc_mtx; struct resource *sc_mem; /* Memory resource */ + struct gpio_pin sc_pins[MAXPIN + 1]; }; static device_t @@ -96,11 +102,16 @@ qoriq_gpio_pin_max(device_t dev, int *maxpin) static int qoriq_gpio_pin_getcaps(device_t dev, uint32_t pin, uint32_t *caps) { + struct qoriq_gpio_softc *sc; + + sc = device_get_softc(dev); if (!VALID_PIN(pin)) return (EINVAL); - *caps = (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | GPIO_PIN_OPENDRAIN); + GPIO_LOCK(sc); + *caps = sc->sc_pins[pin].gp_caps; + GPIO_UNLOCK(sc); return (0); } @@ -135,6 +146,11 @@ qoriq_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) return (EINVAL); GPIO_LOCK(sc); + if ((flags & sc->sc_pins[pin].gp_caps) != flags) { + GPIO_UNLOCK(sc); + return (EINVAL); + } + if (flags & GPIO_PIN_INPUT) { reg = bus_read_4(sc->sc_mem, GPIO_GPDIR); reg &= ~(1 << (31 - pin)); @@ -151,10 +167,28 @@ qoriq_gpio_pin_setflags(device_t dev, uint32_t pin, uint32_t flags) reg &= ~(1 << (31 - pin)); bus_write_4(sc->sc_mem, GPIO_GPODR, reg); } + sc->sc_pins[pin].gp_flags = flags; GPIO_UNLOCK(sc); return (0); } +static int +qoriq_gpio_pin_getflags(device_t dev, uint32_t pin, uint32_t *pflags) +{ + struct qoriq_gpio_softc *sc; + + if (!VALID_PIN(pin)) + return (EINVAL); + + sc = device_get_softc(dev); + + GPIO_LOCK(sc); + *pflags = sc->sc_pins[pin].gp_flags; + GPIO_UNLOCK(sc); + + return (0); +} + /* Set a specific output pin's value. */ static int qoriq_gpio_pin_set(device_t dev, uint32_t pin, unsigned int value) @@ -233,13 +267,113 @@ qoriq_gpio_probe(device_t dev) return (0); } +static int +qoriq_gpio_pin_access_32(device_t dev, uint32_t first_pin, uint32_t clear_pins, + uint32_t change_pins, uint32_t *orig_pins) +{ + struct qoriq_gpio_softc *sc; + uint32_t hwstate; + + sc = device_get_softc(dev); + + if (first_pin != 0) + return (EINVAL); + + GPIO_LOCK(sc); + hwstate = bus_read_4(sc->sc_mem, GPIO_GPDAT); + bus_write_4(sc->sc_mem, GPIO_GPDAT, + (hwstate & ~clear_pins) ^ change_pins); + GPIO_UNLOCK(sc); + + if (orig_pins != NULL) + *orig_pins = hwstate; + + return (0); +} + +static int +qoriq_gpio_pin_config_32(device_t dev, uint32_t first_pin, uint32_t num_pins, + uint32_t *pin_flags) +{ + uint32_t dir, odr, mask, reg; + struct qoriq_gpio_softc *sc; + uint32_t newflags[32]; + int i; + + if (first_pin != 0 || !VALID_PIN(num_pins)) + return (EINVAL); + + sc = device_get_softc(dev); + + dir = odr = mask = 0; + + for (i = 0; i < num_pins; i++) { + newflags[i] = 0; + mask |= (1 << i); + + if (pin_flags[i] & GPIO_PIN_INPUT) { + newflags[i] = GPIO_PIN_INPUT; + dir &= ~(1 << i); + } else { + newflags[i] = GPIO_PIN_OUTPUT; + dir |= (1 << i); + + if (pin_flags[i] & GPIO_PIN_OPENDRAIN) { + newflags[i] |= GPIO_PIN_OPENDRAIN; + odr |= (1 << i); + } else { + newflags[i] |= GPIO_PIN_PUSHPULL; + odr &= ~(1 << i); + } + } + } + + GPIO_LOCK(sc); + + reg = (bus_read_4(sc->sc_mem, GPIO_GPDIR) & ~mask) | dir; + bus_write_4(sc->sc_mem, GPIO_GPDIR, reg); + + reg = (bus_read_4(sc->sc_mem, GPIO_GPODR) & ~mask) | odr; + bus_write_4(sc->sc_mem, GPIO_GPODR, reg); + + for (i = 0; i < num_pins; i++) + sc->sc_pins[i].gp_flags = newflags[i]; + + GPIO_UNLOCK(sc); + + return (0); +} + +static int +qoriq_gpio_map_gpios(device_t bus, phandle_t dev, phandle_t gparent, int gcells, + pcell_t *gpios, uint32_t *pin, uint32_t *flags) +{ + struct qoriq_gpio_softc *sc; + int err; + + if (!VALID_PIN(gpios[0])) + return (EINVAL); + + sc = device_get_softc(bus); + GPIO_LOCK(sc); + err = qoriq_gpio_pin_setflags(bus, gpios[0], gpios[1]); + GPIO_UNLOCK(sc); + + if (err == 0) { + *pin = gpios[0]; + *flags = gpios[1]; + } + + return (err); +} + static int qoriq_gpio_detach(device_t dev); static int qoriq_gpio_attach(device_t dev) { struct qoriq_gpio_softc *sc = device_get_softc(dev); - int rid; + int i, rid; sc->dev = dev; @@ -255,11 +389,21 @@ qoriq_gpio_attach(device_t dev) return (ENOMEM); } + for (i = 0; i <= MAXPIN; i++) + sc->sc_pins[i].gp_caps = DEFAULT_CAPS; + sc->busdev = gpiobus_attach_bus(dev); if (sc->busdev == NULL) { qoriq_gpio_detach(dev); return (ENOMEM); } + /* + * Enable the GPIO Input Buffer for all GPIOs. + * This is safe on devices without a GPIBE register, because those + * devices ignore writes and read 0's in undefined portions of the map. + */ + if (ofw_bus_is_compatible(dev, "fsl,qoriq-gpio")) + bus_write_4(sc->sc_mem, GPIO_GPIBE, 0xffffffff); OF_device_register_xref(OF_xref_from_node(ofw_bus_get_node(dev)), dev); @@ -297,9 +441,14 @@ static device_method_t qoriq_gpio_methods[] = { DEVMETHOD(gpio_pin_getcaps, qoriq_gpio_pin_getcaps), DEVMETHOD(gpio_pin_get, qoriq_gpio_pin_get), DEVMETHOD(gpio_pin_set, qoriq_gpio_pin_set), + DEVMETHOD(gpio_pin_getflags, qoriq_gpio_pin_getflags), DEVMETHOD(gpio_pin_setflags, qoriq_gpio_pin_setflags), DEVMETHOD(gpio_pin_toggle, qoriq_gpio_pin_toggle), + DEVMETHOD(gpio_map_gpios, qoriq_gpio_map_gpios), + DEVMETHOD(gpio_pin_access_32, qoriq_gpio_pin_access_32), + DEVMETHOD(gpio_pin_config_32, qoriq_gpio_pin_config_32), + DEVMETHOD_END }; From owner-dev-commits-src-all@freebsd.org Mon Apr 5 15:42:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F0D05BD1CC; Mon, 5 Apr 2021 15:42: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 4FDZfp1Cwtz4kXJ; Mon, 5 Apr 2021 15:42: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 1921C1B444; Mon, 5 Apr 2021 15:42: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 135FgfoJ084245; Mon, 5 Apr 2021 15:42:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 135Fgfux084244; Mon, 5 Apr 2021 15:42:41 GMT (envelope-from git) Date: Mon, 5 Apr 2021 15:42:41 GMT Message-Id: <202104051542.135Fgfux084244@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: 015351de04e3 - main - rc: make ctld depend on NETWORKING 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: 015351de04e3e621cff825cc1fdad5faf078c3ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 15:42:42 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=015351de04e3e621cff825cc1fdad5faf078c3ac commit 015351de04e3e621cff825cc1fdad5faf078c3ac Author: Edward Tomasz Napierala AuthorDate: 2021-04-05 15:40:49 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-04-05 15:40:54 +0000 rc: make ctld depend on NETWORKING This fixes a problem where ctld(8) would refuse to start on boot with a specific IP address to listen on configured in ctl.conf(5). It also fixes a problem where ctld(8) would fail to start with some network interfaces which require a sysctl.conf(5) tweak to configure them, eg to switch them from InfiniBand to IP mode. PR: 232397 Reported By: Mahmoud Al-Qudsi Submitted By: Jeremy Faulkner Reviewed By: mav Differential Revision: https://reviews.freebsd.org/D29578 --- libexec/rc/rc.d/ctld | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/ctld b/libexec/rc/rc.d/ctld index 1364d4f6c7a7..2919a10dea4d 100755 --- a/libexec/rc/rc.d/ctld +++ b/libexec/rc/rc.d/ctld @@ -4,7 +4,7 @@ # # PROVIDE: ctld -# REQUIRE: FILESYSTEMS +# REQUIRE: FILESYSTEMS NETWORKING # BEFORE: DAEMON # KEYWORD: nojail From owner-dev-commits-src-all@freebsd.org Mon Apr 5 16:30:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C33035BEB2D; Mon, 5 Apr 2021 16:30: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 4FDbjw53Sqz4p9N; Mon, 5 Apr 2021 16:30: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 9F4901B6FF; Mon, 5 Apr 2021 16:30: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 135GUSnI050551; Mon, 5 Apr 2021 16:30:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 135GUSKM050550; Mon, 5 Apr 2021 16:30:28 GMT (envelope-from git) Date: Mon, 5 Apr 2021 16:30:28 GMT Message-Id: <202104051630.135GUSKM050550@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Chuck Tuffli Subject: git: f30f11f878fe - main - wait for device mounts in zpool and dumpon MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chuck X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f30f11f878fe2aa535cd286810d31c92793a3d95 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 16:30:28 -0000 The branch main has been updated by chuck: URL: https://cgit.FreeBSD.org/src/commit/?id=f30f11f878fe2aa535cd286810d31c92793a3d95 commit f30f11f878fe2aa535cd286810d31c92793a3d95 Author: Chuck Tuffli AuthorDate: 2021-03-05 16:13:23 +0000 Commit: Chuck Tuffli CommitDate: 2021-04-05 16:25:04 +0000 wait for device mounts in zpool and dumpon If the root file system is composed from multiple devices, wait for devices to be ready before running zpool and dumpon rc scripts. An example of this is if the bulk of the root file system exists on a fast device (e.g. NVMe) but the /var directory comes from a ZFS dataset on a slower device (e.g. SATA). In this case, it is possible that the zpool import may run before the slower device has finished being probed, leaving the system in an intermediate state. Fix is to add root_hold_wait to the zpool and dumpon (which has a similar issue) rc scripts. PR: 242189 Reported by: osidorkin@gmail.com Reviewed by: allanjude MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D29101 --- libexec/rc/rc.d/dumpon | 2 ++ libexec/rc/rc.d/zpool | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/dumpon b/libexec/rc/rc.d/dumpon index dddbf2af01cc..752f52315f49 100755 --- a/libexec/rc/rc.d/dumpon +++ b/libexec/rc/rc.d/dumpon @@ -42,6 +42,7 @@ dumpon_start() [Nn][Oo] | '') ;; [Aa][Uu][Tt][Oo]) + root_hold_wait dev=$(/bin/kenv -q dumpdev) if [ -n "${dev}" ] ; then dumpon_try "${dev}" @@ -56,6 +57,7 @@ dumpon_start() return 1 ;; *) + root_hold_wait dumpon_try "${dumpdev}" ;; esac diff --git a/libexec/rc/rc.d/zpool b/libexec/rc/rc.d/zpool index f98693f2cb13..e73c2b7e5b73 100755 --- a/libexec/rc/rc.d/zpool +++ b/libexec/rc/rc.d/zpool @@ -22,7 +22,14 @@ zpool_start() for cachefile in /etc/zfs/zpool.cache /boot/zfs/zpool.cache; do if [ -r $cachefile ]; then - zpool import -c $cachefile -a -N && break + zpool import -c $cachefile -a -N + if [ $? -ne 0 ]; then + echo "Import of zpool cache ${cachefile} failed," \ + "will retry after root mount hold release" + root_hold_wait + zpool import -c $cachefile -a -N + fi + break fi done } From owner-dev-commits-src-all@freebsd.org Mon Apr 5 17:10:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E94725C0985; Mon, 5 Apr 2021 17:10: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 4FDcbp6C9Yz4sSY; Mon, 5 Apr 2021 17:10: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 BF8FA1C1E5; Mon, 5 Apr 2021 17:10: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 135HAEBu003572; Mon, 5 Apr 2021 17:10:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 135HAE6a003566; Mon, 5 Apr 2021 17:10:14 GMT (envelope-from git) Date: Mon, 5 Apr 2021 17:10:14 GMT Message-Id: <202104051710.135HAE6a003566@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Brandon Bergren Subject: git: 0c9f52d4cebf - main - powerpc: Fix programmer's switch driver and add to GENERIC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c9f52d4cebf18addbea45bd19abd910ba1ea43b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 17:10:15 -0000 The branch main has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=0c9f52d4cebf18addbea45bd19abd910ba1ea43b commit 0c9f52d4cebf18addbea45bd19abd910ba1ea43b Author: Brandon Bergren AuthorDate: 2021-04-05 17:04:12 +0000 Commit: Brandon Bergren CommitDate: 2021-04-05 17:04:12 +0000 powerpc: Fix programmer's switch driver and add to GENERIC Older G4 and G3 models have a programmer's switch that can be used to generate an interrupt to drop into the debugger. This code hadn't been tested for a long time. It had been broken back in 2005 in r153050. Repair and modernize the code and add it to GENERIC. Reviewed by: jhibbits (approved w/ removal of unused sc_dev var) Sponsored by: Tag1 Consulting, Inc. Differential Revision: https://reviews.freebsd.org/D29131 --- sys/powerpc/conf/GENERIC | 1 + sys/powerpc/powermac/pswitch.c | 46 ++++++++++++------------------------------ 2 files changed, 14 insertions(+), 33 deletions(-) diff --git a/sys/powerpc/conf/GENERIC b/sys/powerpc/conf/GENERIC index dc3484d7f614..7854e89d17b7 100644 --- a/sys/powerpc/conf/GENERIC +++ b/sys/powerpc/conf/GENERIC @@ -215,6 +215,7 @@ device smu # Apple System Management Unit device adm1030 # Apple G4 MDD fan controller device atibl # ATI-based backlight driver for PowerBooks/iBooks device nvbl # nVidia-based backlight driver for PowerBooks/iBooks +device pswitch # Macio programmer's switch # ADB support device adb diff --git a/sys/powerpc/powermac/pswitch.c b/sys/powerpc/powermac/pswitch.c index df47b5ae6d1f..e2da0f534188 100644 --- a/sys/powerpc/powermac/pswitch.c +++ b/sys/powerpc/powermac/pswitch.c @@ -41,14 +41,15 @@ #include +#include #include #include struct pswitch_softc { - int sc_irqrid; - struct resource *sc_irq; - void *sc_ih; + int sc_irq_rid; + struct resource *sc_irq; + void *sc_ih; }; static int pswitch_probe(device_t); @@ -71,14 +72,15 @@ static driver_t pswitch_driver = { static devclass_t pswitch_devclass; -DRIVER_MODULE(pswitch, macio, pswitch_driver, pswitch_devclass, 0, 0); +EARLY_DRIVER_MODULE(pswitch, macgpio, pswitch_driver, pswitch_devclass, + 0, 0, BUS_PASS_RESOURCE); static int pswitch_probe(device_t dev) { - char *type = macio_get_devtype(dev); + const char *type = ofw_bus_get_type(dev); - if (strcmp(type, "gpio") != 0) + if (strcmp(type, "programmer-switch") != 0) return (ENXIO); device_set_desc(dev, "GPIO Programmer's Switch"); @@ -89,43 +91,21 @@ static int pswitch_attach(device_t dev) { struct pswitch_softc *sc; - phandle_t node, child; - char type[32]; - u_int irq[2]; sc = device_get_softc(dev); - node = macio_get_node(dev); - for (child = OF_child(node); child != 0; child = OF_peer(child)) { - if (OF_getprop(child, "device_type", type, 32) == -1) - continue; - - if (strcmp(type, "programmer-switch") == 0) - break; - } - - if (child == 0) { - device_printf(dev, "could not find correct node\n"); - return (ENXIO); - } - - if (OF_getprop(child, "interrupts", irq, sizeof(irq)) == -1) { - device_printf(dev, "could not get interrupt\n"); - return (ENXIO); - } - - sc->sc_irqrid = 0; - sc->sc_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &sc->sc_irqrid, - irq[0], irq[0], 1, RF_ACTIVE); + sc->sc_irq_rid = 0; + sc->sc_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &sc->sc_irq_rid, RF_ACTIVE); if (sc->sc_irq == NULL) { device_printf(dev, "could not allocate interrupt\n"); return (ENXIO); } - if (bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_MISC, + if (bus_setup_intr(dev, sc->sc_irq, INTR_TYPE_MISC | INTR_EXCL, pswitch_intr, NULL, dev, &sc->sc_ih) != 0) { device_printf(dev, "could not setup interrupt\n"); - bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irqrid, + bus_release_resource(dev, SYS_RES_IRQ, sc->sc_irq_rid, sc->sc_irq); return (ENXIO); } From owner-dev-commits-src-all@freebsd.org Mon Apr 5 17:16:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 399395C09B4; Mon, 5 Apr 2021 17:16: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 4FDclR146qz4tDk; Mon, 5 Apr 2021 17:16: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 0EC551C98E; Mon, 5 Apr 2021 17:16: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 135HGott012525; Mon, 5 Apr 2021 17: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 135HGoYJ012524; Mon, 5 Apr 2021 17:16:50 GMT (envelope-from git) Date: Mon, 5 Apr 2021 17:16:50 GMT Message-Id: <202104051716.135HGoYJ012524@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: 4bbfa3d3baf7 - main - release: move installworld before installkernel 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: 4bbfa3d3baf70492ad4c3eacace0f966f3ca7070 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 17:16:51 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=4bbfa3d3baf70492ad4c3eacace0f966f3ca7070 commit 4bbfa3d3baf70492ad4c3eacace0f966f3ca7070 Author: Ed Maste AuthorDate: 2021-04-05 17:16:01 +0000 Commit: Ed Maste CommitDate: 2021-04-05 17:16:01 +0000 release: move installworld before installkernel To support -DNO_ROOT work. The top-level installworld target creates a new METALOG starting with `#mtree 2.0` so it needs to be first, to avoid overwriting installkernel METALOG entries. Reviewed by: gjb MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29582 --- release/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/release/Makefile b/release/Makefile index fee5f9acf59b..c176ae6f2bb7 100644 --- a/release/Makefile +++ b/release/Makefile @@ -152,7 +152,7 @@ ports.txz: disc1: packagesystem # Install system mkdir -p ${.TARGET} - cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ + cd ${WORLDDIR} && ${IMAKE} installworld installkernel distribution \ DESTDIR=${.OBJDIR}/${.TARGET} MK_AT=no \ MK_INSTALLLIB=no MK_LIB32=no MK_MAIL=no \ MK_TOOLCHAIN=no MK_PROFILE=no \ @@ -177,7 +177,7 @@ disc1: packagesystem bootonly: packagesystem # Install system mkdir -p ${.TARGET} - cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ + cd ${WORLDDIR} && ${IMAKE} installworld installkernel distribution \ DESTDIR=${.OBJDIR}/${.TARGET} MK_AT=no \ MK_GAMES=no \ MK_INSTALLLIB=no MK_LIB32=no MK_MAIL=no \ @@ -200,7 +200,7 @@ bootonly: packagesystem dvd: packagesystem # Install system mkdir -p ${.TARGET} - cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ + cd ${WORLDDIR} && ${IMAKE} installworld installkernel distribution \ DESTDIR=${.OBJDIR}/${.TARGET} MK_RESCUE=no MK_KERNEL_SYMBOLS=no \ MK_TESTS=no MK_DEBUG_FILES=no \ -DDB_FROM_SRC From owner-dev-commits-src-all@freebsd.org Mon Apr 5 17:27:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9EAC5C102F; Mon, 5 Apr 2021 17:27: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 4FDczm4pd7z4tpM; Mon, 5 Apr 2021 17:27: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 96E621C74E; Mon, 5 Apr 2021 17:27: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 135HRWEu026400; Mon, 5 Apr 2021 17:27:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 135HRW3i026399; Mon, 5 Apr 2021 17:27:32 GMT (envelope-from git) Date: Mon, 5 Apr 2021 17:27:32 GMT Message-Id: <202104051727.135HRW3i026399@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: 741223a65cd1 - main - freebsd-update: improve mandoc db generation 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: 741223a65cd1752360c44341b762295f633e21cf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 17:27:32 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=741223a65cd1752360c44341b762295f633e21cf commit 741223a65cd1752360c44341b762295f633e21cf Author: Ed Maste AuthorDate: 2021-04-04 00:57:26 +0000 Commit: Ed Maste CommitDate: 2021-04-05 17:23:37 +0000 freebsd-update: improve mandoc db generation freebsd-update compares the dates on man pages with mandoc.db, and if any newer pages are found it regenerates mandoc.db. Previously, if mandoc.db did not already exist the check failed and freebsd-update then failed to create one. Now, check that mandoc.db exists before performing the check for newer pages. Reported by: bdrewery (in D10482) Reviewed by: gordon MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29575 --- usr.sbin/freebsd-update/freebsd-update.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/freebsd-update/freebsd-update.sh b/usr.sbin/freebsd-update/freebsd-update.sh index 004515bb8bf8..7f9b06f0221f 100644 --- a/usr.sbin/freebsd-update/freebsd-update.sh +++ b/usr.sbin/freebsd-update/freebsd-update.sh @@ -2958,7 +2958,8 @@ Kernel updates have been installed. Please reboot and run if [ ! -d ${BASEDIR}/$D ]; then continue fi - if [ -z "$(find ${BASEDIR}/$D -type f -newer ${BASEDIR}/$D/mandoc.db)" ]; then + if [ -f ${BASEDIR}/$D/mandoc.db ] && \ + [ -z "$(find ${BASEDIR}/$D -type f -newer ${BASEDIR}/$D/mandoc.db)" ]; then continue; fi makewhatis ${BASEDIR}/$D From owner-dev-commits-src-all@freebsd.org Mon Apr 5 18:21:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9033C5C25FC; Mon, 5 Apr 2021 18:21: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 4FDf9X3ZL8z3FRn; Mon, 5 Apr 2021 18:21: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 62D8A1D60B; Mon, 5 Apr 2021 18:21: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 135IL42p007905; Mon, 5 Apr 2021 18:21:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 135IL4hE007904; Mon, 5 Apr 2021 18:21:04 GMT (envelope-from git) Date: Mon, 5 Apr 2021 18:21:04 GMT Message-Id: <202104051821.135IL4hE007904@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Eric Joyner Subject: git: 20a52706c814 - main - ixl(4): Add tunable to override Flow Control settings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: erj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 20a52706c814ccfd91c65586404abd2a1563a330 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 18:21:04 -0000 The branch main has been updated by erj: URL: https://cgit.FreeBSD.org/src/commit/?id=20a52706c814ccfd91c65586404abd2a1563a330 commit 20a52706c814ccfd91c65586404abd2a1563a330 Author: Krzysztof Galazka AuthorDate: 2021-04-05 18:08:33 +0000 Commit: Eric Joyner CommitDate: 2021-04-05 18:17:55 +0000 ixl(4): Add tunable to override Flow Control settings Add flow_control to hw.ixl tunables tree to let override initial flow control configuration for all interfaces. Keep using configuration set by NVM by default. Reviewed by: erj@, gallatin@ Tested by: gowtham.kumar.ks_intel.com MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D29338 --- sys/dev/ixl/if_ixl.c | 19 +++++++++++++++++++ sys/dev/ixl/ixl_pf_iflib.c | 2 +- sys/dev/ixl/ixl_pf_main.c | 40 +++++++++++++++++++++++----------------- 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/sys/dev/ixl/if_ixl.c b/sys/dev/ixl/if_ixl.c index c700af889cf1..3b49da5d76b9 100644 --- a/sys/dev/ixl/if_ixl.c +++ b/sys/dev/ixl/if_ixl.c @@ -304,6 +304,10 @@ TUNABLE_INT("hw.ixl.tx_itr", &ixl_tx_itr); SYSCTL_INT(_hw_ixl, OID_AUTO, tx_itr, CTLFLAG_RDTUN, &ixl_tx_itr, 0, "TX Interrupt Rate"); +static int ixl_flow_control = -1; +SYSCTL_INT(_hw_ixl, OID_AUTO, flow_control, CTLFLAG_RDTUN, + &ixl_flow_control, 0, "Initial Flow Control setting"); + #ifdef IXL_IW int ixl_enable_iwarp = 0; TUNABLE_INT("hw.ixl.enable_iwarp", &ixl_enable_iwarp); @@ -1892,5 +1896,20 @@ ixl_save_pf_tunables(struct ixl_pf *pf) pf->rx_itr = IXL_ITR_8K; } else pf->rx_itr = ixl_rx_itr; + + pf->fc = -1; + if (ixl_flow_control != -1) { + if (ixl_flow_control < 0 || ixl_flow_control > 3) { + device_printf(dev, + "Invalid flow_control value of %d set!\n", + ixl_flow_control); + device_printf(dev, + "flow_control must be between %d and %d, " + "inclusive\n", 0, 3); + device_printf(dev, + "Using default configuration instead\n"); + } else + pf->fc = ixl_flow_control; + } } diff --git a/sys/dev/ixl/ixl_pf_iflib.c b/sys/dev/ixl/ixl_pf_iflib.c index 23d9f30299a9..68a174889c41 100644 --- a/sys/dev/ixl/ixl_pf_iflib.c +++ b/sys/dev/ixl/ixl_pf_iflib.c @@ -1094,7 +1094,7 @@ ixl_sysctl_set_flowcntl(SYSCTL_HANDLER_ARGS) aq_error = i40e_set_fc(hw, &fc_aq_err, TRUE); if (aq_error) { device_printf(dev, - "%s: Error setting new fc mode %d; fc_err %#x\n", + "%s: Error setting Flow Control mode %d; fc_err %#x\n", __func__, aq_error, fc_aq_err); return (EIO); } diff --git a/sys/dev/ixl/ixl_pf_main.c b/sys/dev/ixl/ixl_pf_main.c index b546701608f1..896da955843a 100644 --- a/sys/dev/ixl/ixl_pf_main.c +++ b/sys/dev/ixl/ixl_pf_main.c @@ -3169,27 +3169,28 @@ ixl_set_link(struct ixl_pf *pf, bool enable) config.phy_type = 0; config.phy_type_ext = 0; + config.abilities &= ~(I40E_AQ_PHY_FLAG_PAUSE_TX | + I40E_AQ_PHY_FLAG_PAUSE_RX); + + switch (pf->fc) { + case I40E_FC_FULL: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX | + I40E_AQ_PHY_FLAG_PAUSE_RX; + break; + case I40E_FC_RX_PAUSE: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_RX; + break; + case I40E_FC_TX_PAUSE: + config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX; + break; + default: + break; + } + if (enable) { config.phy_type = phy_type; config.phy_type_ext = phy_type_ext; - config.abilities &= ~(I40E_AQ_PHY_FLAG_PAUSE_TX | - I40E_AQ_PHY_FLAG_PAUSE_RX); - - switch (pf->fc) { - case I40E_FC_FULL: - config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX | - I40E_AQ_PHY_FLAG_PAUSE_RX; - break; - case I40E_FC_RX_PAUSE: - config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_RX; - break; - case I40E_FC_TX_PAUSE: - config.abilities |= I40E_AQ_PHY_FLAG_PAUSE_TX; - break; - default: - break; - } } aq_error = i40e_aq_set_phy_config(hw, &config, NULL); @@ -4594,6 +4595,11 @@ ixl_attach_get_link_status(struct ixl_pf *pf) /* Determine link state */ hw->phy.get_link_info = TRUE; i40e_get_link_status(hw, &pf->link_up); + + /* Flow Control mode not set by user, read current FW settings */ + if (pf->fc == -1) + pf->fc = hw->fc.current_mode; + return (0); } From owner-dev-commits-src-all@freebsd.org Mon Apr 5 20:30:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA1D95C645E; Mon, 5 Apr 2021 20:30: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 4FDj2R67b7z3QSw; Mon, 5 Apr 2021 20:30: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 C3CE41F196; Mon, 5 Apr 2021 20:30: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 135KU7bf082456; Mon, 5 Apr 2021 20:30:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 135KU7QT082452; Mon, 5 Apr 2021 20:30:07 GMT (envelope-from git) Date: Mon, 5 Apr 2021 20:30:07 GMT Message-Id: <202104052030.135KU7QT082452@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: 3b666932d409 - main - libc: Fix the WITH_HESIOD build 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: 3b666932d409ad79c527c026abacd4d327df5b46 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 20:30:08 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3b666932d409ad79c527c026abacd4d327df5b46 commit 3b666932d409ad79c527c026abacd4d327df5b46 Author: Mark Johnston AuthorDate: 2021-04-05 20:23:18 +0000 Commit: Mark Johnston CommitDate: 2021-04-05 20:30:00 +0000 libc: Fix the WITH_HESIOD build Reported by: Daniel Braniss MFC after: 1 week --- lib/libc/gen/getgrent.c | 2 +- lib/libc/gen/getpwent.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c index afb89cab308b..5832cb8c6799 100644 --- a/lib/libc/gen/getgrent.c +++ b/lib/libc/gen/getgrent.c @@ -971,7 +971,7 @@ dns_group(void *retval, void *mdata, va_list ap) hes = NULL; name = NULL; gid = (gid_t)-1; - how = (enum nss_lookup_type)mdata; + how = (enum nss_lookup_type)(uintptr_t)mdata; switch (how) { case nss_lt_name: name = va_arg(ap, const char *); diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index a07ee109e2df..bc1d341fd3ad 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -1108,7 +1108,7 @@ dns_passwd(void *retval, void *mdata, va_list ap) hes = NULL; name = NULL; uid = (uid_t)-1; - how = (enum nss_lookup_type)mdata; + how = (enum nss_lookup_type)(uintptr_t)mdata; switch (how) { case nss_lt_name: name = va_arg(ap, const char *); From owner-dev-commits-src-all@freebsd.org Mon Apr 5 20:30:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18DBC5C66AB; Mon, 5 Apr 2021 20:30: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 4FDj2S732zz3QqS; Mon, 5 Apr 2021 20:30: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 E1C131F197; Mon, 5 Apr 2021 20:30: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 135KU8HA082663; Mon, 5 Apr 2021 20:30:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 135KU8T4082660; Mon, 5 Apr 2021 20:30:08 GMT (envelope-from git) Date: Mon, 5 Apr 2021 20:30:08 GMT Message-Id: <202104052030.135KU8T4082660@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: 843d16436d33 - main - qat: Make prototypes consistent with the implementation 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: 843d16436d3388c1b46d37fca4e86885612d0e64 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Apr 2021 20:30:09 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=843d16436d3388c1b46d37fca4e86885612d0e64 commit 843d16436d3388c1b46d37fca4e86885612d0e64 Author: Mark Johnston AuthorDate: 2021-04-05 20:23:22 +0000 Commit: Mark Johnston CommitDate: 2021-04-05 20:30:00 +0000 qat: Make prototypes consistent with the implementation Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/dev/qat/qat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/qat/qat.c b/sys/dev/qat/qat.c index acfe0c6a1e07..49cb408fd702 100644 --- a/sys/dev/qat/qat.c +++ b/sys/dev/qat/qat.c @@ -276,8 +276,8 @@ static const struct qat_sym_hash_def qat_sym_hash_defs[] = { static const struct qat_product *qat_lookup(device_t); static int qat_probe(device_t); static int qat_attach(device_t); -static int qat_init(struct device *); -static int qat_start(struct device *); +static int qat_init(device_t); +static int qat_start(device_t); static int qat_detach(device_t); static int qat_newsession(device_t dev, crypto_session_t cses, From owner-dev-commits-src-all@freebsd.org Tue Apr 6 00:01:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 764775CB014; Tue, 6 Apr 2021 00:01:15 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pf1-x431.google.com (mail-pf1-x431.google.com [IPv6:2607:f8b0:4864:20::431]) (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 4FDnk32MyWz3wXj; Tue, 6 Apr 2021 00:01:14 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pf1-x431.google.com with SMTP id l123so7653545pfl.8; Mon, 05 Apr 2021 17:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:message-id:date:mime-version:user-agent:reply-to:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=0YNssuKxF3EpRXC4WkA62ZFL1AACchjD2buJem5L6aI=; b=b2sxBqsX/l0U3aWBm8jszwQdQIPi/DhZFRtKSSDmxOCAAq+klYKPjqykLnrrR4Kq/1 iPQWKsAT8epcq8nsqvXHd34UpGo4yYMF8K22RlGmnhMaXp8vnfnUnB4tOuOWJ1VK0uAS WZdN2Xb65z32p//M/w67JBY2wgT/Ky8CG7pIss+ovbEz/DkROpzHxDBa4ghP+TIKO0pF HryKX4uLnAqqb8J4503SQdDIIVicH7jhogUzn7e+6WvJzQ58XtjEebo9zB/CCS2YBMUg bzacqkSqZyCeV4IarVEfi38E3U2GqXTcII8eDu7cL45+t3iweylPj97mRIaIG+3jxy/L 69aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :reply-to:subject:content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=0YNssuKxF3EpRXC4WkA62ZFL1AACchjD2buJem5L6aI=; b=qQ3WyO4vMqwhzUVjB3OFYSXbKoOmj3hdrHGKpQ0ivgPglD8jC+XTv7YtQR0IuCZD0i uiE5tb8P3cgsodjmM8LzlOertJBB2LgHUPSzInyFliHZv6ohm09ZmYeduYvhQrTM07iu hZ/uK9yFB7NJazCjJgUDSkBM6xA2fehOVt2g/4R+MyOOaiMCqBFqYtd4Z1KcaEDp25xe WXdP/+yP2ouXlbkpmyIJ5Fv5gopiKwO5GjjPmPwf3BYzwo6owUvZuzsLet7H1Y/TjxWh vmjuapfV2TzDDuK7bQensq1eu8ayXlvtxlk/pjCSd3NJz+/vpQxHNQAEueNWEcwHTYLq dduA== X-Gm-Message-State: AOAM532s2SpHH36XdPWbmBgQ8ZCa/HPMQQcGQRfp6gnpbHJry0ues0Yr t3n7NSP8wUVMC+1Vt8SrmnivJBa4zGQ62Q== X-Google-Smtp-Source: ABdhPJw+1ziwlaH/E/kftWePGti+Qd1wmP9DyDScDNZpv9BoWXOmqOqrOGJaJyEXmVBxVV+cEMt9pQ== X-Received: by 2002:a63:1f42:: with SMTP id q2mr11997066pgm.2.1617667273211; Mon, 05 Apr 2021 17:01:13 -0700 (PDT) Received: from [2403:5800:7500:3601:4d41:6bf9:4b8:f2b2] (2403-5800-7500-3601-4d41-6bf9-4b8-f2b2.ip6.aussiebb.net. [2403:5800:7500:3601:4d41:6bf9:4b8:f2b2]) by smtp.gmail.com with UTF8SMTPSA id o9sm686721pfh.217.2021.04.05.17.01.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Apr 2021 17:01:12 -0700 (PDT) Sender: Kubilay Kocak Message-ID: Date: Tue, 6 Apr 2021 10:01:08 +1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Thunderbird/89.0a1 Reply-To: koobs@FreeBSD.org Subject: Re: git: 829a69db855b - main - pf: change pf_route so pf only runs when packets enter and leave the stack. Content-Language: en-US To: Kristof Provost , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104051144.135BiCpe039479@gitrepo.freebsd.org> From: Kubilay Kocak In-Reply-To: <202104051144.135BiCpe039479@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4FDnk32MyWz3wXj 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 00:01:15 -0000 On 5/04/2021 9:44 pm, Kristof Provost wrote: > The branch main has been updated by kp: > > URL: https://cgit.FreeBSD.org/src/commit/?id=829a69db855b48ff7e8242b95e193a0783c489d9 > > commit 829a69db855b48ff7e8242b95e193a0783c489d9 > Author: Kristof Provost > AuthorDate: 2021-04-02 10:23:42 +0000 > Commit: Kristof Provost > CommitDate: 2021-04-05 07:57:06 +0000 > > pf: change pf_route so pf only runs when packets enter and leave the stack. > > before this change pf_route operated on the semantic that pf runs > when packets go over an interface, so when pf_route changed which > interface the packet was on it would run pf_test again. this change > changes (restores) the semantic that pf is only supposed to run > when packets go in or out of the network stack, even if route-to > is responsibly for short circuiting past the network stack. > > just to be clear, for normal packets (ie, those not touched by > route-to/reply-to/dup-to), there isn't a difference between running > pf when packets enter or leave the stack, or having pf run when a > packet goes over an interface. > > the main reason for this change is that running the same packet > through pf multiple times creates confusion for the state table. > by default, pf states are floating, meaning that packets are matched > to states regardless of which interface they're going over. if a > packet leaving on em0 is rerouted out em1, both traversals will end > up using the same state, which at best will make the accounting > look weird, or at worst fail some checks in the state and get > dropped. > > another reason for this commit is is to make handling of the changes > that route-to makes consistent with other changes that are made to > packet. eg, when nat is applied to a packet, we don't run pf_test > again with the new addresses. > > the main caveat with this diff is you can't have one rule that > pushes a packet out a different interface, and then have a rule on > that second interface that NATs the packet. i'm not convinced this > ever worked reliably or was used much anyway, so we don't think > it's a big concern. > > discussed with many, with special thanks to bluhm@, sashan@ and > sthen@ for weathering most of that pain. > ok claudio@ sashan@ jmatthew@ > > Obtained from: OpenBSD > MFC after: 2 weeks > Sponsored by: Rubicon Communications, LLC ("Netgate") > Differential Revision: https://reviews.freebsd.org/D29554 Relnotes: Yes For the rule semantics change? > --- > sys/netpfil/pf/pf.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c > index 50bf4b3871c5..5b41be4ad683 100644 > --- a/sys/netpfil/pf/pf.c > +++ b/sys/netpfil/pf/pf.c > @@ -5549,7 +5549,7 @@ pf_route(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, > if (ifp == NULL) > goto bad; > > - if (oifp != ifp) { > + if (dir == PF_IN) { > if (pf_test(PF_OUT, 0, ifp, &m0, inp) != PF_PASS) > goto bad; > else if (m0 == NULL) > @@ -5738,7 +5738,7 @@ pf_route6(struct mbuf **m, struct pf_krule *r, int dir, struct ifnet *oifp, > if (ifp == NULL) > goto bad; > > - if (oifp != ifp) { > + if (dir == PF_IN) { > if (pf_test6(PF_OUT, PFIL_FWD, ifp, &m0, inp) != PF_PASS) > goto bad; > else if (m0 == NULL) > _______________________________________________ > 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@freebsd.org" > From owner-dev-commits-src-all@freebsd.org Tue Apr 6 00:37:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AD5D5CB963; Tue, 6 Apr 2021 00:37: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 4FDpWh20X0z4TSR; Tue, 6 Apr 2021 00:37: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 294B0223D3; Tue, 6 Apr 2021 00:37: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 1360bKEw029052; Tue, 6 Apr 2021 00:37:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1360bKwT029051; Tue, 6 Apr 2021 00:37:20 GMT (envelope-from git) Date: Tue, 6 Apr 2021 00:37:20 GMT Message-Id: <202104060037.1360bKwT029051@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: d36d68161517 - main - rtld dl_iterate_phdr(): dlpi_tls_data is wrong 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: d36d6816151705907393889d661cbfd25c630ca8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 00:37:20 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d36d6816151705907393889d661cbfd25c630ca8 commit d36d6816151705907393889d661cbfd25c630ca8 Author: Konstantin Belousov AuthorDate: 2021-04-05 03:05:44 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-06 00:23:08 +0000 rtld dl_iterate_phdr(): dlpi_tls_data is wrong dl_iterate_phdr() dlpi_tls_data should provide the TLS module segment address, and not the TLS init segment address as it does now. Reported by: emacsray@gmail.com PR: 254774 Sponsored by: The FreeBSD Foundation MFC after: 1 week --- lib/libc/gen/dl_iterate_phdr.3 | 7 +++++-- libexec/rtld-elf/Symbol.map | 1 + libexec/rtld-elf/rtld.1 | 7 +++++++ libexec/rtld-elf/rtld.c | 8 +++++++- sys/sys/param.h | 2 +- 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/libc/gen/dl_iterate_phdr.3 b/lib/libc/gen/dl_iterate_phdr.3 index 6e952dc13b57..fe4face9eeb7 100644 --- a/lib/libc/gen/dl_iterate_phdr.3 +++ b/lib/libc/gen/dl_iterate_phdr.3 @@ -15,7 +15,7 @@ .\" .\" $OpenBSD: dl_iterate_phdr.3,v 1.3 2007/05/31 19:19:48 jmc Exp $ .\" $FreeBSD$ -.Dd October 9, 2014 +.Dd April 5, 2021 .Dt DL_ITERATE_PHDR 3 .Os .Sh NAME @@ -80,7 +80,10 @@ The counter of the object unloads performed by the dynamic linker. .It Fa dlpi_tls_modid The TLS index of the object. .It Fa dlpi_tls_data -A pointer to the initialization data for the object TLS segment. +A pointer to the calling thread' TLS data segment for this module, +if it was allocated, +.Dv NULL +otherwise. .El .Pp Future versions of diff --git a/libexec/rtld-elf/Symbol.map b/libexec/rtld-elf/Symbol.map index 13068c5626dc..0a9eac82cf05 100644 --- a/libexec/rtld-elf/Symbol.map +++ b/libexec/rtld-elf/Symbol.map @@ -34,4 +34,5 @@ FBSDprivate_1.0 { _r_debug_postinit; _rtld_version__FreeBSD_version; _rtld_version_laddr_offset; + _rtld_version_dlpi_tls_data; }; diff --git a/libexec/rtld-elf/rtld.1 b/libexec/rtld-elf/rtld.1 index 589b9a92aa77..7f633ce0b486 100644 --- a/libexec/rtld-elf/rtld.1 +++ b/libexec/rtld-elf/rtld.1 @@ -424,6 +424,13 @@ See Also it indicates the presence of .Va l_refname member of the structure. +.It Dv _rtld_version_dlpi_tls_data +The +.Va dlpi_tls_data +member of the structure +.Vt dl_phdr_info +contains the address of the module TLS segment for the calling thread, +and not the address of the initialization segment. .El .Sh FILES .Bl -tag -width ".Pa /var/run/ld-elf32.so.hints" -compact diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 733c3c80b70f..19027518d3c2 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -3909,13 +3909,16 @@ dlinfo(void *handle, int request, void *p) static void rtld_fill_dl_phdr_info(const Obj_Entry *obj, struct dl_phdr_info *phdr_info) { + tls_index ti; phdr_info->dlpi_addr = (Elf_Addr)obj->relocbase; phdr_info->dlpi_name = obj->path; phdr_info->dlpi_phdr = obj->phdr; phdr_info->dlpi_phnum = obj->phsize / sizeof(obj->phdr[0]); phdr_info->dlpi_tls_modid = obj->tlsindex; - phdr_info->dlpi_tls_data = obj->tlsinit; + ti.ti_module = obj->tlsindex; + ti.ti_offset = 0; + phdr_info->dlpi_tls_data = __tls_get_addr(&ti); phdr_info->dlpi_adds = obj_loads; phdr_info->dlpi_subs = obj_loads - obj_count; } @@ -5914,3 +5917,6 @@ int _rtld_version__FreeBSD_version = __FreeBSD_version; extern char _rtld_version_laddr_offset __exported; char _rtld_version_laddr_offset; + +extern char _rtld_version_dlpi_tls_data __exported; +char _rtld_version_dlpi_tls_data; diff --git a/sys/sys/param.h b/sys/sys/param.h index 5176dd1e9732..e3230de27bb1 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400006 /* Master, propagated to newvers */ +#define __FreeBSD_version 1400007 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-all@freebsd.org Tue Apr 6 00:38:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A79B5CBD41; Tue, 6 Apr 2021 00:38: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 4FDpYQ107pz4Tc4; Tue, 6 Apr 2021 00:38: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 1384522573; Tue, 6 Apr 2021 00:38: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 1360coNT029434; Tue, 6 Apr 2021 00:38:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1360cn1G029433; Tue, 6 Apr 2021 00:38:49 GMT (envelope-from git) Date: Tue, 6 Apr 2021 00:38:49 GMT Message-Id: <202104060038.1360cn1G029433@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: 7b0125cbec15 - main - linuxkpi: copy ldev into local to test and free the same pointer 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: 7b0125cbec1579a0a1bf38f7abe583b5f6fd79e7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 00:38:50 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7b0125cbec1579a0a1bf38f7abe583b5f6fd79e7 commit 7b0125cbec1579a0a1bf38f7abe583b5f6fd79e7 Author: Konstantin Belousov AuthorDate: 2021-03-30 08:41:00 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-06 00:38:28 +0000 linuxkpi: copy ldev into local to test and free the same pointer Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/compat/linuxkpi/common/src/linux_compat.c | 5 +- sys/compat/linuxkpi/common/src/linux_compat.c.orig | 2598 ++++++++++++++++++++ 2 files changed, 2601 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 42f47b6e510a..b7a7ba8b4f18 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -1520,8 +1520,9 @@ linux_file_close(struct file *file, struct thread *td) if (filp->f_vnode != NULL) vdrop(filp->f_vnode); linux_drop_fop(ldev); - if (filp->f_cdev != NULL) - linux_cdev_deref(filp->f_cdev); + ldev = filp->f_cdev; + if (ldev != NULL) + linux_cdev_deref(ldev); kfree(filp); return (error); diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c.orig b/sys/compat/linuxkpi/common/src/linux_compat.c.orig new file mode 100644 index 000000000000..42f47b6e510a --- /dev/null +++ b/sys/compat/linuxkpi/common/src/linux_compat.c.orig @@ -0,0 +1,2598 @@ +/*- + * Copyright (c) 2010 Isilon Systems, Inc. + * Copyright (c) 2010 iX Systems, Inc. + * Copyright (c) 2010 Panasas, Inc. + * Copyright (c) 2013-2018 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_stack.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#if defined(__i386__) || defined(__amd64__) +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(__i386__) || defined(__amd64__) +#include +#endif + +SYSCTL_NODE(_compat, OID_AUTO, linuxkpi, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, + "LinuxKPI parameters"); + +int linuxkpi_debug; +SYSCTL_INT(_compat_linuxkpi, OID_AUTO, debug, CTLFLAG_RWTUN, + &linuxkpi_debug, 0, "Set to enable pr_debug() prints. Clear to disable."); + +static struct timeval lkpi_net_lastlog; +static int lkpi_net_curpps; +static int lkpi_net_maxpps = 99; +SYSCTL_INT(_compat_linuxkpi, OID_AUTO, net_ratelimit, CTLFLAG_RWTUN, + &lkpi_net_maxpps, 0, "Limit number of LinuxKPI net messages per second."); + +MALLOC_DEFINE(M_KMALLOC, "linux", "Linux kmalloc compat"); + +#include +/* Undo Linux compat changes. */ +#undef RB_ROOT +#undef file +#undef cdev +#define RB_ROOT(head) (head)->rbh_root + +static void linux_cdev_deref(struct linux_cdev *ldev); +static struct vm_area_struct *linux_cdev_handle_find(void *handle); + +struct kobject linux_class_root; +struct device linux_root_device; +struct class linux_class_misc; +struct list_head pci_drivers; +struct list_head pci_devices; +spinlock_t pci_lock; + +unsigned long linux_timer_hz_mask; + +wait_queue_head_t linux_bit_waitq; +wait_queue_head_t linux_var_waitq; + +int +panic_cmp(struct rb_node *one, struct rb_node *two) +{ + panic("no cmp"); +} + +RB_GENERATE(linux_root, rb_node, __entry, panic_cmp); + +int +kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list args) +{ + va_list tmp_va; + int len; + char *old; + char *name; + char dummy; + + old = kobj->name; + + if (old && fmt == NULL) + return (0); + + /* compute length of string */ + va_copy(tmp_va, args); + len = vsnprintf(&dummy, 0, fmt, tmp_va); + va_end(tmp_va); + + /* account for zero termination */ + len++; + + /* check for error */ + if (len < 1) + return (-EINVAL); + + /* allocate memory for string */ + name = kzalloc(len, GFP_KERNEL); + if (name == NULL) + return (-ENOMEM); + vsnprintf(name, len, fmt, args); + kobj->name = name; + + /* free old string */ + kfree(old); + + /* filter new string */ + for (; *name != '\0'; name++) + if (*name == '/') + *name = '!'; + return (0); +} + +int +kobject_set_name(struct kobject *kobj, const char *fmt, ...) +{ + va_list args; + int error; + + va_start(args, fmt); + error = kobject_set_name_vargs(kobj, fmt, args); + va_end(args); + + return (error); +} + +static int +kobject_add_complete(struct kobject *kobj, struct kobject *parent) +{ + const struct kobj_type *t; + int error; + + kobj->parent = parent; + error = sysfs_create_dir(kobj); + if (error == 0 && kobj->ktype && kobj->ktype->default_attrs) { + struct attribute **attr; + t = kobj->ktype; + + for (attr = t->default_attrs; *attr != NULL; attr++) { + error = sysfs_create_file(kobj, *attr); + if (error) + break; + } + if (error) + sysfs_remove_dir(kobj); + } + return (error); +} + +int +kobject_add(struct kobject *kobj, struct kobject *parent, const char *fmt, ...) +{ + va_list args; + int error; + + va_start(args, fmt); + error = kobject_set_name_vargs(kobj, fmt, args); + va_end(args); + if (error) + return (error); + + return kobject_add_complete(kobj, parent); +} + +void +linux_kobject_release(struct kref *kref) +{ + struct kobject *kobj; + char *name; + + kobj = container_of(kref, struct kobject, kref); + sysfs_remove_dir(kobj); + name = kobj->name; + if (kobj->ktype && kobj->ktype->release) + kobj->ktype->release(kobj); + kfree(name); +} + +static void +linux_kobject_kfree(struct kobject *kobj) +{ + kfree(kobj); +} + +static void +linux_kobject_kfree_name(struct kobject *kobj) +{ + if (kobj) { + kfree(kobj->name); + } +} + +const struct kobj_type linux_kfree_type = { + .release = linux_kobject_kfree +}; + +static void +linux_device_release(struct device *dev) +{ + pr_debug("linux_device_release: %s\n", dev_name(dev)); + kfree(dev); +} + +static ssize_t +linux_class_show(struct kobject *kobj, struct attribute *attr, char *buf) +{ + struct class_attribute *dattr; + ssize_t error; + + dattr = container_of(attr, struct class_attribute, attr); + error = -EIO; + if (dattr->show) + error = dattr->show(container_of(kobj, struct class, kobj), + dattr, buf); + return (error); +} + +static ssize_t +linux_class_store(struct kobject *kobj, struct attribute *attr, const char *buf, + size_t count) +{ + struct class_attribute *dattr; + ssize_t error; + + dattr = container_of(attr, struct class_attribute, attr); + error = -EIO; + if (dattr->store) + error = dattr->store(container_of(kobj, struct class, kobj), + dattr, buf, count); + return (error); +} + +static void +linux_class_release(struct kobject *kobj) +{ + struct class *class; + + class = container_of(kobj, struct class, kobj); + if (class->class_release) + class->class_release(class); +} + +static const struct sysfs_ops linux_class_sysfs = { + .show = linux_class_show, + .store = linux_class_store, +}; + +const struct kobj_type linux_class_ktype = { + .release = linux_class_release, + .sysfs_ops = &linux_class_sysfs +}; + +static void +linux_dev_release(struct kobject *kobj) +{ + struct device *dev; + + dev = container_of(kobj, struct device, kobj); + /* This is the precedence defined by linux. */ + if (dev->release) + dev->release(dev); + else if (dev->class && dev->class->dev_release) + dev->class->dev_release(dev); +} + +static ssize_t +linux_dev_show(struct kobject *kobj, struct attribute *attr, char *buf) +{ + struct device_attribute *dattr; + ssize_t error; + + dattr = container_of(attr, struct device_attribute, attr); + error = -EIO; + if (dattr->show) + error = dattr->show(container_of(kobj, struct device, kobj), + dattr, buf); + return (error); +} + +static ssize_t +linux_dev_store(struct kobject *kobj, struct attribute *attr, const char *buf, + size_t count) +{ + struct device_attribute *dattr; + ssize_t error; + + dattr = container_of(attr, struct device_attribute, attr); + error = -EIO; + if (dattr->store) + error = dattr->store(container_of(kobj, struct device, kobj), + dattr, buf, count); + return (error); +} + +static const struct sysfs_ops linux_dev_sysfs = { + .show = linux_dev_show, + .store = linux_dev_store, +}; + +const struct kobj_type linux_dev_ktype = { + .release = linux_dev_release, + .sysfs_ops = &linux_dev_sysfs +}; + +struct device * +device_create(struct class *class, struct device *parent, dev_t devt, + void *drvdata, const char *fmt, ...) +{ + struct device *dev; + va_list args; + + dev = kzalloc(sizeof(*dev), M_WAITOK); + dev->parent = parent; + dev->class = class; + dev->devt = devt; + dev->driver_data = drvdata; + dev->release = linux_device_release; + va_start(args, fmt); + kobject_set_name_vargs(&dev->kobj, fmt, args); + va_end(args); + device_register(dev); + + return (dev); +} + +int +kobject_init_and_add(struct kobject *kobj, const struct kobj_type *ktype, + struct kobject *parent, const char *fmt, ...) +{ + va_list args; + int error; + + kobject_init(kobj, ktype); + kobj->ktype = ktype; + kobj->parent = parent; + kobj->name = NULL; + + va_start(args, fmt); + error = kobject_set_name_vargs(kobj, fmt, args); + va_end(args); + if (error) + return (error); + return kobject_add_complete(kobj, parent); +} + +static void +linux_kq_lock(void *arg) +{ + spinlock_t *s = arg; + + spin_lock(s); +} +static void +linux_kq_unlock(void *arg) +{ + spinlock_t *s = arg; + + spin_unlock(s); +} + +static void +linux_kq_assert_lock(void *arg, int what) +{ +#ifdef INVARIANTS + spinlock_t *s = arg; + + if (what == LA_LOCKED) + mtx_assert(&s->m, MA_OWNED); + else + mtx_assert(&s->m, MA_NOTOWNED); +#endif +} + +static void +linux_file_kqfilter_poll(struct linux_file *, int); + +struct linux_file * +linux_file_alloc(void) +{ + struct linux_file *filp; + + filp = kzalloc(sizeof(*filp), GFP_KERNEL); + + /* set initial refcount */ + filp->f_count = 1; + + /* setup fields needed by kqueue support */ + spin_lock_init(&filp->f_kqlock); + knlist_init(&filp->f_selinfo.si_note, &filp->f_kqlock, + linux_kq_lock, linux_kq_unlock, linux_kq_assert_lock); + + return (filp); +} + +void +linux_file_free(struct linux_file *filp) +{ + if (filp->_file == NULL) { + if (filp->f_shmem != NULL) + vm_object_deallocate(filp->f_shmem); + kfree(filp); + } else { + /* + * The close method of the character device or file + * will free the linux_file structure: + */ + _fdrop(filp->_file, curthread); + } +} + +static int +linux_cdev_pager_fault(vm_object_t vm_obj, vm_ooffset_t offset, int prot, + vm_page_t *mres) +{ + struct vm_area_struct *vmap; + + vmap = linux_cdev_handle_find(vm_obj->handle); + + MPASS(vmap != NULL); + MPASS(vmap->vm_private_data == vm_obj->handle); + + if (likely(vmap->vm_ops != NULL && offset < vmap->vm_len)) { + vm_paddr_t paddr = IDX_TO_OFF(vmap->vm_pfn) + offset; + vm_page_t page; + + if (((*mres)->flags & PG_FICTITIOUS) != 0) { + /* + * If the passed in result page is a fake + * page, update it with the new physical + * address. + */ + page = *mres; + vm_page_updatefake(page, paddr, vm_obj->memattr); + } else { + /* + * Replace the passed in "mres" page with our + * own fake page and free up the all of the + * original pages. + */ + VM_OBJECT_WUNLOCK(vm_obj); + page = vm_page_getfake(paddr, vm_obj->memattr); + VM_OBJECT_WLOCK(vm_obj); + + vm_page_replace(page, vm_obj, (*mres)->pindex, *mres); + *mres = page; + } + vm_page_valid(page); + return (VM_PAGER_OK); + } + return (VM_PAGER_FAIL); +} + +static int +linux_cdev_pager_populate(vm_object_t vm_obj, vm_pindex_t pidx, int fault_type, + vm_prot_t max_prot, vm_pindex_t *first, vm_pindex_t *last) +{ + struct vm_area_struct *vmap; + int err; + + /* get VM area structure */ + vmap = linux_cdev_handle_find(vm_obj->handle); + MPASS(vmap != NULL); + MPASS(vmap->vm_private_data == vm_obj->handle); + + VM_OBJECT_WUNLOCK(vm_obj); + + linux_set_current(curthread); + + down_write(&vmap->vm_mm->mmap_sem); + if (unlikely(vmap->vm_ops == NULL)) { + err = VM_FAULT_SIGBUS; + } else { + struct vm_fault vmf; + + /* fill out VM fault structure */ + vmf.virtual_address = (void *)(uintptr_t)IDX_TO_OFF(pidx); + vmf.flags = (fault_type & VM_PROT_WRITE) ? FAULT_FLAG_WRITE : 0; + vmf.pgoff = 0; + vmf.page = NULL; + vmf.vma = vmap; + + vmap->vm_pfn_count = 0; + vmap->vm_pfn_pcount = &vmap->vm_pfn_count; + vmap->vm_obj = vm_obj; + + err = vmap->vm_ops->fault(vmap, &vmf); + + while (vmap->vm_pfn_count == 0 && err == VM_FAULT_NOPAGE) { + kern_yield(PRI_USER); + err = vmap->vm_ops->fault(vmap, &vmf); + } + } + + /* translate return code */ + switch (err) { + case VM_FAULT_OOM: + err = VM_PAGER_AGAIN; + break; + case VM_FAULT_SIGBUS: + err = VM_PAGER_BAD; + break; + case VM_FAULT_NOPAGE: + /* + * By contract the fault handler will return having + * busied all the pages itself. If pidx is already + * found in the object, it will simply xbusy the first + * page and return with vm_pfn_count set to 1. + */ + *first = vmap->vm_pfn_first; + *last = *first + vmap->vm_pfn_count - 1; + err = VM_PAGER_OK; + break; + default: + err = VM_PAGER_ERROR; + break; + } + up_write(&vmap->vm_mm->mmap_sem); + VM_OBJECT_WLOCK(vm_obj); + return (err); +} + +static struct rwlock linux_vma_lock; +static TAILQ_HEAD(, vm_area_struct) linux_vma_head = + TAILQ_HEAD_INITIALIZER(linux_vma_head); + +static void +linux_cdev_handle_free(struct vm_area_struct *vmap) +{ + /* Drop reference on vm_file */ + if (vmap->vm_file != NULL) + fput(vmap->vm_file); + + /* Drop reference on mm_struct */ + mmput(vmap->vm_mm); + + kfree(vmap); +} + +static void +linux_cdev_handle_remove(struct vm_area_struct *vmap) +{ + rw_wlock(&linux_vma_lock); + TAILQ_REMOVE(&linux_vma_head, vmap, vm_entry); + rw_wunlock(&linux_vma_lock); +} + +static struct vm_area_struct * +linux_cdev_handle_find(void *handle) +{ + struct vm_area_struct *vmap; + + rw_rlock(&linux_vma_lock); + TAILQ_FOREACH(vmap, &linux_vma_head, vm_entry) { + if (vmap->vm_private_data == handle) + break; + } + rw_runlock(&linux_vma_lock); + return (vmap); +} + +static int +linux_cdev_pager_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot, + vm_ooffset_t foff, struct ucred *cred, u_short *color) +{ + + MPASS(linux_cdev_handle_find(handle) != NULL); + *color = 0; + return (0); +} + +static void +linux_cdev_pager_dtor(void *handle) +{ + const struct vm_operations_struct *vm_ops; + struct vm_area_struct *vmap; + + vmap = linux_cdev_handle_find(handle); + MPASS(vmap != NULL); + + /* + * Remove handle before calling close operation to prevent + * other threads from reusing the handle pointer. + */ + linux_cdev_handle_remove(vmap); + + down_write(&vmap->vm_mm->mmap_sem); + vm_ops = vmap->vm_ops; + if (likely(vm_ops != NULL)) + vm_ops->close(vmap); + up_write(&vmap->vm_mm->mmap_sem); + + linux_cdev_handle_free(vmap); +} + +static struct cdev_pager_ops linux_cdev_pager_ops[2] = { + { + /* OBJT_MGTDEVICE */ + .cdev_pg_populate = linux_cdev_pager_populate, + .cdev_pg_ctor = linux_cdev_pager_ctor, + .cdev_pg_dtor = linux_cdev_pager_dtor + }, + { + /* OBJT_DEVICE */ + .cdev_pg_fault = linux_cdev_pager_fault, + .cdev_pg_ctor = linux_cdev_pager_ctor, + .cdev_pg_dtor = linux_cdev_pager_dtor + }, +}; + +int +zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, + unsigned long size) +{ + vm_object_t obj; + vm_page_t m; + + obj = vma->vm_obj; + if (obj == NULL || (obj->flags & OBJ_UNMANAGED) != 0) + return (-ENOTSUP); + VM_OBJECT_RLOCK(obj); + for (m = vm_page_find_least(obj, OFF_TO_IDX(address)); + m != NULL && m->pindex < OFF_TO_IDX(address + size); + m = TAILQ_NEXT(m, listq)) + pmap_remove_all(m); + VM_OBJECT_RUNLOCK(obj); + return (0); +} + +static struct file_operations dummy_ldev_ops = { + /* XXXKIB */ +}; + +static struct linux_cdev dummy_ldev = { + .ops = &dummy_ldev_ops, +}; + +#define LDEV_SI_DTR 0x0001 +#define LDEV_SI_REF 0x0002 + +static void +linux_get_fop(struct linux_file *filp, const struct file_operations **fop, + struct linux_cdev **dev) +{ + struct linux_cdev *ldev; + u_int siref; + + ldev = filp->f_cdev; + *fop = filp->f_op; + if (ldev != NULL) { + for (siref = ldev->siref;;) { + if ((siref & LDEV_SI_DTR) != 0) { + ldev = &dummy_ldev; + siref = ldev->siref; + *fop = ldev->ops; + MPASS((ldev->siref & LDEV_SI_DTR) == 0); + } else if (atomic_fcmpset_int(&ldev->siref, &siref, + siref + LDEV_SI_REF)) { + break; + } + } + } + *dev = ldev; +} + +static void +linux_drop_fop(struct linux_cdev *ldev) +{ + + if (ldev == NULL) + return; + MPASS((ldev->siref & ~LDEV_SI_DTR) != 0); + atomic_subtract_int(&ldev->siref, LDEV_SI_REF); +} + +#define OPW(fp,td,code) ({ \ + struct file *__fpop; \ + __typeof(code) __retval; \ + \ + __fpop = (td)->td_fpop; \ + (td)->td_fpop = (fp); \ + __retval = (code); \ + (td)->td_fpop = __fpop; \ + __retval; \ +}) + +static int +linux_dev_fdopen(struct cdev *dev, int fflags, struct thread *td, + struct file *file) +{ + struct linux_cdev *ldev; + struct linux_file *filp; + const struct file_operations *fop; + int error; + + ldev = dev->si_drv1; + + filp = linux_file_alloc(); + filp->f_dentry = &filp->f_dentry_store; + filp->f_op = ldev->ops; + filp->f_mode = file->f_flag; + filp->f_flags = file->f_flag; + filp->f_vnode = file->f_vnode; + filp->_file = file; + refcount_acquire(&ldev->refs); + filp->f_cdev = ldev; + + linux_set_current(td); + linux_get_fop(filp, &fop, &ldev); + + if (fop->open != NULL) { + error = -fop->open(file->f_vnode, filp); + if (error != 0) { + linux_drop_fop(ldev); + linux_cdev_deref(filp->f_cdev); + kfree(filp); + return (error); + } + } + + /* hold on to the vnode - used for fstat() */ + vhold(filp->f_vnode); + + /* release the file from devfs */ + finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops); + linux_drop_fop(ldev); + return (ENXIO); +} + +#define LINUX_IOCTL_MIN_PTR 0x10000UL +#define LINUX_IOCTL_MAX_PTR (LINUX_IOCTL_MIN_PTR + IOCPARM_MAX) + +static inline int +linux_remap_address(void **uaddr, size_t len) +{ + uintptr_t uaddr_val = (uintptr_t)(*uaddr); + + if (unlikely(uaddr_val >= LINUX_IOCTL_MIN_PTR && + uaddr_val < LINUX_IOCTL_MAX_PTR)) { + struct task_struct *pts = current; + if (pts == NULL) { + *uaddr = NULL; + return (1); + } + + /* compute data offset */ + uaddr_val -= LINUX_IOCTL_MIN_PTR; + + /* check that length is within bounds */ + if ((len > IOCPARM_MAX) || + (uaddr_val + len) > pts->bsd_ioctl_len) { + *uaddr = NULL; + return (1); + } + + /* re-add kernel buffer address */ + uaddr_val += (uintptr_t)pts->bsd_ioctl_data; + + /* update address location */ + *uaddr = (void *)uaddr_val; + return (1); + } + return (0); +} + +int +linux_copyin(const void *uaddr, void *kaddr, size_t len) +{ + if (linux_remap_address(__DECONST(void **, &uaddr), len)) { + if (uaddr == NULL) + return (-EFAULT); + memcpy(kaddr, uaddr, len); + return (0); + } + return (-copyin(uaddr, kaddr, len)); +} + +int +linux_copyout(const void *kaddr, void *uaddr, size_t len) +{ + if (linux_remap_address(&uaddr, len)) { + if (uaddr == NULL) + return (-EFAULT); + memcpy(uaddr, kaddr, len); + return (0); + } + return (-copyout(kaddr, uaddr, len)); +} + +size_t +linux_clear_user(void *_uaddr, size_t _len) +{ + uint8_t *uaddr = _uaddr; + size_t len = _len; + + /* make sure uaddr is aligned before going into the fast loop */ + while (((uintptr_t)uaddr & 7) != 0 && len > 7) { + if (subyte(uaddr, 0)) + return (_len); + uaddr++; + len--; + } + + /* zero 8 bytes at a time */ + while (len > 7) { +#ifdef __LP64__ + if (suword64(uaddr, 0)) + return (_len); +#else + if (suword32(uaddr, 0)) + return (_len); + if (suword32(uaddr + 4, 0)) + return (_len); +#endif + uaddr += 8; + len -= 8; + } + + /* zero fill end, if any */ + while (len > 0) { + if (subyte(uaddr, 0)) + return (_len); + uaddr++; + len--; + } + return (0); +} + +int +linux_access_ok(const void *uaddr, size_t len) +{ + uintptr_t saddr; + uintptr_t eaddr; + + /* get start and end address */ + saddr = (uintptr_t)uaddr; + eaddr = (uintptr_t)uaddr + len; + + /* verify addresses are valid for userspace */ + return ((saddr == eaddr) || + (eaddr > saddr && eaddr <= VM_MAXUSER_ADDRESS)); +} + +/* + * This function should return either EINTR or ERESTART depending on + * the signal type sent to this thread: + */ +static int +linux_get_error(struct task_struct *task, int error) +{ + /* check for signal type interrupt code */ + if (error == EINTR || error == ERESTARTSYS || error == ERESTART) { + error = -linux_schedule_get_interrupt_value(task); + if (error == 0) + error = EINTR; + } + return (error); +} + +static int +linux_file_ioctl_sub(struct file *fp, struct linux_file *filp, + const struct file_operations *fop, u_long cmd, caddr_t data, + struct thread *td) +{ + struct task_struct *task = current; + unsigned size; + int error; + + size = IOCPARM_LEN(cmd); + /* refer to logic in sys_ioctl() */ + if (size > 0) { + /* + * Setup hint for linux_copyin() and linux_copyout(). + * + * Background: Linux code expects a user-space address + * while FreeBSD supplies a kernel-space address. *** 1653 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Apr 6 00:38:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 598BB5CBAF1; Tue, 6 Apr 2021 00:38: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 4FDpYR1zzLz4Tc5; Tue, 6 Apr 2021 00:38: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 34AFF22340; Tue, 6 Apr 2021 00:38: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 1360cpqd029459; Tue, 6 Apr 2021 00:38:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1360cpWo029458; Tue, 6 Apr 2021 00:38:51 GMT (envelope-from git) Date: Tue, 6 Apr 2021 00:38:51 GMT Message-Id: <202104060038.1360cpWo029458@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: 28b482e2baf4 - main - linuxkpi: rename cdev to ldev 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: 28b482e2baf43cdd30e8b9bd090e6d9f405cf4b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 00:38:51 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=28b482e2baf43cdd30e8b9bd090e6d9f405cf4b3 commit 28b482e2baf43cdd30e8b9bd090e6d9f405cf4b3 Author: Konstantin Belousov AuthorDate: 2021-03-30 08:43:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-06 00:38:28 +0000 linuxkpi: rename cdev to ldev the variables hold pointers to a linux_cdev, not to a FreeBSD cdev. Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/compat/linuxkpi/common/src/linux_compat.c | 6 +++--- sys/compat/linuxkpi/common/src/linux_compat.c.orig | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index b7a7ba8b4f18..0731859e7a53 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -2220,12 +2220,12 @@ linux_cdev_release(struct kobject *kobj) static void linux_cdev_static_release(struct kobject *kobj) { - struct linux_cdev *cdev; + struct linux_cdev *ldev; struct kobject *parent; - cdev = container_of(kobj, struct linux_cdev, kobj); + ldev = container_of(kobj, struct linux_cdev, kobj); parent = kobj->parent; - linux_destroy_dev(cdev); + linux_destroy_dev(ldev); kobject_put(parent); } diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c.orig b/sys/compat/linuxkpi/common/src/linux_compat.c.orig index 42f47b6e510a..b7a7ba8b4f18 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c.orig +++ b/sys/compat/linuxkpi/common/src/linux_compat.c.orig @@ -1520,8 +1520,9 @@ linux_file_close(struct file *file, struct thread *td) if (filp->f_vnode != NULL) vdrop(filp->f_vnode); linux_drop_fop(ldev); - if (filp->f_cdev != NULL) - linux_cdev_deref(filp->f_cdev); + ldev = filp->f_cdev; + if (ldev != NULL) + linux_cdev_deref(ldev); kfree(filp); return (error); From owner-dev-commits-src-all@freebsd.org Tue Apr 6 00:38:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F0915CBD8E; Tue, 6 Apr 2021 00:38: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 4FDpYS4MnTz4TXC; Tue, 6 Apr 2021 00:38: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 5736B2243F; Tue, 6 Apr 2021 00:38: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 1360cqWg029481; Tue, 6 Apr 2021 00:38:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1360cqfL029480; Tue, 6 Apr 2021 00:38:52 GMT (envelope-from git) Date: Tue, 6 Apr 2021 00:38:52 GMT Message-Id: <202104060038.1360cqfL029480@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: 7f9867f8c65b - main - linuxkpi: do not destroy/free embedded linux cdevs 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: 7f9867f8c65b1b3e590dba4dc432a4bc8cf01f68 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 00:38:53 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7f9867f8c65b1b3e590dba4dc432a4bc8cf01f68 commit 7f9867f8c65b1b3e590dba4dc432a4bc8cf01f68 Author: Konstantin Belousov AuthorDate: 2021-03-30 08:44:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-06 00:38:29 +0000 linuxkpi: do not destroy/free embedded linux cdevs They have their own lifetime managed by the containing objects. Premature and unexpected free causes corruption. Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/compat/linuxkpi/common/src/linux_compat.c | 13 ++++++++++--- sys/compat/linuxkpi/common/src/linux_compat.c.orig | 6 +++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 0731859e7a53..71ea7e0844dc 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -2199,8 +2199,8 @@ linux_completion_done(struct completion *c) static void linux_cdev_deref(struct linux_cdev *ldev) { - - if (refcount_release(&ldev->refs)) + if (refcount_release(&ldev->refs) && + ldev->kobj.ktype == &linux_cdev_ktype) kfree(ldev); } @@ -2220,12 +2220,17 @@ linux_cdev_release(struct kobject *kobj) static void linux_cdev_static_release(struct kobject *kobj) { + struct cdev *cdev; struct linux_cdev *ldev; struct kobject *parent; ldev = container_of(kobj, struct linux_cdev, kobj); parent = kobj->parent; - linux_destroy_dev(ldev); + cdev = ldev->cdev; + if (cdev != NULL) { + destroy_dev(cdev); + ldev->cdev = NULL; + } kobject_put(parent); } @@ -2237,6 +2242,8 @@ linux_destroy_dev(struct linux_cdev *ldev) return; MPASS((ldev->siref & LDEV_SI_DTR) == 0); + MPASS(ldev->kobj.ktype == &linux_cdev_ktype); + atomic_set_int(&ldev->siref, LDEV_SI_DTR); while ((atomic_load_int(&ldev->siref) & ~LDEV_SI_DTR) != 0) pause("ldevdtr", hz / 4); diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c.orig b/sys/compat/linuxkpi/common/src/linux_compat.c.orig index b7a7ba8b4f18..0731859e7a53 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c.orig +++ b/sys/compat/linuxkpi/common/src/linux_compat.c.orig @@ -2220,12 +2220,12 @@ linux_cdev_release(struct kobject *kobj) static void linux_cdev_static_release(struct kobject *kobj) { - struct linux_cdev *cdev; + struct linux_cdev *ldev; struct kobject *parent; - cdev = container_of(kobj, struct linux_cdev, kobj); + ldev = container_of(kobj, struct linux_cdev, kobj); parent = kobj->parent; - linux_destroy_dev(cdev); + linux_destroy_dev(ldev); kobject_put(parent); } From owner-dev-commits-src-all@freebsd.org Tue Apr 6 00:38:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37D995CBA69; Tue, 6 Apr 2021 00:38: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 4FDpYV3g0Xz4TZg; Tue, 6 Apr 2021 00:38: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 8A862221E8; Tue, 6 Apr 2021 00:38: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 1360crDZ029506; Tue, 6 Apr 2021 00:38:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1360cr9Z029505; Tue, 6 Apr 2021 00:38:53 GMT (envelope-from git) Date: Tue, 6 Apr 2021 00:38:53 GMT Message-Id: <202104060038.1360cr9Z029505@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: f6b108837e7d - main - linuxkpi: avoid counting per-thread use for the embedded linux cdevs 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: f6b108837e7df7d7bfb35ec447f7cb62afa79441 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 00:38:55 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f6b108837e7df7d7bfb35ec447f7cb62afa79441 commit f6b108837e7df7d7bfb35ec447f7cb62afa79441 Author: Konstantin Belousov AuthorDate: 2021-03-30 08:45:24 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-06 00:38:29 +0000 linuxkpi: avoid counting per-thread use for the embedded linux cdevs The counter is not used to control destroy. Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/compat/linuxkpi/common/src/linux_compat.c | 31 ++++++++++++++-------- sys/compat/linuxkpi/common/src/linux_compat.c.orig | 13 ++++++--- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 71ea7e0844dc..28413c59bb76 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -717,15 +717,19 @@ linux_get_fop(struct linux_file *filp, const struct file_operations **fop, ldev = filp->f_cdev; *fop = filp->f_op; if (ldev != NULL) { - for (siref = ldev->siref;;) { - if ((siref & LDEV_SI_DTR) != 0) { - ldev = &dummy_ldev; - siref = ldev->siref; - *fop = ldev->ops; - MPASS((ldev->siref & LDEV_SI_DTR) == 0); - } else if (atomic_fcmpset_int(&ldev->siref, &siref, - siref + LDEV_SI_REF)) { - break; + if (ldev->kobj.ktype == &linux_cdev_static_ktype) { + refcount_acquire(&ldev->refs); + } else { + for (siref = ldev->siref;;) { + if ((siref & LDEV_SI_DTR) != 0) { + ldev = &dummy_ldev; + *fop = ldev->ops; + siref = ldev->siref; + MPASS((ldev->siref & LDEV_SI_DTR) == 0); + } else if (atomic_fcmpset_int(&ldev->siref, + &siref, siref + LDEV_SI_REF)) { + break; + } } } } @@ -738,8 +742,13 @@ linux_drop_fop(struct linux_cdev *ldev) if (ldev == NULL) return; - MPASS((ldev->siref & ~LDEV_SI_DTR) != 0); - atomic_subtract_int(&ldev->siref, LDEV_SI_REF); + if (ldev->kobj.ktype == &linux_cdev_static_ktype) { + linux_cdev_deref(ldev); + } else { + MPASS(ldev->kobj.ktype == &linux_cdev_ktype); + MPASS((ldev->siref & ~LDEV_SI_DTR) != 0); + atomic_subtract_int(&ldev->siref, LDEV_SI_REF); + } } #define OPW(fp,td,code) ({ \ diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c.orig b/sys/compat/linuxkpi/common/src/linux_compat.c.orig index 0731859e7a53..71ea7e0844dc 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c.orig +++ b/sys/compat/linuxkpi/common/src/linux_compat.c.orig @@ -2199,8 +2199,8 @@ linux_completion_done(struct completion *c) static void linux_cdev_deref(struct linux_cdev *ldev) { - - if (refcount_release(&ldev->refs)) + if (refcount_release(&ldev->refs) && + ldev->kobj.ktype == &linux_cdev_ktype) kfree(ldev); } @@ -2220,12 +2220,17 @@ linux_cdev_release(struct kobject *kobj) static void linux_cdev_static_release(struct kobject *kobj) { + struct cdev *cdev; struct linux_cdev *ldev; struct kobject *parent; ldev = container_of(kobj, struct linux_cdev, kobj); parent = kobj->parent; - linux_destroy_dev(ldev); + cdev = ldev->cdev; + if (cdev != NULL) { + destroy_dev(cdev); + ldev->cdev = NULL; + } kobject_put(parent); } @@ -2237,6 +2242,8 @@ linux_destroy_dev(struct linux_cdev *ldev) return; MPASS((ldev->siref & LDEV_SI_DTR) == 0); + MPASS(ldev->kobj.ktype == &linux_cdev_ktype); + atomic_set_int(&ldev->siref, LDEV_SI_DTR); while ((atomic_load_int(&ldev->siref) & ~LDEV_SI_DTR) != 0) pause("ldevdtr", hz / 4); From owner-dev-commits-src-all@freebsd.org Tue Apr 6 00:38:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 663685CBEB8; Tue, 6 Apr 2021 00:38: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 4FDpYX2hyhz4TXV; Tue, 6 Apr 2021 00:38: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 ACE78222DE; Tue, 6 Apr 2021 00:38: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 1360csfH029527; Tue, 6 Apr 2021 00:38:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1360cs8v029526; Tue, 6 Apr 2021 00:38:54 GMT (envelope-from git) Date: Tue, 6 Apr 2021 00:38:54 GMT Message-Id: <202104060038.1360cs8v029526@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: 8011fb795baa - main - linuxkpi: drop single-use variable 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: 8011fb795baa59ba14371d6db5ab661a5db77615 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 00:38:57 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=8011fb795baa59ba14371d6db5ab661a5db77615 commit 8011fb795baa59ba14371d6db5ab661a5db77615 Author: Konstantin Belousov AuthorDate: 2021-03-30 08:46:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-06 00:38:29 +0000 linuxkpi: drop single-use variable Reviewed by: hselasky Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/compat/linuxkpi/common/src/linux_compat.c | 4 +-- sys/compat/linuxkpi/common/src/linux_compat.c.orig | 31 ++++++++++++++-------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c index 28413c59bb76..630ee30e73e2 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c +++ b/sys/compat/linuxkpi/common/src/linux_compat.c @@ -2231,16 +2231,14 @@ linux_cdev_static_release(struct kobject *kobj) { struct cdev *cdev; struct linux_cdev *ldev; - struct kobject *parent; ldev = container_of(kobj, struct linux_cdev, kobj); - parent = kobj->parent; cdev = ldev->cdev; if (cdev != NULL) { destroy_dev(cdev); ldev->cdev = NULL; } - kobject_put(parent); + kobject_put(kobj->parent); } void diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c.orig b/sys/compat/linuxkpi/common/src/linux_compat.c.orig index 71ea7e0844dc..28413c59bb76 100644 --- a/sys/compat/linuxkpi/common/src/linux_compat.c.orig +++ b/sys/compat/linuxkpi/common/src/linux_compat.c.orig @@ -717,15 +717,19 @@ linux_get_fop(struct linux_file *filp, const struct file_operations **fop, ldev = filp->f_cdev; *fop = filp->f_op; if (ldev != NULL) { - for (siref = ldev->siref;;) { - if ((siref & LDEV_SI_DTR) != 0) { - ldev = &dummy_ldev; - siref = ldev->siref; - *fop = ldev->ops; - MPASS((ldev->siref & LDEV_SI_DTR) == 0); - } else if (atomic_fcmpset_int(&ldev->siref, &siref, - siref + LDEV_SI_REF)) { - break; + if (ldev->kobj.ktype == &linux_cdev_static_ktype) { + refcount_acquire(&ldev->refs); + } else { + for (siref = ldev->siref;;) { + if ((siref & LDEV_SI_DTR) != 0) { + ldev = &dummy_ldev; + *fop = ldev->ops; + siref = ldev->siref; + MPASS((ldev->siref & LDEV_SI_DTR) == 0); + } else if (atomic_fcmpset_int(&ldev->siref, + &siref, siref + LDEV_SI_REF)) { + break; + } } } } @@ -738,8 +742,13 @@ linux_drop_fop(struct linux_cdev *ldev) if (ldev == NULL) return; - MPASS((ldev->siref & ~LDEV_SI_DTR) != 0); - atomic_subtract_int(&ldev->siref, LDEV_SI_REF); + if (ldev->kobj.ktype == &linux_cdev_static_ktype) { + linux_cdev_deref(ldev); + } else { + MPASS(ldev->kobj.ktype == &linux_cdev_ktype); + MPASS((ldev->siref & ~LDEV_SI_DTR) != 0); + atomic_subtract_int(&ldev->siref, LDEV_SI_REF); + } } #define OPW(fp,td,code) ({ \ From owner-dev-commits-src-all@freebsd.org Tue Apr 6 00:43:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C9B75CC408; Tue, 6 Apr 2021 00:43: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 4FDpfk3FY6z4VfD; Tue, 6 Apr 2021 00:43: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 60DB922932; Tue, 6 Apr 2021 00:43: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 1360hQYb042425; Tue, 6 Apr 2021 00:43:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1360hQZN042424; Tue, 6 Apr 2021 00:43:26 GMT (envelope-from git) Date: Tue, 6 Apr 2021 00:43:26 GMT Message-Id: <202104060043.1360hQZN042424@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: 5b3b19db7305 - main - linuxkpi: remove erronously committed diff save file 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: 5b3b19db7305f8255f021d6f8d94d17ab778660f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 00:43:26 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5b3b19db7305f8255f021d6f8d94d17ab778660f commit 5b3b19db7305f8255f021d6f8d94d17ab778660f Author: Konstantin Belousov AuthorDate: 2021-04-06 00:42:13 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-06 00:42:13 +0000 linuxkpi: remove erronously committed diff save file Sponsored by: Mellanox Technologies/NVidia Networking MFC after: 1 week --- sys/compat/linuxkpi/common/src/linux_compat.c.orig | 2615 -------------------- 1 file changed, 2615 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c.orig b/sys/compat/linuxkpi/common/src/linux_compat.c.orig deleted file mode 100644 index 28413c59bb76..000000000000 --- a/sys/compat/linuxkpi/common/src/linux_compat.c.orig +++ /dev/null @@ -1,2615 +0,0 @@ -/*- - * Copyright (c) 2010 Isilon Systems, Inc. - * Copyright (c) 2010 iX Systems, Inc. - * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013-2018 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. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include "opt_stack.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#if defined(__i386__) || defined(__amd64__) -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(__i386__) || defined(__amd64__) -#include -#endif - -SYSCTL_NODE(_compat, OID_AUTO, linuxkpi, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, - "LinuxKPI parameters"); - -int linuxkpi_debug; -SYSCTL_INT(_compat_linuxkpi, OID_AUTO, debug, CTLFLAG_RWTUN, - &linuxkpi_debug, 0, "Set to enable pr_debug() prints. Clear to disable."); - -static struct timeval lkpi_net_lastlog; -static int lkpi_net_curpps; -static int lkpi_net_maxpps = 99; -SYSCTL_INT(_compat_linuxkpi, OID_AUTO, net_ratelimit, CTLFLAG_RWTUN, - &lkpi_net_maxpps, 0, "Limit number of LinuxKPI net messages per second."); - -MALLOC_DEFINE(M_KMALLOC, "linux", "Linux kmalloc compat"); - -#include -/* Undo Linux compat changes. */ -#undef RB_ROOT -#undef file -#undef cdev -#define RB_ROOT(head) (head)->rbh_root - -static void linux_cdev_deref(struct linux_cdev *ldev); -static struct vm_area_struct *linux_cdev_handle_find(void *handle); - -struct kobject linux_class_root; -struct device linux_root_device; -struct class linux_class_misc; -struct list_head pci_drivers; -struct list_head pci_devices; -spinlock_t pci_lock; - -unsigned long linux_timer_hz_mask; - -wait_queue_head_t linux_bit_waitq; -wait_queue_head_t linux_var_waitq; - -int -panic_cmp(struct rb_node *one, struct rb_node *two) -{ - panic("no cmp"); -} - -RB_GENERATE(linux_root, rb_node, __entry, panic_cmp); - -int -kobject_set_name_vargs(struct kobject *kobj, const char *fmt, va_list args) -{ - va_list tmp_va; - int len; - char *old; - char *name; - char dummy; - - old = kobj->name; - - if (old && fmt == NULL) - return (0); - - /* compute length of string */ - va_copy(tmp_va, args); - len = vsnprintf(&dummy, 0, fmt, tmp_va); - va_end(tmp_va); - - /* account for zero termination */ - len++; - - /* check for error */ - if (len < 1) - return (-EINVAL); - - /* allocate memory for string */ - name = kzalloc(len, GFP_KERNEL); - if (name == NULL) - return (-ENOMEM); - vsnprintf(name, len, fmt, args); - kobj->name = name; - - /* free old string */ - kfree(old); - - /* filter new string */ - for (; *name != '\0'; name++) - if (*name == '/') - *name = '!'; - return (0); -} - -int -kobject_set_name(struct kobject *kobj, const char *fmt, ...) -{ - va_list args; - int error; - - va_start(args, fmt); - error = kobject_set_name_vargs(kobj, fmt, args); - va_end(args); - - return (error); -} - -static int -kobject_add_complete(struct kobject *kobj, struct kobject *parent) -{ - const struct kobj_type *t; - int error; - - kobj->parent = parent; - error = sysfs_create_dir(kobj); - if (error == 0 && kobj->ktype && kobj->ktype->default_attrs) { - struct attribute **attr; - t = kobj->ktype; - - for (attr = t->default_attrs; *attr != NULL; attr++) { - error = sysfs_create_file(kobj, *attr); - if (error) - break; - } - if (error) - sysfs_remove_dir(kobj); - } - return (error); -} - -int -kobject_add(struct kobject *kobj, struct kobject *parent, const char *fmt, ...) -{ - va_list args; - int error; - - va_start(args, fmt); - error = kobject_set_name_vargs(kobj, fmt, args); - va_end(args); - if (error) - return (error); - - return kobject_add_complete(kobj, parent); -} - -void -linux_kobject_release(struct kref *kref) -{ - struct kobject *kobj; - char *name; - - kobj = container_of(kref, struct kobject, kref); - sysfs_remove_dir(kobj); - name = kobj->name; - if (kobj->ktype && kobj->ktype->release) - kobj->ktype->release(kobj); - kfree(name); -} - -static void -linux_kobject_kfree(struct kobject *kobj) -{ - kfree(kobj); -} - -static void -linux_kobject_kfree_name(struct kobject *kobj) -{ - if (kobj) { - kfree(kobj->name); - } -} - -const struct kobj_type linux_kfree_type = { - .release = linux_kobject_kfree -}; - -static void -linux_device_release(struct device *dev) -{ - pr_debug("linux_device_release: %s\n", dev_name(dev)); - kfree(dev); -} - -static ssize_t -linux_class_show(struct kobject *kobj, struct attribute *attr, char *buf) -{ - struct class_attribute *dattr; - ssize_t error; - - dattr = container_of(attr, struct class_attribute, attr); - error = -EIO; - if (dattr->show) - error = dattr->show(container_of(kobj, struct class, kobj), - dattr, buf); - return (error); -} - -static ssize_t -linux_class_store(struct kobject *kobj, struct attribute *attr, const char *buf, - size_t count) -{ - struct class_attribute *dattr; - ssize_t error; - - dattr = container_of(attr, struct class_attribute, attr); - error = -EIO; - if (dattr->store) - error = dattr->store(container_of(kobj, struct class, kobj), - dattr, buf, count); - return (error); -} - -static void -linux_class_release(struct kobject *kobj) -{ - struct class *class; - - class = container_of(kobj, struct class, kobj); - if (class->class_release) - class->class_release(class); -} - -static const struct sysfs_ops linux_class_sysfs = { - .show = linux_class_show, - .store = linux_class_store, -}; - -const struct kobj_type linux_class_ktype = { - .release = linux_class_release, - .sysfs_ops = &linux_class_sysfs -}; - -static void -linux_dev_release(struct kobject *kobj) -{ - struct device *dev; - - dev = container_of(kobj, struct device, kobj); - /* This is the precedence defined by linux. */ - if (dev->release) - dev->release(dev); - else if (dev->class && dev->class->dev_release) - dev->class->dev_release(dev); -} - -static ssize_t -linux_dev_show(struct kobject *kobj, struct attribute *attr, char *buf) -{ - struct device_attribute *dattr; - ssize_t error; - - dattr = container_of(attr, struct device_attribute, attr); - error = -EIO; - if (dattr->show) - error = dattr->show(container_of(kobj, struct device, kobj), - dattr, buf); - return (error); -} - -static ssize_t -linux_dev_store(struct kobject *kobj, struct attribute *attr, const char *buf, - size_t count) -{ - struct device_attribute *dattr; - ssize_t error; - - dattr = container_of(attr, struct device_attribute, attr); - error = -EIO; - if (dattr->store) - error = dattr->store(container_of(kobj, struct device, kobj), - dattr, buf, count); - return (error); -} - -static const struct sysfs_ops linux_dev_sysfs = { - .show = linux_dev_show, - .store = linux_dev_store, -}; - -const struct kobj_type linux_dev_ktype = { - .release = linux_dev_release, - .sysfs_ops = &linux_dev_sysfs -}; - -struct device * -device_create(struct class *class, struct device *parent, dev_t devt, - void *drvdata, const char *fmt, ...) -{ - struct device *dev; - va_list args; - - dev = kzalloc(sizeof(*dev), M_WAITOK); - dev->parent = parent; - dev->class = class; - dev->devt = devt; - dev->driver_data = drvdata; - dev->release = linux_device_release; - va_start(args, fmt); - kobject_set_name_vargs(&dev->kobj, fmt, args); - va_end(args); - device_register(dev); - - return (dev); -} - -int -kobject_init_and_add(struct kobject *kobj, const struct kobj_type *ktype, - struct kobject *parent, const char *fmt, ...) -{ - va_list args; - int error; - - kobject_init(kobj, ktype); - kobj->ktype = ktype; - kobj->parent = parent; - kobj->name = NULL; - - va_start(args, fmt); - error = kobject_set_name_vargs(kobj, fmt, args); - va_end(args); - if (error) - return (error); - return kobject_add_complete(kobj, parent); -} - -static void -linux_kq_lock(void *arg) -{ - spinlock_t *s = arg; - - spin_lock(s); -} -static void -linux_kq_unlock(void *arg) -{ - spinlock_t *s = arg; - - spin_unlock(s); -} - -static void -linux_kq_assert_lock(void *arg, int what) -{ -#ifdef INVARIANTS - spinlock_t *s = arg; - - if (what == LA_LOCKED) - mtx_assert(&s->m, MA_OWNED); - else - mtx_assert(&s->m, MA_NOTOWNED); -#endif -} - -static void -linux_file_kqfilter_poll(struct linux_file *, int); - -struct linux_file * -linux_file_alloc(void) -{ - struct linux_file *filp; - - filp = kzalloc(sizeof(*filp), GFP_KERNEL); - - /* set initial refcount */ - filp->f_count = 1; - - /* setup fields needed by kqueue support */ - spin_lock_init(&filp->f_kqlock); - knlist_init(&filp->f_selinfo.si_note, &filp->f_kqlock, - linux_kq_lock, linux_kq_unlock, linux_kq_assert_lock); - - return (filp); -} - -void -linux_file_free(struct linux_file *filp) -{ - if (filp->_file == NULL) { - if (filp->f_shmem != NULL) - vm_object_deallocate(filp->f_shmem); - kfree(filp); - } else { - /* - * The close method of the character device or file - * will free the linux_file structure: - */ - _fdrop(filp->_file, curthread); - } -} - -static int -linux_cdev_pager_fault(vm_object_t vm_obj, vm_ooffset_t offset, int prot, - vm_page_t *mres) -{ - struct vm_area_struct *vmap; - - vmap = linux_cdev_handle_find(vm_obj->handle); - - MPASS(vmap != NULL); - MPASS(vmap->vm_private_data == vm_obj->handle); - - if (likely(vmap->vm_ops != NULL && offset < vmap->vm_len)) { - vm_paddr_t paddr = IDX_TO_OFF(vmap->vm_pfn) + offset; - vm_page_t page; - - if (((*mres)->flags & PG_FICTITIOUS) != 0) { - /* - * If the passed in result page is a fake - * page, update it with the new physical - * address. - */ - page = *mres; - vm_page_updatefake(page, paddr, vm_obj->memattr); - } else { - /* - * Replace the passed in "mres" page with our - * own fake page and free up the all of the - * original pages. - */ - VM_OBJECT_WUNLOCK(vm_obj); - page = vm_page_getfake(paddr, vm_obj->memattr); - VM_OBJECT_WLOCK(vm_obj); - - vm_page_replace(page, vm_obj, (*mres)->pindex, *mres); - *mres = page; - } - vm_page_valid(page); - return (VM_PAGER_OK); - } - return (VM_PAGER_FAIL); -} - -static int -linux_cdev_pager_populate(vm_object_t vm_obj, vm_pindex_t pidx, int fault_type, - vm_prot_t max_prot, vm_pindex_t *first, vm_pindex_t *last) -{ - struct vm_area_struct *vmap; - int err; - - /* get VM area structure */ - vmap = linux_cdev_handle_find(vm_obj->handle); - MPASS(vmap != NULL); - MPASS(vmap->vm_private_data == vm_obj->handle); - - VM_OBJECT_WUNLOCK(vm_obj); - - linux_set_current(curthread); - - down_write(&vmap->vm_mm->mmap_sem); - if (unlikely(vmap->vm_ops == NULL)) { - err = VM_FAULT_SIGBUS; - } else { - struct vm_fault vmf; - - /* fill out VM fault structure */ - vmf.virtual_address = (void *)(uintptr_t)IDX_TO_OFF(pidx); - vmf.flags = (fault_type & VM_PROT_WRITE) ? FAULT_FLAG_WRITE : 0; - vmf.pgoff = 0; - vmf.page = NULL; - vmf.vma = vmap; - - vmap->vm_pfn_count = 0; - vmap->vm_pfn_pcount = &vmap->vm_pfn_count; - vmap->vm_obj = vm_obj; - - err = vmap->vm_ops->fault(vmap, &vmf); - - while (vmap->vm_pfn_count == 0 && err == VM_FAULT_NOPAGE) { - kern_yield(PRI_USER); - err = vmap->vm_ops->fault(vmap, &vmf); - } - } - - /* translate return code */ - switch (err) { - case VM_FAULT_OOM: - err = VM_PAGER_AGAIN; - break; - case VM_FAULT_SIGBUS: - err = VM_PAGER_BAD; - break; - case VM_FAULT_NOPAGE: - /* - * By contract the fault handler will return having - * busied all the pages itself. If pidx is already - * found in the object, it will simply xbusy the first - * page and return with vm_pfn_count set to 1. - */ - *first = vmap->vm_pfn_first; - *last = *first + vmap->vm_pfn_count - 1; - err = VM_PAGER_OK; - break; - default: - err = VM_PAGER_ERROR; - break; - } - up_write(&vmap->vm_mm->mmap_sem); - VM_OBJECT_WLOCK(vm_obj); - return (err); -} - -static struct rwlock linux_vma_lock; -static TAILQ_HEAD(, vm_area_struct) linux_vma_head = - TAILQ_HEAD_INITIALIZER(linux_vma_head); - -static void -linux_cdev_handle_free(struct vm_area_struct *vmap) -{ - /* Drop reference on vm_file */ - if (vmap->vm_file != NULL) - fput(vmap->vm_file); - - /* Drop reference on mm_struct */ - mmput(vmap->vm_mm); - - kfree(vmap); -} - -static void -linux_cdev_handle_remove(struct vm_area_struct *vmap) -{ - rw_wlock(&linux_vma_lock); - TAILQ_REMOVE(&linux_vma_head, vmap, vm_entry); - rw_wunlock(&linux_vma_lock); -} - -static struct vm_area_struct * -linux_cdev_handle_find(void *handle) -{ - struct vm_area_struct *vmap; - - rw_rlock(&linux_vma_lock); - TAILQ_FOREACH(vmap, &linux_vma_head, vm_entry) { - if (vmap->vm_private_data == handle) - break; - } - rw_runlock(&linux_vma_lock); - return (vmap); -} - -static int -linux_cdev_pager_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot, - vm_ooffset_t foff, struct ucred *cred, u_short *color) -{ - - MPASS(linux_cdev_handle_find(handle) != NULL); - *color = 0; - return (0); -} - -static void -linux_cdev_pager_dtor(void *handle) -{ - const struct vm_operations_struct *vm_ops; - struct vm_area_struct *vmap; - - vmap = linux_cdev_handle_find(handle); - MPASS(vmap != NULL); - - /* - * Remove handle before calling close operation to prevent - * other threads from reusing the handle pointer. - */ - linux_cdev_handle_remove(vmap); - - down_write(&vmap->vm_mm->mmap_sem); - vm_ops = vmap->vm_ops; - if (likely(vm_ops != NULL)) - vm_ops->close(vmap); - up_write(&vmap->vm_mm->mmap_sem); - - linux_cdev_handle_free(vmap); -} - -static struct cdev_pager_ops linux_cdev_pager_ops[2] = { - { - /* OBJT_MGTDEVICE */ - .cdev_pg_populate = linux_cdev_pager_populate, - .cdev_pg_ctor = linux_cdev_pager_ctor, - .cdev_pg_dtor = linux_cdev_pager_dtor - }, - { - /* OBJT_DEVICE */ - .cdev_pg_fault = linux_cdev_pager_fault, - .cdev_pg_ctor = linux_cdev_pager_ctor, - .cdev_pg_dtor = linux_cdev_pager_dtor - }, -}; - -int -zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, - unsigned long size) -{ - vm_object_t obj; - vm_page_t m; - - obj = vma->vm_obj; - if (obj == NULL || (obj->flags & OBJ_UNMANAGED) != 0) - return (-ENOTSUP); - VM_OBJECT_RLOCK(obj); - for (m = vm_page_find_least(obj, OFF_TO_IDX(address)); - m != NULL && m->pindex < OFF_TO_IDX(address + size); - m = TAILQ_NEXT(m, listq)) - pmap_remove_all(m); - VM_OBJECT_RUNLOCK(obj); - return (0); -} - -static struct file_operations dummy_ldev_ops = { - /* XXXKIB */ -}; - -static struct linux_cdev dummy_ldev = { - .ops = &dummy_ldev_ops, -}; - -#define LDEV_SI_DTR 0x0001 -#define LDEV_SI_REF 0x0002 - -static void -linux_get_fop(struct linux_file *filp, const struct file_operations **fop, - struct linux_cdev **dev) -{ - struct linux_cdev *ldev; - u_int siref; - - ldev = filp->f_cdev; - *fop = filp->f_op; - if (ldev != NULL) { - if (ldev->kobj.ktype == &linux_cdev_static_ktype) { - refcount_acquire(&ldev->refs); - } else { - for (siref = ldev->siref;;) { - if ((siref & LDEV_SI_DTR) != 0) { - ldev = &dummy_ldev; - *fop = ldev->ops; - siref = ldev->siref; - MPASS((ldev->siref & LDEV_SI_DTR) == 0); - } else if (atomic_fcmpset_int(&ldev->siref, - &siref, siref + LDEV_SI_REF)) { - break; - } - } - } - } - *dev = ldev; -} - -static void -linux_drop_fop(struct linux_cdev *ldev) -{ - - if (ldev == NULL) - return; - if (ldev->kobj.ktype == &linux_cdev_static_ktype) { - linux_cdev_deref(ldev); - } else { - MPASS(ldev->kobj.ktype == &linux_cdev_ktype); - MPASS((ldev->siref & ~LDEV_SI_DTR) != 0); - atomic_subtract_int(&ldev->siref, LDEV_SI_REF); - } -} - -#define OPW(fp,td,code) ({ \ - struct file *__fpop; \ - __typeof(code) __retval; \ - \ - __fpop = (td)->td_fpop; \ - (td)->td_fpop = (fp); \ - __retval = (code); \ - (td)->td_fpop = __fpop; \ - __retval; \ -}) - -static int -linux_dev_fdopen(struct cdev *dev, int fflags, struct thread *td, - struct file *file) -{ - struct linux_cdev *ldev; - struct linux_file *filp; - const struct file_operations *fop; - int error; - - ldev = dev->si_drv1; - - filp = linux_file_alloc(); - filp->f_dentry = &filp->f_dentry_store; - filp->f_op = ldev->ops; - filp->f_mode = file->f_flag; - filp->f_flags = file->f_flag; - filp->f_vnode = file->f_vnode; - filp->_file = file; - refcount_acquire(&ldev->refs); - filp->f_cdev = ldev; - - linux_set_current(td); - linux_get_fop(filp, &fop, &ldev); - - if (fop->open != NULL) { - error = -fop->open(file->f_vnode, filp); - if (error != 0) { - linux_drop_fop(ldev); - linux_cdev_deref(filp->f_cdev); - kfree(filp); - return (error); - } - } - - /* hold on to the vnode - used for fstat() */ - vhold(filp->f_vnode); - - /* release the file from devfs */ - finit(file, filp->f_mode, DTYPE_DEV, filp, &linuxfileops); - linux_drop_fop(ldev); - return (ENXIO); -} - -#define LINUX_IOCTL_MIN_PTR 0x10000UL -#define LINUX_IOCTL_MAX_PTR (LINUX_IOCTL_MIN_PTR + IOCPARM_MAX) - -static inline int -linux_remap_address(void **uaddr, size_t len) -{ - uintptr_t uaddr_val = (uintptr_t)(*uaddr); - - if (unlikely(uaddr_val >= LINUX_IOCTL_MIN_PTR && - uaddr_val < LINUX_IOCTL_MAX_PTR)) { - struct task_struct *pts = current; - if (pts == NULL) { - *uaddr = NULL; - return (1); - } - - /* compute data offset */ - uaddr_val -= LINUX_IOCTL_MIN_PTR; - - /* check that length is within bounds */ - if ((len > IOCPARM_MAX) || - (uaddr_val + len) > pts->bsd_ioctl_len) { - *uaddr = NULL; - return (1); - } - - /* re-add kernel buffer address */ - uaddr_val += (uintptr_t)pts->bsd_ioctl_data; - - /* update address location */ - *uaddr = (void *)uaddr_val; - return (1); - } - return (0); -} - -int -linux_copyin(const void *uaddr, void *kaddr, size_t len) -{ - if (linux_remap_address(__DECONST(void **, &uaddr), len)) { - if (uaddr == NULL) - return (-EFAULT); - memcpy(kaddr, uaddr, len); - return (0); - } - return (-copyin(uaddr, kaddr, len)); -} - -int -linux_copyout(const void *kaddr, void *uaddr, size_t len) -{ - if (linux_remap_address(&uaddr, len)) { - if (uaddr == NULL) - return (-EFAULT); - memcpy(uaddr, kaddr, len); - return (0); - } - return (-copyout(kaddr, uaddr, len)); -} - -size_t -linux_clear_user(void *_uaddr, size_t _len) -{ - uint8_t *uaddr = _uaddr; - size_t len = _len; - - /* make sure uaddr is aligned before going into the fast loop */ - while (((uintptr_t)uaddr & 7) != 0 && len > 7) { - if (subyte(uaddr, 0)) - return (_len); - uaddr++; - len--; - } - - /* zero 8 bytes at a time */ - while (len > 7) { -#ifdef __LP64__ - if (suword64(uaddr, 0)) - return (_len); -#else - if (suword32(uaddr, 0)) - return (_len); - if (suword32(uaddr + 4, 0)) - return (_len); -#endif - uaddr += 8; - len -= 8; - } - - /* zero fill end, if any */ - while (len > 0) { - if (subyte(uaddr, 0)) - return (_len); - uaddr++; - len--; - } - return (0); -} - -int -linux_access_ok(const void *uaddr, size_t len) -{ - uintptr_t saddr; - uintptr_t eaddr; - - /* get start and end address */ - saddr = (uintptr_t)uaddr; - eaddr = (uintptr_t)uaddr + len; - - /* verify addresses are valid for userspace */ - return ((saddr == eaddr) || - (eaddr > saddr && eaddr <= VM_MAXUSER_ADDRESS)); -} - -/* - * This function should return either EINTR or ERESTART depending on - * the signal type sent to this thread: - */ -static int -linux_get_error(struct task_struct *task, int error) -{ - /* check for signal type interrupt code */ - if (error == EINTR || error == ERESTARTSYS || error == ERESTART) { - error = -linux_schedule_get_interrupt_value(task); - if (error == 0) - error = EINTR; - } - return (error); -} - -static int -linux_file_ioctl_sub(struct file *fp, struct linux_file *filp, - const struct file_operations *fop, u_long cmd, caddr_t data, - struct thread *td) -{ - struct task_struct *task = current; - unsigned size; - int error; - - size = IOCPARM_LEN(cmd); - /* refer to logic in sys_ioctl() */ - if (size > 0) { - /* - * Setup hint for linux_copyin() and linux_copyout(). - * - * Background: Linux code expects a user-space address - * while FreeBSD supplies a kernel-space address. - */ - task->bsd_ioctl_data = data; - task->bsd_ioctl_len = size; - data = (void *)LINUX_IOCTL_MIN_PTR; - } else { - /* fetch user-space pointer */ - data = *(void **)data; - } -#if defined(__amd64__) *** 1652 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Apr 6 00:48:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF3D85CC4C4; Tue, 6 Apr 2021 00:48: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 4FDpmK4QYzz4Vlt; Tue, 6 Apr 2021 00:48: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 845722280F; Tue, 6 Apr 2021 00:48: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 1360mHYn043307; Tue, 6 Apr 2021 00:48:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1360mHcL043306; Tue, 6 Apr 2021 00:48:17 GMT (envelope-from git) Date: Tue, 6 Apr 2021 00:48:17 GMT Message-Id: <202104060048.1360mHcL043306@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 3a014191d72b - stable/13 - libc//sys/cerror.S: fix typo 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3a014191d72ba55861009487072a7fa72b935469 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 00:48:17 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3a014191d72ba55861009487072a7fa72b935469 commit 3a014191d72ba55861009487072a7fa72b935469 Author: Konstantin Belousov AuthorDate: 2021-04-03 01:36:41 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-06 00:47:34 +0000 libc//sys/cerror.S: fix typo (cherry picked from commit 4c2e9c35fb1958544040493e4fd8d8b8a0927677) --- lib/libc/amd64/sys/cerror.S | 2 +- lib/libc/i386/sys/cerror.S | 2 +- lib/libc/powerpc/sys/cerror.S | 2 +- lib/libc/powerpc64/sys/cerror.S | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libc/amd64/sys/cerror.S b/lib/libc/amd64/sys/cerror.S index ffce9d561993..1928acd0b7a9 100644 --- a/lib/libc/amd64/sys/cerror.S +++ b/lib/libc/amd64/sys/cerror.S @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); /* * The __error() function is thread aware. For non-threaded - * programs and the initial threaded in threaded programs, + * programs and the initial thread in threaded programs, * it returns a pointer to the global errno variable. */ .globl CNAME(__error) diff --git a/lib/libc/i386/sys/cerror.S b/lib/libc/i386/sys/cerror.S index 423d716cb651..47bd0fade000 100644 --- a/lib/libc/i386/sys/cerror.S +++ b/lib/libc/i386/sys/cerror.S @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); /* * The __error() function is thread aware. For non-threaded - * programs and the initial threaded in threaded programs, + * programs and the initial thread in threaded programs, * it returns a pointer to the global errno variable. */ .globl CNAME(__error) diff --git a/lib/libc/powerpc/sys/cerror.S b/lib/libc/powerpc/sys/cerror.S index c2bc994b9c33..9ec3cbaf63a2 100644 --- a/lib/libc/powerpc/sys/cerror.S +++ b/lib/libc/powerpc/sys/cerror.S @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); /* * The __error() function is thread aware. For non-threaded - * programs and the initial threaded in threaded programs, + * programs and the initial thread in threaded programs, * it returns a pointer to the global errno variable. */ HIDENAME(cerror): diff --git a/lib/libc/powerpc64/sys/cerror.S b/lib/libc/powerpc64/sys/cerror.S index 3362c9fdf046..93172fdb822e 100644 --- a/lib/libc/powerpc64/sys/cerror.S +++ b/lib/libc/powerpc64/sys/cerror.S @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD$"); /* * The __error() function is thread aware. For non-threaded - * programs and the initial threaded in threaded programs, + * programs and the initial thread in threaded programs, * it returns a pointer to the global errno variable. */ ENTRY_NOPROF(HIDENAME(cerror)) From owner-dev-commits-src-all@freebsd.org Tue Apr 6 00:48:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF1505CC532; Tue, 6 Apr 2021 00:48: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 4FDpmL4ypGz4W53; Tue, 6 Apr 2021 00:48: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 9C31B22933; Tue, 6 Apr 2021 00:48: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 1360mIN6043331; Tue, 6 Apr 2021 00:48:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1360mIAx043329; Tue, 6 Apr 2021 00:48:18 GMT (envelope-from git) Date: Tue, 6 Apr 2021 00:48:18 GMT Message-Id: <202104060048.1360mIAx043329@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: fb698c2c6dd1 - stable/13 - amd64 fabs(3): move signbit to .rodata 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/stable/13 X-Git-Reftype: branch X-Git-Commit: fb698c2c6dd1a0f8c5dd00888294dd272a42602c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 00:48:18 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fb698c2c6dd1a0f8c5dd00888294dd272a42602c commit fb698c2c6dd1a0f8c5dd00888294dd272a42602c Author: Konstantin Belousov AuthorDate: 2021-04-03 01:32:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-06 00:47:34 +0000 amd64 fabs(3): move signbit to .rodata (cherry picked from commit f548033818b8bbcee17ad3926103f2a9b2c975df) (cherry picked from commit 6d3f54fd090162ab14e2ec66f46bb1335a127a30) (cherry picked from commit d218c6f6af336135ea88342d472b0e66c21239c9) --- lib/libc/amd64/gen/fabs.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/libc/amd64/gen/fabs.S b/lib/libc/amd64/gen/fabs.S index 2ace0f9fb926..38e67ab03873 100644 --- a/lib/libc/amd64/gen/fabs.S +++ b/lib/libc/amd64/gen/fabs.S @@ -39,7 +39,8 @@ ENTRY(fabs) ret END(fabs) - .data + .section .rodata + .p2align 3 signbit: .quad 0x8000000000000000 From owner-dev-commits-src-all@freebsd.org Tue Apr 6 00:48:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50D7C5CC453; Tue, 6 Apr 2021 00:48: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 4FDpmM74j5z4VxK; Tue, 6 Apr 2021 00:48: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 C917F2278F; Tue, 6 Apr 2021 00:48: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 1360mJMP043354; Tue, 6 Apr 2021 00:48:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1360mJD9043353; Tue, 6 Apr 2021 00:48:19 GMT (envelope-from git) Date: Tue, 6 Apr 2021 00:48:19 GMT Message-Id: <202104060048.1360mJD9043353@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5524122ee3b7 - stable/13 - x86: clear %db registers in new process 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5524122ee3b78b3a9bba1d0a0d9b8ac080a8e6d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 00:48:20 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5524122ee3b78b3a9bba1d0a0d9b8ac080a8e6d8 commit 5524122ee3b78b3a9bba1d0a0d9b8ac080a8e6d8 Author: Konstantin Belousov AuthorDate: 2021-03-30 15:40:02 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-06 00:47:34 +0000 x86: clear %db registers in new process PR: 254661 (cherry picked from commit 8223717ce62c1ad0becc34ce69fe2d1771f3ba05) --- sys/amd64/amd64/vm_machdep.c | 8 ++++++++ sys/i386/i386/vm_machdep.c | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index f64259decbff..98d212dc8771 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -229,6 +229,14 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) copy_thread(td1, td2); + /* Reset debug registers in the new process */ + pcb2->pcb_dr0 = 0; + pcb2->pcb_dr1 = 0; + pcb2->pcb_dr2 = 0; + pcb2->pcb_dr3 = 0; + pcb2->pcb_dr6 = 0; + pcb2->pcb_dr7 = 0; + /* Point mdproc and then copy over p1's contents */ mdp2 = &p2->p_md; bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index c04fb57db4b1..ed40ebe5d1c8 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -241,6 +241,14 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) copy_thread(td1, td2); + /* Reset debug registers in the new process */ + pcb2->pcb_dr0 = 0; + pcb2->pcb_dr1 = 0; + pcb2->pcb_dr2 = 0; + pcb2->pcb_dr3 = 0; + pcb2->pcb_dr6 = 0; + pcb2->pcb_dr7 = 0; + /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); From owner-dev-commits-src-all@freebsd.org Tue Apr 6 02:33:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 784825CE0E3; Tue, 6 Apr 2021 02:33: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 4FDs612w9xz4cs9; Tue, 6 Apr 2021 02:33:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 55DA323DC5; Tue, 6 Apr 2021 02:33:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1362Xj7I096749; Tue, 6 Apr 2021 02:33:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1362XjhV096748; Tue, 6 Apr 2021 02:33:45 GMT (envelope-from git) Date: Tue, 6 Apr 2021 02:33:45 GMT Message-Id: <202104060233.1362XjhV096748@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Philip Paeps Subject: git: e270eebc97a5 - main - bsdconfig: remove ftp7.ua.freebsd.org mirror MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e270eebc97a53b306334cb23116c4e583cc5ef13 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 02:33:45 -0000 The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=e270eebc97a53b306334cb23116c4e583cc5ef13 commit e270eebc97a53b306334cb23116c4e583cc5ef13 Author: Philip Paeps AuthorDate: 2021-04-06 02:32:23 +0000 Commit: Philip Paeps CommitDate: 2021-04-06 02:32:23 +0000 bsdconfig: remove ftp7.ua.freebsd.org mirror PR: 254779 Reported by: Dmytro --- usr.sbin/bsdconfig/share/media/ftp.subr | 1 - 1 file changed, 1 deletion(-) diff --git a/usr.sbin/bsdconfig/share/media/ftp.subr b/usr.sbin/bsdconfig/share/media/ftp.subr index a6d0e1ca1ad0..992203ed7402 100644 --- a/usr.sbin/bsdconfig/share/media/ftp.subr +++ b/usr.sbin/bsdconfig/share/media/ftp.subr @@ -164,7 +164,6 @@ f_dialog_menu_media_ftp() ' $msg_uk #4' 'ftp4.uk.freebsd.org' ' $msg_uk #5' 'ftp5.uk.freebsd.org' '$msg_ukraine' 'ftp.ua.freebsd.org' - ' $msg_ukraine #7' 'ftp7.ua.freebsd.org' '$msg_usa #1' 'ftp1.us.freebsd.org' ' $msg_usa #2' 'ftp2.us.freebsd.org' ' $msg_usa #3' 'ftp3.us.freebsd.org' From owner-dev-commits-src-all@freebsd.org Tue Apr 6 02:33:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 927715CE1D2; Tue, 6 Apr 2021 02:33:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FDs623Ds6z4cpZ; Tue, 6 Apr 2021 02:33: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 60D1123CB1; Tue, 6 Apr 2021 02:33: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 1362XkFQ096770; Tue, 6 Apr 2021 02:33:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1362XkYo096769; Tue, 6 Apr 2021 02:33:46 GMT (envelope-from git) Date: Tue, 6 Apr 2021 02:33:46 GMT Message-Id: <202104060233.1362XkYo096769@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Philip Paeps Subject: git: e5fc416c2855 - main - bsdinstall: remove ftp7.ua.freebsd.org mirror MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: philip X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e5fc416c2855d684d49bfbcc6199b54620bf1bfe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 02:33:46 -0000 The branch main has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=e5fc416c2855d684d49bfbcc6199b54620bf1bfe commit e5fc416c2855d684d49bfbcc6199b54620bf1bfe Author: Philip Paeps AuthorDate: 2021-04-06 02:32:52 +0000 Commit: Philip Paeps CommitDate: 2021-04-06 02:32:52 +0000 bsdinstall: remove ftp7.ua.freebsd.org mirror PR: 254779 Reported by: Dmytro --- usr.sbin/bsdinstall/scripts/mirrorselect | 1 - 1 file changed, 1 deletion(-) diff --git a/usr.sbin/bsdinstall/scripts/mirrorselect b/usr.sbin/bsdinstall/scripts/mirrorselect index 987a524218af..b78a0bf10aa1 100755 --- a/usr.sbin/bsdinstall/scripts/mirrorselect +++ b/usr.sbin/bsdinstall/scripts/mirrorselect @@ -125,7 +125,6 @@ MIRROR=`dialog --backtitle "FreeBSD Installer" \ ftp://ftp4.uk.freebsd.org "UK #4"\ ftp://ftp5.uk.freebsd.org "UK #5"\ ftp://ftp.ua.freebsd.org "Ukraine"\ - ftp://ftp7.ua.freebsd.org "Ukraine #7"\ ftp://ftp1.us.freebsd.org "USA #1"\ ftp://ftp2.us.freebsd.org "USA #2"\ ftp://ftp3.us.freebsd.org "USA #3"\ From owner-dev-commits-src-all@freebsd.org Tue Apr 6 06:01:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 202155D417F; Tue, 6 Apr 2021 06: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 4FDxjY0KG3z4sn2; Tue, 6 Apr 2021 06:01: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 F0CBB26A1A; Tue, 6 Apr 2021 06:01: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 13661Kn8004821; Tue, 6 Apr 2021 06:01:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13661KVi004820; Tue, 6 Apr 2021 06:01:20 GMT (envelope-from git) Date: Tue, 6 Apr 2021 06:01:20 GMT Message-Id: <202104060601.13661KVi004820@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: 42cd37dfbd1b - main - gptboot.efi: Add man page 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: 42cd37dfbd1b2feff8f7aba32d2577e08b058231 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 06:01:21 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=42cd37dfbd1b2feff8f7aba32d2577e08b058231 commit 42cd37dfbd1b2feff8f7aba32d2577e08b058231 Author: Warner Losh AuthorDate: 2021-04-06 05:55:08 +0000 Commit: Warner Losh CommitDate: 2021-04-06 05:57:57 +0000 gptboot.efi: Add man page Add a man page for gptboot.efi. Describe when and how to use this as it differs from the BIOS cases. Include cross reference for the preferred method described in efibootmgr(8) as well as cross links in both gptboot(8) and gptboot.efi(8) to the other. This man page was heavily copied from the gptboot.8 man page by Warren Block. They are different enough to need separate man pages for clarity, but there's enough similarity that I worry about the duplication. In the really long term, gptboot(8) will disappear, so having the same info here will help when that day comes. In the short to medium term, the information is likely to not change in gptboot(8) and any changes to gptboot.efi(8) will be easier to make in a separate copy. loader.efi(8) needs a complete rewrite from scratch, otherwise I'd have referenced gptboot.efi(8) from there. Suggetions from: cress@, mhorne@ Reviewed by: rpokala@ Differential Revision: https://reviews.freebsd.org/D29591 --- stand/efi/gptboot/Makefile | 1 + stand/efi/gptboot/gptboot.efi.8 | 282 ++++++++++++++++++++++++++++++++++++++++ stand/i386/gptboot/gptboot.8 | 6 +- stand/man/boot1.efi.8 | 14 +- 4 files changed, 300 insertions(+), 3 deletions(-) diff --git a/stand/efi/gptboot/Makefile b/stand/efi/gptboot/Makefile index 7d6dee85f93f..2dcf8dda8f59 100644 --- a/stand/efi/gptboot/Makefile +++ b/stand/efi/gptboot/Makefile @@ -6,6 +6,7 @@ MK_LOADER_ZFS=no EFI_DEBUG=yes BOOT1?= gptboot +MAN= gptboot.efi.8 .PATH: ${SRCTOP}/stand/efi/boot1 ${SRCTOP}/stand/libsa CFLAGS+= -I${SRCTOP}/stand/efi/boot1 CFLAGS+= -I${.CURDIR} diff --git a/stand/efi/gptboot/gptboot.efi.8 b/stand/efi/gptboot/gptboot.efi.8 new file mode 100644 index 000000000000..134c5353e9f1 --- /dev/null +++ b/stand/efi/gptboot/gptboot.efi.8 @@ -0,0 +1,282 @@ +.\" Copyright (c) 2013 Warren Block All rights reserved. +.\" Copyright (c) 2021 Warner Losh +.\" +.\" 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. +.\" +.\" $FreeBSD$ +.\" +.Dd April 6, 2021 +.Dt GPTBOOT.EFI 8 +.Os +.Sh NAME +.Nm gptboot.efi +.Nd GPT bootcode for UFS on UEFI computers +.Sh DESCRIPTION +.Nm +is used on UEFI computers to boot from a UFS partition on a +GPT-partitioned disk. +.Nm +is installed in the EFI System Partition (ESP). +For BIOS-based computers, +see +.Xr gptboot 8 +for details. +While conceptually similar, the details differ. +.Nm +works only with UFS root file systems. +Users with ZFS partitions should use +.Xr loader.efi 8 +with +.Xr bectl 8 +to control what dataset is used for root. +.Pp +What UEFI computers boot is usually controlled via the mechanisms explained in +.Xr efibootmgr 8 +using +.Xr loader.efi 8 +or +.Xr boot1.efi 8 . +However, some setups cannot use those mechanisms. +When the users cannot rely on host-supplied UEFI variables +or they want the contents of the media alone to decide root, +.Nm +accomplishes these goals. +.Pp +When it starts, +.Nm +first reads the GPT and determines which drive and partition to +boot from, as described under +.Sx BOOTING , +below. +If it does not find an eligible partition, it returns to the UEFI +firmware. +The firmware will then try the next bootable item in the UEFI Boot Manager's +list, if any, usually a different disk. +.Sh IMPLEMENTATION NOTES +The GPT standard allows a variable number of partitions, but +.Nm +only boots from tables with 128 partitions or less. +.Sh PARTITION ATTRIBUTES +.Nm +checks and manages several attributes of GPT UFS partitions. +These flags are +.Fx +specific and non-standard. +.Bl -tag -width ".Cm bootfailed" +.It Cm bootme +Attempt to boot from this partition. +If more than one partition has the +.Cm bootme +attribute set, +.Nm +will attempt to boot each one until successful. +.It Cm bootonce +Attempt to boot from this partition only one time. +Setting this attribute with +.Xr gpart 8 +automatically also sets the +.Cm bootme +attribute. +Multiple partitions may have the +.Cm bootonce +and +.Cm bootme +attributes set. +.It Cm bootfailed +The +.Cm bootfailed +attribute marks partitions that had the +.Cm bootonce +attribute set, but failed to boot. +This attribute is managed by the system. +See +.Sx "BOOTING" +and +.Sx "POST-BOOT ACTIONS" +below for details. +.El +.Sh USAGE +For normal usage, the user does not have to set or manage any of the +partition attributes. +.Nm +will boot from the first UFS partition found on the device. +.Pp +The +.Cm bootonce +attribute can be used for testing an upgraded operating system on +an already-working computer. +The existing system partition is left untouched, and the new version +of the operating system to be tested is installed on another partition. +The +.Cm bootonce +attribute is set on that new test partition. +The next boot is attempted from the test partition. +Success or failure will be shown in the system log files. +After a successful boot of the test partition, a user script can check +the logs and change the +.Cm bootme +attributes so the test partition becomes the new system partition. +Because the +.Cm bootonce +attribute is cleared after an attempted boot, a failed boot will not +leave the system attempting to boot from a partition that will never +succeed. +Instead, the system will boot from the older, known-working operating +system that has not been modified. +If the +.Cm bootme +attribute is set on any partitions, booting will be attempted from them +first. +If no partitions with +.Cm bootme +attributes are found, booting will be attempted from the first UFS +partition found. +.Sh BOOTING +.Nm +first reads the partition table. +All +.Cm freebsd-ufs +partitions with only the +.Cm bootonce +attribute set, indicating a failed boot, are set to +.Cm bootfailed . +.Nm +then scans through all of the +.Cm freebsd-ufs +partitions. +Boot behavior depends on the combination of +.Cm bootme +and +.Cm bootonce +attributes set on those partitions. +.Bl -tag -width ".Cm bootonce + .Cm bootme" +.It Cm bootonce + Cm bootme +Highest priority: booting is attempted from each of the +.Cm freebsd-ufs +partitions with both of these attributes. +On each partition, the +.Cm bootme +attribute is removed and the boot attempted. +.It Cm bootme +Middle priority: booting is attempted from each of the +.Cm freebsd-ufs +partitions with the +.Cm bootme +attribute. +.El +.Pp +If neither +.Cm bootonce +nor +.Cm bootme +attributes are found on any partitions, booting is attempted from the +first +.Cm freebsd-ufs +partition on the disk. +.Sh POST-BOOT ACTIONS +The startup script +.Pa /etc/rc.d/gptboot +checks the attributes of +.Cm freebsd-ufs +partitions on all GPT disks. +Partitions with the +.Cm bootfailed +attribute generate a +.Dq boot from X failed +system log message. +Partitions with only the +.Cm bootonce +attribute, indicating a partition that successfully booted, generate a +.Dq boot from X succeeded +system log message. +The +.Cm bootfailed +attributes are cleared from all the partitions. +The +.Cm bootonce +attribute is cleared from the partition that successfully booted. +There is normally only one of these. +.Sh FILES +.Bl -tag -width /boot/gptboot.efi -compact +.It Pa /boot/gptboot.efi +bootcode binary +.It Pa /boot/efi/efi/boot/bootx64.efi +Default boot loader for amd64 systems. +.It Pa /boot/efi/efi/boot/bootaa64.efi +Default boot loader for arm64 systems. +.It Pa /boot/efi/efi/boot/bootarm.efi +Default boot loader for arm systems. +.It Pa /boot/efi/efi/boot/bootriscv64.efi +Default boot loader for riscv systems. +.El +.Sh EXAMPLES +.Nm +is installed in the ESP with +.Xr cp 1 . +.Pp +Install +.Nm +into the ESP for the system. +This assumes the ESP is mounted in the standard +.Pa /boot/efi +directory. +For amd64, use the following +.Bd -literal -offset indent -compact +cp /boot/gptboot.efi /boot/efi/efi/boot/bootx64.efi +.Ed +For other systems, use the file listed in the +.Sx FILES +section. +.Pp +Set the +.Cm bootme +attribute for partition 2: +.Bd -literal -offset indent +gpart set -a bootme -i 2 ada0 +.Ed +.Pp +Set the +.Cm bootonce +attribute for partition 2, automatically also setting the +.Cm bootme +attribute: +.Bd -literal -offset indent +gpart set -a bootonce -i 2 ada0 +.Ed +.Sh SEE ALSO +.Xr rc.conf 5 , +.Xr boot 8 , +.Xr efibootmgr 8 , +.Xr gpart 8 , +.Xr gptboot 8 , +.Xr loader.efi 8 +.Sh HISTORY +.Nm +appeared in +.Fx 13.0 +.Sh AUTHORS +This manual page written by +.An Warner Losh Aq imp@FreeBSD.org . +It is based heavily on the +.Xr gptboot 8 +man page by +.An Warren Block Aq wblock@FreeBSD.org . diff --git a/stand/i386/gptboot/gptboot.8 b/stand/i386/gptboot/gptboot.8 index 06ccaa37cdce..fa6eecc3cfab 100644 --- a/stand/i386/gptboot/gptboot.8 +++ b/stand/i386/gptboot/gptboot.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 30, 2019 +.Dd April 6, 2021 .Dt GPTBOOT 8 .Os .Sh NAME @@ -39,6 +39,10 @@ is installed in a .Cm freebsd-boot partition with .Xr gpart 8 . +For UEFI, +.Xr gptboot.efi 8 +is used instead. +While conceptually similar, the details differ. .Pp When it starts, .Nm diff --git a/stand/man/boot1.efi.8 b/stand/man/boot1.efi.8 index 74758a0c5660..efd3c2c93d5e 100644 --- a/stand/man/boot1.efi.8 +++ b/stand/man/boot1.efi.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 1, 2020 +.Dd April 6, 2021 .Dt BOOT1.EFI 8 .Os .Sh NAME @@ -33,13 +33,19 @@ .Sh DESCRIPTION .Nm has been deprecated and will be removed from a future release. -.Xr loader.efi 8 handles all its former use cases with more flexibility. +.Xr loader.efi 8 +handles all its former use cases with more flexibility. .Pp On UEFI systems, .Nm loads .Pa /boot/loader.efi from the default root file system and transfers execution there. +Some systems may need to use +.Xr gptboot.efi 8 +when +.Xr loader.efi 8 +cannot be used directly on the ESP (EFI System Partition). .Ss Initialization Before looking for the boot device, .Nm @@ -94,6 +100,10 @@ When configuring a serial console for FreeBSD, but not for UEFI, no output will show up on the serial console from boot1.efi. .It There's no support for marking partitions as the preferred one. +See +.Xr gptboot.efi 8 . .It There's no support for boot-once functionality. +See +.Xr gptboot.efi 8 . .El From owner-dev-commits-src-all@freebsd.org Tue Apr 6 06:51:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9DC15D5C1A; Tue, 6 Apr 2021 06:51: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 4FDyq54prYz3CCZ; Tue, 6 Apr 2021 06:51: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 96E9A27154; Tue, 6 Apr 2021 06:51: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 1366pDbn077767; Tue, 6 Apr 2021 06:51:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1366pDjD077766; Tue, 6 Apr 2021 06:51:13 GMT (envelope-from git) Date: Tue, 6 Apr 2021 06:51:13 GMT Message-Id: <202104060651.1366pDjD077766@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: 38c299fe8562 - stable/12 - ipdivert: check that PCB is still valid after taking INPCB_RLOCK. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 38c299fe856216d6ab38eb5e04d9ee4f8c22995d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 06:51:13 -0000 The branch stable/12 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=38c299fe856216d6ab38eb5e04d9ee4f8c22995d commit 38c299fe856216d6ab38eb5e04d9ee4f8c22995d Author: Andrey V. Elsukov AuthorDate: 2021-03-30 09:31:09 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-04-06 06:50:55 +0000 ipdivert: check that PCB is still valid after taking INPCB_RLOCK. We are inspecting PCBs of divert sockets under NET_EPOCH section, but PCB could be already detached and we should check INP_FREED flag when we took INP_RLOCK. PR: 254478 Differential Revision: https://reviews.freebsd.org/D29420 (cherry picked from commit c80a4b76ceacc5aab322e7ac1407eea8c90cb3b1) --- sys/netinet/ip_divert.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index bcde5416456b..81e70177e641 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -278,6 +278,10 @@ divert_packet(struct mbuf *m, int incoming) /* XXX why does only one socket match? */ if (inp->inp_lport == nport) { INP_RLOCK(inp); + if (__predict_false(inp->inp_flags2 & INP_FREED)) { + INP_RUNLOCK(inp); + continue; + } sa = inp->inp_socket; SOCKBUF_LOCK(&sa->so_rcv); if (sbappendaddr_locked(&sa->so_rcv, From owner-dev-commits-src-all@freebsd.org Tue Apr 6 06:49:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0EAB5D5BBC; Tue, 6 Apr 2021 06:49: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 4FDynZ5tWnz3Byx; Tue, 6 Apr 2021 06:49: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 B4953270D0; Tue, 6 Apr 2021 06:49: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 1366nsLX067856; Tue, 6 Apr 2021 06:49:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1366nsHB067855; Tue, 6 Apr 2021 06:49:54 GMT (envelope-from git) Date: Tue, 6 Apr 2021 06:49:54 GMT Message-Id: <202104060649.1366nsHB067855@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Andrey V. Elsukov" Subject: git: 6b8c65318e81 - stable/13 - ipdivert: check that PCB is still valid after taking INPCB_RLOCK. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ae X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6b8c65318e81a451b33ed57b84a5495284dcb20f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 06:49:55 -0000 The branch stable/13 has been updated by ae: URL: https://cgit.FreeBSD.org/src/commit/?id=6b8c65318e81a451b33ed57b84a5495284dcb20f commit 6b8c65318e81a451b33ed57b84a5495284dcb20f Author: Andrey V. Elsukov AuthorDate: 2021-03-30 09:31:09 +0000 Commit: Andrey V. Elsukov CommitDate: 2021-04-06 06:47:54 +0000 ipdivert: check that PCB is still valid after taking INPCB_RLOCK. We are inspecting PCBs of divert sockets under NET_EPOCH section, but PCB could be already detached and we should check INP_FREED flag when we took INP_RLOCK. PR: 254478 Differential Revision: https://reviews.freebsd.org/D29420 (cherry picked from commit c80a4b76ceacc5aab322e7ac1407eea8c90cb3b1) --- sys/netinet/ip_divert.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c index 65f1d263b5fa..70d3fbd1f230 100644 --- a/sys/netinet/ip_divert.c +++ b/sys/netinet/ip_divert.c @@ -280,6 +280,10 @@ divert_packet(struct mbuf *m, bool incoming) /* XXX why does only one socket match? */ if (inp->inp_lport == nport) { INP_RLOCK(inp); + if (__predict_false(inp->inp_flags2 & INP_FREED)) { + INP_RUNLOCK(inp); + continue; + } sa = inp->inp_socket; SOCKBUF_LOCK(&sa->so_rcv); if (sbappendaddr_locked(&sa->so_rcv, From owner-dev-commits-src-all@freebsd.org Tue Apr 6 07:09:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2878A5D670C; Tue, 6 Apr 2021 07:09:31 +0000 (UTC) (envelope-from kp@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 4FDzDC0Zdsz3D33; Tue, 6 Apr 2021 07:09:31 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [5.9.86.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.codepro.be", Issuer "R3" (verified OK)) (Authenticated sender: kp) by smtp.freebsd.org (Postfix) with ESMTPSA id DC7009372; Tue, 6 Apr 2021 07:09:30 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: by venus.codepro.be (Postfix, authenticated sender kp) id 634A234B39; Tue, 6 Apr 2021 09:09:28 +0200 (CEST) From: "Kristof Provost" To: "Kubilay Kocak" Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 829a69db855b - main - pf: change pf_route so pf only runs when packets enter and leave the stack. Date: Tue, 06 Apr 2021 09:09:27 +0200 X-Mailer: MailMate (1.13.2r5673) Message-ID: In-Reply-To: References: <202104051144.135BiCpe039479@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 07:09:31 -0000 On 6 Apr 2021, at 2:01, Kubilay Kocak wrote: > On 5/04/2021 9:44 pm, Kristof Provost wrote: >> The branch main has been updated by kp: >> >> URL: = >> https://cgit.FreeBSD.org/src/commit/?id=3D829a69db855b48ff7e8242b95e19= 3a0783c489d9 >> >> commit 829a69db855b48ff7e8242b95e193a0783c489d9 >> Author: Kristof Provost >> AuthorDate: 2021-04-02 10:23:42 +0000 >> Commit: Kristof Provost >> CommitDate: 2021-04-05 07:57:06 +0000 >> >> pf: change pf_route so pf only runs when packets enter and leave = >> the stack. > > Relnotes: Yes > > For the rule semantics change? > I wouldn=E2=80=99t. This is an extremely subtle change, and in all likeli= hood = won=E2=80=99t impact anyone other than those suffering from the bug this = fixes. It=E2=80=99s really more of a bug fix than behaviour change. Listing it in the release notes is going to generate more confusion than = enlightenment. Best regards, Kristof From owner-dev-commits-src-all@freebsd.org Tue Apr 6 08:46:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E603B5C548B for ; Tue, 6 Apr 2021 08:46:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FF1NQ68bhz3mNt; Tue, 6 Apr 2021 08:46: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 C58F0B34; Tue, 6 Apr 2021 08:46: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 1368kkXm032353; Tue, 6 Apr 2021 08:46:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1368kksR032348; Tue, 6 Apr 2021 08:46:46 GMT (envelope-from git) Date: Tue, 6 Apr 2021 08:46:46 GMT Message-Id: <202104060846.1368kksR032348@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: =?utf-8?B?U3RlZmFuIEXDn2Vy?= Subject: git: 7a590c074cee - vendor/bc - Vendor import of Gavin D. Howard's bc version 4.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/vendor/bc X-Git-Reftype: branch X-Git-Commit: 7a590c074ceede12b2b6e794f8703d6fa5749918 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 08:46:47 -0000 The branch vendor/bc has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=7a590c074ceede12b2b6e794f8703d6fa5749918 commit 7a590c074ceede12b2b6e794f8703d6fa5749918 Author: Stefan Eßer AuthorDate: 2021-04-06 08:44:52 +0000 Commit: Stefan Eßer CommitDate: 2021-04-06 08:44:52 +0000 Vendor import of Gavin D. Howard's bc version 4.0.0 --- Makefile.in | 11 +- NEWS.md | 25 + README.md | 107 ++- bc.sln | 31 + bc.vcxproj | 278 +++++++ bc.vcxproj.filters | 182 +++++ bcl.sln | 31 + bcl.vcxproj | 161 ++++ bcl.vcxproj.filters | 96 +++ configure | 1322 +++++++++++++++++++++++++++++- configure.sh | 2 + gen/bc_help.txt | 19 +- gen/dc_help.txt | 17 +- gen/strgen.c | 56 +- include/bcl.h | 102 +++ include/file.h | 34 +- include/history.h | 3 + include/num.h | 3 +- include/status.h | 59 -- include/version.h | 41 + include/vm.h | 32 +- karatsuba.py | 10 +- manpage.sh | 2 +- manuals/bc.1.md.in | 23 +- manuals/bc/A.1 | 1901 ++++++++++++++++++++++++-------------------- manuals/bc/A.1.md | 18 +- manuals/bc/E.1 | 905 +++++++++++---------- manuals/bc/E.1.md | 18 +- manuals/bc/EH.1 | 905 +++++++++++---------- manuals/bc/EH.1.md | 18 +- manuals/bc/EHN.1 | 905 +++++++++++---------- manuals/bc/EHN.1.md | 18 +- manuals/bc/EHNP.1 | 894 +++++++++++---------- manuals/bc/EHNP.1.md | 8 +- manuals/bc/EHP.1 | 894 +++++++++++---------- manuals/bc/EHP.1.md | 8 +- manuals/bc/EN.1 | 905 +++++++++++---------- manuals/bc/EN.1.md | 18 +- manuals/bc/ENP.1 | 894 +++++++++++---------- manuals/bc/ENP.1.md | 8 +- manuals/bc/EP.1 | 894 +++++++++++---------- manuals/bc/EP.1.md | 8 +- manuals/bc/H.1 | 1901 ++++++++++++++++++++++++-------------------- manuals/bc/H.1.md | 18 +- manuals/bc/HN.1 | 1901 ++++++++++++++++++++++++-------------------- manuals/bc/HN.1.md | 18 +- manuals/bc/HNP.1 | 1892 +++++++++++++++++++++++-------------------- manuals/bc/HNP.1.md | 8 +- manuals/bc/HP.1 | 1892 +++++++++++++++++++++++-------------------- manuals/bc/HP.1.md | 8 +- manuals/bc/N.1 | 1901 ++++++++++++++++++++++++-------------------- manuals/bc/N.1.md | 18 +- manuals/bc/NP.1 | 1892 +++++++++++++++++++++++-------------------- manuals/bc/NP.1.md | 8 +- manuals/bc/P.1 | 1892 +++++++++++++++++++++++-------------------- manuals/bc/P.1.md | 8 +- manuals/bcl.3 | 1751 +++++++++++++++++++++------------------- manuals/build.md | 121 ++- manuals/dc.1.md.in | 61 +- manuals/dc/A.1 | 1386 ++++++++++++++++++-------------- manuals/dc/A.1.md | 56 +- manuals/dc/E.1 | 1197 ++++++++++++++++------------ manuals/dc/E.1.md | 56 +- manuals/dc/EH.1 | 1197 ++++++++++++++++------------ manuals/dc/EH.1.md | 56 +- manuals/dc/EHN.1 | 1197 ++++++++++++++++------------ manuals/dc/EHN.1.md | 56 +- manuals/dc/EHNP.1 | 1185 +++++++++++++++------------ manuals/dc/EHNP.1.md | 46 +- manuals/dc/EHP.1 | 1185 +++++++++++++++------------ manuals/dc/EHP.1.md | 46 +- manuals/dc/EN.1 | 1197 ++++++++++++++++------------ manuals/dc/EN.1.md | 56 +- manuals/dc/ENP.1 | 1185 +++++++++++++++------------ manuals/dc/ENP.1.md | 46 +- manuals/dc/EP.1 | 1185 +++++++++++++++------------ manuals/dc/EP.1.md | 46 +- manuals/dc/H.1 | 1386 ++++++++++++++++++-------------- manuals/dc/H.1.md | 56 +- manuals/dc/HN.1 | 1386 ++++++++++++++++++-------------- manuals/dc/HN.1.md | 56 +- manuals/dc/HNP.1 | 1374 ++++++++++++++++++-------------- manuals/dc/HNP.1.md | 46 +- manuals/dc/HP.1 | 1374 ++++++++++++++++++-------------- manuals/dc/HP.1.md | 46 +- manuals/dc/N.1 | 1386 ++++++++++++++++++-------------- manuals/dc/N.1.md | 56 +- manuals/dc/NP.1 | 1374 ++++++++++++++++++-------------- manuals/dc/NP.1.md | 46 +- manuals/dc/P.1 | 1374 ++++++++++++++++++-------------- manuals/dc/P.1.md | 46 +- manuals/header_bc.txt | 2 +- manuals/header_bcl.txt | 2 +- manuals/header_dc.txt | 2 +- release.sh | 33 +- src/args.c | 9 + src/data.c | 6 + src/file.c | 71 +- src/history.c | 63 +- src/main.c | 6 +- src/num.c | 29 +- src/program.c | 36 +- src/rand.c | 36 +- src/read.c | 29 +- src/vm.c | 132 ++- tests/dc/scripts/easter.sh | 47 ++ tests/other.sh | 37 +- 107 files changed, 28963 insertions(+), 20117 deletions(-) diff --git a/Makefile.in b/Makefile.in index aab7f9b569e5..2b50476a79fe 100644 --- a/Makefile.in +++ b/Makefile.in @@ -29,8 +29,6 @@ # .POSIX: -VERSION = 3.3.4 - SRC = %%SRC%% OBJ = %%OBJ%% GCDA = %%GCDA%% @@ -128,6 +126,8 @@ MAIN_EXEC = $(EXEC_PREFIX)$(%%MAIN_EXEC%%)$(EXEC_SUFFIX) EXEC = $(%%EXEC%%) NLSPATH = %%NLSPATH%% +BC_BUILD_TYPE = %%BUILD_TYPE%% + BC_ENABLE_LIBRARY = %%LIBRARY%% BC_ENABLE_HISTORY = %%HISTORY%% @@ -158,7 +158,7 @@ TEST_STARS = "****************************************************************** BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%% CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED) -CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DVERSION=$(VERSION) %%LONG_BIT_DEFINE%% +CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DBUILD_TYPE=$(BC_BUILD_TYPE) %%LONG_BIT_DEFINE%% CPPFLAGS3 = $(CPPFLAGS2) -DEXECPREFIX=$(EXEC_PREFIX) -DMAINEXEC=$(MAIN_EXEC) CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN) @@ -322,9 +322,6 @@ coverage_output: coverage:%%COVERAGE_PREREQS%% -version: - @printf '%s' "$(VERSION)" - libcname: @printf '%s' "$(BC_LIB_C)" @@ -341,6 +338,7 @@ clean_gen: clean:%%CLEAN_PREREQS%% @printf 'Cleaning files...\n' + @$(RM) -f src/*.tmp gen/*.tmp @$(RM) -f $(OBJ) @$(RM) -f $(BC_EXEC) @$(RM) -f $(DC_EXEC) @@ -352,6 +350,7 @@ clean:%%CLEAN_PREREQS%% @$(RM) -f $(DC_HELP_C) $(DC_HELP_O) @$(RM) -fr $(BC_TEST_OUTPUTS) $(DC_TEST_OUTPUTS) @$(RM) -fr $(BC_FUZZ_OUTPUTS) $(DC_FUZZ_OUTPUTS) + @$(RM) -fr Debug/ Release/ clean_config: clean @printf 'Cleaning config...\n' diff --git a/NEWS.md b/NEWS.md index 3374ab57bc41..011cb9138912 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,30 @@ # News +## 4.0.0 + +This is a production release with many fixes, a new command-line option, and a +big surprise: + +* A bug was fixed in `dc`'s `P` command where the item on the stack was *not* + popped. +* Various bugs in the manuals have been fixed. +* A known bug was fixed where history did not interact well with prompts printed + by user code without newlines. +* A new command-line option, `-R` and `--no-read-prompt` was added to disable + just the prompt when using `read()` (`bc`) or `?` (`dc`). +* And finally, **official support for Windows was added**. + +The last item is why this is a major version bump. + +Currently, only one set of build options (extra math and prompt enabled, history +and NLS/locale support disabled, both calculators enabled) is supported on +Windows. However, both debug and release builds are supported. + +In addition, Windows builds are supported for the the library (`bcl`). + +For more details about how to build on Windows, see the [README][5] or the +[build manual][13]. + ## 3.3.4 This is a production release that fixes a small bug. diff --git a/README.md b/README.md index 6a37a8bfb8da..852c8956a73d 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,16 @@ This `bc` is Free and Open Source Software (FOSS). It is offered under the BSD ## Prerequisites -This `bc` only requires a C99-compatible compiler and a (mostly) POSIX -2008-compatible system with the XSI (X/Open System Interfaces) option group. +This `bc` only requires either: + +1. Windows 10 or later, or +2. A C99-compatible compiler and a (mostly) POSIX 2008-compatible system with + the XSI (X/Open System Interfaces) option group. Since POSIX 2008 with XSI requires the existence of a C99 compiler as `c99`, any POSIX and XSI-compatible system will have everything needed. -Systems that are known to work: +POSIX-compatible systems that are known to work: * Linux * FreeBSD @@ -41,17 +44,68 @@ Systems that are known to work: * AIX * HP-UX* (except for history) +In addition, there is compatibility code to make this `bc` work on Windows. + Please submit bug reports if this `bc` does not build out of the box on any -system besides Windows. +system. ## Build -This `bc` should build unmodified on any POSIX-compliant system. +### Windows + +There is no guarantee that this `bc` will work on any version of Windows earlier +than Windows 10 (I cannot test on earlier versions), but it is guaranteed to +work on Windows 10 at least. + +Also, if building with MSBuild, the MSBuild bundled with Visual Studio is +required. + +**Note**: Unlike the POSIX-compatible platforms, only one build configuration is +supported on Windows: extra math and prompt enabled, history and NLS (locale +support) disabled, with both calculators built. + +#### `bc` + +To build `bc`, you can open the `bc.sln` file in Visual Studio, select the +configuration, and build. + +You can also build using MSBuild with the following from the root directory: + +``` +msbuild -property:Configuration= bc.sln +``` + +where `` is either one of `Debug` or `Release`. + +#### `bcl` (Library) + +To build the library, you can open the `bcl.sln` file in Visual Studio, select +the configuration, and build. + +You can also build using MSBuild with the following from the root directory: + +``` +msbuild -property:Configuration= bcl.sln +``` + +where `` is either one of `Debug` or `Release`. + +### POSIX-Compatible Systems + +This `bc` should build unmodified on any POSIX-compliant system or on Windows +starting with Windows 10 (though earlier versions may work). For more complex build requirements than the ones below, see the [build manual][5]. -### Default +On POSIX-compatible systems, `bc` is built as `bin/bc` and `dc` is built as +`bin/dc` by default. On Windows, they are built as `Release/bc/bc.exe` and +`Release/bc/dc.exe`. + +**Note**: On Windows, `dc.exe` is just copied from `bc.exe`; it is not linked. +Patches are welcome for a way to do that. + +#### Default For the default build with optimization, use the following commands in the root directory: @@ -61,7 +115,7 @@ directory: make ``` -### One Calculator +#### One Calculator To only build `bc`, use the following commands: @@ -77,7 +131,7 @@ To only build `dc`, use the following commands: make ``` -### Debug +#### Debug For debug builds, use the following commands in the root directory: @@ -86,7 +140,7 @@ For debug builds, use the following commands in the root directory: make ``` -### Install +#### Install To install, use the following command: @@ -99,7 +153,7 @@ other locations, use the `PREFIX` environment variable when running `configure.sh` or pass the `--prefix=` option to `configure.sh`. See the [build manual][5], or run `./configure.sh --help`, for more details. -### Library +#### Library This `bc` does provide a way to build a math library with C bindings. This is done by the `-a` or `--library` options to `configure.sh`: @@ -114,11 +168,12 @@ see the [build manual][5]. The library API can be found in [`manuals/bcl.3.md`][26] or `man bcl` once the library is installed. -The library is built as `bin/libbcl.a`. +The library is built as `bin/libbcl.a` on POSIX-compatible systems or as +`Release/bcl/bcl.lib` on Windows. -### Package and Distro Maintainers +#### Package and Distro Maintainers -#### Recommended Compiler +##### Recommended Compiler When I ran benchmarks with my `bc` compiled under `clang`, it performed much better than when compiled under `gcc`. I recommend compiling this `bc` with @@ -127,7 +182,7 @@ better than when compiled under `gcc`. I recommend compiling this `bc` with I also recommend building this `bc` with C11 if you can because `bc` will detect a C11 compiler and add `_Noreturn` to any relevant function(s). -#### Recommended Optimizations +##### Recommended Optimizations I wrote this `bc` with Separation of Concerns, which means that there are many small functions that could be inlined. However, they are often called across @@ -154,12 +209,12 @@ However, I recommend ***NOT*** using `-march=native`. Doing so will reduce this `bc`'s performance, at least when building with link-time optimization. See the [benchmarks][19] for more details. -#### Stripping Binaries +##### Stripping Binaries By default, non-debug binaries are stripped, but stripping can be disabled with the `-T` option to `configure.sh`. -#### Using This `bc` as an Alternative +##### Using This `bc` as an Alternative If this `bc` is packaged as an alternative to an already existing `bc` package, it is possible to rename it in the build to prevent name collision. To prepend @@ -181,7 +236,7 @@ allowed. **Note**: The suggested name (and package name) when `bc` is not available is `bc-gh`. -#### Karatsuba Number +##### Karatsuba Number Package and distro maintainers have one tool at their disposal to build this `bc` in the optimal configuration: `karatsuba.py`. @@ -217,6 +272,7 @@ translations will also be added as they are provided. This `bc` compares favorably to GNU `bc`. +* This `bc` builds natively on Windows. * It has more extensions, which make this `bc` more useful for scripting. * This `bc` is a bit more POSIX compliant. * It has a much less buggy parser. The GNU `bc` will give parse errors for what @@ -246,7 +302,9 @@ To see what algorithms this `bc` uses, see the [algorithms manual][7]. ## Locales -Currently, this `bc` only has support for English (and US English), French, +Currently, there is no locale support on Windows. + +Additionally, this `bc` only has support for English (and US English), French, German, Portuguese, Dutch, Polish, Russian, Japanese, and Chinese locales. Patches are welcome for translations; use the existing `*.msg` files in `locales/` as a starting point. @@ -276,7 +334,8 @@ Other projects based on this bc are: ## Language -This `bc` is written in pure ISO C99, using POSIX 2008 APIs. +This `bc` is written in pure ISO C99, using POSIX 2008 APIs with custom Windows +compatibility code. ## Commit Messages @@ -294,6 +353,13 @@ tarballs. Files: .gitignore The git ignore file (maintainer use only). + .gitattributes The git attributes file (maintainer use only). + bc.sln The Visual Studio solution file for bc. + bc.vcxproj The Visual Studio project file for bc. + bc.vcxproj.filters The Visual Studio filters file for bc. + bcl.sln The Visual Studio solution file for bcl. + bcl.vcxproj The Visual Studio project file for bcl. + bcl.vcxproj.filters The Visual Studio filters file for bcl. configure A symlink to configure.sh to make packaging easier. configure.sh The configure script. functions.sh A script with functions used by other scripts. @@ -304,7 +370,8 @@ Files: locale_install.sh A script to install locales, if desired. locale_uninstall.sh A script to uninstall locales. Makefile.in The Makefile template. - manpage.sh Script to generate man pages from markdown files. + manpage.sh Script to generate man pages from markdown files + (maintainer use only). NOTICE.md List of contributors and copyright owners. RELEASE.md A checklist for making a release (maintainer use only). release.sh A script to test for release (maintainer use only). diff --git a/bc.sln b/bc.sln new file mode 100644 index 000000000000..584b28d13bf6 --- /dev/null +++ b/bc.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31129.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bc", "bc.vcxproj", "{D5086CFE-052C-4742-B005-E05DB983BBA2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x64.ActiveCfg = Debug|x64 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x64.Build.0 = Debug|x64 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x86.ActiveCfg = Debug|Win32 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x86.Build.0 = Debug|Win32 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x64.ActiveCfg = Release|x64 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x64.Build.0 = Release|x64 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x86.ActiveCfg = Release|Win32 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7869B1FB-A7C4-4FCF-8B99-F696DB2765EC} + EndGlobalSection +EndGlobal diff --git a/bc.vcxproj b/bc.vcxproj new file mode 100644 index 000000000000..ba0a7f6f1dd6 --- /dev/null +++ b/bc.vcxproj @@ -0,0 +1,278 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + {D5086CFE-052C-4742-B005-E05DB983BBA2} + Win32Proj + + + + Application + true + v142 + + + Application + false + v142 + + + Application + true + v142 + + + Application + false + v142 + + + + + + + + + + + + + + + + + + + + + Building strgen + CL /Fo:$(Configuration)\$(ProjectName)\ /Fe:$(Configuration)\$(ProjectName)\strgen.exe gen\strgen.c + gen\strgen.c + $(Configuration)\$(ProjectName)\strgen.exe + + + Generating $(Configuration)\$(ProjectName)/lib.c + START $(Configuration)\$(ProjectName)/strgen gen\lib.bc $(Configuration)\$(ProjectName)/lib.c bc_lib bc_lib_name BC_ENABLED 1 + $(Configuration)\$(ProjectName)\strgen.exe;gen\lib.bc + $(Configuration)\$(ProjectName)\lib.c + + + Generating $(Configuration)\$(ProjectName)/lib2.c + START $(Configuration)\$(ProjectName)/strgen gen\lib2.bc $(Configuration)\$(ProjectName)/lib2.c bc_lib2 bc_lib2_name BC_ENABLED 1 + $(Configuration)\$(ProjectName)\strgen.exe;gen\lib2.bc + $(Configuration)\$(ProjectName)\lib2.c + + + Generating $(Configuration)\$(ProjectName)/bc_help.c + START $(Configuration)\$(ProjectName)/strgen gen\bc_help.txt $(Configuration)\$(ProjectName)\bc_help.c bc_help "" BC_ENABLED + $(Configuration)\$(ProjectName)\strgen.exe;gen\bc_help.txt + $(Configuration)\$(ProjectName)\bc_help.c + + + Generating $(Configuration)\$(ProjectName)/dc_help.c + START $(Configuration)\$(ProjectName)/strgen gen\dc_help.txt $(Configuration)\$(ProjectName)\dc_help.c dc_help "" DC_ENABLED + $(Configuration)\$(ProjectName)\strgen.exe;gen\dc_help.txt + $(Configuration)\$(ProjectName)\dc_help.c + + + + ClCompile + + + + true + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + + + true + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + false + /W3 %(AdditionalOptions) + + + MachineX86 + true + Console + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies) + + + copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe" + + + Copying bc to dc... + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + MaxSpeed + false + /W3 %(AdditionalOptions) + + + MachineX86 + false + Console + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies) + true + true + + + copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe" + + + Copying bc to dc... + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + false + /W3 %(AdditionalOptions) + + + MachineX64 + true + Console + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies) + + + copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe" + + + Copying bc to dc... + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + MaxSpeed + false + /W3 %(AdditionalOptions) + Default + + + MachineX64 + false + Console + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies) + + + copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe" + + + Copying bc to dc... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bc.vcxproj.filters b/bc.vcxproj.filters new file mode 100644 index 000000000000..bc72b60519e9 --- /dev/null +++ b/bc.vcxproj.filters @@ -0,0 +1,182 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + + + + + + + + + + + Resource Files + + + Resource Files + + + + + Resource Files + + + Resource Files + + + \ No newline at end of file diff --git a/bcl.sln b/bcl.sln new file mode 100644 index 000000000000..77009a439db3 --- /dev/null +++ b/bcl.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31129.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bcl", "bcl.vcxproj", "{D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Debug|x64.ActiveCfg = Debug|x64 + {D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Debug|x64.Build.0 = Debug|x64 + {D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Debug|x86.ActiveCfg = Debug|Win32 + {D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Debug|x86.Build.0 = Debug|Win32 + {D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Release|x64.ActiveCfg = Release|x64 + {D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Release|x64.Build.0 = Release|x64 + {D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Release|x86.ActiveCfg = Release|Win32 + {D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}.Release|x86.Build.0 = Release|Win32 *** 66009 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Tue Apr 6 08:46:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 107FE5C52D3 for ; Tue, 6 Apr 2021 08:46: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 4FF1NR75LLz3m7g; Tue, 6 Apr 2021 08:46: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 E6905579; Tue, 6 Apr 2021 08:46: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 1368klGv032389; Tue, 6 Apr 2021 08:46:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1368kltT032388; Tue, 6 Apr 2021 08:46:47 GMT (envelope-from git) Date: Tue, 6 Apr 2021 08:46:47 GMT Message-Id: <202104060846.1368kltT032388@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: =?utf-8?B?U3RlZmFuIEXDn2Vy?= Subject: git: 9f2c5c68f1b4 - Create tag vendor/bc/4.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/tags/vendor/bc/4.0.0 X-Git-Reftype: annotated tag X-Git-Commit: 9f2c5c68f1b4b0405783aaf47835dc05c8362bb1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 08:46:48 -0000 The annotated tag vendor/bc/4.0.0 has been created by se: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/bc/4.0.0 tag vendor/bc/4.0.0 Tagger: Stefan Eßer TaggerDate: 2021-04-06 08:45:30 +0000 Tag bc version 4.0.0 commit 7a590c074ceede12b2b6e794f8703d6fa5749918 Author: Stefan Eßer AuthorDate: 2021-04-06 08:44:52 +0000 Commit: Stefan Eßer CommitDate: 2021-04-06 08:44:52 +0000 Vendor import of Gavin D. Howard's bc version 4.0.0 From owner-dev-commits-src-all@freebsd.org Tue Apr 6 09:05:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A26C75C6223; Tue, 6 Apr 2021 09:05: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 4FF1nT42W5z3pD5; Tue, 6 Apr 2021 09:05: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 7C061B64; Tue, 6 Apr 2021 09:05: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 1369517Y061111; Tue, 6 Apr 2021 09:05:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1369516h061109; Tue, 6 Apr 2021 09:05:01 GMT (envelope-from git) Date: Tue, 6 Apr 2021 09:05:01 GMT Message-Id: <202104060905.1369516h061109@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?U3RlZmFuIEXDn2Vy?= Subject: git: 7e5c51e523ae - main - Merge commit '7a590c074ceede12b2b6e794f8703d6fa5749918' MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7e5c51e523ae2a0b4f00cf5d6b9168e053d8eed1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 09:05:01 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=7e5c51e523ae2a0b4f00cf5d6b9168e053d8eed1 commit 7e5c51e523ae2a0b4f00cf5d6b9168e053d8eed1 Merge: 42cd37dfbd1b 7a590c074cee Author: Stefan Eßer AuthorDate: 2021-04-06 08:48:09 +0000 Commit: Stefan Eßer CommitDate: 2021-04-06 08:48:09 +0000 Merge commit '7a590c074ceede12b2b6e794f8703d6fa5749918' Update to version 4.0.0 This version fixes an issue (missing pop of top-of-stack value in the "P" command of the dc program). This issue did not affect the bc program, since it does not use dc as an back-end to actually perform the calculations as was the case with the traditional bc and dc programs. The major number has been bumped due to Windows support that has been added to this version. It does not correspond to a major change that might affect FreeBSD. contrib/bc/Makefile.in | 11 +- contrib/bc/NEWS.md | 25 + contrib/bc/README.md | 107 +- contrib/bc/bc.sln | 31 + contrib/bc/bc.vcxproj | 278 +++++ contrib/bc/bc.vcxproj.filters | 182 ++++ contrib/bc/bcl.sln | 31 + contrib/bc/bcl.vcxproj | 161 +++ contrib/bc/bcl.vcxproj.filters | 96 ++ contrib/bc/configure | 1322 ++++++++++++++++++++++- contrib/bc/configure.sh | 2 + contrib/bc/gen/bc_help.txt | 19 +- contrib/bc/gen/dc_help.txt | 17 +- contrib/bc/gen/strgen.c | 56 +- contrib/bc/include/bcl.h | 102 ++ contrib/bc/include/file.h | 34 +- contrib/bc/include/history.h | 3 + contrib/bc/include/num.h | 3 +- contrib/bc/include/status.h | 59 - contrib/bc/include/version.h | 41 + contrib/bc/include/vm.h | 32 +- contrib/bc/karatsuba.py | 10 +- contrib/bc/manpage.sh | 2 +- contrib/bc/manuals/bc.1.md.in | 23 +- contrib/bc/manuals/bc/A.1 | 1901 ++++++++++++++++++--------------- contrib/bc/manuals/bc/A.1.md | 18 +- contrib/bc/manuals/bc/E.1 | 905 +++++++++------- contrib/bc/manuals/bc/E.1.md | 18 +- contrib/bc/manuals/bc/EH.1 | 905 +++++++++------- contrib/bc/manuals/bc/EH.1.md | 18 +- contrib/bc/manuals/bc/EHN.1 | 905 +++++++++------- contrib/bc/manuals/bc/EHN.1.md | 18 +- contrib/bc/manuals/bc/EHNP.1 | 894 +++++++++------- contrib/bc/manuals/bc/EHNP.1.md | 8 +- contrib/bc/manuals/bc/EHP.1 | 894 +++++++++------- contrib/bc/manuals/bc/EHP.1.md | 8 +- contrib/bc/manuals/bc/EN.1 | 905 +++++++++------- contrib/bc/manuals/bc/EN.1.md | 18 +- contrib/bc/manuals/bc/ENP.1 | 894 +++++++++------- contrib/bc/manuals/bc/ENP.1.md | 8 +- contrib/bc/manuals/bc/EP.1 | 894 +++++++++------- contrib/bc/manuals/bc/EP.1.md | 8 +- contrib/bc/manuals/bc/H.1 | 1901 ++++++++++++++++++--------------- contrib/bc/manuals/bc/H.1.md | 18 +- contrib/bc/manuals/bc/HN.1 | 1901 ++++++++++++++++++--------------- contrib/bc/manuals/bc/HN.1.md | 18 +- contrib/bc/manuals/bc/HNP.1 | 1892 +++++++++++++++++--------------- contrib/bc/manuals/bc/HNP.1.md | 8 +- contrib/bc/manuals/bc/HP.1 | 1892 +++++++++++++++++--------------- contrib/bc/manuals/bc/HP.1.md | 8 +- contrib/bc/manuals/bc/N.1 | 1901 ++++++++++++++++++--------------- contrib/bc/manuals/bc/N.1.md | 18 +- contrib/bc/manuals/bc/NP.1 | 1892 +++++++++++++++++--------------- contrib/bc/manuals/bc/NP.1.md | 8 +- contrib/bc/manuals/bc/P.1 | 1892 +++++++++++++++++--------------- contrib/bc/manuals/bc/P.1.md | 8 +- contrib/bc/manuals/bcl.3 | 1751 +++++++++++++++--------------- contrib/bc/manuals/build.md | 121 ++- contrib/bc/manuals/dc.1.md.in | 61 +- contrib/bc/manuals/dc/A.1 | 1386 ++++++++++++++---------- contrib/bc/manuals/dc/A.1.md | 56 +- contrib/bc/manuals/dc/E.1 | 1197 ++++++++++++--------- contrib/bc/manuals/dc/E.1.md | 56 +- contrib/bc/manuals/dc/EH.1 | 1197 ++++++++++++--------- contrib/bc/manuals/dc/EH.1.md | 56 +- contrib/bc/manuals/dc/EHN.1 | 1197 ++++++++++++--------- contrib/bc/manuals/dc/EHN.1.md | 56 +- contrib/bc/manuals/dc/EHNP.1 | 1185 +++++++++++--------- contrib/bc/manuals/dc/EHNP.1.md | 46 +- contrib/bc/manuals/dc/EHP.1 | 1185 +++++++++++--------- contrib/bc/manuals/dc/EHP.1.md | 46 +- contrib/bc/manuals/dc/EN.1 | 1197 ++++++++++++--------- contrib/bc/manuals/dc/EN.1.md | 56 +- contrib/bc/manuals/dc/ENP.1 | 1185 +++++++++++--------- contrib/bc/manuals/dc/ENP.1.md | 46 +- contrib/bc/manuals/dc/EP.1 | 1185 +++++++++++--------- contrib/bc/manuals/dc/EP.1.md | 46 +- contrib/bc/manuals/dc/H.1 | 1386 ++++++++++++++---------- contrib/bc/manuals/dc/H.1.md | 56 +- contrib/bc/manuals/dc/HN.1 | 1386 ++++++++++++++---------- contrib/bc/manuals/dc/HN.1.md | 56 +- contrib/bc/manuals/dc/HNP.1 | 1374 ++++++++++++++---------- contrib/bc/manuals/dc/HNP.1.md | 46 +- contrib/bc/manuals/dc/HP.1 | 1374 ++++++++++++++---------- contrib/bc/manuals/dc/HP.1.md | 46 +- contrib/bc/manuals/dc/N.1 | 1386 ++++++++++++++---------- contrib/bc/manuals/dc/N.1.md | 56 +- contrib/bc/manuals/dc/NP.1 | 1374 ++++++++++++++---------- contrib/bc/manuals/dc/NP.1.md | 46 +- contrib/bc/manuals/dc/P.1 | 1374 ++++++++++++++---------- contrib/bc/manuals/dc/P.1.md | 46 +- contrib/bc/manuals/header_bc.txt | 2 +- contrib/bc/manuals/header_bcl.txt | 2 +- contrib/bc/manuals/header_dc.txt | 2 +- contrib/bc/release.sh | 33 +- contrib/bc/src/args.c | 9 + contrib/bc/src/data.c | 6 + contrib/bc/src/file.c | 71 +- contrib/bc/src/history.c | 63 +- contrib/bc/src/main.c | 6 +- contrib/bc/src/num.c | 29 +- contrib/bc/src/program.c | 36 +- contrib/bc/src/rand.c | 36 +- contrib/bc/src/read.c | 29 +- contrib/bc/src/vm.c | 132 ++- contrib/bc/tests/dc/scripts/easter.sh | 47 + contrib/bc/tests/other.sh | 37 +- 107 files changed, 28963 insertions(+), 20117 deletions(-) diff --cc contrib/bc/README.md index 6a37a8bfb8da,000000000000..852c8956a73d mode 100644,000000..100644 --- a/contrib/bc/README.md +++ b/contrib/bc/README.md @@@ -1,340 -1,0 +1,407 @@@ +# `bc` + +[![Coverity Scan Build Status][17]][18] + +***WARNING: This project has moved to [https://git.yzena.com/][20] for [these +reasons][21], though GitHub will remain a mirror.*** + +This is an implementation of the [POSIX `bc` calculator][12] that implements +[GNU `bc`][1] extensions, as well as the period (`.`) extension for the BSD +flavor of `bc`. + +For more information, see this `bc`'s full manual. + +This `bc` also includes an implementation of `dc` in the same binary, accessible +via a symbolic link, which implements all FreeBSD and GNU extensions. (If a +standalone `dc` binary is desired, `bc` can be copied and renamed to `dc`.) The +`!` command is omitted; I believe this poses security concerns and that such +functionality is unnecessary. + +For more information, see the `dc`'s full manual. + +This `bc` is Free and Open Source Software (FOSS). It is offered under the BSD +2-clause License. Full license text may be found in the [`LICENSE.md`][4] file. + +## Prerequisites + - This `bc` only requires a C99-compatible compiler and a (mostly) POSIX - 2008-compatible system with the XSI (X/Open System Interfaces) option group. ++This `bc` only requires either: ++ ++1. Windows 10 or later, or ++2. A C99-compatible compiler and a (mostly) POSIX 2008-compatible system with ++ the XSI (X/Open System Interfaces) option group. + +Since POSIX 2008 with XSI requires the existence of a C99 compiler as `c99`, any +POSIX and XSI-compatible system will have everything needed. + - Systems that are known to work: ++POSIX-compatible systems that are known to work: + +* Linux +* FreeBSD +* OpenBSD +* NetBSD +* Mac OSX +* Solaris* (as long as the Solaris version supports POSIX 2008) +* AIX +* HP-UX* (except for history) + ++In addition, there is compatibility code to make this `bc` work on Windows. ++ +Please submit bug reports if this `bc` does not build out of the box on any - system besides Windows. ++system. + +## Build + - This `bc` should build unmodified on any POSIX-compliant system. ++### Windows ++ ++There is no guarantee that this `bc` will work on any version of Windows earlier ++than Windows 10 (I cannot test on earlier versions), but it is guaranteed to ++work on Windows 10 at least. ++ ++Also, if building with MSBuild, the MSBuild bundled with Visual Studio is ++required. ++ ++**Note**: Unlike the POSIX-compatible platforms, only one build configuration is ++supported on Windows: extra math and prompt enabled, history and NLS (locale ++support) disabled, with both calculators built. ++ ++#### `bc` ++ ++To build `bc`, you can open the `bc.sln` file in Visual Studio, select the ++configuration, and build. ++ ++You can also build using MSBuild with the following from the root directory: ++ ++``` ++msbuild -property:Configuration= bc.sln ++``` ++ ++where `` is either one of `Debug` or `Release`. ++ ++#### `bcl` (Library) ++ ++To build the library, you can open the `bcl.sln` file in Visual Studio, select ++the configuration, and build. ++ ++You can also build using MSBuild with the following from the root directory: ++ ++``` ++msbuild -property:Configuration= bcl.sln ++``` ++ ++where `` is either one of `Debug` or `Release`. ++ ++### POSIX-Compatible Systems ++ ++This `bc` should build unmodified on any POSIX-compliant system or on Windows ++starting with Windows 10 (though earlier versions may work). + +For more complex build requirements than the ones below, see the +[build manual][5]. + - ### Default ++On POSIX-compatible systems, `bc` is built as `bin/bc` and `dc` is built as ++`bin/dc` by default. On Windows, they are built as `Release/bc/bc.exe` and ++`Release/bc/dc.exe`. ++ ++**Note**: On Windows, `dc.exe` is just copied from `bc.exe`; it is not linked. ++Patches are welcome for a way to do that. ++ ++#### Default + +For the default build with optimization, use the following commands in the root +directory: + +``` +./configure.sh -O3 +make +``` + - ### One Calculator ++#### One Calculator + +To only build `bc`, use the following commands: + +``` +./configure.sh --disable-dc +make +``` + +To only build `dc`, use the following commands: + +``` +./configure.sh --disable-bc +make +``` + - ### Debug ++#### Debug + +For debug builds, use the following commands in the root directory: + +``` +./configure.sh -g +make +``` + - ### Install ++#### Install + +To install, use the following command: + +``` +make install +``` + +By default, `bc` and `dc` will be installed in `/usr/local`. For installing in +other locations, use the `PREFIX` environment variable when running +`configure.sh` or pass the `--prefix=` option to `configure.sh`. See the +[build manual][5], or run `./configure.sh --help`, for more details. + - ### Library ++#### Library + +This `bc` does provide a way to build a math library with C bindings. This is +done by the `-a` or `--library` options to `configure.sh`: + +``` +./configure.sh -a +``` + +When building the library, the executables are not built. For more information, +see the [build manual][5]. + +The library API can be found in [`manuals/bcl.3.md`][26] or `man bcl` once the +library is installed. + - The library is built as `bin/libbcl.a`. ++The library is built as `bin/libbcl.a` on POSIX-compatible systems or as ++`Release/bcl/bcl.lib` on Windows. + - ### Package and Distro Maintainers ++#### Package and Distro Maintainers + - #### Recommended Compiler ++##### Recommended Compiler + +When I ran benchmarks with my `bc` compiled under `clang`, it performed much +better than when compiled under `gcc`. I recommend compiling this `bc` with +`clang`. + +I also recommend building this `bc` with C11 if you can because `bc` will detect +a C11 compiler and add `_Noreturn` to any relevant function(s). + - #### Recommended Optimizations ++##### Recommended Optimizations + +I wrote this `bc` with Separation of Concerns, which means that there are many +small functions that could be inlined. However, they are often called across +file boundaries, and the default optimizer can only look at the current file, +which means that they are not inlined. + +Thus, because of the way this `bc` is built, it will automatically be slower +than other `bc` implementations when running scripts with no math. (My `bc`'s +math is *much* faster, so any non-trivial script should run faster in my `bc`.) + +Some, or all, of the difference can be made up with the right optimizations. The +optimizations I recommend are: + +1. `-O3` +2. `-flto` (link-time optimization) + +in that order. + +Link-time optimization, in particular, speeds up the `bc` a lot. This is because +when link-time optimization is turned on, the optimizer can look across files +and inline *much* more heavily. + +However, I recommend ***NOT*** using `-march=native`. Doing so will reduce this +`bc`'s performance, at least when building with link-time optimization. See the +[benchmarks][19] for more details. + - #### Stripping Binaries ++##### Stripping Binaries + +By default, non-debug binaries are stripped, but stripping can be disabled with +the `-T` option to `configure.sh`. + - #### Using This `bc` as an Alternative ++##### Using This `bc` as an Alternative + +If this `bc` is packaged as an alternative to an already existing `bc` package, +it is possible to rename it in the build to prevent name collision. To prepend +to the name, just run the following: + +``` +EXECPREFIX= ./configure.sh +``` + +To append to the name, just run the following: + +``` +EXECSUFFIX= ./configure.sh +``` + +If a package maintainer wishes to add both a prefix and a suffix, that is +allowed. + +**Note**: The suggested name (and package name) when `bc` is not available is +`bc-gh`. + - #### Karatsuba Number ++##### Karatsuba Number + +Package and distro maintainers have one tool at their disposal to build this +`bc` in the optimal configuration: `karatsuba.py`. + +This script is not a compile-time or runtime prerequisite; it is for package and +distro maintainers to run once when a package is being created. It finds the +optimal Karatsuba number (see the [algorithms manual][7] for more information) +for the machine that it is running on. + +The easiest way to run this script is with `make karatsuba`. + +If desired, maintainers can also skip running this script because there is a +sane default for the Karatsuba number. + +## Status + +This `bc` is robust. + +It is well-tested, fuzzed, and fully standards-compliant (though not certified) +with POSIX `bc`. The math has been tested with 40+ million random problems, so +it is as correct as I can make it. + +This `bc` can be used as a drop-in replacement for any existing `bc`. This `bc` +is also compatible with MinGW toolchains, though history is not supported on +Windows. + +In addition, this `bc` is considered complete; i.e., there will be no more +releases with additional features. However, it *is* actively maintained, so if +any bugs are found, they will be fixed in new releases. Also, additional +translations will also be added as they are provided. + +## Comparison to GNU `bc` + +This `bc` compares favorably to GNU `bc`. + ++* This `bc` builds natively on Windows. +* It has more extensions, which make this `bc` more useful for scripting. +* This `bc` is a bit more POSIX compliant. +* It has a much less buggy parser. The GNU `bc` will give parse errors for what + is actually valid `bc` code, or should be. For example, putting an `else` on + a new line after a brace can cause GNU `bc` to give a parse error. +* This `bc` has fewer crashes. +* GNU `bc` calculates the wrong number of significant digits for `length(x)`. +* GNU `bc` will sometimes print numbers incorrectly. For example, when running + it on the file `tests/bc/power.txt` in this repo, GNU `bc` gets all the right + answers, but it fails to wrap the numbers at the proper place when outputting + to a file. +* This `bc` is faster. (See [Performance](#performance).) + +### Performance + +Because this `bc` packs more than `1` decimal digit per hardware integer, this +`bc` is faster than GNU `bc` and can be *much* faster. Full benchmarks can be +found at [manuals/benchmarks.md][19]. + +There is one instance where this `bc` is slower: if scripts are light on math. +This is because this `bc`'s intepreter is slightly slower than GNU `bc`, but +that is because it is more robust. See the [benchmarks][19]. + +## Algorithms + +To see what algorithms this `bc` uses, see the [algorithms manual][7]. + +## Locales + - Currently, this `bc` only has support for English (and US English), French, ++Currently, there is no locale support on Windows. ++ ++Additionally, this `bc` only has support for English (and US English), French, +German, Portuguese, Dutch, Polish, Russian, Japanese, and Chinese locales. +Patches are welcome for translations; use the existing `*.msg` files in +`locales/` as a starting point. + +In addition, patches for improvements are welcome; the last two messages in +Portuguese were made with Google Translate, and the Dutch, Polish, Russian, +Japanese, and Chinese locales were all generated with [DeepL][22]. + +The message files provided assume that locales apply to all regions where a +language is used, but this might not be true for, e.g., `fr_CA` and `fr_CH`. +Any corrections or a confirmation that the current texts are acceptable for +those regions would be appreciated, too. + +## Other Projects + +Other projects based on this bc are: + +* [busybox `bc`][8]. The busybox maintainers have made their own changes, so any + bugs in the busybox `bc` should be reported to them. + +* [toybox `bc`][9]. The maintainer has also made his own changes, so bugs in the + toybox `bc` should be reported there. + +* [FreeBSD `bc`][23]. While the `bc` in FreeBSD is kept up-to-date, it is better + to [report bugs there][24], as well as [submit patches][25], and the + maintainers of the package will contact me if necessary. + +## Language + - This `bc` is written in pure ISO C99, using POSIX 2008 APIs. ++This `bc` is written in pure ISO C99, using POSIX 2008 APIs with custom Windows ++compatibility code. + +## Commit Messages + +This `bc` uses the commit message guidelines laid out in [this blog post][10]. + +## Semantic Versioning + +This `bc` uses [semantic versioning][11]. + +## Contents + +Items labeled with `(maintainer use only)` are not included in release source +tarballs. + +Files: + + .gitignore The git ignore file (maintainer use only). ++ .gitattributes The git attributes file (maintainer use only). ++ bc.sln The Visual Studio solution file for bc. ++ bc.vcxproj The Visual Studio project file for bc. ++ bc.vcxproj.filters The Visual Studio filters file for bc. ++ bcl.sln The Visual Studio solution file for bcl. ++ bcl.vcxproj The Visual Studio project file for bcl. ++ bcl.vcxproj.filters The Visual Studio filters file for bcl. + configure A symlink to configure.sh to make packaging easier. + configure.sh The configure script. + functions.sh A script with functions used by other scripts. + install.sh Install script. + karatsuba.py Script to find the optimal Karatsuba number. + LICENSE.md A Markdown form of the BSD 2-clause License. + link.sh A script to link dc to bc. + locale_install.sh A script to install locales, if desired. + locale_uninstall.sh A script to uninstall locales. + Makefile.in The Makefile template. - manpage.sh Script to generate man pages from markdown files. ++ manpage.sh Script to generate man pages from markdown files ++ (maintainer use only). + NOTICE.md List of contributors and copyright owners. + RELEASE.md A checklist for making a release (maintainer use only). + release.sh A script to test for release (maintainer use only). + safe-install.sh Safe install script from musl libc. + +Folders: + + gen The bc math library, help texts, and code to generate C source. + include All header files. + locales Locale files, in .msg format. Patches welcome for translations. + manuals Manuals for both programs. + src All source code. + tests All tests. + +[1]: https://www.gnu.org/software/bc/ +[4]: ./LICENSE.md +[5]: ./manuals/build.md +[7]: ./manuals/algorithms.md +[8]: https://git.busybox.net/busybox/tree/miscutils/bc.c +[9]: https://github.com/landley/toybox/blob/master/toys/pending/bc.c +[10]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html +[11]: http://semver.org/ +[12]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html +[17]: https://img.shields.io/coverity/scan/16609.svg +[18]: https://scan.coverity.com/projects/gavinhoward-bc +[19]: ./manuals/benchmarks.md +[20]: https://git.yzena.com/gavin/bc +[21]: https://gavinhoward.com/2020/04/i-am-moving-away-from-github/ +[22]: https://www.deepl.com/translator +[23]: https://cgit.freebsd.org/src/tree/contrib/bc +[24]: https://bugs.freebsd.org/ +[25]: https://reviews.freebsd.org/ +[26]: ./manuals/bcl.3.md diff --cc contrib/bc/bc.sln index 000000000000,584b28d13bf6..584b28d13bf6 mode 000000,100644..100644 --- a/contrib/bc/bc.sln +++ b/contrib/bc/bc.sln diff --cc contrib/bc/bc.vcxproj index 000000000000,ba0a7f6f1dd6..ba0a7f6f1dd6 mode 000000,100644..100644 --- a/contrib/bc/bc.vcxproj +++ b/contrib/bc/bc.vcxproj diff --cc contrib/bc/bc.vcxproj.filters index 000000000000,bc72b60519e9..bc72b60519e9 mode 000000,100644..100644 --- a/contrib/bc/bc.vcxproj.filters +++ b/contrib/bc/bc.vcxproj.filters diff --cc contrib/bc/bcl.sln index 000000000000,77009a439db3..77009a439db3 mode 000000,100644..100644 --- a/contrib/bc/bcl.sln +++ b/contrib/bc/bcl.sln diff --cc contrib/bc/bcl.vcxproj index 000000000000,933c4e93094c..933c4e93094c mode 000000,100644..100644 --- a/contrib/bc/bcl.vcxproj +++ b/contrib/bc/bcl.vcxproj diff --cc contrib/bc/bcl.vcxproj.filters index 000000000000,5d8a13ba25f7..5d8a13ba25f7 mode 000000,100644..100644 --- a/contrib/bc/bcl.vcxproj.filters +++ b/contrib/bc/bcl.vcxproj.filters diff --cc contrib/bc/configure index bd7a56adb6f9,af96564e7702..af96564e7702 mode 120000,100755..100755 --- a/contrib/bc/configure +++ b/contrib/bc/configure diff --cc contrib/bc/include/version.h index 000000000000,7f33df62312e..7f33df62312e mode 000000,100644..100644 --- a/contrib/bc/include/version.h +++ b/contrib/bc/include/version.h diff --cc contrib/bc/tests/dc/scripts/easter.sh index 000000000000,dd030e4024d0..dd030e4024d0 mode 000000,100644..100644 --- a/contrib/bc/tests/dc/scripts/easter.sh +++ b/contrib/bc/tests/dc/scripts/easter.sh From owner-dev-commits-src-all@freebsd.org Tue Apr 6 09:59:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A00675C81CA; Tue, 6 Apr 2021 09:59: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 4FF30D47dfz3tx5; Tue, 6 Apr 2021 09:59: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 80D0E1955; Tue, 6 Apr 2021 09:59: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 1369xOUn030373; Tue, 6 Apr 2021 09:59:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1369xOkP030372; Tue, 6 Apr 2021 09:59:24 GMT (envelope-from git) Date: Tue, 6 Apr 2021 09:59:24 GMT Message-Id: <202104060959.1369xOkP030372@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?U3RlZmFuIEXDn2Vy?= Subject: git: b55a927bc884 - main - [bc] Update to version 4.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b55a927bc884d7780d65a508572023b0dc2dede9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 09:59:24 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=b55a927bc884d7780d65a508572023b0dc2dede9 commit b55a927bc884d7780d65a508572023b0dc2dede9 Author: Stefan Eßer AuthorDate: 2021-04-06 09:57:07 +0000 Commit: Stefan Eßer CommitDate: 2021-04-06 09:57:07 +0000 [bc] Update to version 4.0.0 This version fixes an issue (missing pop of top-of-stack value in the "P" command of the dc program). This issue did not affect the bc program, since it does not use dc as an back-end to actually perform the calculations as was the case with the traditional bc and dc programs. The major number has been bumped due to Windows support that has been added to this version. It does not correspond to a major change that might affect FreeBSD. MFC after: 3 days --- usr.bin/gh-bc/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/usr.bin/gh-bc/Makefile b/usr.bin/gh-bc/Makefile index 79526628cf61..7b06f310a33c 100644 --- a/usr.bin/gh-bc/Makefile +++ b/usr.bin/gh-bc/Makefile @@ -6,7 +6,6 @@ PROG= gh-bc PROGNAME= bc BCDIR= ${SRCTOP}/contrib/${PROGNAME} -BCVERSION!= sed -n -e '/.*VERSION *= *[0-9]/s/.*VERSION *= *//p' ${BCDIR}/Makefile.in SRCS= args.c data.c file.c lang.c lex.c main.c num.c parse.c program.c read.c vector.c vm.c SRCS+= bc.c bc_lex.c bc_parse.c dc.c dc_lex.c dc_parse.c history.c library.c @@ -41,7 +40,6 @@ CFLAGS+= -DBC_ENABLE_HISTORY CFLAGS+= -DBC_ENABLE_RAND CFLAGS+= -DDC_ENABLED CFLAGS+= -DNDEBUG -CFLAGS+= -DVERSION=${BCVERSION} CFLAGS+= -I${BCDIR}/include .if ${MK_NLS_CATALOGS} == "no" From owner-dev-commits-src-all@freebsd.org Tue Apr 6 10:25:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 02E175C9A66; Tue, 6 Apr 2021 10:25: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 4FF3Z56jR2z4SBw; Tue, 6 Apr 2021 10:25: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 CF4422141; Tue, 6 Apr 2021 10:25: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 136APHEa070764; Tue, 6 Apr 2021 10:25:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136APHSQ070763; Tue, 6 Apr 2021 10:25:17 GMT (envelope-from git) Date: Tue, 6 Apr 2021 10:25:17 GMT Message-Id: <202104061025.136APHSQ070763@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 38e7de43ba24 - stable/13 - Reduce chance of RCU deadlock in the LinuxKPI by implementing the section feature of the concurrency kit, CK. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 38e7de43ba245c1e7067868a99d7cc6e074bcdd9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 10:25:18 -0000 The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=38e7de43ba245c1e7067868a99d7cc6e074bcdd9 commit 38e7de43ba245c1e7067868a99d7cc6e074bcdd9 Author: Hans Petter Selasky AuthorDate: 2021-03-28 07:36:48 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-06 10:23:08 +0000 Reduce chance of RCU deadlock in the LinuxKPI by implementing the section feature of the concurrency kit, CK. Differential Revision: https://reviews.freebsd.org/D29467 Reviewed by: kib@ and markj@ Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 177772088060ab0f41bcdbdd81c4712e7f1c7621) --- sys/compat/linuxkpi/common/include/linux/sched.h | 1 + sys/compat/linuxkpi/common/src/linux_rcu.c | 43 ++++++++++++++++++------ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/sched.h b/sys/compat/linuxkpi/common/include/linux/sched.h index da38d89eb639..937e9f27870c 100644 --- a/sys/compat/linuxkpi/common/include/linux/sched.h +++ b/sys/compat/linuxkpi/common/include/linux/sched.h @@ -82,6 +82,7 @@ struct task_struct { int bsd_interrupt_value; struct work_struct *work; /* current work struct, if set */ struct task_struct *group_leader; + unsigned rcu_section[TS_RCU_TYPE_MAX]; }; #define current ({ \ diff --git a/sys/compat/linuxkpi/common/src/linux_rcu.c b/sys/compat/linuxkpi/common/src/linux_rcu.c index 86ec193aa4e4..404c5cec4ae4 100644 --- a/sys/compat/linuxkpi/common/src/linux_rcu.c +++ b/sys/compat/linuxkpi/common/src/linux_rcu.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2016 Matthew Macy (mmacy@mattmacy.io) - * Copyright (c) 2017-2020 Hans Petter Selasky (hselasky@freebsd.org) + * Copyright (c) 2017-2021 Hans Petter Selasky (hselasky@freebsd.org) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -85,6 +85,15 @@ struct linux_epoch_record { */ CTASSERT(sizeof(struct rcu_head) == sizeof(struct callback_head)); +/* + * Verify that "rcu_section[0]" has the same size as + * "ck_epoch_section_t". This has been done to avoid having to add + * special compile flags for including ck_epoch.h to all clients of + * the LinuxKPI. + */ +CTASSERT(sizeof(((struct task_struct *)0)->rcu_section[0] == + sizeof(ck_epoch_section_t))); + /* * Verify that "epoch_record" is at beginning of "struct * linux_epoch_record": @@ -189,6 +198,14 @@ linux_rcu_read_lock(unsigned type) if (RCU_SKIP()) return; + ts = current; + + /* assert valid refcount */ + MPASS(ts->rcu_recurse[type] != INT_MAX); + + if (++(ts->rcu_recurse[type]) != 1) + return; + /* * Pin thread to current CPU so that the unlock code gets the * same per-CPU epoch record: @@ -196,17 +213,15 @@ linux_rcu_read_lock(unsigned type) sched_pin(); record = &DPCPU_GET(linux_epoch_record[type]); - ts = current; /* * Use a critical section to prevent recursion inside * ck_epoch_begin(). Else this function supports recursion. */ critical_enter(); - ck_epoch_begin(&record->epoch_record, NULL); - ts->rcu_recurse[type]++; - if (ts->rcu_recurse[type] == 1) - TAILQ_INSERT_TAIL(&record->ts_head, ts, rcu_entry[type]); + ck_epoch_begin(&record->epoch_record, + (ck_epoch_section_t *)&ts->rcu_section[type]); + TAILQ_INSERT_TAIL(&record->ts_head, ts, rcu_entry[type]); critical_exit(); } @@ -221,18 +236,24 @@ linux_rcu_read_unlock(unsigned type) if (RCU_SKIP()) return; - record = &DPCPU_GET(linux_epoch_record[type]); ts = current; + /* assert valid refcount */ + MPASS(ts->rcu_recurse[type] > 0); + + if (--(ts->rcu_recurse[type]) != 0) + return; + + record = &DPCPU_GET(linux_epoch_record[type]); + /* * Use a critical section to prevent recursion inside * ck_epoch_end(). Else this function supports recursion. */ critical_enter(); - ck_epoch_end(&record->epoch_record, NULL); - ts->rcu_recurse[type]--; - if (ts->rcu_recurse[type] == 0) - TAILQ_REMOVE(&record->ts_head, ts, rcu_entry[type]); + ck_epoch_end(&record->epoch_record, + (ck_epoch_section_t *)&ts->rcu_section[type]); + TAILQ_REMOVE(&record->ts_head, ts, rcu_entry[type]); critical_exit(); sched_unpin(); From owner-dev-commits-src-all@freebsd.org Tue Apr 6 10:27:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33CB15C9E1A; Tue, 6 Apr 2021 10:27: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 4FF3cW11Jbz4SQf; Tue, 6 Apr 2021 10:27: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 158B921A2; Tue, 6 Apr 2021 10:27: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 136ARNAV071014; Tue, 6 Apr 2021 10:27:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136ARNiT071013; Tue, 6 Apr 2021 10:27:23 GMT (envelope-from git) Date: Tue, 6 Apr 2021 10:27:23 GMT Message-Id: <202104061027.136ARNiT071013@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 30b1f8cd1122 - stable/12 - Reduce chance of RCU deadlock in the LinuxKPI by implementing the section feature of the concurrency kit, CK. 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 30b1f8cd1122ef7d770431956c86dd468ae48275 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 10:27:23 -0000 The branch stable/12 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=30b1f8cd1122ef7d770431956c86dd468ae48275 commit 30b1f8cd1122ef7d770431956c86dd468ae48275 Author: Hans Petter Selasky AuthorDate: 2021-03-28 07:36:48 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-06 10:25:00 +0000 Reduce chance of RCU deadlock in the LinuxKPI by implementing the section feature of the concurrency kit, CK. Differential Revision: https://reviews.freebsd.org/D29467 Reviewed by: kib@ and markj@ Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 177772088060ab0f41bcdbdd81c4712e7f1c7621) --- sys/compat/linuxkpi/common/include/linux/sched.h | 1 + sys/compat/linuxkpi/common/src/linux_rcu.c | 43 ++++++++++++++++++------ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/sched.h b/sys/compat/linuxkpi/common/include/linux/sched.h index da38d89eb639..937e9f27870c 100644 --- a/sys/compat/linuxkpi/common/include/linux/sched.h +++ b/sys/compat/linuxkpi/common/include/linux/sched.h @@ -82,6 +82,7 @@ struct task_struct { int bsd_interrupt_value; struct work_struct *work; /* current work struct, if set */ struct task_struct *group_leader; + unsigned rcu_section[TS_RCU_TYPE_MAX]; }; #define current ({ \ diff --git a/sys/compat/linuxkpi/common/src/linux_rcu.c b/sys/compat/linuxkpi/common/src/linux_rcu.c index d2a414926e54..04166926775a 100644 --- a/sys/compat/linuxkpi/common/src/linux_rcu.c +++ b/sys/compat/linuxkpi/common/src/linux_rcu.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2016 Matthew Macy (mmacy@mattmacy.io) - * Copyright (c) 2017-2020 Hans Petter Selasky (hselasky@freebsd.org) + * Copyright (c) 2017-2021 Hans Petter Selasky (hselasky@freebsd.org) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -85,6 +85,15 @@ struct linux_epoch_record { */ CTASSERT(sizeof(struct rcu_head) == sizeof(struct callback_head)); +/* + * Verify that "rcu_section[0]" has the same size as + * "ck_epoch_section_t". This has been done to avoid having to add + * special compile flags for including ck_epoch.h to all clients of + * the LinuxKPI. + */ +CTASSERT(sizeof(((struct task_struct *)0)->rcu_section[0] == + sizeof(ck_epoch_section_t))); + /* * Verify that "epoch_record" is at beginning of "struct * linux_epoch_record": @@ -190,6 +199,14 @@ linux_rcu_read_lock(unsigned type) if (RCU_SKIP()) return; + ts = current; + + /* assert valid refcount */ + MPASS(ts->rcu_recurse[type] != INT_MAX); + + if (++(ts->rcu_recurse[type]) != 1) + return; + /* * Pin thread to current CPU so that the unlock code gets the * same per-CPU epoch record: @@ -197,17 +214,15 @@ linux_rcu_read_lock(unsigned type) sched_pin(); record = &DPCPU_GET(linux_epoch_record[type]); - ts = current; /* * Use a critical section to prevent recursion inside * ck_epoch_begin(). Else this function supports recursion. */ critical_enter(); - ck_epoch_begin(&record->epoch_record, NULL); - ts->rcu_recurse[type]++; - if (ts->rcu_recurse[type] == 1) - TAILQ_INSERT_TAIL(&record->ts_head, ts, rcu_entry[type]); + ck_epoch_begin(&record->epoch_record, + (ck_epoch_section_t *)&ts->rcu_section[type]); + TAILQ_INSERT_TAIL(&record->ts_head, ts, rcu_entry[type]); critical_exit(); } @@ -222,18 +237,24 @@ linux_rcu_read_unlock(unsigned type) if (RCU_SKIP()) return; - record = &DPCPU_GET(linux_epoch_record[type]); ts = current; + /* assert valid refcount */ + MPASS(ts->rcu_recurse[type] > 0); + + if (--(ts->rcu_recurse[type]) != 0) + return; + + record = &DPCPU_GET(linux_epoch_record[type]); + /* * Use a critical section to prevent recursion inside * ck_epoch_end(). Else this function supports recursion. */ critical_enter(); - ck_epoch_end(&record->epoch_record, NULL); - ts->rcu_recurse[type]--; - if (ts->rcu_recurse[type] == 0) - TAILQ_REMOVE(&record->ts_head, ts, rcu_entry[type]); + ck_epoch_end(&record->epoch_record, + (ck_epoch_section_t *)&ts->rcu_section[type]); + TAILQ_REMOVE(&record->ts_head, ts, rcu_entry[type]); critical_exit(); sched_unpin(); From owner-dev-commits-src-all@freebsd.org Tue Apr 6 10:29:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 09CE15C9D56; Tue, 6 Apr 2021 10:29: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 4FF3fs6w4Sz4SVM; Tue, 6 Apr 2021 10:29: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 E040E1F64; Tue, 6 Apr 2021 10:29: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 136ATPD4071371; Tue, 6 Apr 2021 10:29:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136ATP7h071370; Tue, 6 Apr 2021 10:29:25 GMT (envelope-from git) Date: Tue, 6 Apr 2021 10:29:25 GMT Message-Id: <202104061029.136ATP7h071370@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: b9de88350f2e - stable/11 - Reduce chance of RCU deadlock in the LinuxKPI by implementing the section feature of the concurrency kit, CK. 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/stable/11 X-Git-Reftype: branch X-Git-Commit: b9de88350f2e5b7d1c837d619d34b9fe3a79826e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 10:29:26 -0000 The branch stable/11 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=b9de88350f2e5b7d1c837d619d34b9fe3a79826e commit b9de88350f2e5b7d1c837d619d34b9fe3a79826e Author: Hans Petter Selasky AuthorDate: 2021-03-28 07:36:48 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-06 10:27:48 +0000 Reduce chance of RCU deadlock in the LinuxKPI by implementing the section feature of the concurrency kit, CK. Differential Revision: https://reviews.freebsd.org/D29467 Reviewed by: kib@ and markj@ Sponsored by: Mellanox Technologies // NVIDIA Networking (cherry picked from commit 177772088060ab0f41bcdbdd81c4712e7f1c7621) --- sys/compat/linuxkpi/common/include/linux/sched.h | 1 + sys/compat/linuxkpi/common/src/linux_rcu.c | 43 ++++++++++++++++++------ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/sched.h b/sys/compat/linuxkpi/common/include/linux/sched.h index 877b05189cdb..bc08550b18ee 100644 --- a/sys/compat/linuxkpi/common/include/linux/sched.h +++ b/sys/compat/linuxkpi/common/include/linux/sched.h @@ -81,6 +81,7 @@ struct task_struct { int rcu_recurse[TS_RCU_TYPE_MAX]; int bsd_interrupt_value; struct work_struct *work; /* current work struct, if set */ + unsigned rcu_section[TS_RCU_TYPE_MAX]; }; #define current ({ \ diff --git a/sys/compat/linuxkpi/common/src/linux_rcu.c b/sys/compat/linuxkpi/common/src/linux_rcu.c index 61aa21ae37ec..b180c6b74361 100644 --- a/sys/compat/linuxkpi/common/src/linux_rcu.c +++ b/sys/compat/linuxkpi/common/src/linux_rcu.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2016 Matthew Macy (mmacy@mattmacy.io) - * Copyright (c) 2017-2020 Hans Petter Selasky (hselasky@freebsd.org) + * Copyright (c) 2017-2021 Hans Petter Selasky (hselasky@freebsd.org) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -85,6 +85,15 @@ struct linux_epoch_record { */ CTASSERT(sizeof(struct rcu_head) == sizeof(struct callback_head)); +/* + * Verify that "rcu_section[0]" has the same size as + * "ck_epoch_section_t". This has been done to avoid having to add + * special compile flags for including ck_epoch.h to all clients of + * the LinuxKPI. + */ +CTASSERT(sizeof(((struct task_struct *)0)->rcu_section[0] == + sizeof(ck_epoch_section_t))); + /* * Verify that "epoch_record" is at beginning of "struct * linux_epoch_record": @@ -190,6 +199,14 @@ linux_rcu_read_lock(unsigned type) if (RCU_SKIP()) return; + ts = current; + + /* assert valid refcount */ + MPASS(ts->rcu_recurse[type] != INT_MAX); + + if (++(ts->rcu_recurse[type]) != 1) + return; + /* * Pin thread to current CPU so that the unlock code gets the * same per-CPU epoch record: @@ -197,17 +214,15 @@ linux_rcu_read_lock(unsigned type) sched_pin(); record = &DPCPU_GET(linux_epoch_record[type]); - ts = current; /* * Use a critical section to prevent recursion inside * ck_epoch_begin(). Else this function supports recursion. */ critical_enter(); - ck_epoch_begin(&record->epoch_record, NULL); - ts->rcu_recurse[type]++; - if (ts->rcu_recurse[type] == 1) - TAILQ_INSERT_TAIL(&record->ts_head, ts, rcu_entry[type]); + ck_epoch_begin(&record->epoch_record, + (ck_epoch_section_t *)&ts->rcu_section[type]); + TAILQ_INSERT_TAIL(&record->ts_head, ts, rcu_entry[type]); critical_exit(); } @@ -222,18 +237,24 @@ linux_rcu_read_unlock(unsigned type) if (RCU_SKIP()) return; - record = &DPCPU_GET(linux_epoch_record[type]); ts = current; + /* assert valid refcount */ + MPASS(ts->rcu_recurse[type] > 0); + + if (--(ts->rcu_recurse[type]) != 0) + return; + + record = &DPCPU_GET(linux_epoch_record[type]); + /* * Use a critical section to prevent recursion inside * ck_epoch_end(). Else this function supports recursion. */ critical_enter(); - ck_epoch_end(&record->epoch_record, NULL); - ts->rcu_recurse[type]--; - if (ts->rcu_recurse[type] == 0) - TAILQ_REMOVE(&record->ts_head, ts, rcu_entry[type]); + ck_epoch_end(&record->epoch_record, + (ck_epoch_section_t *)&ts->rcu_section[type]); + TAILQ_REMOVE(&record->ts_head, ts, rcu_entry[type]); critical_exit(); sched_unpin(); From owner-dev-commits-src-all@freebsd.org Tue Apr 6 10:56:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D244F5CB241; Tue, 6 Apr 2021 10:56: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 4FF4GQ5cYnz4W93; Tue, 6 Apr 2021 10:56: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 AEB442910; Tue, 6 Apr 2021 10:56: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 136Auk49011260; Tue, 6 Apr 2021 10:56:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136AukuQ011259; Tue, 6 Apr 2021 10:56:46 GMT (envelope-from git) Date: Tue, 6 Apr 2021 10:56:46 GMT Message-Id: <202104061056.136AukuQ011259@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Poul-Henning Kamp Subject: git: 6c709cbf03c3 - main - Add Siemens SITOP UPS500S usb device MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: phk X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6c709cbf03c39646968a51059d56049c48da6817 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 10:56:46 -0000 The branch main has been updated by phk: URL: https://cgit.FreeBSD.org/src/commit/?id=6c709cbf03c39646968a51059d56049c48da6817 commit 6c709cbf03c39646968a51059d56049c48da6817 Author: Poul-Henning Kamp AuthorDate: 2021-04-06 10:56:27 +0000 Commit: Poul-Henning Kamp CommitDate: 2021-04-06 10:56:27 +0000 Add Siemens SITOP UPS500S usb device --- sys/dev/usb/serial/uftdi.c | 1 + sys/dev/usb/usbdevs | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/dev/usb/serial/uftdi.c b/sys/dev/usb/serial/uftdi.c index 010560f81678..52977352fb94 100644 --- a/sys/dev/usb/serial/uftdi.c +++ b/sys/dev/usb/serial/uftdi.c @@ -511,6 +511,7 @@ static const STRUCT_USB_HOST_ID uftdi_devs[] = { UFTDI_DEV(FTDI, SIGNALYZER_SH4, UFTDI_JTAG_IFACE(0)), UFTDI_DEV(FTDI, SIGNALYZER_SLITE, UFTDI_JTAG_IFACE(0)), UFTDI_DEV(FTDI, SIGNALYZER_ST, UFTDI_JTAG_IFACE(0)), + UFTDI_DEV(FTDI, SITOP_UPS500S, 0), UFTDI_DEV(FTDI, SPECIAL_1, 0), UFTDI_DEV(FTDI, SPECIAL_3, 0), UFTDI_DEV(FTDI, SPECIAL_4, 0), diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs index ab1d1339d587..9bd95e03d41c 100644 --- a/sys/dev/usb/usbdevs +++ b/sys/dev/usb/usbdevs @@ -2217,6 +2217,7 @@ product FTDI SIGNALYZER_SH2 0xbca2 FTDI compatible adapter product FTDI SIGNALYZER_SH4 0xbca4 FTDI compatible adapter product FTDI SIGNALYZER_SLITE 0xbca1 FTDI compatible adapter product FTDI SIGNALYZER_ST 0xbca0 FTDI compatible adapter +product FTDI SITOP_UPS500S 0xe0e4 Siemens UPS500S standby power product FTDI SPECIAL_1 0xfc70 FTDI compatible adapter product FTDI SPECIAL_3 0xfc72 FTDI compatible adapter product FTDI SPECIAL_4 0xfc73 FTDI compatible adapter From owner-dev-commits-src-all@freebsd.org Tue Apr 6 11:27:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2D415CC9FE; Tue, 6 Apr 2021 11:27: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 4FF4xc4CRmz4ZxS; Tue, 6 Apr 2021 11:27: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 8364A2C53; Tue, 6 Apr 2021 11:27: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 136BRGmv052464; Tue, 6 Apr 2021 11:27:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136BRG5b052463; Tue, 6 Apr 2021 11:27:16 GMT (envelope-from git) Date: Tue, 6 Apr 2021 11:27:16 GMT Message-Id: <202104061127.136BRG5b052463@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Leandro Lupori Subject: git: e21b6ce854f2 - stable/13 - [PowerPC64] Port optimized strcpy to PPC64LE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e21b6ce854f25540f9f8ba33f15d60c5de91bc29 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 11:27:16 -0000 The branch stable/13 has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=e21b6ce854f25540f9f8ba33f15d60c5de91bc29 commit e21b6ce854f25540f9f8ba33f15d60c5de91bc29 Author: Leandro Lupori AuthorDate: 2021-03-25 16:14:00 +0000 Commit: Leandro Lupori CommitDate: 2021-04-06 11:26:30 +0000 [PowerPC64] Port optimized strcpy to PPC64LE Submitted by: Bruno Larsen Reviewed by: luporl, bdragon (IRC) MFC after: 1 week Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D29067 (cherry picked from commit 9f50aa45be18b9b11b14345fe0a137d1ac51a391) --- lib/libc/powerpc64/string/Makefile.inc | 7 +-- lib/libc/powerpc64/string/strcpy_arch_2_05.S | 66 ++++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 9 deletions(-) diff --git a/lib/libc/powerpc64/string/Makefile.inc b/lib/libc/powerpc64/string/Makefile.inc index 14f0845595c9..486ca47a44be 100644 --- a/lib/libc/powerpc64/string/Makefile.inc +++ b/lib/libc/powerpc64/string/Makefile.inc @@ -12,12 +12,7 @@ MDSRCS+= \ memmove_resolver.c \ strncpy_arch_2_05.S \ strncpy.c \ - strncpy_resolver.c - -# XXX Port strcpy to LE. -.if ${MACHINE_ARCH} == "powerpc64" -MDSRCS+= \ + strncpy_resolver.c \ strcpy_arch_2_05.S \ strcpy.c \ strcpy_resolver.c -.endif diff --git a/lib/libc/powerpc64/string/strcpy_arch_2_05.S b/lib/libc/powerpc64/string/strcpy_arch_2_05.S index 23ffb5c2a75e..7f42fd813395 100644 --- a/lib/libc/powerpc64/string/strcpy_arch_2_05.S +++ b/lib/libc/powerpc64/string/strcpy_arch_2_05.S @@ -26,9 +26,6 @@ * SUCH DAMAGE. */ -#if !defined(__BIG_ENDIAN__) -#error "Optimized SRTCPY is only supported by big-endian architecture!" -#endif #include __FBSDID("$FreeBSD$"); @@ -71,6 +68,7 @@ ENTRY(__strcpy_arch_2_05) beq cr7,.Lcopy_dw_loop addi %r8,%r8,8 /* Forward r8 to use std instruction. */ +#if defined(__BIG_ENDIAN__) /* Find where the zero is located. */ .Lcheck_zero: rldicr. %r5,%r0,0,7 @@ -136,6 +134,68 @@ ENTRY(__strcpy_arch_2_05) .Lfound_on_byte_0: srdi %r6,%r0,56 stb %r6,0(%r8) +#elif defined(__LITTLE_ENDIAN__) +/* Find where the zero is located. */ +.Lcheck_zero: + andi. %r7,%r0,0xff + beq .Lfound_on_byte_0 + andi. %r7,%r0,0xff00 + beq .Lfound_on_byte_1 + andis. %r7,%r0,0xff + beq .Lfound_on_byte_2 + andis. %r7,%r0,0xff00 + beq .Lfound_on_byte_3 + rldicr. %r7,%r0,24,7 + beq .Lfound_on_byte_4 + rldicr. %r7,%r0,16,7 + beq .Lfound_on_byte_5 + rldicr. %r7,%r0,8,7 + beq .Lfound_on_byte_6 + +/* Copy the last string bytes according to the string end position. */ +.Lfound_on_byte_7: + std %r0,0(%r8) + b .Lexit + +.Lfound_on_byte_6: + stw %r0,0(%r8) + srdi %r6,%r0,32 + sth %r6,4(%r8) + srdi %r6,%r0,48 + stb %r6,6(%r8) + b .Lexit + +.Lfound_on_byte_5: + stw %r0,0(%r8) + srdi %r6,%r0,32 + sth %r6,4(%r8) + b .Lexit + +.Lfound_on_byte_4: + stw %r0,0(%r8) + srdi %r6,%r0,32 + stb %r6,4(%r8) + b .Lexit + +.Lfound_on_byte_3: + stw %r0,0(%r8) + b .Lexit + +.Lfound_on_byte_2: + sth %r0,0(%r8) + srdi %r6,%r0,16 + stb %r6,2(%r8) + b .Lexit + +.Lfound_on_byte_1: + sth %r0,0(%r8) + b .Lexit + +.Lfound_on_byte_0: + stb %r0,0(%r8) +#else +#error "Unable to determine Endianness" +#endif .Lexit: blr From owner-dev-commits-src-all@freebsd.org Tue Apr 6 11:29:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 432125CCC6C; Tue, 6 Apr 2021 11:29: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 4FF50X1Tx3z4b49; Tue, 6 Apr 2021 11:29: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 17F612E35; Tue, 6 Apr 2021 11:29: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 136BTlJd052806; Tue, 6 Apr 2021 11:29:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136BTlkO052805; Tue, 6 Apr 2021 11:29:47 GMT (envelope-from git) Date: Tue, 6 Apr 2021 11:29:47 GMT Message-Id: <202104061129.136BTlkO052805@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Leandro Lupori Subject: git: 1805ce694542 - stable/13 - powerpc64: enforce natural alignment in bcopy MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1805ce694542f03a95a064aa3be5905ce9cffa3b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 11:29:48 -0000 The branch stable/13 has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=1805ce694542f03a95a064aa3be5905ce9cffa3b commit 1805ce694542f03a95a064aa3be5905ce9cffa3b Author: Leandro Lupori AuthorDate: 2021-03-25 14:54:06 +0000 Commit: Leandro Lupori CommitDate: 2021-04-06 11:28:26 +0000 powerpc64: enforce natural alignment in bcopy POWER architecture CPUs (Book-S) require natural alignment for cache-inhibited storage accesses. Since we can't know the caching model for a page ahead of time, always enforce natural alignment in bcopy. This fixes a SIGBUS when calling the function with misaligned pointers on POWER7. Submitted by: Bruno Larsen Reviewed by: luporl, bdragon (IRC) MFC after: 1 week Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D28776 (cherry picked from commit 2f561284033c0f53d0911baf9056078e6026a278) --- lib/libc/powerpc64/string/bcopy.S | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lib/libc/powerpc64/string/bcopy.S b/lib/libc/powerpc64/string/bcopy.S index bb860c098feb..4dc80c264362 100644 --- a/lib/libc/powerpc64/string/bcopy.S +++ b/lib/libc/powerpc64/string/bcopy.S @@ -34,6 +34,11 @@ __FBSDID("$FreeBSD$"); #define BLOCK_SIZE (1 << BLOCK_SIZE_BITS) #define BLOCK_SIZE_MASK (BLOCK_SIZE - 1) +/* Minimum 8 byte alignment, to avoid cache-inhibited alignment faults.*/ +#ifndef ALIGN_MASK +#define ALIGN_MASK 0x7 +#endif + #define MULTI_PHASE_THRESHOLD 512 #ifndef FN_NAME @@ -66,9 +71,38 @@ ENTRY(FN_NAME) mr %r4, %r0 #endif + /* First check for relative alignment, if unaligned copy one byte at a time */ + andi. %r8, %r3, ALIGN_MASK + andi. %r7, %r4, ALIGN_MASK + cmpd %r7, %r8 + bne .Lunaligned + + cmpldi %r5, MULTI_PHASE_THRESHOLD bge .Lmulti_phase + b .Lfast_copy + +.Lunaligned: + /* forward or backward copy? */ + cmpd %r4, %r3 + blt .Lbackward_unaligned + + /* Just need to setup increment and jump to copy */ + li %r0, 1 + mtctr %r5 + b .Lsingle_1_loop + +.Lbackward_unaligned: + /* advance src and dst to last byte, set decrement and jump to copy */ + add %r3, %r3, %r5 + addi %r3, %r3, -1 + add %r4, %r4, %r5 + addi %r4, %r4, -1 + li %r0, -1 + mtctr %r5 + b .Lsingle_1_loop +.Lfast_copy: /* align src */ cmpd %r4, %r3 /* forward or backward copy? */ blt .Lbackward_align From owner-dev-commits-src-all@freebsd.org Tue Apr 6 11:41:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 94EE55CD1CE; Tue, 6 Apr 2021 11:41: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 4FF5GD3sVmz4cKd; Tue, 6 Apr 2021 11:41: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 77E542E6B; Tue, 6 Apr 2021 11:41: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 136BfeR5078293; Tue, 6 Apr 2021 11:41:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136BfefM078292; Tue, 6 Apr 2021 11:41:40 GMT (envelope-from git) Date: Tue, 6 Apr 2021 11:41:40 GMT Message-Id: <202104061141.136BfefM078292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Leandro Lupori Subject: git: 28d14569c873 - main - powerpc64: add missing TLB invalidations to radix MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 28d14569c8735060d0a1646a3422562c0741ac44 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 11:41:40 -0000 The branch main has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=28d14569c8735060d0a1646a3422562c0741ac44 commit 28d14569c8735060d0a1646a3422562c0741ac44 Author: Leandro Lupori AuthorDate: 2021-04-06 11:31:44 +0000 Commit: Leandro Lupori CommitDate: 2021-04-06 11:31:44 +0000 powerpc64: add missing TLB invalidations to radix Radix MMU code was missing TLB invalidations when some Level 3 PDEs were modified. This caused TLB multi-hit machine check interrupts when superpages were enabled. Reviewed by: jhibbits MFC after: 2 weeks Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D29511 --- sys/powerpc/aim/mmu_radix.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/powerpc/aim/mmu_radix.c b/sys/powerpc/aim/mmu_radix.c index b2500e4ec359..bb43b64febff 100644 --- a/sys/powerpc/aim/mmu_radix.c +++ b/sys/powerpc/aim/mmu_radix.c @@ -3184,6 +3184,7 @@ pmap_enter_l3e(pmap_t pmap, vm_offset_t va, pml3_entry_t newpde, u_int flags, * a reserved PT page could be freed. */ (void)pmap_remove_l3e(pmap, l3e, va, &free, lockp); + pmap_invalidate_l3e_page(pmap, va, oldl3e); } else { if (pmap_remove_ptes(pmap, va, va + L3_PAGE_SIZE, l3e, &free, lockp)) @@ -3242,6 +3243,7 @@ pmap_enter_l3e(pmap_t pmap, vm_offset_t va, pml3_entry_t newpde, u_int flags, * be any lingering 4KB page mappings in the TLB.) */ pte_store(l3e, newpde); + ptesync(); atomic_add_long(&pmap_l3e_mappings, 1); CTR2(KTR_PMAP, "pmap_enter_pde: success for va %#lx" @@ -4943,7 +4945,7 @@ pmap_demote_l3e_locked(pmap_t pmap, pml3_entry_t *l3e, vm_offset_t va, * the read above and the store below. */ pde_store(l3e, mptepa); - ptesync(); + pmap_invalidate_l3e_page(pmap, trunc_2mpage(va), oldpde); /* * Demote the PV entry. */ @@ -5224,6 +5226,7 @@ mmu_radix_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) */ if (sva + L3_PAGE_SIZE == va_next && eva >= va_next) { pmap_remove_l3e(pmap, l3e, sva, &free, &lock); + anyvalid = true; continue; } else if (!pmap_demote_l3e_locked(pmap, l3e, sva, &lock)) { From owner-dev-commits-src-all@freebsd.org Tue Apr 6 11:48:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11E345CD69E; Tue, 6 Apr 2021 11:48: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 4FF5Q804F4z4dFh; Tue, 6 Apr 2021 11:48: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 E9754343F; Tue, 6 Apr 2021 11:48:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 136BmV8C079328; Tue, 6 Apr 2021 11:48:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136BmV0M079327; Tue, 6 Apr 2021 11:48:31 GMT (envelope-from git) Date: Tue, 6 Apr 2021 11:48:31 GMT Message-Id: <202104061148.136BmV0M079327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Leandro Lupori Subject: git: 32b50b8520d0 - stable/13 - powerpc64: support superpages on pmap_mincore MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: luporl X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 32b50b8520d00b58ff88ab9ea46cf2423a3ad81b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 11:48:32 -0000 The branch stable/13 has been updated by luporl: URL: https://cgit.FreeBSD.org/src/commit/?id=32b50b8520d00b58ff88ab9ea46cf2423a3ad81b commit 32b50b8520d00b58ff88ab9ea46cf2423a3ad81b Author: Leandro Lupori AuthorDate: 2021-03-30 18:54:01 +0000 Commit: Leandro Lupori CommitDate: 2021-04-06 11:47:43 +0000 powerpc64: support superpages on pmap_mincore Now that superpages for HPT MMU has landed, finish implementation of pmap_mincore by adding support for superpages. Submitted by: Fernando Eckhardt Valle Reviewed by: bdragon, luporl MFC after: 1 week Sponsored by: Eldorado Research Institute (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D29230 (cherry picked from commit 75e67b4920f2d70b98bd1383966d17d541b7c46c) --- sys/powerpc/aim/mmu_oea64.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/powerpc/aim/mmu_oea64.c b/sys/powerpc/aim/mmu_oea64.c index 14fea6f29a52..f311b61188e7 100644 --- a/sys/powerpc/aim/mmu_oea64.c +++ b/sys/powerpc/aim/mmu_oea64.c @@ -1400,13 +1400,15 @@ moea64_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap) PMAP_LOCK(pmap); - /* XXX Add support for superpages */ pvo = moea64_pvo_find_va(pmap, addr); if (pvo != NULL) { pa = PVO_PADDR(pvo); m = PHYS_TO_VM_PAGE(pa); managed = (pvo->pvo_vaddr & PVO_MANAGED) == PVO_MANAGED; - val = MINCORE_INCORE; + if (PVO_IS_SP(pvo)) + val = MINCORE_INCORE | MINCORE_PSIND(1); + else + val = MINCORE_INCORE; } else { PMAP_UNLOCK(pmap); return (0); From owner-dev-commits-src-all@freebsd.org Tue Apr 6 12:34:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 112755CFE5B; Tue, 6 Apr 2021 12:34: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 4FF6Rb75n3z4m78; Tue, 6 Apr 2021 12:34: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 E6C3D40A1; Tue, 6 Apr 2021 12:34: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 136CYpeg048403; Tue, 6 Apr 2021 12:34:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136CYpwh048402; Tue, 6 Apr 2021 12:34:51 GMT (envelope-from git) Date: Tue, 6 Apr 2021 12:34:51 GMT Message-Id: <202104061234.136CYpwh048402@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 57dbb3c25936 - main - pci_dw: fix outbound I/O window configuration MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 57dbb3c25936f0d61fef152eb224ca86a73af0e9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 12:34:52 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=57dbb3c25936f0d61fef152eb224ca86a73af0e9 commit 57dbb3c25936f0d61fef152eb224ca86a73af0e9 Author: Marcin Wojtas AuthorDate: 2021-04-06 12:31:39 +0000 Commit: Marcin Wojtas CommitDate: 2021-04-06 12:31:39 +0000 pci_dw: fix outbound I/O window configuration Use viewport "2" instead of "0" and change window type from MEM to IO. Without these changes the MEM ATU window can be overwritten with the IO one. Submitted by: Kornel Duleba Obtained from: Semihalf Sponsored by: Marvell Differential revision: https://reviews.freebsd.org/D29516 --- sys/dev/pci/pci_dw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/pci/pci_dw.c b/sys/dev/pci/pci_dw.c index 33c6c0b070c3..161a68d2929d 100644 --- a/sys/dev/pci/pci_dw.c +++ b/sys/dev/pci/pci_dw.c @@ -231,7 +231,7 @@ pci_dw_setup_hw(struct pci_dw_softc *sc) /* If we have enouht viewports ..*/ if (sc->num_viewport >= 3 && sc->io_range.size != 0) { /* Setup outbound I/O window */ - rv = pci_dw_map_out_atu(sc, 0, IATU_CTRL1_TYPE_MEM, + rv = pci_dw_map_out_atu(sc, 2, IATU_CTRL1_TYPE_IO, sc->io_range.host, sc->io_range.pci, sc->io_range.size); if (rv != 0) return (rv); From owner-dev-commits-src-all@freebsd.org Tue Apr 6 13:08:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F1CC5D0D5C; Tue, 6 Apr 2021 13:08: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 4FF7BL1r54z4q8B; Tue, 6 Apr 2021 13:08: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 320B946B1; Tue, 6 Apr 2021 13:08: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 136D8Qwo089194; Tue, 6 Apr 2021 13:08:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136D8QN9089193; Tue, 6 Apr 2021 13:08:26 GMT (envelope-from git) Date: Tue, 6 Apr 2021 13:08:26 GMT Message-Id: <202104061308.136D8QN9089193@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: edda63ba979a - stable/13 - makefs: Ignore the "tags" keyword in mtree manifests 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/stable/13 X-Git-Reftype: branch X-Git-Commit: edda63ba979a8e39e935ed97e1c9049ee1ff4e0a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 13:08:26 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=edda63ba979a8e39e935ed97e1c9049ee1ff4e0a commit edda63ba979a8e39e935ed97e1c9049ee1ff4e0a Author: Mark Johnston AuthorDate: 2021-03-23 18:38:28 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 13:07:24 +0000 makefs: Ignore the "tags" keyword in mtree manifests An install using -DNO_ROOT emits mtree entries containing tags used by pkgbase. makefs(8) can safely ignore them, so do that rather than emitting a warning for each entry. Reviewed by: brooks, imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29384 (cherry picked from commit ed42b22abc48ba53aaa38e1e64438b6d71e7e944) --- usr.sbin/makefs/mtree.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/usr.sbin/makefs/mtree.c b/usr.sbin/makefs/mtree.c index 266315466900..4272299ce135 100644 --- a/usr.sbin/makefs/mtree.c +++ b/usr.sbin/makefs/mtree.c @@ -629,7 +629,13 @@ read_mtree_keywords(FILE *fp, fsnode *node) error = ENOSYS; break; case 't': - if (strcmp(keyword, "time") == 0) { + if (strcmp(keyword, "tags") == 0) { + if (value == NULL) { + error = ENOATTR; + break; + } + /* Ignore. */ + } else if (strcmp(keyword, "time") == 0) { if (value == NULL) { error = ENOATTR; break; From owner-dev-commits-src-all@freebsd.org Tue Apr 6 15:16:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 486715D4E5F; Tue, 6 Apr 2021 15:16: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 4FFB2H1YJtz3MRS; Tue, 6 Apr 2021 15:16: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 2819861DF; Tue, 6 Apr 2021 15:16: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 136FGdBb063773; Tue, 6 Apr 2021 15:16:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136FGd3F063772; Tue, 6 Apr 2021 15:16:39 GMT (envelope-from git) Date: Tue, 6 Apr 2021 15:16:39 GMT Message-Id: <202104061516.136FGd3F063772@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 1c1ead9b94a1 - main - pciconf: Use VM_MEMATTR_DEVICE on supported architectures MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c1ead9b94a1a731646327ec3b09e8f3acd577b8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 15:16:39 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=1c1ead9b94a1a731646327ec3b09e8f3acd577b8 commit 1c1ead9b94a1a731646327ec3b09e8f3acd577b8 Author: Marcin Wojtas AuthorDate: 2021-04-06 15:00:05 +0000 Commit: Marcin Wojtas CommitDate: 2021-04-06 15:00:05 +0000 pciconf: Use VM_MEMATTR_DEVICE on supported architectures Some architectures - armv7, armv8 and riscv use VM_MEMATTR_DEVICE when mapping device registers in kernel. Do the same in pciconf. On armada8k SoC all reads from BARs mapped with hitherto attribute (VM_MEMATTR_UNCACHEABLE) return 0xff's. Submitted by: Kornel Duleba Reviewed by: kib Obtained from: Semihalf Sponsored by: Marvell Differential revision: https://reviews.freebsd.org/D29603 --- usr.sbin/pciconf/pciconf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.sbin/pciconf/pciconf.c b/usr.sbin/pciconf/pciconf.c index 817de6ec09ed..6b54687d7c79 100644 --- a/usr.sbin/pciconf/pciconf.c +++ b/usr.sbin/pciconf/pciconf.c @@ -1126,7 +1126,11 @@ dump_bar(const char *name, const char *reg, const char *bar_start, if (*reg == '\0' || *el != '\0') errx(1, "Invalid bar specification %s", reg); pbm.pbm_flags = 0; - pbm.pbm_memattr = VM_MEMATTR_UNCACHEABLE; /* XXX */ +#ifdef VM_MEMATTR_DEVICE + pbm.pbm_memattr = VM_MEMATTR_DEVICE; +#else + pbm.pbm_memattr = VM_MEMATTR_UNCACHEABLE; +#endif fd = open(_PATH_DEVPCI, O_RDWR, 0); if (fd < 0) From owner-dev-commits-src-all@freebsd.org Tue Apr 6 15:16:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6449C5D4CD7; Tue, 6 Apr 2021 15:16: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 4FFB2J2S6kz3MRT; Tue, 6 Apr 2021 15:16: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 4740F6235; Tue, 6 Apr 2021 15:16: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 136FGecr063795; Tue, 6 Apr 2021 15:16:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136FGeEn063794; Tue, 6 Apr 2021 15:16:40 GMT (envelope-from git) Date: Tue, 6 Apr 2021 15:16:40 GMT Message-Id: <202104061516.136FGeEn063794@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: f2f1ab39c040 - main - pci_user: call bus_translate_resource before BAR mmap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f2f1ab39c04088ce53287528549e652cf68cee09 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 15:16:40 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=f2f1ab39c04088ce53287528549e652cf68cee09 commit f2f1ab39c04088ce53287528549e652cf68cee09 Author: Marcin Wojtas AuthorDate: 2021-04-06 15:10:04 +0000 Commit: Marcin Wojtas CommitDate: 2021-04-06 15:15:04 +0000 pci_user: call bus_translate_resource before BAR mmap On some armv8 machines it is possible that the mapping between CPU and PCI bus BAR base addresses is not 1:1. In case a BAR is allocated in kernel using bus_alloc_resource_any this translation is handled in ofw_pci_activate_resource. Do the same in pci_user.c by calling bus_translate_resource devmethod. This fixes mmaping BARs to userspace on Marvell SoCs (Armada 7k8k/CN913x) and possibly many other platforms. Submitted by: Kornel Duleba Reviewed by: kib Obtained from: Semihalf Sponsored by: Marvell MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29604 --- sys/dev/pci/pci_user.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index c34fd715707e..0496b3bf6c06 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -878,6 +878,11 @@ pci_bar_mmap(device_t pcidev, struct pci_bar_mmap *pbm) if (!PCI_BAR_MEM(pm->pm_value)) return (EIO); membase = pm->pm_value & PCIM_BAR_MEM_BASE; + error = BUS_TRANSLATE_RESOURCE(pcidev, SYS_RES_MEMORY, membase, + &membase); + if (error != 0) + return (error); + pbase = trunc_page(membase); plen = round_page(membase + ((pci_addr_t)1 << pm->pm_size)) - pbase; From owner-dev-commits-src-all@freebsd.org Tue Apr 6 15:20:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 383895D5288; Tue, 6 Apr 2021 15:20: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 4FFB724SMtz3ND1; Tue, 6 Apr 2021 15:20: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 54A4C65AF; Tue, 6 Apr 2021 15:20: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 136FKeTG072386; Tue, 6 Apr 2021 15:20:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136FKex0072385; Tue, 6 Apr 2021 15:20:40 GMT (envelope-from git) Date: Tue, 6 Apr 2021 15:20:40 GMT Message-Id: <202104061520.136FKex0072385@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: bd422989a99b - stable/12 - Lock busdma operations and serialize detach against open/close 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/stable/12 X-Git-Reftype: branch X-Git-Commit: bd422989a99b5acbc1017945a115f111ac81c131 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 15:20:47 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=bd422989a99b5acbc1017945a115f111ac81c131 commit bd422989a99b5acbc1017945a115f111ac81c131 Author: Marcel Moolenaar AuthorDate: 2019-07-04 02:51:34 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 15:20:13 +0000 Lock busdma operations and serialize detach against open/close Use sx to allow M_WAITOK allocations (suggested by markj). admbugs: 782 Reviewed by: markj (cherry picked from commit 9f011bca829751ed3552ac94fe7c865d75fabfc4) --- sys/dev/proto/proto.h | 8 ++++-- sys/dev/proto/proto_busdma.c | 27 +++++++++++++++--- sys/dev/proto/proto_busdma.h | 3 +- sys/dev/proto/proto_core.c | 66 +++++++++++++++++++++++++++++++------------- 4 files changed, 77 insertions(+), 27 deletions(-) diff --git a/sys/dev/proto/proto.h b/sys/dev/proto/proto.h index cf89512f6ea7..14f6af648f82 100644 --- a/sys/dev/proto/proto.h +++ b/sys/dev/proto/proto.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014, 2015 Marcel Moolenaar + * Copyright (c) 2014, 2015, 2019 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,7 +36,8 @@ #define PROTO_RES_BUSDMA 11 struct proto_res { - int r_type; + u_int r_type:8; + u_int r_opened:1; int r_rid; union { struct resource *res; @@ -47,13 +48,14 @@ struct proto_res { void *cookie; struct cdev *cdev; } r_u; - uintptr_t r_opened; }; struct proto_softc { device_t sc_dev; struct proto_res sc_res[PROTO_RES_MAX]; int sc_rescnt; + int sc_opencnt; + struct mtx sc_mtx; }; extern devclass_t proto_devclass; diff --git a/sys/dev/proto/proto_busdma.c b/sys/dev/proto/proto_busdma.c index 6f6bf7b08916..6838af1e3a1e 100644 --- a/sys/dev/proto/proto_busdma.c +++ b/sys/dev/proto/proto_busdma.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Marcel Moolenaar + * Copyright (c) 2015, 2019 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -355,6 +356,7 @@ proto_busdma_attach(struct proto_softc *sc) struct proto_busdma *busdma; busdma = malloc(sizeof(*busdma), M_PROTO_BUSDMA, M_WAITOK | M_ZERO); + sx_init(&busdma->sxlck, "proto-busdma"); return (busdma); } @@ -363,6 +365,7 @@ proto_busdma_detach(struct proto_softc *sc, struct proto_busdma *busdma) { proto_busdma_cleanup(sc, busdma); + sx_destroy(&busdma->sxlck); free(busdma, M_PROTO_BUSDMA); return (0); } @@ -373,10 +376,12 @@ proto_busdma_cleanup(struct proto_softc *sc, struct proto_busdma *busdma) struct proto_md *md, *md1; struct proto_tag *tag, *tag1; + sx_xlock(&busdma->sxlck); LIST_FOREACH_SAFE(md, &busdma->mds, mds, md1) proto_busdma_md_destroy_internal(busdma, md); LIST_FOREACH_SAFE(tag, &busdma->tags, tags, tag1) proto_busdma_tag_destroy(busdma, tag); + sx_xunlock(&busdma->sxlck); return (0); } @@ -388,6 +393,8 @@ proto_busdma_ioctl(struct proto_softc *sc, struct proto_busdma *busdma, struct proto_md *md; int error; + sx_xlock(&busdma->sxlck); + error = 0; switch (ioc->request) { case PROTO_IOC_BUSDMA_TAG_CREATE: @@ -470,6 +477,9 @@ proto_busdma_ioctl(struct proto_softc *sc, struct proto_busdma *busdma, error = EINVAL; break; } + + sx_xunlock(&busdma->sxlck); + return (error); } @@ -477,11 +487,20 @@ int proto_busdma_mmap_allowed(struct proto_busdma *busdma, vm_paddr_t physaddr) { struct proto_md *md; + int result; + sx_xlock(&busdma->sxlck); + + result = 0; LIST_FOREACH(md, &busdma->mds, mds) { if (physaddr >= trunc_page(md->physaddr) && - physaddr <= trunc_page(md->physaddr + md->tag->maxsz)) - return (1); + physaddr <= trunc_page(md->physaddr + md->tag->maxsz)) { + result = 1; + break; + } } - return (0); + + sx_xunlock(&busdma->sxlck); + + return (result); } diff --git a/sys/dev/proto/proto_busdma.h b/sys/dev/proto/proto_busdma.h index 2b645cebcc4d..a3a3f0087ba3 100644 --- a/sys/dev/proto/proto_busdma.h +++ b/sys/dev/proto/proto_busdma.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Marcel Moolenaar + * Copyright (c) 2015, 2019 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,6 +60,7 @@ struct proto_busdma { LIST_HEAD(,proto_tag) tags; LIST_HEAD(,proto_md) mds; bus_dma_tag_t bd_roottag; + struct sx sxlck; }; struct proto_busdma *proto_busdma_attach(struct proto_softc *); diff --git a/sys/dev/proto/proto_core.c b/sys/dev/proto/proto_core.c index 83da523b1cbb..404ba498f09d 100644 --- a/sys/dev/proto/proto_core.c +++ b/sys/dev/proto/proto_core.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014, 2015 Marcel Moolenaar + * Copyright (c) 2014, 2015, 2019 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -184,6 +184,7 @@ proto_attach(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; + mtx_init(&sc->sc_mtx, "proto-softc", NULL, MTX_DEF); for (res = 0; res < sc->sc_rescnt; res++) { r = sc->sc_res + res; @@ -231,15 +232,16 @@ proto_detach(device_t dev) sc = device_get_softc(dev); - /* Don't detach if we have open device files. */ - for (res = 0; res < sc->sc_rescnt; res++) { - r = sc->sc_res + res; - if (r->r_opened) - return (EBUSY); - } + mtx_lock(&sc->sc_mtx); + if (sc->sc_opencnt == 0) + sc->sc_opencnt = -1; + mtx_unlock(&sc->sc_mtx); + if (sc->sc_opencnt > 0) + return (EBUSY); for (res = 0; res < sc->sc_rescnt; res++) { r = sc->sc_res + res; + switch (r->r_type) { case SYS_RES_IRQ: /* XXX TODO */ @@ -252,21 +254,25 @@ proto_detach(device_t dev) break; case SYS_RES_MEMORY: case SYS_RES_IOPORT: + destroy_dev(r->r_u.cdev); bus_release_resource(dev, r->r_type, r->r_rid, r->r_d.res); - destroy_dev(r->r_u.cdev); break; case PROTO_RES_PCICFG: destroy_dev(r->r_u.cdev); break; case PROTO_RES_BUSDMA: - proto_busdma_detach(sc, r->r_d.busdma); destroy_dev(r->r_u.cdev); + proto_busdma_detach(sc, r->r_d.busdma); break; } r->r_type = PROTO_RES_UNUSED; } + mtx_lock(&sc->sc_mtx); sc->sc_rescnt = 0; + sc->sc_opencnt = 0; + mtx_unlock(&sc->sc_mtx); + mtx_destroy(&sc->sc_mtx); return (0); } @@ -278,11 +284,23 @@ static int proto_open(struct cdev *cdev, int oflags, int devtype, struct thread *td) { struct proto_res *r; + struct proto_softc *sc; + int error; - r = cdev->si_drv2; - if (!atomic_cmpset_acq_ptr(&r->r_opened, 0UL, (uintptr_t)td->td_proc)) - return (EBUSY); - return (0); + sc = cdev->si_drv1; + mtx_lock(&sc->sc_mtx); + if (sc->sc_opencnt >= 0) { + r = cdev->si_drv2; + if (!r->r_opened) { + r->r_opened = 1; + sc->sc_opencnt++; + error = 0; + } else + error = EBUSY; + } else + error = ENXIO; + mtx_unlock(&sc->sc_mtx); + return (error); } static int @@ -290,14 +308,24 @@ proto_close(struct cdev *cdev, int fflag, int devtype, struct thread *td) { struct proto_res *r; struct proto_softc *sc; + int error; sc = cdev->si_drv1; - r = cdev->si_drv2; - if (!atomic_cmpset_acq_ptr(&r->r_opened, (uintptr_t)td->td_proc, 0UL)) - return (ENXIO); - if (r->r_type == PROTO_RES_BUSDMA) - proto_busdma_cleanup(sc, r->r_d.busdma); - return (0); + mtx_lock(&sc->sc_mtx); + if (sc->sc_opencnt > 0) { + r = cdev->si_drv2; + if (r->r_opened) { + if (r->r_type == PROTO_RES_BUSDMA) + proto_busdma_cleanup(sc, r->r_d.busdma); + r->r_opened = 0; + sc->sc_opencnt--; + error = 0; + } else + error = ENXIO; + } else + error = ENXIO; + mtx_unlock(&sc->sc_mtx); + return (error); } static int From owner-dev-commits-src-all@freebsd.org Tue Apr 6 16:57:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C41065D7B03; Tue, 6 Apr 2021 16:57: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 4FFDGN54l6z3qJf; Tue, 6 Apr 2021 16:57: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 A12DF7A29; Tue, 6 Apr 2021 16:57: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 136GvGvF099870; Tue, 6 Apr 2021 16:57:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136GvGL0099869; Tue, 6 Apr 2021 16:57:16 GMT (envelope-from git) Date: Tue, 6 Apr 2021 16:57:16 GMT Message-Id: <202104061657.136GvGL0099869@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Marcin Wojtas Subject: git: 9857e00a528b - main - pci_user: fix build for 32-bit platforms MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mw X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9857e00a528bb230c8935ded5f118a7374bf808b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 16:57:16 -0000 The branch main has been updated by mw: URL: https://cgit.FreeBSD.org/src/commit/?id=9857e00a528bb230c8935ded5f118a7374bf808b commit 9857e00a528bb230c8935ded5f118a7374bf808b Author: Marcin Wojtas AuthorDate: 2021-04-06 16:50:36 +0000 Commit: Marcin Wojtas CommitDate: 2021-04-06 16:50:36 +0000 pci_user: fix build for 32-bit platforms Commit: f2f1ab39c040 ("pci_user: call bus_translate_resource before BAR mmap") broke build for 32-bit platforms due to rman_res_t and vm_paddr_t incompatible types. Fix that. --- sys/dev/pci/pci_user.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/dev/pci/pci_user.c b/sys/dev/pci/pci_user.c index 0496b3bf6c06..ef2f48ecb48d 100644 --- a/sys/dev/pci/pci_user.c +++ b/sys/dev/pci/pci_user.c @@ -854,7 +854,7 @@ pci_bar_mmap(device_t pcidev, struct pci_bar_mmap *pbm) struct thread *td; struct sglist *sg; struct pci_map *pm; - vm_paddr_t membase; + rman_res_t membase; vm_paddr_t pbase; vm_size_t plen; vm_offset_t addr; @@ -877,9 +877,8 @@ pci_bar_mmap(device_t pcidev, struct pci_bar_mmap *pbm) return (EBUSY); /* XXXKIB enable if _ACTIVATE */ if (!PCI_BAR_MEM(pm->pm_value)) return (EIO); - membase = pm->pm_value & PCIM_BAR_MEM_BASE; - error = BUS_TRANSLATE_RESOURCE(pcidev, SYS_RES_MEMORY, membase, - &membase); + error = BUS_TRANSLATE_RESOURCE(pcidev, SYS_RES_MEMORY, + pm->pm_value & PCIM_BAR_MEM_BASE, &membase); if (error != 0) return (error); From owner-dev-commits-src-all@freebsd.org Tue Apr 6 17:14:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54D745B064B; Tue, 6 Apr 2021 17:14: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 4FFDdl1v5Xz3sQ4; Tue, 6 Apr 2021 17:14: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 339D37B63; Tue, 6 Apr 2021 17:14: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 136HE38A026956; Tue, 6 Apr 2021 17:14:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136HE3ab026955; Tue, 6 Apr 2021 17:14:03 GMT (envelope-from git) Date: Tue, 6 Apr 2021 17:14:03 GMT Message-Id: <202104061714.136HE3ab026955@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: 9e6158d27482 - main - uefisign: fix handling of errors from child proc 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: 9e6158d274829249322efb3767e6ac2e690cc4a9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 17:14:03 -0000 The branch main has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=9e6158d274829249322efb3767e6ac2e690cc4a9 commit 9e6158d274829249322efb3767e6ac2e690cc4a9 Author: Eric van Gyzen AuthorDate: 2021-04-06 14:36:52 +0000 Commit: Eric van Gyzen CommitDate: 2021-04-06 17:13:59 +0000 uefisign: fix handling of errors from child proc Close the unused pipe file descriptors so the parent will notice if the child exits prematurely. Previously, the parent would block forever on a read from the pipe. $ uefisign -c foo.cert -k foo.key -o loader.efi loader.efi.unsigned uefisign: section points inside the headers load: 0.06 cmd: uefisign 4502 [piperd] 7.25r 0.00u 0.00s 0% 5968k ... _sleep+0x1be pipe_read+0x3d6 kern_readv+0x8c sys_read+0x83 ... Reviewed by: trasz MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D29605 --- usr.sbin/uefisign/uefisign.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.sbin/uefisign/uefisign.c b/usr.sbin/uefisign/uefisign.c index 149e90ba0e67..7eab934c3394 100644 --- a/usr.sbin/uefisign/uefisign.c +++ b/usr.sbin/uefisign/uefisign.c @@ -410,8 +410,12 @@ main(int argc, char **argv) if (pid < 0) err(1, "fork"); - if (pid == 0) + if (pid == 0) { + close(pipefds[0]); exit(child(inpath, outpath, pipefds[1], Vflag, vflag)); + } + + close(pipefds[1]); if (!Vflag) { certfp = checked_fopen(certpath, "r"); From owner-dev-commits-src-all@freebsd.org Tue Apr 6 17:45:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 270245B2189; Tue, 6 Apr 2021 17:45:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFFLZ6Y8tz4S4R; Tue, 6 Apr 2021 17:45:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D362010813; Tue, 6 Apr 2021 17:45:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 136Hjw3X068161; Tue, 6 Apr 2021 17:45:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136HjwON068160; Tue, 6 Apr 2021 17:45:58 GMT (envelope-from git) Date: Tue, 6 Apr 2021 17:45:58 GMT Message-Id: <202104061745.136HjwON068160@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: afb6a168f8ee - main - Allocate extra inodes in makefs when leaving free space in UFS images. 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: afb6a168f8ee08ac74769464726c396fbef83d0b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 17:45:59 -0000 The branch main has been updated by nwhitehorn: URL: https://cgit.FreeBSD.org/src/commit/?id=afb6a168f8ee08ac74769464726c396fbef83d0b commit afb6a168f8ee08ac74769464726c396fbef83d0b Author: Nathan Whitehorn AuthorDate: 2021-04-06 17:43:29 +0000 Commit: Nathan Whitehorn CommitDate: 2021-04-06 17:43:29 +0000 Allocate extra inodes in makefs when leaving free space in UFS images. By default, makefs(8) has very few spare inodes in its output images, which is fine for static filesystems, but not so great for VM images where many more files will be added. Make makefs(8) use the same default settings as newfs(8) when creating images with free space -- there isn't much point to leaving free space on the image if you can't put files there. If no free space is requested, use current behavior of a minimal number of available inodes. Reviewed by: manu MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D29492 --- usr.sbin/makefs/ffs.c | 8 +++++++- usr.sbin/makefs/ffs.h | 2 ++ usr.sbin/makefs/ffs/mkfs.c | 18 +++++++++++++++++- usr.sbin/makefs/makefs.8 | 5 ++++- 4 files changed, 30 insertions(+), 3 deletions(-) diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c index dcc6eb5cbed7..4496cabcd83e 100644 --- a/usr.sbin/makefs/ffs.c +++ b/usr.sbin/makefs/ffs.c @@ -190,6 +190,7 @@ ffs_prep_opts(fsinfo_t *fsopts) ffs_opts->fsize= -1; ffs_opts->cpg= -1; ffs_opts->density= -1; + ffs_opts->min_inodes= false; ffs_opts->minfree= -1; ffs_opts->optimization= -1; ffs_opts->maxcontig= -1; @@ -266,6 +267,11 @@ ffs_makefs(const char *image, const char *dir, fsnode *root, fsinfo_t *fsopts) printf("ffs_makefs: image %s directory %s root %p\n", image, dir, root); + /* if user wants no free space, use minimum number of inodes */ + if (fsopts->minsize == 0 && fsopts->freeblockpc == 0 && + fsopts->freeblocks == 0) + ((ffs_opt_t *)fsopts->fs_specific)->min_inodes = true; + /* validate tree and options */ TIMER_START(start); ffs_validate(dir, root, fsopts); @@ -424,7 +430,7 @@ ffs_validate(const char *dir, fsnode *root, fsinfo_t *fsopts) if (fsopts->roundup > 0) fsopts->size = roundup(fsopts->size, fsopts->roundup); - /* calculate density if necessary */ + /* calculate density to just fit inodes if no free space */ if (ffs_opts->density == -1) ffs_opts->density = fsopts->size / fsopts->inodes + 1; diff --git a/usr.sbin/makefs/ffs.h b/usr.sbin/makefs/ffs.h index 8b4fbc33dc83..e1dda429ff26 100644 --- a/usr.sbin/makefs/ffs.h +++ b/usr.sbin/makefs/ffs.h @@ -44,6 +44,7 @@ #include #include +#include typedef struct { char label[MAXVOLLEN]; /* volume name/label */ @@ -52,6 +53,7 @@ typedef struct { int cpg; /* cylinders per group */ int cpgflg; /* cpg was specified by user */ int density; /* bytes per inode */ + bool min_inodes; /* allocate minimum number of inodes */ int ntracks; /* number of tracks */ int nsectors; /* number of sectors */ int rpm; /* rpm */ diff --git a/usr.sbin/makefs/ffs/mkfs.c b/usr.sbin/makefs/ffs/mkfs.c index ff3c1d594b4e..a22a604fe501 100644 --- a/usr.sbin/makefs/ffs/mkfs.c +++ b/usr.sbin/makefs/ffs/mkfs.c @@ -117,10 +117,13 @@ static int avgfpdir; /* expected number of files per directory */ struct fs * ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp) { - int fragsperinode, optimalfpg, origdensity, minfpg, lastminfpg; + int fragsperinode, optimalfpg, origdensity, mindensity; + int minfpg, lastminfpg; int32_t csfrags; uint32_t i, cylno; long long sizepb; + ino_t maxinum; + int minfragsperinode; /* minimum ratio of frags to inodes */ void *space; int size; int nprintcols, printcolwidth; @@ -312,7 +315,20 @@ ffs_mkfs(const char *fsys, const fsinfo_t *fsopts, time_t tstamp) * can put into each cylinder group. If this is too big, we reduce * the density until it fits. */ + maxinum = (((int64_t)(1)) << 32) - INOPB(&sblock); + minfragsperinode = 1 + fssize / maxinum; + mindensity = minfragsperinode * fsize; + if (density == 0) + density = MAX(2, minfragsperinode) * fsize; + if (density < mindensity) { + origdensity = density; + density = mindensity; + fprintf(stderr, "density increased from %d to %d\n", + origdensity, density); + } origdensity = density; + if (!ffs_opts->min_inodes) + density = MIN(density, MAX(2, minfragsperinode) * fsize); for (;;) { fragsperinode = MAX(numfrags(&sblock, density), 1); minfpg = fragsperinode * INOPB(&sblock); diff --git a/usr.sbin/makefs/makefs.8 b/usr.sbin/makefs/makefs.8 index 8c4fbcb7b322..4a4c69b06946 100644 --- a/usr.sbin/makefs/makefs.8 +++ b/usr.sbin/makefs/makefs.8 @@ -312,7 +312,10 @@ Expected number of files per directory. .It Sy bsize Block size. .It Sy density -Bytes per inode. +Bytes per inode. If unset, will allocate the minimum number of inodes to +represent the filesystem if no free space has been requested (free blocks +or minimum size set); otherwise the larger of the newfs defaults or what +is required by the free inode parameters if set. .It Sy fsize Fragment size. .It Sy label From owner-dev-commits-src-all@freebsd.org Tue Apr 6 18:36:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24B3E5B3E2E; Tue, 6 Apr 2021 18:36:00 +0000 (UTC) (envelope-from jkim@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 4FFGSJ0KF5z4XxV; Tue, 6 Apr 2021 18:36:00 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (pool-100-8-53-238.nwrknj.fios.verizon.net [100.8.53.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jkim/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id E3B97F53F; Tue, 6 Apr 2021 18:35:59 +0000 (UTC) (envelope-from jkim@FreeBSD.org) To: Konstantin Belousov , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104060037.1360bKwT029051@gitrepo.freebsd.org> From: Jung-uk Kim Organization: FreeBSD.org Subject: Re: git: d36d68161517 - main - rtld dl_iterate_phdr(): dlpi_tls_data is wrong Message-ID: Date: Tue, 6 Apr 2021 14:35:59 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <202104060037.1360bKwT029051@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 18:36:00 -0000 On 21. 4. 5., Konstantin Belousov wrote: > The branch main has been updated by kib: > > URL: https://cgit.FreeBSD.org/src/commit/?id=d36d6816151705907393889d661cbfd25c630ca8 > > commit d36d6816151705907393889d661cbfd25c630ca8 > Author: Konstantin Belousov > AuthorDate: 2021-04-05 03:05:44 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-04-06 00:23:08 +0000 > > rtld dl_iterate_phdr(): dlpi_tls_data is wrong > > dl_iterate_phdr() dlpi_tls_data should provide the TLS module segment > address, and not the TLS init segment address as it does now. > > Reported by: emacsray@gmail.com > PR: 254774 > Sponsored by: The FreeBSD Foundation > MFC after: 1 week I started having strange hangs in various applications from yesterday, e.g., Xorg, Thunderbird, etc. Today, I updated ports tree from Git for the first time and started updating packages. Then, I experienced similar problems, e.g., building editors/kate, multimedia/vlc, etc., were hanging. I noticed some tools were stuck in urwlck state and I found reverting this commit fixed the problem for me. Please take a look. Jung-uk Kim From owner-dev-commits-src-all@freebsd.org Tue Apr 6 18:47:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 45D125B43D5; Tue, 6 Apr 2021 18:47:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFGj26Nk2z4Z1W; Tue, 6 Apr 2021 18:47:02 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 136IkrBn042695 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 6 Apr 2021 21:46:56 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 136IkrBn042695 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 136Ikre6042694; Tue, 6 Apr 2021 21:46:53 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 6 Apr 2021 21:46:53 +0300 From: Konstantin Belousov To: Jung-uk Kim Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d36d68161517 - main - rtld dl_iterate_phdr(): dlpi_tls_data is wrong Message-ID: References: <202104060037.1360bKwT029051@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=0.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM,FREEMAIL_REPLY, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4FFGj26Nk2z4Z1W 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 18:47:03 -0000 On Tue, Apr 06, 2021 at 02:35:59PM -0400, Jung-uk Kim wrote: > On 21. 4. 5., Konstantin Belousov wrote: > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=d36d6816151705907393889d661cbfd25c630ca8 > > > > commit d36d6816151705907393889d661cbfd25c630ca8 > > Author: Konstantin Belousov > > AuthorDate: 2021-04-05 03:05:44 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-04-06 00:23:08 +0000 > > > > rtld dl_iterate_phdr(): dlpi_tls_data is wrong > > > > dl_iterate_phdr() dlpi_tls_data should provide the TLS module segment > > address, and not the TLS init segment address as it does now. > > > > Reported by: emacsray@gmail.com > > PR: 254774 > > Sponsored by: The FreeBSD Foundation > > MFC after: 1 week > > I started having strange hangs in various applications from yesterday, > e.g., Xorg, Thunderbird, etc. Today, I updated ports tree from Git for > the first time and started updating packages. Then, I experienced > similar problems, e.g., building editors/kate, multimedia/vlc, etc., > were hanging. I noticed some tools were stuck in urwlck state and I > found reverting this commit fixed the problem for me. > > Please take a look. Can you get backtrace for all threads in hanging process? I do not need debugging symbols for the apps, libc/libthr/rtld with debug info, installed by default from the base, should be enough. From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:18:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C9EA5B4F63; Tue, 6 Apr 2021 19:18: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 4FFHNr1D8kz4cJp; Tue, 6 Apr 2021 19:18: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 1CA1A11A41; Tue, 6 Apr 2021 19:18: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 136JI4B9096974; Tue, 6 Apr 2021 19:18:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JI4Vr096973; Tue, 6 Apr 2021 19:18:04 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:18:04 GMT Message-Id: <202104061918.136JI4Vr096973@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: 982693bb729b - main - vm_fault: Shoot down multiply mapped COW source page mappings 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: 982693bb729badac4e65ecd59772979f2849a2b2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:18:04 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=982693bb729badac4e65ecd59772979f2849a2b2 commit 982693bb729badac4e65ecd59772979f2849a2b2 Author: Mark Johnston AuthorDate: 2021-03-15 20:02:17 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 18:49:28 +0000 vm_fault: Shoot down multiply mapped COW source page mappings Reviewed by: kib, rlibby Discussed with: alc Approved by: so Security: CVE-2021-29626 Security: FreeBSD-SA-21:08.vm --- sys/vm/vm_fault.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index dd112feefdcd..c9f3cdf2e4f6 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -900,6 +900,9 @@ vm_fault_cow(struct faultstate *fs) { bool is_first_object_locked; + KASSERT(fs->object != fs->first_object, + ("source and target COW objects are identical")); + /* * This allows pages to be virtually copied from a backing_object * into the first_object, where the backing object has no other @@ -963,11 +966,29 @@ vm_fault_cow(struct faultstate *fs) */ fs->m_cow = fs->m; fs->m = NULL; + + /* + * Typically, the shadow object is either private to this + * address space (OBJ_ONEMAPPING) or its pages are read only. + * In the highly unusual case where the pages of a shadow object + * are read/write shared between this and other address spaces, + * we need to ensure that any pmap-level mappings to the + * original, copy-on-write page from the backing object are + * removed from those other address spaces. + * + * The flag check is racy, but this is tolerable: if + * OBJ_ONEMAPPING is cleared after the check, the busy state + * ensures that new mappings of m_cow can't be created. + * pmap_enter() will replace an existing mapping in the current + * address space. If OBJ_ONEMAPPING is set after the check, + * removing mappings will at worse trigger some unnecessary page + * faults. + */ + vm_page_assert_xbusied(fs->m_cow); + if ((fs->first_object->flags & OBJ_ONEMAPPING) == 0) + pmap_remove_all(fs->m_cow); } - /* - * fs->object != fs->first_object due to above - * conditional - */ + vm_object_pip_wakeup(fs->object); /* From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:18:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B45C5B4E98; Tue, 6 Apr 2021 19:18:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFHNs29nrz4cD0; Tue, 6 Apr 2021 19:18:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3DB6E117DF; Tue, 6 Apr 2021 19:18:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 136JI5U0096995; Tue, 6 Apr 2021 19:18:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JI5Qs096994; Tue, 6 Apr 2021 19:18:05 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:18:05 GMT Message-Id: <202104061918.136JI5Qs096994@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: 2425f5e91281 - main - mount: Disallow mounting over a jail root 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: 2425f5e9128102c8e6e473567ad6759a55be5b02 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:18:05 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2425f5e9128102c8e6e473567ad6759a55be5b02 commit 2425f5e9128102c8e6e473567ad6759a55be5b02 Author: Mark Johnston AuthorDate: 2021-04-05 21:19:15 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 18:49:36 +0000 mount: Disallow mounting over a jail root Discussed with: jamie Approved by: so Security: CVE-2020-25584 Security: FreeBSD-SA-21:10.jail_mount --- sys/kern/vfs_mount.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index e20e1520f677..7dc6b795eefd 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -956,10 +956,10 @@ vfs_domount_first( /* * If the jail of the calling thread lacks permission for this type of - * file system, deny immediately. + * file system, or is trying to cover its own root, deny immediately. */ - if (jailed(td->td_ucred) && !prison_allow(td->td_ucred, - vfsp->vfc_prison_flag)) { + if (jailed(td->td_ucred) && (!prison_allow(td->td_ucred, + vfsp->vfc_prison_flag) || vp == td->td_ucred->cr_prison->pr_root)) { vput(vp); return (EPERM); } From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:18:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B0E515B50D8; Tue, 6 Apr 2021 19:18: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 4FFHP32SDQz4cDn; Tue, 6 Apr 2021 19:18: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 701DC11B97; Tue, 6 Apr 2021 19:18: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 136JIDJg097128; Tue, 6 Apr 2021 19:18:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JIDS2097127; Tue, 6 Apr 2021 19:18:13 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:18:13 GMT Message-Id: <202104061918.136JIDS2097127@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 2e08308d62f3 - stable/13 - vm_fault: Shoot down multiply mapped COW source page mappings 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2e08308d62f381312b3da9dac8970dcdad4b3f2d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:18:15 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=2e08308d62f381312b3da9dac8970dcdad4b3f2d commit 2e08308d62f381312b3da9dac8970dcdad4b3f2d Author: Mark Johnston AuthorDate: 2021-03-15 20:02:17 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 18:50:46 +0000 vm_fault: Shoot down multiply mapped COW source page mappings Reviewed by: kib, rlibby Discussed with: alc Approved by: so Security: CVE-2021-29626 Security: FreeBSD-SA-21:08.vm (cherry picked from commit 982693bb729badac4e65ecd59772979f2849a2b2) --- sys/vm/vm_fault.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index 585e1544415d..0e8ff9b27ed1 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -896,6 +896,9 @@ vm_fault_cow(struct faultstate *fs) { bool is_first_object_locked; + KASSERT(fs->object != fs->first_object, + ("source and target COW objects are identical")); + /* * This allows pages to be virtually copied from a backing_object * into the first_object, where the backing object has no other @@ -959,11 +962,29 @@ vm_fault_cow(struct faultstate *fs) */ fs->m_cow = fs->m; fs->m = NULL; + + /* + * Typically, the shadow object is either private to this + * address space (OBJ_ONEMAPPING) or its pages are read only. + * In the highly unusual case where the pages of a shadow object + * are read/write shared between this and other address spaces, + * we need to ensure that any pmap-level mappings to the + * original, copy-on-write page from the backing object are + * removed from those other address spaces. + * + * The flag check is racy, but this is tolerable: if + * OBJ_ONEMAPPING is cleared after the check, the busy state + * ensures that new mappings of m_cow can't be created. + * pmap_enter() will replace an existing mapping in the current + * address space. If OBJ_ONEMAPPING is set after the check, + * removing mappings will at worse trigger some unnecessary page + * faults. + */ + vm_page_assert_xbusied(fs->m_cow); + if ((fs->first_object->flags & OBJ_ONEMAPPING) == 0) + pmap_remove_all(fs->m_cow); } - /* - * fs->object != fs->first_object due to above - * conditional - */ + vm_object_pip_wakeup(fs->object); /* From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:18:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 11A015B5059; Tue, 6 Apr 2021 19:18: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 4FFHP3612kz4cDp; Tue, 6 Apr 2021 19:18: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 90ABC11C12; Tue, 6 Apr 2021 19:18: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 136JIEWN097149; Tue, 6 Apr 2021 19:18:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JIEdT097148; Tue, 6 Apr 2021 19:18:14 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:18:14 GMT Message-Id: <202104061918.136JIEdT097148@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 3ae17faa3704 - stable/13 - mount: Disallow mounting over a jail root 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3ae17faa370491d7ce1fcfc4d5b9cd1ed0117b67 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:18:16 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=3ae17faa370491d7ce1fcfc4d5b9cd1ed0117b67 commit 3ae17faa370491d7ce1fcfc4d5b9cd1ed0117b67 Author: Mark Johnston AuthorDate: 2021-04-05 21:19:15 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 18:50:48 +0000 mount: Disallow mounting over a jail root Discussed with: jamie Approved by: so Security: CVE-2020-25584 Security: FreeBSD-SA-21:10.jail_mount (cherry picked from commit 2425f5e9128102c8e6e473567ad6759a55be5b02) --- sys/kern/vfs_mount.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index b3870e46c5e9..59000728efcc 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -918,10 +918,10 @@ vfs_domount_first( /* * If the jail of the calling thread lacks permission for this type of - * file system, deny immediately. + * file system, or is trying to cover its own root, deny immediately. */ - if (jailed(td->td_ucred) && !prison_allow(td->td_ucred, - vfsp->vfc_prison_flag)) { + if (jailed(td->td_ucred) && (!prison_allow(td->td_ucred, + vfsp->vfc_prison_flag) || vp == td->td_ucred->cr_prison->pr_root)) { vput(vp); return (EPERM); } From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:19:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 57C145B4FF7; Tue, 6 Apr 2021 19:19: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 4FFHQB1cZvz4cr8; Tue, 6 Apr 2021 19:19: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 1FCC811968; Tue, 6 Apr 2021 19:19: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 136JJEBj097407; Tue, 6 Apr 2021 19:19:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JJE0S097406; Tue, 6 Apr 2021 19:19:14 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:19:14 GMT Message-Id: <202104061919.136JJE0S097406@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 724bc23da1a9 - releng/13.0 - vm_fault: Shoot down multiply mapped COW source page mappings 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 724bc23da1a9c40768723a4796060c921dbaf224 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:19:14 -0000 The branch releng/13.0 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=724bc23da1a9c40768723a4796060c921dbaf224 commit 724bc23da1a9c40768723a4796060c921dbaf224 Author: Mark Johnston AuthorDate: 2021-03-15 20:02:17 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 19:18:49 +0000 vm_fault: Shoot down multiply mapped COW source page mappings Reviewed by: kib, rlibby Discussed with: alc Approved by: re (so, implicit) Approved by: so Security: CVE-2021-29626 Security: FreeBSD-SA-21:08.vm (cherry picked from commit 982693bb729badac4e65ecd59772979f2849a2b2) (cherry picked from commit 2e08308d62f381312b3da9dac8970dcdad4b3f2d) --- sys/vm/vm_fault.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index da7b1f1d2d8e..8b212f3f84e5 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -894,6 +894,9 @@ vm_fault_cow(struct faultstate *fs) { bool is_first_object_locked; + KASSERT(fs->object != fs->first_object, + ("source and target COW objects are identical")); + /* * This allows pages to be virtually copied from a backing_object * into the first_object, where the backing object has no other @@ -957,11 +960,29 @@ vm_fault_cow(struct faultstate *fs) */ fs->m_cow = fs->m; fs->m = NULL; + + /* + * Typically, the shadow object is either private to this + * address space (OBJ_ONEMAPPING) or its pages are read only. + * In the highly unusual case where the pages of a shadow object + * are read/write shared between this and other address spaces, + * we need to ensure that any pmap-level mappings to the + * original, copy-on-write page from the backing object are + * removed from those other address spaces. + * + * The flag check is racy, but this is tolerable: if + * OBJ_ONEMAPPING is cleared after the check, the busy state + * ensures that new mappings of m_cow can't be created. + * pmap_enter() will replace an existing mapping in the current + * address space. If OBJ_ONEMAPPING is set after the check, + * removing mappings will at worse trigger some unnecessary page + * faults. + */ + vm_page_assert_xbusied(fs->m_cow); + if ((fs->first_object->flags & OBJ_ONEMAPPING) == 0) + pmap_remove_all(fs->m_cow); } - /* - * fs->object != fs->first_object due to above - * conditional - */ + vm_object_pip_wakeup(fs->object); /* From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:19:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F7265B51F2; Tue, 6 Apr 2021 19:19: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 4FFHQC2JSrz4cnj; Tue, 6 Apr 2021 19:19: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 4292811B98; Tue, 6 Apr 2021 19:19: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 136JJFXe097428; Tue, 6 Apr 2021 19:19:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JJFXW097427; Tue, 6 Apr 2021 19:19:15 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:19:15 GMT Message-Id: <202104061919.136JJFXW097427@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 4710439ec594 - releng/13.0 - mount: Disallow mounting over a jail root 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 4710439ec594a5375657acc403326f868d05a05a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:19:15 -0000 The branch releng/13.0 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4710439ec594a5375657acc403326f868d05a05a commit 4710439ec594a5375657acc403326f868d05a05a Author: Mark Johnston AuthorDate: 2021-04-05 21:19:15 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 19:18:59 +0000 mount: Disallow mounting over a jail root Discussed with: jamie Approved by: re (so, implicit) Approved by: so Security: CVE-2020-25584 Security: FreeBSD-SA-21:10.jail_mount (cherry picked from commit 2425f5e9128102c8e6e473567ad6759a55be5b02) (cherry picked from commit 3ae17faa370491d7ce1fcfc4d5b9cd1ed0117b67) --- sys/kern/vfs_mount.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index b3870e46c5e9..59000728efcc 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -918,10 +918,10 @@ vfs_domount_first( /* * If the jail of the calling thread lacks permission for this type of - * file system, deny immediately. + * file system, or is trying to cover its own root, deny immediately. */ - if (jailed(td->td_ucred) && !prison_allow(td->td_ucred, - vfsp->vfc_prison_flag)) { + if (jailed(td->td_ucred) && (!prison_allow(td->td_ucred, + vfsp->vfc_prison_flag) || vp == td->td_ucred->cr_prison->pr_root)) { vput(vp); return (EPERM); } From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:19:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F8B55B54A1; Tue, 6 Apr 2021 19:19: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 4FFHQD36J7z4ckb; Tue, 6 Apr 2021 19:19: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 5C5BE117E1; Tue, 6 Apr 2021 19:19: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 136JJGle097454; Tue, 6 Apr 2021 19:19:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JJGgf097453; Tue, 6 Apr 2021 19:19:16 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:19:16 GMT Message-Id: <202104061919.136JJGgf097453@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 273977acb0aa - releng/13.0 - Add UPDATING entries and bump version 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 273977acb0aa4b999b851c85d8ce44db0ade1b44 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:19:16 -0000 The branch releng/13.0 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=273977acb0aa4b999b851c85d8ce44db0ade1b44 commit 273977acb0aa4b999b851c85d8ce44db0ade1b44 Author: Mark Johnston AuthorDate: 2021-04-06 19:03:53 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 19:19:09 +0000 Add UPDATING entries and bump version Approved by: re (implicit, so) Approved by: so --- UPDATING | 7 +++++++ sys/conf/newvers.sh | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 019b45d7c6e0..14efebc5d37b 100644 --- a/UPDATING +++ b/UPDATING @@ -11,6 +11,13 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20210406: 13.0-RC5-p1 FreeBSD-SA-21:08.vm + FreeBSD-SA-21:10.jail_mount + + Memory disclosure by stale virtual memory mapping [SA-21:08.vm] + + Jail escape possible by mounting over jail root [SA-21:10.jail_mount] + 20210325: 13.0-RC3-p1 FreeBSD-SA-21:07.openssl Fix multiple OpenSSL issues [SA-21:07.openssl] diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 1afb885e9c9d..0d6ec4b72680 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -54,7 +54,7 @@ TYPE="FreeBSD" REVISION="13.0" -BRANCH="RC5" +BRANCH="RC5-p1" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:19:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD1455B54D1; Tue, 6 Apr 2021 19:19: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 4FFHQX1kcLz4d3b; Tue, 6 Apr 2021 19:19:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AEFAD11C14; Tue, 6 Apr 2021 19:19: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 136JJSJt097591; Tue, 6 Apr 2021 19:19:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JJSmK097590; Tue, 6 Apr 2021 19:19:28 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:19:28 GMT Message-Id: <202104061919.136JJSmK097590@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 304a533fd2ec - stable/12 - vm_fault: Shoot down multiply mapped COW source page mappings 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 304a533fd2ec6d61805eb7c991b3e9ce502fc730 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:19:34 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=304a533fd2ec6d61805eb7c991b3e9ce502fc730 commit 304a533fd2ec6d61805eb7c991b3e9ce502fc730 Author: Mark Johnston AuthorDate: 2021-04-06 18:56:37 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 18:56:37 +0000 vm_fault: Shoot down multiply mapped COW source page mappings Reviewed by: kib, rlibby Discussed with: alc Approved by: so Security: CVE-2021-29626 Security: FreeBSD-SA-21:08.vm --- sys/vm/vm_fault.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index cf2db256eaa3..7829b3691d83 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -1298,6 +1298,33 @@ readrest: vm_page_unwire(fs.m, PQ_INACTIVE); vm_page_unlock(fs.m); } + + /* + * Typically, the shadow object is either + * private to this address space + * (OBJ_ONEMAPPING) or its pages are read only. + * In the highly unusual case where the pages of + * a shadow object are read/write shared between + * this and other address spaces, we need to + * ensure that any pmap-level mappings to the + * original, copy-on-write page from the backing + * object are removed from those other address + * spaces. + * + * The flag check is racy, but this is + * tolerable: if OBJ_ONEMAPPING is cleared after + * the check, the busy state ensures that new + * mappings of fs.m can't be created. + * pmap_enter() will replace an existing mapping + * in the current address space. If + * OBJ_ONEMAPPING is set after the check, + * removing mappings will at worse trigger some + * unnecessary page faults. + */ + vm_page_assert_xbusied(fs.m); + if ((fs.first_object->flags & OBJ_ONEMAPPING) == 0) + pmap_remove_all(fs.m); + /* * We no longer need the old page or object. */ From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:19:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B69525B5793; Tue, 6 Apr 2021 19:19: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 4FFHQX2DkSz4d0t; Tue, 6 Apr 2021 19:19:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D222E11A42; Tue, 6 Apr 2021 19:19: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 136JJT5i097615; Tue, 6 Apr 2021 19:19:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JJTWM097614; Tue, 6 Apr 2021 19:19:29 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:19:29 GMT Message-Id: <202104061919.136JJTWM097614@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 110ebf088682 - stable/12 - mount: Disallow mounting over a jail root 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 110ebf0886825227d03d2ab17139a8741272aef5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:19:34 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=110ebf0886825227d03d2ab17139a8741272aef5 commit 110ebf0886825227d03d2ab17139a8741272aef5 Author: Mark Johnston AuthorDate: 2021-04-06 18:57:57 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 18:57:57 +0000 mount: Disallow mounting over a jail root Discussed with: jamie Approved by: so Security: CVE-2020-25584 Security: FreeBSD-SA-21:10.jail_mount --- sys/kern/vfs_mount.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 9befa5361c16..4addc14f7541 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -844,10 +844,10 @@ vfs_domount_first( /* * If the jail of the calling thread lacks permission for this type of - * file system, deny immediately. + * file system, or is trying to cover its own root, deny immediately. */ - if (jailed(td->td_ucred) && !prison_allow(td->td_ucred, - vfsp->vfc_prison_flag)) { + if (jailed(td->td_ucred) && (!prison_allow(td->td_ucred, + vfsp->vfc_prison_flag) || vp == td->td_ucred->cr_prison->pr_root)) { vput(vp); return (EPERM); } From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:19:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAF355B5641; Tue, 6 Apr 2021 19:19: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 4FFHQz0KXFz4dKv; Tue, 6 Apr 2021 19:19: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 B4C111174E; Tue, 6 Apr 2021 19:19: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 136JJqnQ097848; Tue, 6 Apr 2021 19:19:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JJqIo097847; Tue, 6 Apr 2021 19:19:52 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:19:52 GMT Message-Id: <202104061919.136JJqIo097847@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 421c07013f2d - releng/12.2 - MFC r368588: 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/releng/12.2 X-Git-Reftype: branch X-Git-Commit: 421c07013f2d6de9bbd4b528897abef27c558b7e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:19:56 -0000 The branch releng/12.2 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=421c07013f2d6de9bbd4b528897abef27c558b7e commit 421c07013f2d6de9bbd4b528897abef27c558b7e Author: Kristof Provost AuthorDate: 2020-12-15 08:29:45 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 19:00:05 +0000 MFC r368588: pf: Allow net.pf.request_maxcount to be set from loader.conf Mark request_maxcount as RWTUN so we can set it both at runtime and from loader.conf. This avoids users getting caught out by the change from tunable to run time configuration. Suggested by: Franco Fichtner Approved by: so Security: FreeBSD-EN-21:06.pf (cherry picked from commit 08d13750ebdae45bcdb73d52665b823e9ba93db1) --- sys/netpfil/pf/pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index f1d89a752f1e..bbc374365bdd 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -382,7 +382,7 @@ SYSCTL_ULONG(_net_pf, OID_AUTO, states_hashsize, CTLFLAG_RDTUN, &pf_hashsize, 0, "Size of pf(4) states hashtable"); SYSCTL_ULONG(_net_pf, OID_AUTO, source_nodes_hashsize, CTLFLAG_RDTUN, &pf_srchashsize, 0, "Size of pf(4) source nodes hashtable"); -SYSCTL_ULONG(_net_pf, OID_AUTO, request_maxcount, CTLFLAG_RW, +SYSCTL_ULONG(_net_pf, OID_AUTO, request_maxcount, CTLFLAG_RWTUN, &pf_ioctl_maxcount, 0, "Maximum number of tables, addresses, ... in a single ioctl() call"); VNET_DEFINE(void *, pf_swi_cookie); From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:19:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB3735B57CE; Tue, 6 Apr 2021 19:19: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 4FFHQz3JC5z4dCP; Tue, 6 Apr 2021 19:19: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 8869C11A43; Tue, 6 Apr 2021 19:19: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 136JJpp8097818; Tue, 6 Apr 2021 19:19:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JJpRs097817; Tue, 6 Apr 2021 19:19:51 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:19:51 GMT Message-Id: <202104061919.136JJpRs097817@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 49f3ea024bc1 - releng/12.2 - accept_filter: Fix filter parameter handling 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/releng/12.2 X-Git-Reftype: branch X-Git-Commit: 49f3ea024bc1a12c82d3729254221d5a0242794d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:19:57 -0000 The branch releng/12.2 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=49f3ea024bc1a12c82d3729254221d5a0242794d commit 49f3ea024bc1a12c82d3729254221d5a0242794d Author: Mark Johnston AuthorDate: 2021-03-25 21:55:20 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 18:59:00 +0000 accept_filter: Fix filter parameter handling For filters which implement accf_create, the setsockopt(2) handler caches the filter name in the socket, but it also incorrectly frees the buffer containing the copy, leaving a dangling pointer. Note that no accept filters provided in the base system are susceptible to this, as they don't implement accf_create. Reported by: Alexey Kulaev Discussed with: emaste Sponsored by: The FreeBSD Foundation Approved by: so Security: CVE-2021-29627 Security: FreeBSD-SA-21:09.accept_filter (cherry picked from commit 653a437c04440495cd8e7712c7cf39444f26f1ee) (cherry picked from commit 6008a5fad3c110c4ec03cc3fe60ce41c4e548b98) --- sys/kern/uipc_accf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/uipc_accf.c b/sys/kern/uipc_accf.c index 9aab541883d6..98cefe0789a8 100644 --- a/sys/kern/uipc_accf.c +++ b/sys/kern/uipc_accf.c @@ -298,6 +298,7 @@ accept_filt_setopt(struct socket *so, struct sockopt *sopt) so->sol_accept_filter = afp; so->sol_accept_filter_arg = accept_filter_arg; so->sol_accept_filter_str = accept_filter_str; + accept_filter_str = NULL; so->so_options |= SO_ACCEPTFILTER; out: SOCK_UNLOCK(so); From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:20:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 382EB5B57DA; Tue, 6 Apr 2021 19:20: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 4FFHR24X9Lz4dR5; Tue, 6 Apr 2021 19: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 198C711A44; Tue, 6 Apr 2021 19:19: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 136JJt6i097912; Tue, 6 Apr 2021 19:19:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JJtOi097911; Tue, 6 Apr 2021 19:19:55 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:19:55 GMT Message-Id: <202104061919.136JJtOi097911@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d50b66a6c387 - releng/12.2 - mount: Disallow mounting over a jail root 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/releng/12.2 X-Git-Reftype: branch X-Git-Commit: d50b66a6c387930377f94c9362343cca8ddc0886 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:20:00 -0000 The branch releng/12.2 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d50b66a6c387930377f94c9362343cca8ddc0886 commit d50b66a6c387930377f94c9362343cca8ddc0886 Author: Mark Johnston AuthorDate: 2021-04-06 18:57:57 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 19:02:24 +0000 mount: Disallow mounting over a jail root Discussed with: jamie Approved by: so Security: CVE-2020-25584 Security: FreeBSD-SA-21:10.jail_mount (cherry picked from commit 110ebf0886825227d03d2ab17139a8741272aef5) --- sys/kern/vfs_mount.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index afbb3e313d75..a7db7a3dd9d4 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -844,10 +844,10 @@ vfs_domount_first( /* * If the jail of the calling thread lacks permission for this type of - * file system, deny immediately. + * file system, or is trying to cover its own root, deny immediately. */ - if (jailed(td->td_ucred) && !prison_allow(td->td_ucred, - vfsp->vfc_prison_flag)) { + if (jailed(td->td_ucred) && (!prison_allow(td->td_ucred, + vfsp->vfc_prison_flag) || vp == td->td_ucred->cr_prison->pr_root)) { vput(vp); return (EPERM); } From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:20:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADC845B55DF; Tue, 6 Apr 2021 19:20: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 4FFHR32prJz4dFT; Tue, 6 Apr 2021 19: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 B4A7D1174F; Tue, 6 Apr 2021 19:19: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 136JJrV7097870; Tue, 6 Apr 2021 19:19:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JJrUm097869; Tue, 6 Apr 2021 19:19:53 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:19:53 GMT Message-Id: <202104061919.136JJrUm097869@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: f1d1353d2d7b - releng/12.2 - MFC r364480: 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/releng/12.2 X-Git-Reftype: branch X-Git-Commit: f1d1353d2d7b84434cb7d6bb003d6f560bfc83e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:20:01 -0000 The branch releng/12.2 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=f1d1353d2d7b84434cb7d6bb003d6f560bfc83e3 commit f1d1353d2d7b84434cb7d6bb003d6f560bfc83e3 Author: Dimitry Andric AuthorDate: 2020-10-31 18:42:03 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 19:01:24 +0000 MFC r364480: Merge commit 1ce07cd614be from llvm git (by me): Instantiate Error in Target::GetEntryPointAddress() only when necessary When Target::GetEntryPointAddress() calls exe_module->GetObjectFile()->GetEntryPointAddress(), and the returned entry_addr is valid, it can immediately be returned. However, just before that, an llvm::Error value has been setup, but in this case it is not consumed before returning, like is done further below in the function. In https://bugs.freebsd.org/248745 we got a bug report for this, where a very simple test case aborts and dumps core: * thread #1, name = 'testcase', stop reason = breakpoint 1.1 frame #0: 0x00000000002018d4 testcase`main(argc=1, argv=0x00007fffffffea18) at testcase.c:3:5 1 int main(int argc, char *argv[]) 2 { -> 3 return 0; 4 } (lldb) p argc Program aborted due to an unhandled Error: Error value was Success. (Note: Success values must still be checked prior to being destroyed). Thread 1 received signal SIGABRT, Aborted. thr_kill () at thr_kill.S:3 3 thr_kill.S: No such file or directory. (gdb) bt #0 thr_kill () at thr_kill.S:3 #1 0x00000008049a0004 in __raise (s=6) at /usr/src/lib/libc/gen/raise.c:52 #2 0x0000000804916229 in abort () at /usr/src/lib/libc/stdlib/abort.c:67 #3 0x000000000451b5f5 in fatalUncheckedError () at /usr/src/contrib/llvm-project/llvm/lib/Support/Error.cpp:112 #4 0x00000000019cf008 in GetEntryPointAddress () at /usr/src/contrib/llvm-project/llvm/include/llvm/Support/Error.h:267 #5 0x0000000001bccbd8 in ConstructorSetup () at /usr/src/contrib/llvm-project/lldb/source/Target/ThreadPlanCallFunction.cpp:67 #6 0x0000000001bcd2c0 in ThreadPlanCallFunction () at /usr/src/contrib/llvm-project/lldb/source/Target/ThreadPlanCallFunction.cpp:114 #7 0x00000000020076d4 in InferiorCallMmap () at /usr/src/contrib/llvm-project/lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp:97 #8 0x0000000001f4be33 in DoAllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp:604 #9 0x0000000001fe51b9 in AllocatePage () at /usr/src/contrib/llvm-project/lldb/source/Target/Memory.cpp:347 #10 0x0000000001fe5385 in AllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Target/Memory.cpp:383 #11 0x0000000001974da2 in AllocateMemory () at /usr/src/contrib/llvm-project/lldb/source/Target/Process.cpp:2301 #12 CanJIT () at /usr/src/contrib/llvm-project/lldb/source/Target/Process.cpp:2331 #13 0x0000000001a1bf3d in Evaluate () at /usr/src/contrib/llvm-project/lldb/source/Expression/UserExpression.cpp:190 #14 0x00000000019ce7a2 in EvaluateExpression () at /usr/src/contrib/llvm-project/lldb/source/Target/Target.cpp:2372 #15 0x0000000001ad784c in EvaluateExpression () at /usr/src/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp:414 #16 0x0000000001ad86ae in DoExecute () at /usr/src/contrib/llvm-project/lldb/source/Commands/CommandObjectExpression.cpp:646 #17 0x0000000001a5e3ed in Execute () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandObject.cpp:1003 #18 0x0000000001a6c4a3 in HandleCommand () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:1762 #19 0x0000000001a6f98c in IOHandlerInputComplete () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2760 #20 0x0000000001a90b08 in Run () at /usr/src/contrib/llvm-project/lldb/source/Core/IOHandler.cpp:548 #21 0x00000000019a6c6a in ExecuteIOHandlers () at /usr/src/contrib/llvm-project/lldb/source/Core/Debugger.cpp:903 #22 0x0000000001a70337 in RunCommandInterpreter () at /usr/src/contrib/llvm-project/lldb/source/Interpreter/CommandInterpreter.cpp:2946 #23 0x0000000001d9d812 in RunCommandInterpreter () at /usr/src/contrib/llvm-project/lldb/source/API/SBDebugger.cpp:1169 #24 0x0000000001918be8 in MainLoop () at /usr/src/contrib/llvm-project/lldb/tools/driver/Driver.cpp:675 #25 0x000000000191a114 in main () at /usr/src/contrib/llvm-project/lldb/tools/driver/Driver.cpp:890 Fix the incorrect error catch by only instantiating an Error object if it is necessary. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D86355 This should fix lldb aborting as described in the scenario above. Reported by: dmgk PR: 248745 Approved by: so Security: FreeBSD-EN-21:07.lldb (cherry picked from commit eb41eed03c084bd6eefe91992b0f704caa0fb58b) --- contrib/llvm-project/lldb/source/Target/Target.cpp | 31 +++++++++++----------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/contrib/llvm-project/lldb/source/Target/Target.cpp b/contrib/llvm-project/lldb/source/Target/Target.cpp index 83e6f3062666..47e4c78496ab 100644 --- a/contrib/llvm-project/lldb/source/Target/Target.cpp +++ b/contrib/llvm-project/lldb/source/Target/Target.cpp @@ -2412,21 +2412,13 @@ lldb::addr_t Target::GetPersistentSymbol(ConstString name) { llvm::Expected Target::GetEntryPointAddress() { Module *exe_module = GetExecutableModulePointer(); - llvm::Error error = llvm::Error::success(); - assert(!error); // Check the success value when assertions are enabled. - if (!exe_module || !exe_module->GetObjectFile()) { - error = llvm::make_error("No primary executable found", - llvm::inconvertibleErrorCode()); - } else { + // Try to find the entry point address in the primary executable. + const bool has_primary_executable = exe_module && exe_module->GetObjectFile(); + if (has_primary_executable) { Address entry_addr = exe_module->GetObjectFile()->GetEntryPointAddress(); if (entry_addr.IsValid()) return entry_addr; - - error = llvm::make_error( - "Could not find entry point address for executable module \"" + - exe_module->GetFileSpec().GetFilename().GetStringRef() + "\"", - llvm::inconvertibleErrorCode()); } const ModuleList &modules = GetImages(); @@ -2437,14 +2429,21 @@ llvm::Expected Target::GetEntryPointAddress() { continue; Address entry_addr = module_sp->GetObjectFile()->GetEntryPointAddress(); - if (entry_addr.IsValid()) { - // Discard the error. - llvm::consumeError(std::move(error)); + if (entry_addr.IsValid()) return entry_addr; - } } - return std::move(error); + // We haven't found the entry point address. Return an appropriate error. + if (!has_primary_executable) + return llvm::make_error( + "No primary executable found and could not find entry point address in " + "any executable module", + llvm::inconvertibleErrorCode()); + + return llvm::make_error( + "Could not find entry point address for primary executable module \"" + + exe_module->GetFileSpec().GetFilename().GetStringRef() + "\"", + llvm::inconvertibleErrorCode()); } lldb::addr_t Target::GetCallableLoadAddress(lldb::addr_t load_addr, From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:20:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 398A95B572C; Tue, 6 Apr 2021 19:20: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 4FFHR64Q6Vz4dHk; Tue, 6 Apr 2021 19:20: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 27BDF11B99; Tue, 6 Apr 2021 19: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 136JJvgH097933; Tue, 6 Apr 2021 19: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 136JJvTL097932; Tue, 6 Apr 2021 19:19:57 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:19:57 GMT Message-Id: <202104061919.136JJvTL097932@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: fb01adcfa76f - releng/12.2 - Add UPDATING entries and bump version 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/releng/12.2 X-Git-Reftype: branch X-Git-Commit: fb01adcfa76f0f32b7788d3a97c9fa79703a1caf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:20:04 -0000 The branch releng/12.2 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=fb01adcfa76f0f32b7788d3a97c9fa79703a1caf commit fb01adcfa76f0f32b7788d3a97c9fa79703a1caf Author: Mark Johnston AuthorDate: 2021-04-06 19:07:29 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 19:07:29 +0000 Add UPDATING entries and bump version Approved by: so --- UPDATING | 16 ++++++++++++++++ sys/conf/newvers.sh | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index dcb82fbcf4a6..60c75b005a0b 100644 --- a/UPDATING +++ b/UPDATING @@ -16,6 +16,22 @@ from older versions of FreeBSD, try WITHOUT_CLANG and WITH_GCC to bootstrap to the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20210406: p6 FreeBSD-EN-21:06.pf + FreeBSD-EN-21:07.lldb + FreeBSD-SA-21:08.vm + FreeBSD-SA-21:09.accept_filter + FreeBSD-SA-21:10.jail_mount + + net.pf.request_maxcount not settable from loader.conf(5) [EN-21:06.pf] + + lldb abort on print command [EN-21:07.lldb] + + Memory disclosure by stale virtual memory mapping [SA-21:08.vm] + + Double free in accept_filter(9) socket configuration interface [SA-21:09.accept_filter] + + Jail escape possible by mounting over jail root [SA-21:10.jail_mount] + 20210325: p5 FreeBSD-SA-21:07.openssl Fix multiple OpenSSL issues [SA-21:07.openssl] diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 68ee29d30168..51990433f5e6 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -49,7 +49,7 @@ TYPE="FreeBSD" REVISION="12.2" -BRANCH="RELEASE-p5" +BRANCH="RELEASE-p6" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:20:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA8615B55DE; Tue, 6 Apr 2021 19:20: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 4FFHR24Jb1z4dR4; Tue, 6 Apr 2021 19: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 E182F11969; Tue, 6 Apr 2021 19:19: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 136JJsFO097891; Tue, 6 Apr 2021 19:19:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JJsh1097890; Tue, 6 Apr 2021 19:19:54 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:19:54 GMT Message-Id: <202104061919.136JJsh1097890@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: e7b28b5bb38e - releng/12.2 - vm_fault: Shoot down multiply mapped COW source page mappings 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/releng/12.2 X-Git-Reftype: branch X-Git-Commit: e7b28b5bb38ed942bc49b4cf9d313f9a051c9966 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:20:01 -0000 The branch releng/12.2 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e7b28b5bb38ed942bc49b4cf9d313f9a051c9966 commit e7b28b5bb38ed942bc49b4cf9d313f9a051c9966 Author: Mark Johnston AuthorDate: 2021-04-06 18:56:37 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 19:02:17 +0000 vm_fault: Shoot down multiply mapped COW source page mappings Reviewed by: kib, rlibby Discussed with: alc Approved by: so Security: CVE-2021-29626 Security: FreeBSD-SA-21:08.vm (cherry picked from commit 304a533fd2ec6d61805eb7c991b3e9ce502fc730) --- sys/vm/vm_fault.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index cf2db256eaa3..7829b3691d83 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -1298,6 +1298,33 @@ readrest: vm_page_unwire(fs.m, PQ_INACTIVE); vm_page_unlock(fs.m); } + + /* + * Typically, the shadow object is either + * private to this address space + * (OBJ_ONEMAPPING) or its pages are read only. + * In the highly unusual case where the pages of + * a shadow object are read/write shared between + * this and other address spaces, we need to + * ensure that any pmap-level mappings to the + * original, copy-on-write page from the backing + * object are removed from those other address + * spaces. + * + * The flag check is racy, but this is + * tolerable: if OBJ_ONEMAPPING is cleared after + * the check, the busy state ensures that new + * mappings of fs.m can't be created. + * pmap_enter() will replace an existing mapping + * in the current address space. If + * OBJ_ONEMAPPING is set after the check, + * removing mappings will at worse trigger some + * unnecessary page faults. + */ + vm_page_assert_xbusied(fs.m); + if ((fs.first_object->flags & OBJ_ONEMAPPING) == 0) + pmap_remove_all(fs.m); + /* * We no longer need the old page or object. */ From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:20:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 088205B57F3; Tue, 6 Apr 2021 19:20: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 4FFHRF1nF4z4dX1; Tue, 6 Apr 2021 19:20: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 BDB6011C15; Tue, 6 Apr 2021 19:20: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 136JK6Th000732; Tue, 6 Apr 2021 19:20:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JK63K000730; Tue, 6 Apr 2021 19:20:06 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:20:06 GMT Message-Id: <202104061920.136JK63K000730@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 71a0b26df14a - stable/11 - vm_fault: Shoot down multiply mapped COW source page mappings 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/stable/11 X-Git-Reftype: branch X-Git-Commit: 71a0b26df14a18b720faaa924bd4e18fcb9638d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:20:11 -0000 The branch stable/11 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=71a0b26df14a18b720faaa924bd4e18fcb9638d5 commit 71a0b26df14a18b720faaa924bd4e18fcb9638d5 Author: Mark Johnston AuthorDate: 2021-04-06 19:09:01 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 19:09:01 +0000 vm_fault: Shoot down multiply mapped COW source page mappings Reviewed by: kib, rlibby Discussed with: alc Approved by: so Security: CVE-2021-29626 Security: FreeBSD-SA-21:08.vm --- sys/vm/vm_fault.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index cb21edb23f05..1d4736aa92bc 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -1147,6 +1147,33 @@ readrest: vm_page_unwire(fs.m, PQ_INACTIVE); vm_page_unlock(fs.m); } + + /* + * Typically, the shadow object is either + * private to this address space + * (OBJ_ONEMAPPING) or its pages are read only. + * In the highly unusual case where the pages of + * a shadow object are read/write shared between + * this and other address spaces, we need to + * ensure that any pmap-level mappings to the + * original, copy-on-write page from the backing + * object are removed from those other address + * spaces. + * + * The flag check is racy, but this is + * tolerable: if OBJ_ONEMAPPING is cleared after + * the check, the busy state ensures that new + * mappings of fs.m can't be created. + * pmap_enter() will replace an existing mapping + * in the current address space. If + * OBJ_ONEMAPPING is set after the check, + * removing mappings will at worse trigger some + * unnecessary page faults. + */ + vm_page_assert_xbusied(fs.m); + if ((fs.first_object->flags & OBJ_ONEMAPPING) == 0) + pmap_remove_all(fs.m); + /* * We no longer need the old page or object. */ From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:20:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CF605B57F8; Tue, 6 Apr 2021 19:20: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 4FFHRJ3b5mz4dPd; Tue, 6 Apr 2021 19:20: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 C251911C16; Tue, 6 Apr 2021 19:20: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 136JK7Kg000944; Tue, 6 Apr 2021 19:20:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JK78P000942; Tue, 6 Apr 2021 19:20:07 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:20:07 GMT Message-Id: <202104061920.136JK78P000942@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 6f7815083ad6 - stable/11 - mount: Disallow mounting over a jail root 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/stable/11 X-Git-Reftype: branch X-Git-Commit: 6f7815083ad66c34bad0dfa08c7033ff670b3be1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:20:13 -0000 The branch stable/11 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6f7815083ad66c34bad0dfa08c7033ff670b3be1 commit 6f7815083ad66c34bad0dfa08c7033ff670b3be1 Author: Mark Johnston AuthorDate: 2021-04-06 19:09:43 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 19:09:43 +0000 mount: Disallow mounting over a jail root Discussed with: jamie Approved by: so Security: CVE-2020-25584 Security: FreeBSD-SA-21:10.jail_mount --- sys/kern/vfs_mount.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 7885052c27d6..613872303982 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -830,6 +830,11 @@ vfs_domount_first( ASSERT_VOP_ELOCKED(vp, __func__); KASSERT((fsflags & MNT_UPDATE) == 0, ("MNT_UPDATE shouldn't be here")); + if (vp == td->td_ucred->cr_prison->pr_root) { + vput(vp); + return (EPERM); + } + /* * If the user is not root, ensure that they own the directory * onto which we are attempting to mount. From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:20:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A29DB5B599B; Tue, 6 Apr 2021 19:20: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 4FFHRf10qPz4dk1; Tue, 6 Apr 2021 19:20: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 5FBDF11C8A; Tue, 6 Apr 2021 19:20: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 136JKN5C006537; Tue, 6 Apr 2021 19:20:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JKNIO006536; Tue, 6 Apr 2021 19:20:23 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:20:23 GMT Message-Id: <202104061920.136JKNIO006536@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: e5e06b6d295b - releng/11.4 - vm_fault: Shoot down multiply mapped COW source page mappings 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/releng/11.4 X-Git-Reftype: branch X-Git-Commit: e5e06b6d295b5445a79eafaaa17af5aba1b8e972 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:20:30 -0000 The branch releng/11.4 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e5e06b6d295b5445a79eafaaa17af5aba1b8e972 commit e5e06b6d295b5445a79eafaaa17af5aba1b8e972 Author: Mark Johnston AuthorDate: 2021-04-06 19:09:01 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 19:10:17 +0000 vm_fault: Shoot down multiply mapped COW source page mappings Reviewed by: kib, rlibby Discussed with: alc Approved by: so Security: CVE-2021-29626 Security: FreeBSD-SA-21:08.vm (cherry picked from commit 71a0b26df14a18b720faaa924bd4e18fcb9638d5) --- sys/vm/vm_fault.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c index cb21edb23f05..1d4736aa92bc 100644 --- a/sys/vm/vm_fault.c +++ b/sys/vm/vm_fault.c @@ -1147,6 +1147,33 @@ readrest: vm_page_unwire(fs.m, PQ_INACTIVE); vm_page_unlock(fs.m); } + + /* + * Typically, the shadow object is either + * private to this address space + * (OBJ_ONEMAPPING) or its pages are read only. + * In the highly unusual case where the pages of + * a shadow object are read/write shared between + * this and other address spaces, we need to + * ensure that any pmap-level mappings to the + * original, copy-on-write page from the backing + * object are removed from those other address + * spaces. + * + * The flag check is racy, but this is + * tolerable: if OBJ_ONEMAPPING is cleared after + * the check, the busy state ensures that new + * mappings of fs.m can't be created. + * pmap_enter() will replace an existing mapping + * in the current address space. If + * OBJ_ONEMAPPING is set after the check, + * removing mappings will at worse trigger some + * unnecessary page faults. + */ + vm_page_assert_xbusied(fs.m); + if ((fs.first_object->flags & OBJ_ONEMAPPING) == 0) + pmap_remove_all(fs.m); + /* * We no longer need the old page or object. */ From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:20:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF41C5B599C; Tue, 6 Apr 2021 19:20: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 4FFHRd0b4yz4dTB; Tue, 6 Apr 2021 19:20: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 86E3D11B2B; Tue, 6 Apr 2021 19:20: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 136JKOdZ006558; Tue, 6 Apr 2021 19:20:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JKOtx006557; Tue, 6 Apr 2021 19:20:24 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:20:24 GMT Message-Id: <202104061920.136JKOtx006557@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: e59bfcaa37fc - releng/11.4 - mount: Disallow mounting over a jail root 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/releng/11.4 X-Git-Reftype: branch X-Git-Commit: e59bfcaa37fc8fe5c6e200e53aa6daa841751cb7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:20:31 -0000 The branch releng/11.4 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e59bfcaa37fc8fe5c6e200e53aa6daa841751cb7 commit e59bfcaa37fc8fe5c6e200e53aa6daa841751cb7 Author: Mark Johnston AuthorDate: 2021-04-06 19:09:43 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 19:10:21 +0000 mount: Disallow mounting over a jail root Discussed with: jamie Approved by: so Security: CVE-2020-25584 Security: FreeBSD-SA-21:10.jail_mount (cherry picked from commit 6f7815083ad66c34bad0dfa08c7033ff670b3be1) --- sys/kern/vfs_mount.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 3e5ebe715a42..c88f2be54d02 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -830,6 +830,11 @@ vfs_domount_first( ASSERT_VOP_ELOCKED(vp, __func__); KASSERT((fsflags & MNT_UPDATE) == 0, ("MNT_UPDATE shouldn't be here")); + if (vp == td->td_ucred->cr_prison->pr_root) { + vput(vp); + return (EPERM); + } + /* * If the user is not root, ensure that they own the directory * onto which we are attempting to mount. From owner-dev-commits-src-all@freebsd.org Tue Apr 6 19:20:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26FA65B58CC; Tue, 6 Apr 2021 19:20:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFHRd45Zpz4dgR; Tue, 6 Apr 2021 19:20: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 ADC9411B2C; Tue, 6 Apr 2021 19:20: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 136JKPS2006579; Tue, 6 Apr 2021 19:20:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136JKPQk006578; Tue, 6 Apr 2021 19:20:25 GMT (envelope-from git) Date: Tue, 6 Apr 2021 19:20:25 GMT Message-Id: <202104061920.136JKPQk006578@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: b2127f3c6b29 - releng/11.4 - Add UPDATING entries and bump version 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/releng/11.4 X-Git-Reftype: branch X-Git-Commit: b2127f3c6b298ad55cf2d84c484a7cf09b120191 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 19:20:31 -0000 The branch releng/11.4 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=b2127f3c6b298ad55cf2d84c484a7cf09b120191 commit b2127f3c6b298ad55cf2d84c484a7cf09b120191 Author: Mark Johnston AuthorDate: 2021-04-06 19:11:19 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 19:11:19 +0000 Add UPDATING entries and bump version Approved by: so --- UPDATING | 7 +++++++ sys/conf/newvers.sh | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index f67b1d59b118..c9f01e72a4ba 100644 --- a/UPDATING +++ b/UPDATING @@ -16,6 +16,13 @@ from older versions of FreeBSD, try WITHOUT_CLANG and WITH_GCC to bootstrap to the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20210406: p9 FreeBSD-SA-21:08.vm + FreeBSD-SA-21:10.jail_mount + + Memory disclosure by stale virtual memory mapping [SA-21:08.vm] + + Jail escape possible by mounting over jail root [SA-21:10.jail_mount] + 20210223: p8 FreeBSD-SA-21:03.pam_login_access FreeBSD-SA-21:04.jail_remove FreeBSD-SA-21:05.jail_chdir diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 96d5d515e010..095499d9ea62 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -44,7 +44,7 @@ TYPE="FreeBSD" REVISION="11.4" -BRANCH="RELEASE-p8" +BRANCH="RELEASE-p9" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-dev-commits-src-all@freebsd.org Tue Apr 6 20:19:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6FF95B7B0A; Tue, 6 Apr 2021 20:19: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 4FFJmD40Cqz4lgY; Tue, 6 Apr 2021 20:19: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 42A6C124C5; Tue, 6 Apr 2021 20:19: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 136KJuWd078079; Tue, 6 Apr 2021 20:19:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136KJuQj078078; Tue, 6 Apr 2021 20:19:56 GMT (envelope-from git) Date: Tue, 6 Apr 2021 20:19:56 GMT Message-Id: <202104062019.136KJuQj078078@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 81526c74d9cd - releng/12.2 - Correct EN numbers in the most recent UPDATING entry 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/releng/12.2 X-Git-Reftype: branch X-Git-Commit: 81526c74d9cd16944ca240573680c358a031c989 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 20:19:56 -0000 The branch releng/12.2 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=81526c74d9cd16944ca240573680c358a031c989 commit 81526c74d9cd16944ca240573680c358a031c989 Author: Mark Johnston AuthorDate: 2021-04-06 20:18:44 +0000 Commit: Mark Johnston CommitDate: 2021-04-06 20:18:44 +0000 Correct EN numbers in the most recent UPDATING entry Approved by: so --- UPDATING | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/UPDATING b/UPDATING index 60c75b005a0b..898bd853fe9a 100644 --- a/UPDATING +++ b/UPDATING @@ -16,15 +16,15 @@ from older versions of FreeBSD, try WITHOUT_CLANG and WITH_GCC to bootstrap to the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. -20210406: p6 FreeBSD-EN-21:06.pf - FreeBSD-EN-21:07.lldb +20210406: p6 FreeBSD-EN-21:09.pf + FreeBSD-EN-21:10.lldb FreeBSD-SA-21:08.vm FreeBSD-SA-21:09.accept_filter FreeBSD-SA-21:10.jail_mount - net.pf.request_maxcount not settable from loader.conf(5) [EN-21:06.pf] + net.pf.request_maxcount not settable from loader.conf(5) [EN-21:09.pf] - lldb abort on print command [EN-21:07.lldb] + lldb abort on print command [EN-21:10.lldb] Memory disclosure by stale virtual memory mapping [SA-21:08.vm] From owner-dev-commits-src-all@freebsd.org Tue Apr 6 20:28:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8190A5BA0D0; Tue, 6 Apr 2021 20:28:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFJxk1qMMz4ppb; Tue, 6 Apr 2021 20:28: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 AE696124EF; Tue, 6 Apr 2021 20:28: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 136KS9dt091664; Tue, 6 Apr 2021 20:28:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136KS92E091662; Tue, 6 Apr 2021 20:28:09 GMT (envelope-from git) Date: Tue, 6 Apr 2021 20:28:09 GMT Message-Id: <202104062028.136KS92E091662@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rene Ladan Subject: git: 11f47f17e122 - main - ports(7): update instructions for git MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rene X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 11f47f17e122b6f185002e4ec6cfe749b3e7a6bd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 20:28:10 -0000 The branch main has been updated by rene (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=11f47f17e122b6f185002e4ec6cfe749b3e7a6bd commit 11f47f17e122b6f185002e4ec6cfe749b3e7a6bd Author: Rene Ladan AuthorDate: 2021-04-06 20:24:12 +0000 Commit: Rene Ladan CommitDate: 2021-04-06 20:26:03 +0000 ports(7): update instructions for git Reviewed by: gjb, imp, lwhsu, mat Differential Revision: https://reviews.freebsd.org/D29502 --- share/man/man7/ports.7 | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/share/man/man7/ports.7 b/share/man/man7/ports.7 index d428770f921c..c3dbbc680050 100644 --- a/share/man/man7/ports.7 +++ b/share/man/man7/ports.7 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 18, 2021 +.Dd April 6, 2021 .Dt PORTS 7 .Os .Sh NAME @@ -64,23 +64,35 @@ The .Fx Ports Collection is maintained in several branches, which differ mostly by versions of software provided: the -.Em head -branch contains all the latest changes, while the +.Em main +branch contains all the latest changes and corresponds to the +.Em latest +package set, while the .Em quarterly branches only provide critical fixes. The -.Em head -branch can be installed or updated from the Subversion repository located at: +.Em main +branch can be cloned and updated from the Git repository located at: .Pp -.Lk https://svn.FreeBSD.org/ports/head +.Lk https://git.FreeBSD.org/ports.git +.Pp +so eg: +.Pp +.Cm git clone https://git.FreeBSD.org/ports.git .Pp The .Em quarterly -branches can be found in Subversion in the -.Pa branches/ -subdirectory, eg: +branches can be found in Git as branches like +.Pa yyyyQn +, where +.Em yyyy +indicates the year and +.Em n +indicates the quarter +.Po 1 to 4 +.Pc , eg: .Pp -.Lk https://svn.FreeBSD.org/ports/branches/2019Q1 +.Cm git clone -b 2021Q2 https://git.FreeBSD.org/ports.git .Pp It is generally a good idea to use the .Nm @@ -92,7 +104,7 @@ By default, for the .Xr pkg 8 is configured to install packages built from the -.Em head +.Em main branch, while for .Fx STABLE or RELEASE versions it is configured to install packages built from From owner-dev-commits-src-all@freebsd.org Tue Apr 6 20:39:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B84A5BD60C; Tue, 6 Apr 2021 20:39: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 4FFKBl0l9gz4t0G; Tue, 6 Apr 2021 20:39: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 0BC9C128F0; Tue, 6 Apr 2021 20:39: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 136KdQdB005149; Tue, 6 Apr 2021 20:39:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136KdQjl005148; Tue, 6 Apr 2021 20:39:26 GMT (envelope-from git) Date: Tue, 6 Apr 2021 20:39:26 GMT Message-Id: <202104062039.136KdQjl005148@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: 13b3862ee874 - main - cache: update an assert on CACHE_FPL_STATUS_ABORTED 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: 13b3862ee874db0b5efae484934de9b20da864e4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 20:39:27 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=13b3862ee874db0b5efae484934de9b20da864e4 commit 13b3862ee874db0b5efae484934de9b20da864e4 Author: Mateusz Guzik AuthorDate: 2021-04-06 20:31:48 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-06 20:31:58 +0000 cache: update an assert on CACHE_FPL_STATUS_ABORTED Since symlink support it can get upgraded to CACHE_FPL_STATUS_DESTROYED. Reported by: bdrewery --- sys/kern/vfs_cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 649ee9b9783b..c4b6fdd468db 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4660,7 +4660,8 @@ cache_fplookup_final_withparent(struct cache_fpl *fpl) error = cache_fplookup_final_child(fpl, tvs); if (__predict_false(error != 0)) { - MPASS(fpl->status == CACHE_FPL_STATUS_ABORTED); + MPASS(fpl->status == CACHE_FPL_STATUS_ABORTED || + fpl->status == CACHE_FPL_STATUS_DESTROYED); if ((cnp->cn_flags & LOCKPARENT) != 0) vput(dvp); else From owner-dev-commits-src-all@freebsd.org Tue Apr 6 21:28:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF9EE5BED48; Tue, 6 Apr 2021 21:28: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 4FFLH460P9z4xmw; Tue, 6 Apr 2021 21:28: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 C08C213798; Tue, 6 Apr 2021 21:28: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 136LSGPw072317; Tue, 6 Apr 2021 21:28:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136LSGBe072316; Tue, 6 Apr 2021 21:28:16 GMT (envelope-from git) Date: Tue, 6 Apr 2021 21:28:16 GMT Message-Id: <202104062128.136LSGBe072316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: ac503c194cd8 - main - Introduce "soft" serseq variant. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ac503c194cd8e9dbef5c120e87f9521e1a89003a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 21:28:16 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=ac503c194cd8e9dbef5c120e87f9521e1a89003a commit ac503c194cd8e9dbef5c120e87f9521e1a89003a Author: Alexander Motin AuthorDate: 2021-04-06 21:27:16 +0000 Commit: Alexander Motin CommitDate: 2021-04-06 21:27:16 +0000 Introduce "soft" serseq variant. With new ZFS prefetcher improvements it is no longer needed to fully serialize reads to reach decent prediction hit rate. Softer variant only creates small time window to reduce races instead of completely blocking following reads while previous is running. It much less hurts the performance in case of prediction miss. MFC after: 1 month --- sys/cam/ctl/ctl.c | 3 --- sys/cam/ctl/ctl_backend.h | 1 + sys/cam/ctl/ctl_backend_block.c | 32 ++++++++++++++++++++++---------- sys/cam/ctl/ctl_backend_ramdisk.c | 5 ++++- usr.sbin/ctladm/ctladm.8 | 9 +++++---- 5 files changed, 32 insertions(+), 18 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index cae6dd4aa101..575c8eea5198 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -13272,9 +13272,6 @@ ctl_serseq_done(union ctl_io *io) { struct ctl_lun *lun = CTL_LUN(io); - if (lun->be_lun->serseq == CTL_LUN_SERSEQ_OFF) - return; - /* This is racy, but should not be a problem. */ if (!TAILQ_EMPTY(&io->io_hdr.blocked_queue)) { mtx_lock(&lun->lun_lock); diff --git a/sys/cam/ctl/ctl_backend.h b/sys/cam/ctl/ctl_backend.h index 05e65abe41f8..fe4e7f5df1d0 100644 --- a/sys/cam/ctl/ctl_backend.h +++ b/sys/cam/ctl/ctl_backend.h @@ -47,6 +47,7 @@ typedef enum { CTL_LUN_SERSEQ_OFF, + CTL_LUN_SERSEQ_SOFT, CTL_LUN_SERSEQ_READ, CTL_LUN_SERSEQ_ON } ctl_lun_serseq; diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 9f96c157d5ae..4ffaf0912915 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -490,13 +490,12 @@ ctl_be_block_move_done(union ctl_io *io, bool samethr) static void ctl_be_block_biodone(struct bio *bio) { - struct ctl_be_block_io *beio; - struct ctl_be_block_lun *be_lun; + struct ctl_be_block_io *beio = bio->bio_caller1; + struct ctl_be_block_lun *be_lun = beio->lun; + struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; union ctl_io *io; int error; - beio = bio->bio_caller1; - be_lun = beio->lun; io = beio->io; DPRINTF("entered\n"); @@ -576,7 +575,8 @@ ctl_be_block_biodone(struct bio *bio) if ((ARGS(io)->flags & CTL_LLF_READ) && beio->beio_cont == NULL) { ctl_set_success(&io->scsiio); - ctl_serseq_done(io); + if (cbe_lun->serseq >= CTL_LUN_SERSEQ_SOFT) + ctl_serseq_done(io); } ctl_datamove(io); } @@ -636,6 +636,7 @@ static void ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio) { + struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; struct ctl_be_block_filedata *file_data; union ctl_io *io; struct uio xuio; @@ -679,6 +680,9 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, if (beio->bio_cmd == BIO_READ) { vn_lock(be_lun->vn, LK_SHARED | LK_RETRY); + if (beio->beio_cont == NULL && + cbe_lun->serseq == CTL_LUN_SERSEQ_SOFT) + ctl_serseq_done(io); /* * UFS pays attention to IO_DIRECT for reads. If the * DIRECTIO option is configured into the kernel, it calls @@ -786,7 +790,8 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, if ((ARGS(io)->flags & CTL_LLF_READ) && beio->beio_cont == NULL) { ctl_set_success(&io->scsiio); - ctl_serseq_done(io); + if (cbe_lun->serseq > CTL_LUN_SERSEQ_SOFT) + ctl_serseq_done(io); } ctl_datamove(io); } @@ -863,6 +868,7 @@ static void ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio) { + struct ctl_be_lun *cbe_lun = &be_lun->cbe_lun; union ctl_io *io; struct cdevsw *csw; struct cdev *dev; @@ -904,9 +910,12 @@ ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun, csw = devvn_refthread(be_lun->vn, &dev, &ref); if (csw) { - if (beio->bio_cmd == BIO_READ) + if (beio->bio_cmd == BIO_READ) { + if (beio->beio_cont == NULL && + cbe_lun->serseq == CTL_LUN_SERSEQ_SOFT) + ctl_serseq_done(io); error = csw->d_read(dev, &xuio, flags); - else + } else error = csw->d_write(dev, &xuio, flags); dev_relthread(dev, ref); } else @@ -952,7 +961,8 @@ ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun, if ((ARGS(io)->flags & CTL_LLF_READ) && beio->beio_cont == NULL) { ctl_set_success(&io->scsiio); - ctl_serseq_done(io); + if (cbe_lun->serseq > CTL_LUN_SERSEQ_SOFT) + ctl_serseq_done(io); } ctl_datamove(io); } @@ -2187,12 +2197,14 @@ again: ctl_be_block_close(be_lun); cbe_lun->serseq = CTL_LUN_SERSEQ_OFF; if (be_lun->dispatch != ctl_be_block_dispatch_dev) - cbe_lun->serseq = CTL_LUN_SERSEQ_READ; + cbe_lun->serseq = CTL_LUN_SERSEQ_SOFT; value = dnvlist_get_string(cbe_lun->options, "serseq", NULL); if (value != NULL && strcmp(value, "on") == 0) cbe_lun->serseq = CTL_LUN_SERSEQ_ON; else if (value != NULL && strcmp(value, "read") == 0) cbe_lun->serseq = CTL_LUN_SERSEQ_READ; + else if (value != NULL && strcmp(value, "soft") == 0) + cbe_lun->serseq = CTL_LUN_SERSEQ_SOFT; else if (value != NULL && strcmp(value, "off") == 0) cbe_lun->serseq = CTL_LUN_SERSEQ_OFF; return (0); diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c index e67d699bda70..6febdd469bdd 100644 --- a/sys/cam/ctl/ctl_backend_ramdisk.c +++ b/sys/cam/ctl/ctl_backend_ramdisk.c @@ -507,7 +507,8 @@ nospc: if ((ARGS(io)->flags & CTL_LLF_READ) && ARGS(io)->len <= PRIV(io)->len) { ctl_set_success(&io->scsiio); - ctl_serseq_done(io); + if (cbe_lun->serseq >= CTL_LUN_SERSEQ_SOFT) + ctl_serseq_done(io); } ctl_datamove(io); } @@ -1036,6 +1037,8 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc, cbe_lun->serseq = CTL_LUN_SERSEQ_ON; else if (value != NULL && strcmp(value, "read") == 0) cbe_lun->serseq = CTL_LUN_SERSEQ_READ; + else if (value != NULL && strcmp(value, "soft") == 0) + cbe_lun->serseq = CTL_LUN_SERSEQ_SOFT; else if (value != NULL && strcmp(value, "off") == 0) cbe_lun->serseq = CTL_LUN_SERSEQ_OFF; diff --git a/usr.sbin/ctladm/ctladm.8 b/usr.sbin/ctladm/ctladm.8 index 25380c86441a..b8b90ad200fe 100644 --- a/usr.sbin/ctladm/ctladm.8 +++ b/usr.sbin/ctladm/ctladm.8 @@ -1,6 +1,6 @@ .\" .\" Copyright (c) 2003 Silicon Graphics International Corp. -.\" Copyright (c) 2015-2020 Alexander Motin +.\" Copyright (c) 2015-2021 Alexander Motin .\" Copyright (c) 2018 Marcelo Araujo .\" All rights reserved. .\" @@ -36,7 +36,7 @@ .\" $Id: //depot/users/kenm/FreeBSD-test2/usr.sbin/ctladm/ctladm.8#3 $ .\" $FreeBSD$ .\" -.Dd November 23, 2020 +.Dd March 9, 2021 .Dt CTLADM 8 .Os .Sh NAME @@ -919,8 +919,9 @@ appropriate commands and task attributes. The default value is "restricted". It improves data integrity, but may introduce some additional delays. .It Va serseq -Set to "on" to serialize consecutive reads/writes. -Set to "read" to serialize consecutive reads. +Set to "on" to fully serialize consecutive reads/writes. +Set to "read" to fully serialize consecutive reads. +Set to "soft" to slightly serialize consecutive reads. Set to "off" to allow them be issued in parallel. Parallel issue of consecutive operations may confuse logic of the backing file system, hurting performance; but it may improve performance From owner-dev-commits-src-all@freebsd.org Tue Apr 6 21:28:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E48D5BEC7A; Tue, 6 Apr 2021 21:28:26 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFLH936nKz4xvs; Tue, 6 Apr 2021 21:28:21 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 136LS9mw080659 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 7 Apr 2021 00:28:12 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 136LS9mw080659 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 136LS9Cb080658; Wed, 7 Apr 2021 00:28:09 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 7 Apr 2021 00:28:09 +0300 From: Konstantin Belousov To: Jung-uk Kim Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d36d68161517 - main - rtld dl_iterate_phdr(): dlpi_tls_data is wrong Message-ID: References: <202104060037.1360bKwT029051@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=0.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM,FREEMAIL_REPLY, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4FFLH936nKz4xvs X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [0.99 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2001:470:d5e7:1::1:from]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; FREEMAIL_FROM(0.00)[gmail.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_SPF_SOFTFAIL(0.00)[~all:c]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; SPAMHAUS_ZRD(0.00)[2001:470:d5e7:1::1:from:127.0.2.255]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.99)[0.986]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; MIME_TRACE(0.00)[0:+]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 21:28:27 -0000 On Tue, Apr 06, 2021 at 09:46:59PM +0300, Konstantin Belousov wrote: > On Tue, Apr 06, 2021 at 02:35:59PM -0400, Jung-uk Kim wrote: > > On 21. 4. 5., Konstantin Belousov wrote: > > > The branch main has been updated by kib: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=d36d6816151705907393889d661cbfd25c630ca8 > > > > > > commit d36d6816151705907393889d661cbfd25c630ca8 > > > Author: Konstantin Belousov > > > AuthorDate: 2021-04-05 03:05:44 +0000 > > > Commit: Konstantin Belousov > > > CommitDate: 2021-04-06 00:23:08 +0000 > > > > > > rtld dl_iterate_phdr(): dlpi_tls_data is wrong > > > > > > dl_iterate_phdr() dlpi_tls_data should provide the TLS module segment > > > address, and not the TLS init segment address as it does now. > > > > > > Reported by: emacsray@gmail.com > > > PR: 254774 > > > Sponsored by: The FreeBSD Foundation > > > MFC after: 1 week > > > > I started having strange hangs in various applications from yesterday, > > e.g., Xorg, Thunderbird, etc. Today, I updated ports tree from Git for > > the first time and started updating packages. Then, I experienced > > similar problems, e.g., building editors/kate, multimedia/vlc, etc., > > were hanging. I noticed some tools were stuck in urwlck state and I > > found reverting this commit fixed the problem for me. > > > > Please take a look. > > Can you get backtrace for all threads in hanging process? > I do not need debugging symbols for the apps, libc/libthr/rtld with debug > info, installed by default from the base, should be enough. Also you might try this. It should help if my guess is right. Only x86 handled ATM. diff --git a/lib/libc/amd64/gen/Makefile.inc b/lib/libc/amd64/gen/Makefile.inc index 30fb05f89cb7..4df3c044493e 100644 --- a/lib/libc/amd64/gen/Makefile.inc +++ b/lib/libc/amd64/gen/Makefile.inc @@ -1,7 +1,7 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 # $FreeBSD$ -SRCS+= _setjmp.S _set_tp.c rfork_thread.S setjmp.S sigsetjmp.S \ +SRCS+= _setjmp.S _get_tp.c _set_tp.c rfork_thread.S setjmp.S sigsetjmp.S \ fabs.S \ infinity.c ldexp.c makecontext.c signalcontext.c \ flt_rounds.c fpgetmask.c fpsetmask.c fpgetprec.c fpsetprec.c \ diff --git a/lib/libc/amd64/gen/_get_tp.c b/lib/libc/amd64/gen/_get_tp.c new file mode 100644 index 000000000000..73770ca7fa08 --- /dev/null +++ b/lib/libc/amd64/gen/_get_tp.c @@ -0,0 +1,46 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Foundation + * + * This software were developed by Konstantin Belousov + * 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$ + */ + +#include +#include +#include +#include "libc_private.h" + +void * +_get_tp(void) +{ + void **res; + + /* This function is used by rtld, avoid ifuncs. */ + __asm __volatile("movq %%fs:0, %0" : "=r" (res)); + return (&res[1]); +} diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index 0ab717600e56..ab2c1409f879 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -172,6 +172,11 @@ SRCS+= __getosreldate.c \ CFLAGS.arc4random.c= -I${SRCTOP}/sys -I${SRCTOP}/sys/crypto/chacha20 +RTLD_HDRS= -I${SRCTOP}/libexec/rtld-elf \ + -I${SRCTOP}/libexec/rtld-elf/${MACHINE_CPUARCH} +CFLAGS.dlfcn.c= ${RTLD_HDRS} +CFLAGS.tls.c= ${RTLD_HDRS} + .PATH: ${SRCTOP}/contrib/libc-pwcache SRCS+= pwcache.c pwcache.h diff --git a/lib/libc/gen/dlfcn.c b/lib/libc/gen/dlfcn.c index 395a6d9402e8..337ad48fd691 100644 --- a/lib/libc/gen/dlfcn.c +++ b/lib/libc/gen/dlfcn.c @@ -43,10 +43,11 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" #include #include "un-namespace.h" +#include "rtld.h" #include "libc_private.h" #include "reentrant.h" -static char sorry[] = "Service unavailable"; +static const char sorry[] = "Service unavailable"; void _rtld_thread_init(void *); void _rtld_atfork_pre(int *); @@ -91,7 +92,7 @@ char * dlerror(void) { - return (sorry); + return (__DECONST(char *, sorry)); } #pragma weak dllockinit @@ -195,8 +196,6 @@ dl_init_phdr_info(void) for (i = 0; i < phdr_info.dlpi_phnum; i++) { if (phdr_info.dlpi_phdr[i].p_type == PT_TLS) { phdr_info.dlpi_tls_modid = 1; - phdr_info.dlpi_tls_data = - (void*)phdr_info.dlpi_phdr[i].p_vaddr; } } phdr_info.dlpi_adds = 1; @@ -209,13 +208,17 @@ dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *) __unused, void *data __unused) { #ifndef IN_LIBDL + tls_index ti; int ret; __init_elf_aux_vector(); if (__elf_aux_vector == NULL) return (1); _once(&dl_phdr_info_once, dl_init_phdr_info); + ti.ti_module = 1; + ti.ti_offset = 0; mutex_lock(&dl_phdr_info_lock); + phdr_info.dlpi_tls_data = __tls_get_addr(&ti); ret = callback(&phdr_info, sizeof(phdr_info), data); mutex_unlock(&dl_phdr_info_lock); return (ret); diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index 719391130827..8c525e3e996a 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -41,6 +41,7 @@ #include #include +#include "rtld.h" #include "libc_private.h" #define tls_assert(cond) ((cond) ? (void) 0 : \ @@ -96,35 +97,41 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign); #ifndef PIC -static size_t tls_static_space; -static size_t tls_init_size; -static size_t tls_init_align; -static void *tls_init; +static size_t libc_tls_static_space; +static size_t libc_tls_init_size; +static size_t libc_tls_init_align; +static void *libc_tls_init; #endif +void * +__libc_tls_get_addr(void *vti) +{ + Elf_Addr **dtvp, *dtv; + tls_index *ti; + + dtvp = _get_tp(); + dtv = *dtvp; + ti = vti; + return ((void *)(dtv[ti->ti_module + 1] + ti->ti_offset)); +} + #ifdef __i386__ /* GNU ABI */ __attribute__((__regparm__(1))) void * -___libc_tls_get_addr(void *ti __unused) +___libc_tls_get_addr(void *vti) { - return (0); + return (__libc_tls_get_addr(vti)); } #endif -void * -__libc_tls_get_addr(void *ti __unused) -{ - return (0); -} - #ifndef PIC static void * -malloc_aligned(size_t size, size_t align) +libc_malloc_aligned(size_t size, size_t align) { void *mem, *res; @@ -138,7 +145,7 @@ malloc_aligned(size_t size, size_t align) } static void -free_aligned(void *ptr) +libc_free_aligned(void *ptr) { void *mem; uintptr_t x; @@ -201,12 +208,13 @@ get_tls_block_ptr(void *tcb, size_t tcbsize) /* Compute fragments sizes. */ extra_size = tcbsize - TLS_TCB_SIZE; #if defined(__aarch64__) || defined(__arm__) - post_size = roundup2(TLS_TCB_SIZE, tls_init_align) - TLS_TCB_SIZE; + post_size = roundup2(TLS_TCB_SIZE, libc_tls_init_align) - TLS_TCB_SIZE; #else post_size = 0; #endif tls_block_size = tcbsize + post_size; - pre_size = roundup2(tls_block_size, tls_init_align) - tls_block_size; + pre_size = roundup2(tls_block_size, libc_tls_init_align) - + tls_block_size; return ((char *)tcb - pre_size - extra_size); } @@ -225,7 +233,7 @@ __libc_free_tls(void *tcb, size_t tcbsize, size_t tcbalign __unused) tls = (Elf_Addr **)tcb; dtv = tls[0]; __je_bootstrap_free(dtv); - free_aligned(get_tls_block_ptr(tcb, tcbsize)); + libc_free_aligned(get_tls_block_ptr(tcb, tcbsize)); } /* @@ -259,21 +267,22 @@ __libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign) return (oldtcb); tls_assert(tcbalign >= TLS_TCB_ALIGN); - maxalign = MAX(tcbalign, tls_init_align); + maxalign = MAX(tcbalign, libc_tls_init_align); /* Compute fragmets sizes. */ extra_size = tcbsize - TLS_TCB_SIZE; #if defined(__aarch64__) || defined(__arm__) - post_size = roundup2(TLS_TCB_SIZE, tls_init_align) - TLS_TCB_SIZE; + post_size = roundup2(TLS_TCB_SIZE, libc_tls_init_align) - TLS_TCB_SIZE; #else post_size = 0; #endif tls_block_size = tcbsize + post_size; - pre_size = roundup2(tls_block_size, tls_init_align) - tls_block_size; - tls_block_size += pre_size + tls_static_space; + pre_size = roundup2(tls_block_size, libc_tls_init_align) - + tls_block_size; + tls_block_size += pre_size + libc_tls_static_space; /* Allocate whole TLS block */ - tls_block = malloc_aligned(tls_block_size, maxalign); + tls_block = libc_malloc_aligned(tls_block_size, maxalign); if (tls_block == NULL) { tls_msg("__libc_allocate_tls: Out of memory.\n"); abort(); @@ -285,7 +294,7 @@ __libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign) if (oldtcb != NULL) { memcpy(tls_block, get_tls_block_ptr(oldtcb, tcbsize), tls_block_size); - free_aligned(oldtcb); + libc_free_aligned(oldtcb); /* Adjust the DTV. */ dtv = tcb[0]; @@ -302,8 +311,8 @@ __libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign) dtv[1] = 1; /* Segments count. */ dtv[2] = (Elf_Addr)(tls + DTV_OFFSET); - if (tls_init_size > 0) - memcpy(tls, tls_init, tls_init_size); + if (libc_tls_init_size > 0) + memcpy(tls, libc_tls_init, libc_tls_init_size); } return (tcb); @@ -329,13 +338,13 @@ __libc_free_tls(void *tcb, size_t tcbsize __unused, size_t tcbalign) * Figure out the size of the initial TLS block so that we can * find stuff which ___tls_get_addr() allocated dynamically. */ - tcbalign = MAX(tcbalign, tls_init_align); - size = roundup2(tls_static_space, tcbalign); + tcbalign = MAX(tcbalign, libc_tls_init_align); + size = roundup2(libc_tls_static_space, tcbalign); dtv = ((Elf_Addr**)tcb)[1]; tlsend = (Elf_Addr) tcb; tlsstart = tlsend - size; - free_aligned((void*)tlsstart); + libc_free_aligned((void*)tlsstart); __je_bootstrap_free(dtv); } @@ -350,12 +359,12 @@ __libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign) Elf_Addr *dtv; Elf_Addr segbase, oldsegbase; - tcbalign = MAX(tcbalign, tls_init_align); - size = roundup2(tls_static_space, tcbalign); + tcbalign = MAX(tcbalign, libc_tls_init_align); + size = roundup2(libc_tls_static_space, tcbalign); if (tcbsize < 2 * sizeof(Elf_Addr)) tcbsize = 2 * sizeof(Elf_Addr); - tls = malloc_aligned(size + tcbsize, tcbalign); + tls = libc_malloc_aligned(size + tcbsize, tcbalign); if (tls == NULL) { tls_msg("__libc_allocate_tls: Out of memory.\n"); abort(); @@ -373,16 +382,16 @@ __libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign) dtv[0] = 1; dtv[1] = 1; - dtv[2] = segbase - tls_static_space; + dtv[2] = segbase - libc_tls_static_space; if (oldtls) { /* * Copy the static TLS block over whole. */ oldsegbase = (Elf_Addr) oldtls; - memcpy((void *)(segbase - tls_static_space), - (const void *)(oldsegbase - tls_static_space), - tls_static_space); + memcpy((void *)(segbase - libc_tls_static_space), + (const void *)(oldsegbase - libc_tls_static_space), + libc_tls_static_space); /* * We assume that this block was the one we created with @@ -390,10 +399,11 @@ __libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign) */ _rtld_free_tls(oldtls, 2*sizeof(Elf_Addr), sizeof(Elf_Addr)); } else { - memcpy((void *)(segbase - tls_static_space), - tls_init, tls_init_size); - memset((void *)(segbase - tls_static_space + tls_init_size), - 0, tls_static_space - tls_init_size); + memcpy((void *)(segbase - libc_tls_static_space), + libc_tls_init, libc_tls_init_size); + memset((void *)(segbase - libc_tls_static_space + + libc_tls_init_size), 0, + libc_tls_static_space - libc_tls_init_size); } return (void*) segbase; @@ -457,11 +467,11 @@ _init_tls(void) for (i = 0; (unsigned) i < phnum; i++) { if (phdr[i].p_type == PT_TLS) { - tls_static_space = roundup2(phdr[i].p_memsz, + libc_tls_static_space = roundup2(phdr[i].p_memsz, phdr[i].p_align); - tls_init_size = phdr[i].p_filesz; - tls_init_align = phdr[i].p_align; - tls_init = (void*) phdr[i].p_vaddr; + libc_tls_init_size = phdr[i].p_filesz; + libc_tls_init_align = phdr[i].p_align; + libc_tls_init = (void *)phdr[i].p_vaddr; break; } } diff --git a/lib/libc/i386/gen/Makefile.inc b/lib/libc/i386/gen/Makefile.inc index 45e69cad1d0f..bad73852f6eb 100644 --- a/lib/libc/i386/gen/Makefile.inc +++ b/lib/libc/i386/gen/Makefile.inc @@ -1,6 +1,6 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 # $FreeBSD$ -SRCS+= _ctx_start.S _setjmp.S _set_tp.c fabs.S \ +SRCS+= _ctx_start.S _setjmp.S _set_tp.c _get_tp.c fabs.S \ flt_rounds.c infinity.c ldexp.c makecontext.c \ rfork_thread.S setjmp.S signalcontext.c sigsetjmp.S diff --git a/lib/libc/i386/gen/_get_tp.c b/lib/libc/i386/gen/_get_tp.c new file mode 100644 index 000000000000..7910d752753f --- /dev/null +++ b/lib/libc/i386/gen/_get_tp.c @@ -0,0 +1,45 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Foundation + * + * This software were developed by Konstantin Belousov + * 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$ + */ + +#include +#include +#include +#include "libc_private.h" + +void * +_get_tp(void) +{ + void **res; + + __asm __volatile("movl %%gs:0, %0" : "=r" (res)); + return (&res[1]); +} diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index 363e1057986b..5a524c0211d1 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -261,8 +261,9 @@ void _init_tls(void); int _once(pthread_once_t *, void (*)(void)); /* - * Set the TLS thread pointer + * Get/set the TLS thread pointer */ +void *_get_tp(void); void _set_tp(void *tp); /* diff --git a/lib/libdl/Makefile b/lib/libdl/Makefile index d91547352de4..831f0e68180c 100644 --- a/lib/libdl/Makefile +++ b/lib/libdl/Makefile @@ -6,6 +6,8 @@ SHLIB_MAJOR=1 .PATH: ${SRCTOP}/lib/libc/gen CFLAGS+=-I${SRCTOP}/lib/libc/include +CFLAGS+=-I${SRCTOP}/libexec/rtld-elf \ + -I${SRCTOP}/libexec/rtld-elf/${MACHINE_CPUARCH} CFLAGS+=-DIN_LIBDL LDFLAGS+=-Wl,-F,libc.so.7 VERSION_DEF=${SRCTOP}/lib/libc/Versions.def diff --git a/libexec/rtld-elf/rtld-libc/Makefile.inc b/libexec/rtld-elf/rtld-libc/Makefile.inc index d5f5993e3f16..7ffcb6e41ec7 100644 --- a/libexec/rtld-elf/rtld-libc/Makefile.inc +++ b/libexec/rtld-elf/rtld-libc/Makefile.inc @@ -67,6 +67,8 @@ _libc_other_objects+=syncicache abs _libc_other_objects+=syncicache .endif +_libc_other_objects+=_get_tp + # Extract all the .o files from libc_nossp_pic.a. This ensures that # we don't accidentally pull in the interposing table or similar by linking # directly against libc_nossp_pic.a diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 19027518d3c2..2ed4c4c9cb44 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -166,6 +166,7 @@ static int symlook_list(SymLook *, const Objlist *, DoneList *); static int symlook_needed(SymLook *, const Needed_Entry *, DoneList *); static int symlook_obj1_sysv(SymLook *, const Obj_Entry *); static int symlook_obj1_gnu(SymLook *, const Obj_Entry *); +static void *tls_get_addr_slow(Elf_Addr **, int, size_t, bool) __noinline; static void trace_loaded_objects(Obj_Entry *); static void unlink_object(Obj_Entry *); static void unload_object(Obj_Entry *, RtldLockState *lockstate); @@ -3906,19 +3907,21 @@ dlinfo(void *handle, int request, void *p) return (error); } +void *_get_tp(void); + static void rtld_fill_dl_phdr_info(const Obj_Entry *obj, struct dl_phdr_info *phdr_info) { - tls_index ti; + Elf_Addr **dtvp; phdr_info->dlpi_addr = (Elf_Addr)obj->relocbase; phdr_info->dlpi_name = obj->path; phdr_info->dlpi_phdr = obj->phdr; phdr_info->dlpi_phnum = obj->phsize / sizeof(obj->phdr[0]); phdr_info->dlpi_tls_modid = obj->tlsindex; - ti.ti_module = obj->tlsindex; - ti.ti_offset = 0; - phdr_info->dlpi_tls_data = __tls_get_addr(&ti); + dtvp = _get_tp(); + phdr_info->dlpi_tls_data = tls_get_addr_slow(dtvp, obj->tlsindex, + 0, true); phdr_info->dlpi_adds = obj_loads; phdr_info->dlpi_subs = obj_loads - obj_count; } @@ -4871,39 +4874,42 @@ unref_dag(Obj_Entry *root) /* * Common code for MD __tls_get_addr(). */ -static void *tls_get_addr_slow(Elf_Addr **, int, size_t) __noinline; static void * -tls_get_addr_slow(Elf_Addr **dtvp, int index, size_t offset) +tls_get_addr_slow(Elf_Addr **dtvp, int index, size_t offset, bool locked) { - Elf_Addr *newdtv, *dtv; - RtldLockState lockstate; - int to_copy; + Elf_Addr *newdtv, *dtv; + RtldLockState lockstate; + int to_copy; - dtv = *dtvp; - /* Check dtv generation in case new modules have arrived */ - if (dtv[0] != tls_dtv_generation) { - wlock_acquire(rtld_bind_lock, &lockstate); - newdtv = xcalloc(tls_max_index + 2, sizeof(Elf_Addr)); - to_copy = dtv[1]; - if (to_copy > tls_max_index) - to_copy = tls_max_index; - memcpy(&newdtv[2], &dtv[2], to_copy * sizeof(Elf_Addr)); - newdtv[0] = tls_dtv_generation; - newdtv[1] = tls_max_index; - free(dtv); - lock_release(rtld_bind_lock, &lockstate); - dtv = *dtvp = newdtv; - } + dtv = *dtvp; + /* Check dtv generation in case new modules have arrived */ + if (dtv[0] != tls_dtv_generation) { + if (!locked) + wlock_acquire(rtld_bind_lock, &lockstate); + newdtv = xcalloc(tls_max_index + 2, sizeof(Elf_Addr)); + to_copy = dtv[1]; + if (to_copy > tls_max_index) + to_copy = tls_max_index; + memcpy(&newdtv[2], &dtv[2], to_copy * sizeof(Elf_Addr)); + newdtv[0] = tls_dtv_generation; + newdtv[1] = tls_max_index; + free(dtv); + if (!locked) + lock_release(rtld_bind_lock, &lockstate); + dtv = *dtvp = newdtv; + } - /* Dynamically allocate module TLS if necessary */ - if (dtv[index + 1] == 0) { - /* Signal safe, wlock will block out signals. */ - wlock_acquire(rtld_bind_lock, &lockstate); - if (!dtv[index + 1]) - dtv[index + 1] = (Elf_Addr)allocate_module_tls(index); - lock_release(rtld_bind_lock, &lockstate); - } - return ((void *)(dtv[index + 1] + offset)); + /* Dynamically allocate module TLS if necessary */ + if (dtv[index + 1] == 0) { + /* Signal safe, wlock will block out signals. */ + if (!locked) + wlock_acquire(rtld_bind_lock, &lockstate); + if (!dtv[index + 1]) + dtv[index + 1] = (Elf_Addr)allocate_module_tls(index); + if (!locked) + lock_release(rtld_bind_lock, &lockstate); + } + return ((void *)(dtv[index + 1] + offset)); } void * @@ -4916,7 +4922,7 @@ tls_get_addr_common(Elf_Addr **dtvp, int index, size_t offset) if (__predict_true(dtv[0] == tls_dtv_generation && dtv[index + 1] != 0)) return ((void *)(dtv[index + 1] + offset)); - return (tls_get_addr_slow(dtvp, index, offset)); + return (tls_get_addr_slow(dtvp, index, offset, false)); } #if defined(__aarch64__) || defined(__arm__) || defined(__mips__) || \ diff --git a/libexec/rtld-elf/rtld_lock.h b/libexec/rtld-elf/rtld_lock.h index 339028c568dc..9aa769b1f7e6 100644 --- a/libexec/rtld-elf/rtld_lock.h +++ b/libexec/rtld-elf/rtld_lock.h @@ -46,9 +46,13 @@ struct RtldLockInfo void (*at_fork)(void); }; -extern void _rtld_thread_init(struct RtldLockInfo *) __exported; -extern void _rtld_atfork_pre(int *) __exported; -extern void _rtld_atfork_post(int *) __exported; +#if defined(IN_RTLD) || defined(PTHREAD_KERNEL) + +void _rtld_thread_init(struct RtldLockInfo *) __exported; +void _rtld_atfork_pre(int *) __exported; +void _rtld_atfork_post(int *) __exported; + +#endif /* IN_RTLD || PTHREAD_KERNEL */ #ifdef IN_RTLD From owner-dev-commits-src-all@freebsd.org Tue Apr 6 23:27:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C65475C1F80; Tue, 6 Apr 2021 23:27:34 +0000 (UTC) (envelope-from jkim@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 4FFNwk4r0fz57TK; Tue, 6 Apr 2021 23:27:34 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from freefall.freebsd.org (pool-100-8-53-238.nwrknj.fios.verizon.net [100.8.53.238]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jkim/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 8562E21988; Tue, 6 Apr 2021 23:27:34 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Subject: Re: git: d36d68161517 - main - rtld dl_iterate_phdr(): dlpi_tls_data is wrong To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202104060037.1360bKwT029051@gitrepo.freebsd.org> From: Jung-uk Kim Organization: FreeBSD.org Message-ID: <4f125d25-e7ef-f5ee-5c9c-5c4d386a4095@FreeBSD.org> Date: Tue, 6 Apr 2021 19:27:28 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="BZS0nEdqvUIoGYpPfb6a8KMTGtJ5n1IWu" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 23:27:34 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --BZS0nEdqvUIoGYpPfb6a8KMTGtJ5n1IWu Content-Type: multipart/mixed; boundary="njADhHwbuhVJJBZCsEh9k7vWzhtf1NUoI"; protected-headers="v1" From: Jung-uk Kim To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Message-ID: <4f125d25-e7ef-f5ee-5c9c-5c4d386a4095@FreeBSD.org> Subject: Re: git: d36d68161517 - main - rtld dl_iterate_phdr(): dlpi_tls_data is wrong References: <202104060037.1360bKwT029051@gitrepo.freebsd.org> In-Reply-To: --njADhHwbuhVJJBZCsEh9k7vWzhtf1NUoI Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 21. 4. 6., Konstantin Belousov wrote: > On Tue, Apr 06, 2021 at 09:46:59PM +0300, Konstantin Belousov wrote: >> On Tue, Apr 06, 2021 at 02:35:59PM -0400, Jung-uk Kim wrote: >>> On 21. 4. 5., Konstantin Belousov wrote: >>>> The branch main has been updated by kib: >>>> >>>> URL: https://cgit.FreeBSD.org/src/commit/?id=3Dd36d68161517059073938= 89d661cbfd25c630ca8 >>>> >>>> commit d36d6816151705907393889d661cbfd25c630ca8 >>>> Author: Konstantin Belousov >>>> AuthorDate: 2021-04-05 03:05:44 +0000 >>>> Commit: Konstantin Belousov >>>> CommitDate: 2021-04-06 00:23:08 +0000 >>>> >>>> rtld dl_iterate_phdr(): dlpi_tls_data is wrong >>>> =20 >>>> dl_iterate_phdr() dlpi_tls_data should provide the TLS module se= gment >>>> address, and not the TLS init segment address as it does now. >>>> =20 >>>> Reported by: emacsray@gmail.com >>>> PR: 254774 >>>> Sponsored by: The FreeBSD Foundation >>>> MFC after: 1 week >>> >>> I started having strange hangs in various applications from yesterday= , >>> e.g., Xorg, Thunderbird, etc. Today, I updated ports tree from Git f= or >>> the first time and started updating packages. Then, I experienced >>> similar problems, e.g., building editors/kate, multimedia/vlc, etc., >>> were hanging. I noticed some tools were stuck in urwlck state and I >>> found reverting this commit fixed the problem for me. >>> >>> Please take a look. >> >> Can you get backtrace for all threads in hanging process? >> I do not need debugging symbols for the apps, libc/libthr/rtld with de= bug >> info, installed by default from the base, should be enough. >=20 > Also you might try this. It should help if my guess is right. > Only x86 handled ATM. It seems the patch fixed the problem for me. I'll try it on other boxes, too. Jung-uk Kim --njADhHwbuhVJJBZCsEh9k7vWzhtf1NUoI-- --BZS0nEdqvUIoGYpPfb6a8KMTGtJ5n1IWu Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- wsB5BAABCAAjFiEEl1bqgKaRyqfWXu/CfJ+WJvzb8UYFAmBs7mAFAwAAAAAACgkQfJ+WJvzb8UYG JQf/XUwFAg/Ta+FLtSJ+/QQCER8UkJSK7pp8I0fBeJmCcXYp4biJDFIAabEf+6nEzyTLkO1QnLad xfLdKI741KxoIOnthJ7HmnWSXeQvCvtglI7H8058ZeaK5kJSAYW0ooBbTnrcYXBJV2wYd/HeZfBG mYZGcrWAoeJUsPBDSrRHtgek6/PzpfZQ5Xguv+HnlS5dtEEMhmgv/1JRKhTylJg4eMdmEDScATHl fu5OB5pDbiVdUngpusxMNJICLcuNCQWL3ouT2hm7bzYzlEhV9JelgoarD2X4IjjHbPZxHLis+yuF 5EuMvhrVb4ZufQu6K3ma8r5JywQMydfO2DNVzY1dWw== =ttPj -----END PGP SIGNATURE----- --BZS0nEdqvUIoGYpPfb6a8KMTGtJ5n1IWu-- From owner-dev-commits-src-all@freebsd.org Tue Apr 6 23:33:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B638F5C2266; Tue, 6 Apr 2021 23:33: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 4FFP3M4pCmz57nq; Tue, 6 Apr 2021 23:33: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 97A73153A7; Tue, 6 Apr 2021 23:33: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 136NXJ5C044294; Tue, 6 Apr 2021 23:33:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 136NXJpm044293; Tue, 6 Apr 2021 23:33:19 GMT (envelope-from git) Date: Tue, 6 Apr 2021 23:33:19 GMT Message-Id: <202104062333.136NXJpm044293@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John-Mark Gurney Subject: git: b8028f9d3ca0 - main - add Xr to the rc.d script... MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jmg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b8028f9d3ca0254413e5d42cb86f1a7fb2daeebf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 23:33:19 -0000 The branch main has been updated by jmg: URL: https://cgit.FreeBSD.org/src/commit/?id=b8028f9d3ca0254413e5d42cb86f1a7fb2daeebf commit b8028f9d3ca0254413e5d42cb86f1a7fb2daeebf Author: John-Mark Gurney AuthorDate: 2021-04-06 23:32:57 +0000 Commit: John-Mark Gurney CommitDate: 2021-04-06 23:32:57 +0000 add Xr to the rc.d script... --- sbin/growfs/growfs.8 | 1 + 1 file changed, 1 insertion(+) diff --git a/sbin/growfs/growfs.8 b/sbin/growfs/growfs.8 index 628ec10a4343..334881369405 100644 --- a/sbin/growfs/growfs.8 +++ b/sbin/growfs/growfs.8 @@ -100,6 +100,7 @@ capacity, and expand the filesystem accordingly: .Dl gpart resize -i 1 da0 .Dl growfs /dev/da0p1 .Sh SEE ALSO +.Xr growfs 7 , .Xr camcontrol 8 , .Xr fsck 8 , .Xr gpart 8 , From owner-dev-commits-src-all@freebsd.org Wed Apr 7 00:31:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 80FBC5C36CD; Wed, 7 Apr 2021 00:31: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 4FFQLD3HQQz3DhR; Wed, 7 Apr 2021 00:31: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 6397D1567B; Wed, 7 Apr 2021 00:31: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 1370VGeZ019506; Wed, 7 Apr 2021 00:31:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1370VGT4019505; Wed, 7 Apr 2021 00:31:16 GMT (envelope-from git) Date: Wed, 7 Apr 2021 00:31:16 GMT Message-Id: <202104070031.1370VGT4019505@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 9c27e7141b74 - stable/13 - Change mwait_bm_avoidance use to match Linux. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9c27e7141b749d68d9fee68e5fb44413765265e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 00:31:16 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=9c27e7141b749d68d9fee68e5fb44413765265e2 commit 9c27e7141b749d68d9fee68e5fb44413765265e2 Author: Alexander Motin AuthorDate: 2021-03-08 22:57:46 +0000 Commit: Alexander Motin CommitDate: 2021-04-07 00:30:23 +0000 Change mwait_bm_avoidance use to match Linux. Even though the information is very limited, it seems the intent of this flag is to control ACPI_BITREG_BUS_MASTER_STATUS use for C3, not force ACPI_BITREG_ARB_DISABLE manipulations for C2, where it was never needed, and which register not really doing anything for years. It wasted lots of CPU time on congested global ACPI hardware lock when many CPU cores were trying to enter/exit deep C-states same time. On idle 80-core system it pushed ping localhost latency up to 20ms, since badport_bandlim() via counter_ratecheck() wakes up all CPUs same time once a second just to synchronously reset the counters. Now enabling C-states increases the latency from 0.1 to just 0.25ms. Discussed with: kib MFC after: 1 month (cherry picked from commit 455219675dbd61010e180cacdfed51e7e34111e1) --- sys/dev/acpica/acpi_cpu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index ce252ab92816..436dd9ddaa93 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -1153,17 +1153,19 @@ acpi_cpu_idle(sbintime_t sbt) * driver polling for new devices keeps this bit set all the * time if USB is loaded. */ + cx_next = &sc->cpu_cx_states[cx_next_idx]; if ((cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0 && - cx_next_idx > sc->cpu_non_c3) { + cx_next_idx > sc->cpu_non_c3 && + (!cx_next->do_mwait || cx_next->mwait_bm_avoidance)) { status = AcpiReadBitRegister(ACPI_BITREG_BUS_MASTER_STATUS, &bm_active); if (ACPI_SUCCESS(status) && bm_active != 0) { AcpiWriteBitRegister(ACPI_BITREG_BUS_MASTER_STATUS, 1); cx_next_idx = sc->cpu_non_c3; + cx_next = &sc->cpu_cx_states[cx_next_idx]; } } /* Select the next state and update statistics. */ - cx_next = &sc->cpu_cx_states[cx_next_idx]; sc->cpu_cx_stats[cx_next_idx]++; KASSERT(cx_next->type != ACPI_STATE_C0, ("acpi_cpu_idle: C0 sleep")); @@ -1197,7 +1199,7 @@ acpi_cpu_idle(sbintime_t sbt) * For C3, disable bus master arbitration and enable bus master wake * if BM control is available, otherwise flush the CPU cache. */ - if (cx_next->type == ACPI_STATE_C3 || cx_next->mwait_bm_avoidance) { + if (cx_next->type == ACPI_STATE_C3) { if ((cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0) { AcpiWriteBitRegister(ACPI_BITREG_ARB_DISABLE, 1); AcpiWriteBitRegister(ACPI_BITREG_BUS_MASTER_RLD, 1); @@ -1237,7 +1239,7 @@ acpi_cpu_idle(sbintime_t sbt) end_time = ((cpu_ticks() - cputicks) << 20) / cpu_tickrate(); /* Enable bus master arbitration and disable bus master wakeup. */ - if ((cx_next->type == ACPI_STATE_C3 || cx_next->mwait_bm_avoidance) && + if (cx_next->type == ACPI_STATE_C3 && (cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0) { AcpiWriteBitRegister(ACPI_BITREG_ARB_DISABLE, 0); AcpiWriteBitRegister(ACPI_BITREG_BUS_MASTER_RLD, 0); From owner-dev-commits-src-all@freebsd.org Wed Apr 7 00:31:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6F0D5C3815; Wed, 7 Apr 2021 00:31: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 4FFQLF4HSpz3Dc4; Wed, 7 Apr 2021 00:31: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 85F941567D; Wed, 7 Apr 2021 00:31: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 1370VHeg019527; Wed, 7 Apr 2021 00:31:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1370VHEu019526; Wed, 7 Apr 2021 00:31:17 GMT (envelope-from git) Date: Wed, 7 Apr 2021 00:31:17 GMT Message-Id: <202104070031.1370VHEu019526@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: e6e4f79a6c4d - stable/13 - Do not read timer extra time when MWAIT is used. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e6e4f79a6c4d3fcde9999e2a7897451de204f1c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 00:31:17 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=e6e4f79a6c4d3fcde9999e2a7897451de204f1c7 commit e6e4f79a6c4d3fcde9999e2a7897451de204f1c7 Author: Alexander Motin AuthorDate: 2021-03-08 23:43:47 +0000 Commit: Alexander Motin CommitDate: 2021-04-07 00:31:10 +0000 Do not read timer extra time when MWAIT is used. When we enter C2+ state via memory read, it may take chipset some time to stop CPU. Extra register read covers that time. But MWAIT makes CPU stop immediately, so we don't need to waste time after wakeup with interrupts still disabled, increasing latency. On my system it reduces ping localhost latency, waking up all CPUs once a second, from 277us to 242us. MFC after: 1 month (cherry picked from commit 075e4807df3e6b0d9196d56e4dbc33765d57e1f8) --- sys/dev/acpica/acpi_cpu.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index 436dd9ddaa93..56182ed743de 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -1220,18 +1220,19 @@ acpi_cpu_idle(sbintime_t sbt) start_time = 0; cputicks = cpu_ticks(); } - if (cx_next->do_mwait) + if (cx_next->do_mwait) { acpi_cpu_idle_mwait(cx_next->mwait_hint); - else + } else { CPU_GET_REG(cx_next->p_lvlx, 1); + /* + * Read the end time twice. Since it may take an arbitrary time + * to enter the idle state, the first read may be executed before + * the processor has stopped. Doing it again provides enough + * margin that we are certain to have a correct value. + */ + AcpiGetTimer(&end_time); + } - /* - * Read the end time twice. Since it may take an arbitrary time - * to enter the idle state, the first read may be executed before - * the processor has stopped. Doing it again provides enough - * margin that we are certain to have a correct value. - */ - AcpiGetTimer(&end_time); if (cx_next->type == ACPI_STATE_C3) { AcpiGetTimer(&end_time); AcpiGetTimerDuration(start_time, end_time, &end_time); From owner-dev-commits-src-all@freebsd.org Wed Apr 7 00:31:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5BDA5C3838; Wed, 7 Apr 2021 00:31: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 4FFQLq5JmFz3F0V; Wed, 7 Apr 2021 00:31: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 A934A15DC1; Wed, 7 Apr 2021 00:31: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 1370Vlhm020496; Wed, 7 Apr 2021 00:31:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1370Vlb4020495; Wed, 7 Apr 2021 00:31:47 GMT (envelope-from git) Date: Wed, 7 Apr 2021 00:31:47 GMT Message-Id: <202104070031.1370Vlb4020495@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: c3afa8d1884f - stable/12 - Change mwait_bm_avoidance use to match Linux. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c3afa8d1884fd4eaef0cecc1a009f1121ad3a11c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 00:31:47 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=c3afa8d1884fd4eaef0cecc1a009f1121ad3a11c commit c3afa8d1884fd4eaef0cecc1a009f1121ad3a11c Author: Alexander Motin AuthorDate: 2021-03-08 22:57:46 +0000 Commit: Alexander Motin CommitDate: 2021-04-07 00:31:38 +0000 Change mwait_bm_avoidance use to match Linux. Even though the information is very limited, it seems the intent of this flag is to control ACPI_BITREG_BUS_MASTER_STATUS use for C3, not force ACPI_BITREG_ARB_DISABLE manipulations for C2, where it was never needed, and which register not really doing anything for years. It wasted lots of CPU time on congested global ACPI hardware lock when many CPU cores were trying to enter/exit deep C-states same time. On idle 80-core system it pushed ping localhost latency up to 20ms, since badport_bandlim() via counter_ratecheck() wakes up all CPUs same time once a second just to synchronously reset the counters. Now enabling C-states increases the latency from 0.1 to just 0.25ms. Discussed with: kib MFC after: 1 month (cherry picked from commit 455219675dbd61010e180cacdfed51e7e34111e1) --- sys/dev/acpica/acpi_cpu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index 4d7573d9b7d2..94f5b981b3c1 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -1155,17 +1155,19 @@ acpi_cpu_idle(sbintime_t sbt) * driver polling for new devices keeps this bit set all the * time if USB is loaded. */ + cx_next = &sc->cpu_cx_states[cx_next_idx]; if ((cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0 && - cx_next_idx > sc->cpu_non_c3) { + cx_next_idx > sc->cpu_non_c3 && + (!cx_next->do_mwait || cx_next->mwait_bm_avoidance)) { status = AcpiReadBitRegister(ACPI_BITREG_BUS_MASTER_STATUS, &bm_active); if (ACPI_SUCCESS(status) && bm_active != 0) { AcpiWriteBitRegister(ACPI_BITREG_BUS_MASTER_STATUS, 1); cx_next_idx = sc->cpu_non_c3; + cx_next = &sc->cpu_cx_states[cx_next_idx]; } } /* Select the next state and update statistics. */ - cx_next = &sc->cpu_cx_states[cx_next_idx]; sc->cpu_cx_stats[cx_next_idx]++; KASSERT(cx_next->type != ACPI_STATE_C0, ("acpi_cpu_idle: C0 sleep")); @@ -1199,7 +1201,7 @@ acpi_cpu_idle(sbintime_t sbt) * For C3, disable bus master arbitration and enable bus master wake * if BM control is available, otherwise flush the CPU cache. */ - if (cx_next->type == ACPI_STATE_C3 || cx_next->mwait_bm_avoidance) { + if (cx_next->type == ACPI_STATE_C3) { if ((cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0) { AcpiWriteBitRegister(ACPI_BITREG_ARB_DISABLE, 1); AcpiWriteBitRegister(ACPI_BITREG_BUS_MASTER_RLD, 1); @@ -1239,7 +1241,7 @@ acpi_cpu_idle(sbintime_t sbt) end_time = ((cpu_ticks() - cputicks) << 20) / cpu_tickrate(); /* Enable bus master arbitration and disable bus master wakeup. */ - if ((cx_next->type == ACPI_STATE_C3 || cx_next->mwait_bm_avoidance) && + if (cx_next->type == ACPI_STATE_C3 && (cpu_quirks & CPU_QUIRK_NO_BM_CTRL) == 0) { AcpiWriteBitRegister(ACPI_BITREG_ARB_DISABLE, 0); AcpiWriteBitRegister(ACPI_BITREG_BUS_MASTER_RLD, 0); From owner-dev-commits-src-all@freebsd.org Wed Apr 7 00:31:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0520A5C36E2; Wed, 7 Apr 2021 00:31: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 4FFQLr6bpFz3Drm; Wed, 7 Apr 2021 00:31: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 CB97615F8E; Wed, 7 Apr 2021 00:31: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 1370VmST020517; Wed, 7 Apr 2021 00:31:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1370Vm9J020516; Wed, 7 Apr 2021 00:31:48 GMT (envelope-from git) Date: Wed, 7 Apr 2021 00:31:48 GMT Message-Id: <202104070031.1370Vm9J020516@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 40074783d818 - stable/12 - Do not read timer extra time when MWAIT is used. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 40074783d8189c1f278d4fe5c373e45a85168534 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 00:31:49 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=40074783d8189c1f278d4fe5c373e45a85168534 commit 40074783d8189c1f278d4fe5c373e45a85168534 Author: Alexander Motin AuthorDate: 2021-03-08 23:43:47 +0000 Commit: Alexander Motin CommitDate: 2021-04-07 00:31:43 +0000 Do not read timer extra time when MWAIT is used. When we enter C2+ state via memory read, it may take chipset some time to stop CPU. Extra register read covers that time. But MWAIT makes CPU stop immediately, so we don't need to waste time after wakeup with interrupts still disabled, increasing latency. On my system it reduces ping localhost latency, waking up all CPUs once a second, from 277us to 242us. MFC after: 1 month (cherry picked from commit 075e4807df3e6b0d9196d56e4dbc33765d57e1f8) --- sys/dev/acpica/acpi_cpu.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index 94f5b981b3c1..44662741a040 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -1222,18 +1222,19 @@ acpi_cpu_idle(sbintime_t sbt) start_time = 0; cputicks = cpu_ticks(); } - if (cx_next->do_mwait) + if (cx_next->do_mwait) { acpi_cpu_idle_mwait(cx_next->mwait_hint); - else + } else { CPU_GET_REG(cx_next->p_lvlx, 1); + /* + * Read the end time twice. Since it may take an arbitrary time + * to enter the idle state, the first read may be executed before + * the processor has stopped. Doing it again provides enough + * margin that we are certain to have a correct value. + */ + AcpiGetTimer(&end_time); + } - /* - * Read the end time twice. Since it may take an arbitrary time - * to enter the idle state, the first read may be executed before - * the processor has stopped. Doing it again provides enough - * margin that we are certain to have a correct value. - */ - AcpiGetTimer(&end_time); if (cx_next->type == ACPI_STATE_C3) { AcpiGetTimer(&end_time); AcpiGetTimerDuration(start_time, end_time, &end_time); From owner-dev-commits-src-all@freebsd.org Wed Apr 7 00:34:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 40F735C3E1E; Wed, 7 Apr 2021 00:34:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFQPT1Lfxz3FXQ; Wed, 7 Apr 2021 00:34:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2130B15E17; Wed, 7 Apr 2021 00:34:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1370Y5eU023783; Wed, 7 Apr 2021 00:34:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1370Y5o4023782; Wed, 7 Apr 2021 00:34:05 GMT (envelope-from git) Date: Wed, 7 Apr 2021 00:34:05 GMT Message-Id: <202104070034.1370Y5o4023782@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 88fe518973b7 - stable/13 - Move time math out of disabled interrupts sections. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 88fe518973b7d94736394e379ed50cce01f6cc70 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 00:34:05 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=88fe518973b7d94736394e379ed50cce01f6cc70 commit 88fe518973b7d94736394e379ed50cce01f6cc70 Author: Alexander Motin AuthorDate: 2021-03-10 18:39:15 +0000 Commit: Alexander Motin CommitDate: 2021-04-07 00:33:59 +0000 Move time math out of disabled interrupts sections. We don't need the result before next sleep time, so no reason to additionally increase interrupt latency. While there, remove extra PM ticks to microseconds conversion, making C2/C3 sleep times look 4 times smaller than really. The conversion is already done by AcpiGetTimerDuration(). Now I see reported sleep times up to 0.5s, just as expected for planned 2 wakeups per second. MFC after: 1 month (cherry picked from commit 2cee045b4d62568d065b838a6cf129fed2424709) --- sys/dev/acpica/acpi_cpu.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index 56182ed743de..3c81d55436ca 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -114,8 +114,6 @@ struct acpi_cpu_device { (bus_space_write_ ## width(rman_get_bustag((reg)), \ rman_get_bushandle((reg)), 0, (val))) -#define PM_USEC(x) ((x) >> 2) /* ~4 clocks per usec (3.57955 Mhz) */ - #define ACPI_NOTIFY_CX_STATES 0x81 /* _CST changed. */ #define CPU_QUIRK_NO_C3 (1<<0) /* C3-type states are not usable. */ @@ -1107,7 +1105,7 @@ acpi_cpu_idle(sbintime_t sbt) { struct acpi_cpu_softc *sc; struct acpi_cx *cx_next; - uint64_t cputicks; + uint64_t start_ticks, end_ticks; uint32_t start_time, end_time; ACPI_STATUS status; int bm_active, cx_next_idx, i, us; @@ -1176,7 +1174,7 @@ acpi_cpu_idle(sbintime_t sbt) * we are called inside critical section, delaying context switch. */ if (cx_next->type == ACPI_STATE_C1) { - cputicks = cpu_ticks(); + start_ticks = cpu_ticks(); if (cx_next->p_lvlx != NULL) { /* C1 I/O then Halt */ CPU_GET_REG(cx_next->p_lvlx, 1); @@ -1185,12 +1183,13 @@ acpi_cpu_idle(sbintime_t sbt) acpi_cpu_idle_mwait(cx_next->mwait_hint); else acpi_cpu_c1(); - end_time = ((cpu_ticks() - cputicks) << 20) / cpu_tickrate(); - if (curthread->td_critnest == 0) - end_time = min(end_time, 500000 / hz); + end_ticks = cpu_ticks(); /* acpi_cpu_c1() returns with interrupts enabled. */ if (cx_next->do_mwait) ACPI_ENABLE_IRQS(); + end_time = ((end_ticks - start_ticks) << 20) / cpu_tickrate(); + if (!cx_next->do_mwait && curthread->td_critnest == 0) + end_time = min(end_time, 500000 / hz); sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + end_time) / 4; return; } @@ -1215,10 +1214,10 @@ acpi_cpu_idle(sbintime_t sbt) */ if (cx_next->type == ACPI_STATE_C3) { AcpiGetTimer(&start_time); - cputicks = 0; + start_ticks = 0; } else { start_time = 0; - cputicks = cpu_ticks(); + start_ticks = cpu_ticks(); } if (cx_next->do_mwait) { acpi_cpu_idle_mwait(cx_next->mwait_hint); @@ -1233,11 +1232,10 @@ acpi_cpu_idle(sbintime_t sbt) AcpiGetTimer(&end_time); } - if (cx_next->type == ACPI_STATE_C3) { + if (cx_next->type == ACPI_STATE_C3) AcpiGetTimer(&end_time); - AcpiGetTimerDuration(start_time, end_time, &end_time); - } else - end_time = ((cpu_ticks() - cputicks) << 20) / cpu_tickrate(); + else + end_ticks = cpu_ticks(); /* Enable bus master arbitration and disable bus master wakeup. */ if (cx_next->type == ACPI_STATE_C3 && @@ -1247,7 +1245,11 @@ acpi_cpu_idle(sbintime_t sbt) } ACPI_ENABLE_IRQS(); - sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + PM_USEC(end_time)) / 4; + if (cx_next->type == ACPI_STATE_C3) + AcpiGetTimerDuration(start_time, end_time, &end_time); + else + end_time = ((end_ticks - start_ticks) << 20) / cpu_tickrate(); + sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + end_time) / 4; } #endif From owner-dev-commits-src-all@freebsd.org Wed Apr 7 00:34:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90F2E5C3DD1; Wed, 7 Apr 2021 00:34: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 4FFQPk2b47z3FfH; Wed, 7 Apr 2021 00:34: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 3A32115FA6; Wed, 7 Apr 2021 00:34: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 1370YIFM023907; Wed, 7 Apr 2021 00:34:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1370YI1r023906; Wed, 7 Apr 2021 00:34:18 GMT (envelope-from git) Date: Wed, 7 Apr 2021 00:34:18 GMT Message-Id: <202104070034.1370YI1r023906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 0d745e16f2d7 - stable/12 - Move time math out of disabled interrupts sections. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 0d745e16f2d79951a35d822a26c7145de804cc26 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 00:34:18 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=0d745e16f2d79951a35d822a26c7145de804cc26 commit 0d745e16f2d79951a35d822a26c7145de804cc26 Author: Alexander Motin AuthorDate: 2021-03-10 18:39:15 +0000 Commit: Alexander Motin CommitDate: 2021-04-07 00:34:12 +0000 Move time math out of disabled interrupts sections. We don't need the result before next sleep time, so no reason to additionally increase interrupt latency. While there, remove extra PM ticks to microseconds conversion, making C2/C3 sleep times look 4 times smaller than really. The conversion is already done by AcpiGetTimerDuration(). Now I see reported sleep times up to 0.5s, just as expected for planned 2 wakeups per second. MFC after: 1 month (cherry picked from commit 2cee045b4d62568d065b838a6cf129fed2424709) --- sys/dev/acpica/acpi_cpu.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sys/dev/acpica/acpi_cpu.c b/sys/dev/acpica/acpi_cpu.c index 44662741a040..ca4162e5faa5 100644 --- a/sys/dev/acpica/acpi_cpu.c +++ b/sys/dev/acpica/acpi_cpu.c @@ -114,8 +114,6 @@ struct acpi_cpu_device { (bus_space_write_ ## width(rman_get_bustag((reg)), \ rman_get_bushandle((reg)), 0, (val))) -#define PM_USEC(x) ((x) >> 2) /* ~4 clocks per usec (3.57955 Mhz) */ - #define ACPI_NOTIFY_CX_STATES 0x81 /* _CST changed. */ #define CPU_QUIRK_NO_C3 (1<<0) /* C3-type states are not usable. */ @@ -1109,7 +1107,7 @@ acpi_cpu_idle(sbintime_t sbt) { struct acpi_cpu_softc *sc; struct acpi_cx *cx_next; - uint64_t cputicks; + uint64_t start_ticks, end_ticks; uint32_t start_time, end_time; ACPI_STATUS status; int bm_active, cx_next_idx, i, us; @@ -1178,7 +1176,7 @@ acpi_cpu_idle(sbintime_t sbt) * we are called inside critical section, delaying context switch. */ if (cx_next->type == ACPI_STATE_C1) { - cputicks = cpu_ticks(); + start_ticks = cpu_ticks(); if (cx_next->p_lvlx != NULL) { /* C1 I/O then Halt */ CPU_GET_REG(cx_next->p_lvlx, 1); @@ -1187,12 +1185,13 @@ acpi_cpu_idle(sbintime_t sbt) acpi_cpu_idle_mwait(cx_next->mwait_hint); else acpi_cpu_c1(); - end_time = ((cpu_ticks() - cputicks) << 20) / cpu_tickrate(); - if (curthread->td_critnest == 0) - end_time = min(end_time, 500000 / hz); + end_ticks = cpu_ticks(); /* acpi_cpu_c1() returns with interrupts enabled. */ if (cx_next->do_mwait) ACPI_ENABLE_IRQS(); + end_time = ((end_ticks - start_ticks) << 20) / cpu_tickrate(); + if (!cx_next->do_mwait && curthread->td_critnest == 0) + end_time = min(end_time, 500000 / hz); sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + end_time) / 4; return; } @@ -1217,10 +1216,10 @@ acpi_cpu_idle(sbintime_t sbt) */ if (cx_next->type == ACPI_STATE_C3) { AcpiGetTimer(&start_time); - cputicks = 0; + start_ticks = 0; } else { start_time = 0; - cputicks = cpu_ticks(); + start_ticks = cpu_ticks(); } if (cx_next->do_mwait) { acpi_cpu_idle_mwait(cx_next->mwait_hint); @@ -1235,11 +1234,10 @@ acpi_cpu_idle(sbintime_t sbt) AcpiGetTimer(&end_time); } - if (cx_next->type == ACPI_STATE_C3) { + if (cx_next->type == ACPI_STATE_C3) AcpiGetTimer(&end_time); - AcpiGetTimerDuration(start_time, end_time, &end_time); - } else - end_time = ((cpu_ticks() - cputicks) << 20) / cpu_tickrate(); + else + end_ticks = cpu_ticks(); /* Enable bus master arbitration and disable bus master wakeup. */ if (cx_next->type == ACPI_STATE_C3 && @@ -1249,7 +1247,11 @@ acpi_cpu_idle(sbintime_t sbt) } ACPI_ENABLE_IRQS(); - sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + PM_USEC(end_time)) / 4; + if (cx_next->type == ACPI_STATE_C3) + AcpiGetTimerDuration(start_time, end_time, &end_time); + else + end_time = ((end_ticks - start_ticks) << 20) / cpu_tickrate(); + sc->cpu_prev_sleep = (sc->cpu_prev_sleep * 3 + end_time) / 4; } #endif From owner-dev-commits-src-all@freebsd.org Wed Apr 7 03:12:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6482E5C6853; Wed, 7 Apr 2021 03:12:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFTvt2HjGz3Ql0; Wed, 7 Apr 2021 03:12: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 41BAB17EB8; Wed, 7 Apr 2021 03:12: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 1373CAUf036156; Wed, 7 Apr 2021 03:12:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1373CAas036155; Wed, 7 Apr 2021 03:12:10 GMT (envelope-from git) Date: Wed, 7 Apr 2021 03:12:10 GMT Message-Id: <202104070312.1373CAas036155@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brandon Bergren Subject: git: a8b0d01fedbf - stable/13 - powerpc/pseries: Add new hypercall definition, H_REGISTER_PROC_TBL MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a8b0d01fedbf5c73c796b5f2ce6256d552ea7f8c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 03:12:10 -0000 The branch stable/13 has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=a8b0d01fedbf5c73c796b5f2ce6256d552ea7f8c commit a8b0d01fedbf5c73c796b5f2ce6256d552ea7f8c Author: Justin Hibbits AuthorDate: 2020-08-16 16:01:49 +0000 Commit: Brandon Bergren CommitDate: 2021-04-07 03:10:09 +0000 powerpc/pseries: Add new hypercall definition, H_REGISTER_PROC_TBL This will be used by the Radix MMU on pseries. (cherry picked from commit a5f07fa0c6b162964b414d00fab319fd13c61f57) --- sys/powerpc/pseries/phyp-hvcall.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/powerpc/pseries/phyp-hvcall.h b/sys/powerpc/pseries/phyp-hvcall.h index fdc6a774ce03..90f75807e56a 100644 --- a/sys/powerpc/pseries/phyp-hvcall.h +++ b/sys/powerpc/pseries/phyp-hvcall.h @@ -321,7 +321,9 @@ #define H_SET_MODE 0x31C /* Reserved ... */ #define H_GET_DMA_XLATES_L 0x324 -#define MAX_HCALL_OPCODE H_GET_DMA_XLATES_L +/* Reserved ... */ +#define H_REGISTER_PROC_TBL 0x37c +#define MAX_HCALL_OPCODE H_REGISTER_PROC_TBL int64_t phyp_hcall(uint64_t opcode, ...); int64_t phyp_pft_hcall(uint64_t opcode, uint64_t flags, uint64_t pteidx, From owner-dev-commits-src-all@freebsd.org Wed Apr 7 03:12:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 824CC5C685B; Wed, 7 Apr 2021 03:12: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 4FFTvv3GVsz3QfJ; Wed, 7 Apr 2021 03:12: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 6171617EB9; Wed, 7 Apr 2021 03:12: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 1373CB3I036177; Wed, 7 Apr 2021 03:12:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1373CBcJ036176; Wed, 7 Apr 2021 03:12:11 GMT (envelope-from git) Date: Wed, 7 Apr 2021 03:12:11 GMT Message-Id: <202104070312.1373CBcJ036176@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brandon Bergren Subject: git: 557ab8869921 - stable/13 - [PowerPC] Remove unused IPI type count tracking. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 557ab8869921c226c7d7b9b9a7f44adfcdea042a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 03:12:11 -0000 The branch stable/13 has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=557ab8869921c226c7d7b9b9a7f44adfcdea042a commit 557ab8869921c226c7d7b9b9a7f44adfcdea042a Author: Justin Hibbits AuthorDate: 2020-09-24 15:00:31 +0000 Commit: Brandon Bergren CommitDate: 2021-04-07 03:10:40 +0000 [PowerPC] Remove unused IPI type count tracking. ipi_msg_count is inaccessible outside this file and is never read. It was introduced in the original SMP support code in r178628 and was never actually used anywhere. Remove it to slightly improve IPI performance. Submitted by: jhibbits (cherry picked from commit 74f6cb0f316bc0f8fae0b7f31d78d041dc4d509e) --- sys/powerpc/powerpc/mp_machdep.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/powerpc/powerpc/mp_machdep.c b/sys/powerpc/powerpc/mp_machdep.c index 619c344b69a7..a9f2aaf36adc 100644 --- a/sys/powerpc/powerpc/mp_machdep.c +++ b/sys/powerpc/powerpc/mp_machdep.c @@ -65,7 +65,6 @@ __FBSDID("$FreeBSD$"); volatile static int ap_awake; volatile static u_int ap_letgo; volatile static u_quad_t ap_timebase; -static u_int ipi_msg_cnt[32]; static struct mtx ap_boot_mtx; struct pcb stoppcbs[MAXCPU]; @@ -309,7 +308,6 @@ powerpc_ipi_handler(void *arg) return (FILTER_STRAY); while ((msg = ffs(ipimask) - 1) != -1) { ipimask &= ~(1u << msg); - ipi_msg_cnt[msg]++; switch (msg) { case IPI_AST: CTR1(KTR_SMP, "%s: IPI_AST", __func__); From owner-dev-commits-src-all@freebsd.org Wed Apr 7 03:32:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A95B25C7905; Wed, 7 Apr 2021 03:32: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 4FFVMn4MtQz3hpw; Wed, 7 Apr 2021 03:32: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 88E2618588; Wed, 7 Apr 2021 03:32: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 1373Wrrj062712; Wed, 7 Apr 2021 03:32:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1373WrdD062711; Wed, 7 Apr 2021 03:32:53 GMT (envelope-from git) Date: Wed, 7 Apr 2021 03:32:53 GMT Message-Id: <202104070332.1373WrdD062711@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2f5491784ebc - stable/13 - vxlan: correct interface MTU when using hw offloads 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 2f5491784ebc64e838a94480cd90d416df6f8457 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 03:32:53 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2f5491784ebc64e838a94480cd90d416df6f8457 commit 2f5491784ebc64e838a94480cd90d416df6f8457 Author: Konstantin Belousov AuthorDate: 2021-03-29 09:03:07 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-07 03:32:39 +0000 vxlan: correct interface MTU when using hw offloads (cherry picked from commit baacf701372bfeb3927c6b9e0b85d6eff198c6a3) --- share/man/man4/vxlan.4 | 15 +++++++++++++-- sys/net/if_vxlan.c | 17 +++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/share/man/man4/vxlan.4 b/share/man/man4/vxlan.4 index 1848897d97c9..99f3411c02d2 100644 --- a/share/man/man4/vxlan.4 +++ b/share/man/man4/vxlan.4 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17, 2020 +.Dd March 30, 2021 .Dt VXLAN 4 .Os .Sh NAME @@ -175,13 +175,24 @@ The .Nm specification recommends the physical network MTU be configured to use jumbo frames to accommodate the encapsulated frame size. +.Pp +By default, the +.Nm +driver sets its MTU to usual ethernet MTU of 1500 bytes, reduced by +the size of vxlan headers prepended to the encapsulated packets. +.Pp Alternatively, the .Xr ifconfig 8 .Cm mtu -command may be used to reduce the MTU size on the +command may be used to set the fixed MTU size on the .Nm interface to allow the encapsulated frame to fit in the current MTU of the physical network. +If the +.Cm mtu +command was used, system no longer adjust the +.Nm +interface MTU on routing or address changes. .Sh HARDWARE The .Nm diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index d0d335dba9ed..dd6e4522ccbb 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -171,6 +171,7 @@ struct vxlan_softc { #define VXLAN_FLAG_INIT 0x0001 #define VXLAN_FLAG_TEARDOWN 0x0002 #define VXLAN_FLAG_LEARN 0x0004 +#define VXLAN_FLAG_USER_MTU 0x0008 uint32_t vxl_port_hash_key; uint16_t vxl_min_port; @@ -1620,6 +1621,8 @@ vxlan_setup_interface_hdrlen(struct vxlan_softc *sc) { struct ifnet *ifp; + VXLAN_LOCK_WASSERT(sc); + ifp = sc->vxl_ifp; ifp->if_hdrlen = ETHER_HDR_LEN + sizeof(struct vxlanudphdr); @@ -1627,6 +1630,9 @@ vxlan_setup_interface_hdrlen(struct vxlan_softc *sc) ifp->if_hdrlen += sizeof(struct ip); else if (VXLAN_SOCKADDR_IS_IPV6(&sc->vxl_dst_addr) != 0) ifp->if_hdrlen += sizeof(struct ip6_hdr); + + if ((sc->vxl_flags & VXLAN_FLAG_USER_MTU) == 0) + ifp->if_mtu = ETHERMTU - ifp->if_hdrlen; } static int @@ -2354,10 +2360,14 @@ vxlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case SIOCSIFMTU: - if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > VXLAN_MAX_MTU) + if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > VXLAN_MAX_MTU) { error = EINVAL; - else + } else { + VXLAN_WLOCK(sc); ifp->if_mtu = ifr->ifr_mtu; + sc->vxl_flags |= VXLAN_FLAG_USER_MTU; + VXLAN_WUNLOCK(sc); + } break; case SIOCSIFCAP: @@ -3210,7 +3220,10 @@ vxlan_clone_create(struct if_clone *ifc, int unit, caddr_t params) ether_ifattach(ifp, sc->vxl_hwaddr.octet); ifp->if_baudrate = 0; + + VXLAN_WLOCK(sc); vxlan_setup_interface_hdrlen(sc); + VXLAN_WUNLOCK(sc); return (0); From owner-dev-commits-src-all@freebsd.org Wed Apr 7 03:32:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA1AD5C751E; Wed, 7 Apr 2021 03:32: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 4FFVMp5N5dz3hs6; Wed, 7 Apr 2021 03:32: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 AB72E18589; Wed, 7 Apr 2021 03:32: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 1373Ws66062737; Wed, 7 Apr 2021 03:32:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1373WsYW062736; Wed, 7 Apr 2021 03:32:54 GMT (envelope-from git) Date: Wed, 7 Apr 2021 03:32:54 GMT Message-Id: <202104070332.1373WsYW062736@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 5cbc9d80b8ab - stable/13 - mbuf: add a way to mark flowid as calculated from the internal headers 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5cbc9d80b8ab3dbc85538fdf72b1228223591f5b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 03:32:54 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5cbc9d80b8ab3dbc85538fdf72b1228223591f5b commit 5cbc9d80b8ab3dbc85538fdf72b1228223591f5b Author: Konstantin Belousov AuthorDate: 2021-02-12 13:38:07 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-07 03:32:39 +0000 mbuf: add a way to mark flowid as calculated from the internal headers (cherry picked from commit e243367b644562c9410b39f8d78dafdb7e785d85) --- sys/kern/uipc_mbuf.c | 23 +++++++++++++++++++++++ sys/net/if_gif.c | 3 ++- sys/net/if_vxlan.c | 3 ++- sys/sys/mbuf.h | 12 +++++++++--- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 5296aac0edc4..f7852bc7dd7f 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -855,6 +855,29 @@ m_adj(struct mbuf *mp, int req_len) } } +void +m_adj_decap(struct mbuf *mp, int len) +{ + uint8_t rsstype; + + m_adj(mp, len); + if ((mp->m_flags & M_PKTHDR) != 0) { + /* + * If flowid was calculated by card from the inner + * headers, move flowid to the decapsulated mbuf + * chain, otherwise clear. This depends on the + * internals of m_adj, which keeps pkthdr as is, in + * particular not changing rsstype and flowid. + */ + rsstype = mp->m_pkthdr.rsstype; + if ((rsstype & M_HASHTYPE_INNER) != 0) { + M_HASHTYPE_SET(mp, rsstype & ~M_HASHTYPE_INNER); + } else { + M_HASHTYPE_CLEAR(mp); + } + } +} + /* * Rearange an mbuf chain so that len bytes are contiguous * and in the data area of an mbuf (so that mtod will work diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index 1784d034ac2d..113bcb5c916e 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -540,7 +540,8 @@ gif_input(struct mbuf *m, struct ifnet *ifp, int proto, uint8_t ecn) m_freem(m); goto drop; } - m_adj(m, sizeof(struct etherip_header)); + + m_adj_decap(m, sizeof(struct etherip_header)); m->m_flags &= ~(M_BCAST|M_MCAST); m->m_pkthdr.rcvif = ifp; diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index dd6e4522ccbb..f56ec23540a7 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -2790,8 +2790,9 @@ vxlan_rcv_udp_packet(struct mbuf *m, int offset, struct inpcb *inpcb, goto out; vni = ntohl(vxh->vxlh_vni) >> VXLAN_HDR_VNI_SHIFT; + /* Adjust to the start of the inner Ethernet frame. */ - m_adj(m, offset + sizeof(struct vxlan_header)); + m_adj_decap(m, offset + sizeof(struct vxlan_header)); error = vxlan_input(vso, vni, &m, srcsa); MPASS(error != 0 || m == NULL); diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index e7d958da2037..0a249b6e2c6a 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -531,6 +531,7 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff) * https://docs.microsoft.com/en-us/windows-hardware/drivers/network/rss-hashing-types#ndishashipv6ex */ #define M_HASHTYPE_HASHPROP 0x80 /* has hash properties */ +#define M_HASHTYPE_INNER 0x40 /* calculated from inner headers */ #define M_HASHTYPE_HASH(t) (M_HASHTYPE_HASHPROP | (t)) /* Microsoft RSS standard hash types */ #define M_HASHTYPE_NONE 0 @@ -547,15 +548,19 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff) #define M_HASHTYPE_RSS_UDP_IPV6_EX M_HASHTYPE_HASH(10)/* IPv6 UDP 4-tuple + * ext hdrs */ -#define M_HASHTYPE_OPAQUE 63 /* ordering, not affinity */ +#define M_HASHTYPE_OPAQUE 0x3f /* ordering, not affinity */ #define M_HASHTYPE_OPAQUE_HASH M_HASHTYPE_HASH(M_HASHTYPE_OPAQUE) /* ordering+hash, not affinity*/ #define M_HASHTYPE_CLEAR(m) ((m)->m_pkthdr.rsstype = 0) -#define M_HASHTYPE_GET(m) ((m)->m_pkthdr.rsstype) +#define M_HASHTYPE_GET(m) ((m)->m_pkthdr.rsstype & ~M_HASHTYPE_INNER) #define M_HASHTYPE_SET(m, v) ((m)->m_pkthdr.rsstype = (v)) #define M_HASHTYPE_TEST(m, v) (M_HASHTYPE_GET(m) == (v)) -#define M_HASHTYPE_ISHASH(m) (M_HASHTYPE_GET(m) & M_HASHTYPE_HASHPROP) +#define M_HASHTYPE_ISHASH(m) \ + (((m)->m_pkthdr.rsstype & M_HASHTYPE_HASHPROP) != 0) +#define M_HASHTYPE_SETINNER(m) do { \ + (m)->m_pkthdr.rsstype |= M_HASHTYPE_INNER; \ + } while (0) /* * External mbuf storage buffer types. @@ -791,6 +796,7 @@ int mb_unmapped_compress(struct mbuf *m); struct mbuf *mb_unmapped_to_ext(struct mbuf *m); void mb_free_notready(struct mbuf *m, int count); void m_adj(struct mbuf *, int); +void m_adj_decap(struct mbuf *, int); int m_apply(struct mbuf *, int, int, int (*)(void *, void *, u_int), void *); int m_append(struct mbuf *, int, c_caddr_t); From owner-dev-commits-src-all@freebsd.org Wed Apr 7 03:32:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 436FE5C7893; Wed, 7 Apr 2021 03:32: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 4FFVMr078Tz3hgw; Wed, 7 Apr 2021 03:32: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 D8D2D181BC; Wed, 7 Apr 2021 03:32: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 1373Wtgh062761; Wed, 7 Apr 2021 03:32:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1373WtkB062760; Wed, 7 Apr 2021 03:32:55 GMT (envelope-from git) Date: Wed, 7 Apr 2021 03:32:55 GMT Message-Id: <202104070332.1373WtkB062760@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: b007a05b5a45 - stable/13 - Style 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/stable/13 X-Git-Reftype: branch X-Git-Commit: b007a05b5a45901f3b0b9ce368707e7b40c04924 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 03:32:56 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=b007a05b5a45901f3b0b9ce368707e7b40c04924 commit b007a05b5a45901f3b0b9ce368707e7b40c04924 Author: Konstantin Belousov AuthorDate: 2021-04-04 16:27:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-07 03:32:40 +0000 Style (cherry picked from commit 51a7be5f6036ebd47c8b3f704d52e7ec3f837114) --- sys/vm/vm_kern.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 0677d901d408..8d6e4f678970 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -886,7 +886,7 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS) i = 0; error = sysctl_handle_int(oidp, &i, 0, req); - if (error) + if (error != 0) return (error); if ((i & ~(VM_LOW_KMEM | VM_LOW_PAGES)) != 0) return (EINVAL); @@ -895,5 +895,6 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS) return (0); } -SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, 0, - debug_vm_lowmem, "I", "set to trigger vm_lowmem event with given flags"); +SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, + CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, 0, debug_vm_lowmem, "I", + "set to trigger vm_lowmem event with given flags"); From owner-dev-commits-src-all@freebsd.org Wed Apr 7 08:20:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2AB35CF495; Wed, 7 Apr 2021 08:20:06 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (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 4FFclB52yDz4fSp; Wed, 7 Apr 2021 08:20:06 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-lj1-f170.google.com with SMTP id o16so19631013ljp.3; Wed, 07 Apr 2021 01:20:06 -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=Q336aiqD4w5PSHStEw59LwSOiyhDSNuan0j4q4jnW10=; b=r3mjwb3WgRaLmfS5WzLdsIRucnaeNptsv8E4GaM4xZCM4SiJi04NJ79z8fgxUnk9Ow GLds57Bx+2D3GGGqHDSgxPYpwxSNB62TmJF0DqvyDAZRsgFV4aqUCP5x219H45kb3HLw rtutp5wqYtNogSGy/w4L16vIPddMswmvJCLgZ0SYnrkqicFKNdV/6XjIVttLRlVz1k5Z K0aZG5ms/BFckvJ2esobSBurMr4dM+xGqz37I+LMsJPA0ncCSd3BW9A5DBwprJsNADP4 C07bM3YdzRD5/OzO7YWKfwDRnJfrrPKfXqr/68O0s4AQdUJjBFh6ESr6mGR8Wl5753LV Nfnw== X-Gm-Message-State: AOAM5325RXNzWfIC4VIet+U0+HB/V7QK+OZ5+tbonpil2TY9NSJdykdZ f4pnlnLy30CmKjmMrT+IHf2Z095rGcS/sRE3VoNCKseAhIg= X-Google-Smtp-Source: ABdhPJzfVcJGIWoZxGHb05T6VpDBh9Q7kIUExsDrS+CMZwn4XIqLb5Vj7bMbsF3WFJf1KTuX2PMGIJcDmPpmVLufpk4= X-Received: by 2002:a2e:3818:: with SMTP id f24mr1475947lja.466.1617783602355; Wed, 07 Apr 2021 01:20:02 -0700 (PDT) MIME-Version: 1.0 References: <202104060037.1360bKwT029051@gitrepo.freebsd.org> In-Reply-To: From: Antoine Brodin Date: Wed, 7 Apr 2021 10:19:51 +0200 Message-ID: Subject: Re: git: d36d68161517 - main - rtld dl_iterate_phdr(): dlpi_tls_data is wrong To: Jung-uk Kim Cc: Konstantin Belousov , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4FFclB52yDz4fSp 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 08:20:06 -0000 On Tue, Apr 6, 2021 at 8:36 PM Jung-uk Kim wrote: > > On 21. 4. 5., Konstantin Belousov wrote: > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=d36d6816151705907393889d661cbfd25c630ca8 > > > > commit d36d6816151705907393889d661cbfd25c630ca8 > > Author: Konstantin Belousov > > AuthorDate: 2021-04-05 03:05:44 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-04-06 00:23:08 +0000 > > > > rtld dl_iterate_phdr(): dlpi_tls_data is wrong > > > > dl_iterate_phdr() dlpi_tls_data should provide the TLS module segment > > address, and not the TLS init segment address as it does now. > > > > Reported by: emacsray@gmail.com > > PR: 254774 > > Sponsored by: The FreeBSD Foundation > > MFC after: 1 week > > I started having strange hangs in various applications from yesterday, > e.g., Xorg, Thunderbird, etc. Today, I updated ports tree from Git for > the first time and started updating packages. Then, I experienced > similar problems, e.g., building editors/kate, multimedia/vlc, etc., > were hanging. I noticed some tools were stuck in urwlck state and I > found reverting this commit fixed the problem for me. > > Please take a look. Hi, I don't know if it's related, but some port builds are hanging with b8028f9d3ca0 that didn't happen with 4c2e9c35fb19. Cheers, Antoine From owner-dev-commits-src-all@freebsd.org Wed Apr 7 08:37:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B3245CF929; Wed, 7 Apr 2021 08:37:45 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFd7Y1PDHz4gKy; Wed, 7 Apr 2021 08:37:44 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 1378bUdG040717 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 7 Apr 2021 11:37:33 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 1378bUdG040717 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 1378bU4R040716; Wed, 7 Apr 2021 11:37:30 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 7 Apr 2021 11:37:30 +0300 From: Konstantin Belousov To: Antoine Brodin Cc: Jung-uk Kim , Konstantin Belousov , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: d36d68161517 - main - rtld dl_iterate_phdr(): dlpi_tls_data is wrong Message-ID: References: <202104060037.1360bKwT029051@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=0.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM,FREEMAIL_REPLY, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4FFd7Y1PDHz4gKy 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 08:37:45 -0000 On Wed, Apr 07, 2021 at 10:19:51AM +0200, Antoine Brodin wrote: > On Tue, Apr 6, 2021 at 8:36 PM Jung-uk Kim wrote: > > > > On 21. 4. 5., Konstantin Belousov wrote: > > > The branch main has been updated by kib: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=d36d6816151705907393889d661cbfd25c630ca8 > > > > > > commit d36d6816151705907393889d661cbfd25c630ca8 > > > Author: Konstantin Belousov > > > AuthorDate: 2021-04-05 03:05:44 +0000 > > > Commit: Konstantin Belousov > > > CommitDate: 2021-04-06 00:23:08 +0000 > > > > > > rtld dl_iterate_phdr(): dlpi_tls_data is wrong > > > > > > dl_iterate_phdr() dlpi_tls_data should provide the TLS module segment > > > address, and not the TLS init segment address as it does now. > > > > > > Reported by: emacsray@gmail.com > > > PR: 254774 > > > Sponsored by: The FreeBSD Foundation > > > MFC after: 1 week > > > > I started having strange hangs in various applications from yesterday, > > e.g., Xorg, Thunderbird, etc. Today, I updated ports tree from Git for > > the first time and started updating packages. Then, I experienced > > similar problems, e.g., building editors/kate, multimedia/vlc, etc., > > were hanging. I noticed some tools were stuck in urwlck state and I > > found reverting this commit fixed the problem for me. > > > > Please take a look. > > Hi, > > I don't know if it's related, but some port builds are hanging with > b8028f9d3ca0 that didn't happen with 4c2e9c35fb19. Perhaps this is related. I did not received the backtrace from the hung process to say definitely. The D29623 review is the fix. From owner-dev-commits-src-all@freebsd.org Wed Apr 7 08:56:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2590D5CFDF2; Wed, 7 Apr 2021 08:56:43 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (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 4FFdYQ15bLz4hsT; Wed, 7 Apr 2021 08:56:41 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pj1-x1030.google.com with SMTP id k23-20020a17090a5917b02901043e35ad4aso901152pji.3; Wed, 07 Apr 2021 01:56:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:message-id:date:mime-version:user-agent:reply-to:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=529RuC3D3r8i49P09tN/Enc7VmlJnqo5Rsa1hizTaTo=; b=Dz2gFUZ976bPyJaBjT7bz7A9p245BQuTohfRkSgn9j00aN1jjlknIOCIQXL9PMzp2F Xju2EzAfPQu+goGzrAhujaTjjG+xt/+WKTW7IhBn49phIBoJVoCv/EbnTGpJIngyJq9D EjnlcZ4reuMQffWM6QYRHDjc70Xam/o1Y/JKEVNxwx82mQ2PVABa9ff3cccceWIYXLWO Tmt73lyWagn9jk1C9Pr73unBncfudXOwqK/ZpjW4kdfP+SoOlyIPwGcMqkHL/yzDJQZd /08O/Ogj1Crg5o04kMiw242xOJwSBikxzmO+FBWgCydLh6xeA3hozhzLD1+hfag6DFxw ZpRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:message-id:date:mime-version:user-agent :reply-to:subject:content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=529RuC3D3r8i49P09tN/Enc7VmlJnqo5Rsa1hizTaTo=; b=F/EAdKP2RTrmws1jSIhi/IyrjYiFo0rDNWFIiR7x0bCTZ5+z2NtNHJBSQKOAHP7r+h XkwYtVfquGmp/dz5AETL6XmSuAHpcWQvL6UsFN/xwr2Vt0iLZI7viZmxe/Wskvpc+xdD h7aGm3iheC9cRThgLEqQeeihfGG9bn1vvMduAwu9mYjTd+xbx8nqQXLUXAfAqaszEo9G eO7B3Ns7WFvl39ceZSZ9X+w9RwqQGrgD1WCDpELrcN8M1mKBYFTMHbw/0Glq1T0NT/GM yGCP/3cDZQ8YI0wLCx/r162y+jYw/nPGCR4gE0KGWe7IcwdcTRnsn49+IOhae+J8P4JZ DUtw== X-Gm-Message-State: AOAM530xagHh/MxJa+OFcuLbryUn/FgoJbgFX/ZLBn1GWBBVg/D9EqMs yUrflm1DWpK5JOdHN2os9dsyuBpRWsxb4Q== X-Google-Smtp-Source: ABdhPJxsk4Q5neeAyFx9kzjttQV4ICDMSBK53/19qc2pyKFPCJTYkHhJNJ0FjbOhyj62Qcgf7VpIzA== X-Received: by 2002:a17:902:f687:b029:e8:da63:6195 with SMTP id l7-20020a170902f687b02900e8da636195mr2148783plg.75.1617785800446; Wed, 07 Apr 2021 01:56:40 -0700 (PDT) Received: from [2403:5800:7500:3601:edc1:5fd6:5a0a:6c7d] (2403-5800-7500-3601-edc1-5fd6-5a0a-6c7d.ip6.aussiebb.net. [2403:5800:7500:3601:edc1:5fd6:5a0a:6c7d]) by smtp.gmail.com with UTF8SMTPSA id e1sm13758703pgl.25.2021.04.07.01.56.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Apr 2021 01:56:40 -0700 (PDT) Sender: Kubilay Kocak Message-ID: <68614ced-d330-54f2-b582-105aacf7e3cb@FreeBSD.org> Date: Wed, 7 Apr 2021 18:56:36 +1000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Thunderbird/89.0a1 Reply-To: koobs@FreeBSD.org Subject: Re: git: 829a69db855b - main - pf: change pf_route so pf only runs when packets enter and leave the stack. Content-Language: en-US To: Kristof Provost Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104051144.135BiCpe039479@gitrepo.freebsd.org> From: Kubilay Kocak In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4FFdYQ15bLz4hsT X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=Dz2gFUZ9; dmarc=none; spf=pass (mx1.freebsd.org: domain of koobsfreebsd@gmail.com designates 2607:f8b0:4864:20::1030 as permitted sender) smtp.mailfrom=koobsfreebsd@gmail.com X-Spamd-Result: default: False [-1.20 / 15.00]; HAS_REPLYTO(0.00)[koobs@FreeBSD.org]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; NEURAL_HAM_SHORT(-1.00)[-0.999]; FORGED_SENDER(0.30)[koobs@FreeBSD.org,koobsfreebsd@gmail.com]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; 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)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::1030:from]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_NEQ_ENVFROM(0.00)[koobs@FreeBSD.org,koobsfreebsd@gmail.com]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_SPAM_MEDIUM(1.00)[1.000]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::1030:from:127.0.2.255]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::1030:from]; MAILMAN_DEST(0.00)[dev-commits-src-all,dev-commits-src-main] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 08:56:43 -0000 On 6/04/2021 5:09 pm, Kristof Provost wrote: > On 6 Apr 2021, at 2:01, Kubilay Kocak wrote: >> On 5/04/2021 9:44 pm, Kristof Provost wrote: >>> The branch main has been updated by kp: >>> >>> URL: >>> https://cgit.FreeBSD.org/src/commit/?id=829a69db855b48ff7e8242b95e193a0783c489d9 >>> >>> >>> commit 829a69db855b48ff7e8242b95e193a0783c489d9 >>> Author:     Kristof Provost >>> AuthorDate: 2021-04-02 10:23:42 +0000 >>> Commit:     Kristof Provost >>> CommitDate: 2021-04-05 07:57:06 +0000 >>> >>>      pf: change pf_route so pf only runs when packets enter and leave >>> the stack. >> >> Relnotes: Yes >> >> For the rule semantics change? >> > I wouldn’t. This is an extremely subtle change, and in all likelihood > won’t impact anyone other than those suffering from the bug this fixes. > It’s really more of a bug fix than behaviour change. > Listing it in the release notes is going to generate more confusion than > enlightenment. Wasn't sure of impact, thought it best to ask. Thanks Kristof! From owner-dev-commits-src-all@freebsd.org Wed Apr 7 10:35:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E52595D2616; Wed, 7 Apr 2021 10:35: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 4FFglL693Xz4pcc; Wed, 7 Apr 2021 10:35: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 C65291DB2A; Wed, 7 Apr 2021 10:35: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 137AZQj3019692; Wed, 7 Apr 2021 10:35:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137AZQEm019690; Wed, 7 Apr 2021 10:35:26 GMT (envelope-from git) Date: Wed, 7 Apr 2021 10:35:26 GMT Message-Id: <202104071035.137AZQEm019690@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 83532eb68cd0 - main - tests/sys/net/routing: XFAIL the two failing tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 83532eb68cd06a3517bb7b5e5a34afcf798de914 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 10:35:27 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=83532eb68cd06a3517bb7b5e5a34afcf798de914 commit 83532eb68cd06a3517bb7b5e5a34afcf798de914 Author: Alex Richardson AuthorDate: 2021-04-07 09:33:21 +0000 Commit: Alex Richardson CommitDate: 2021-04-07 09:34:22 +0000 tests/sys/net/routing: XFAIL the two failing tests They have been failing for 1.5 months and the patch to fix them is stuck in review so mark them as XFAIL for now to get Jenkins back to green. To be reverted when https://reviews.freebsd.org/D28886 (or similar) is commited. Reviewed By: kp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29528 --- tests/sys/net/routing/test_rtsock_l3.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/sys/net/routing/test_rtsock_l3.c b/tests/sys/net/routing/test_rtsock_l3.c index 9486ac466965..91816679400f 100644 --- a/tests/sys/net/routing/test_rtsock_l3.c +++ b/tests/sys/net/routing/test_rtsock_l3.c @@ -383,6 +383,9 @@ ATF_TC_BODY(rtm_get_v4_hostbits_failure, tc) { DECLARE_TEST_VARS; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_expect_fail("Needs https://reviews.freebsd.org/D28886"); + c = presetup_ipv4(tc); /* Q the same prefix */ @@ -447,6 +450,9 @@ ATF_TC_BODY(rtm_add_v4_no_rtf_host_failure, tc) { DECLARE_TEST_VARS; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_expect_fail("Needs https://reviews.freebsd.org/D28886"); + c = presetup_ipv4(tc); /* Create IPv4 subnetwork with smaller prefix */ From owner-dev-commits-src-all@freebsd.org Wed Apr 7 10:35:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 313995D27A9; Wed, 7 Apr 2021 10: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 4FFglN0c4Nz4pyj; Wed, 7 Apr 2021 10:35: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 F18671DBAA; Wed, 7 Apr 2021 10: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 137AZRK9019719; Wed, 7 Apr 2021 10: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 137AZRcE019718; Wed, 7 Apr 2021 10:35:27 GMT (envelope-from git) Date: Wed, 7 Apr 2021 10:35:27 GMT Message-Id: <202104071035.137AZRcE019718@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alex Richardson Subject: git: 2bca8aa7a79a - main - libarchive: Make test_read_append_filter_wrong_program pass again MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2bca8aa7a79ad2b6683e8f5a5c373de81c5baca2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 10:35:28 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=2bca8aa7a79ad2b6683e8f5a5c373de81c5baca2 commit 2bca8aa7a79ad2b6683e8f5a5c373de81c5baca2 Author: Alex Richardson AuthorDate: 2021-04-07 10:35:10 +0000 Commit: Alex Richardson CommitDate: 2021-04-07 10:35:10 +0000 libarchive: Make test_read_append_filter_wrong_program pass again libarchive: Apply upstream commit a1b7bf8013fb7a11a486794247daae592db6f5ae This fixes the failing test_read_append_filter_wrong_program test in CI which has been failing since 01-Dec-2020. Commit message from https://github.com/libarchive/libarchive/commit/a1b7bf8013fb7a11a486794247daae592db6f5ae Silence stderr in test_read_append_filter_program When the FreeBSD testsuite runs the libarchive tests it checks that stderr is empty. Since #1382 this is no longer the case. This change restores the behaviour of silencing bunzip2 stderr but doesn't bring back the output text check. Partially reverts 2e7aa5d9 MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29036 --- .../libarchive/test/test_read_set_format.c | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/contrib/libarchive/libarchive/test/test_read_set_format.c b/contrib/libarchive/libarchive/test/test_read_set_format.c index f357bada82c3..c760de0056d3 100644 --- a/contrib/libarchive/libarchive/test/test_read_set_format.c +++ b/contrib/libarchive/libarchive/test/test_read_set_format.c @@ -201,6 +201,11 @@ DEFINE_TEST(test_read_append_filter_wrong_program) { struct archive_entry *ae; struct archive *a; +#if !defined(_WIN32) || defined(__CYGWIN__) + FILE * fp; + int fd; + fpos_t pos; +#endif /* * If we have "bunzip2 -q", try using that. @@ -210,6 +215,14 @@ DEFINE_TEST(test_read_append_filter_wrong_program) return; } +#if !defined(_WIN32) || defined(__CYGWIN__) + /* bunzip2 will write to stderr, redirect it to a file */ + fflush(stderr); + fgetpos(stderr, &pos); + assert((fd = dup(fileno(stderr))) != -1); + fp = freopen("stderr1", "w", stderr); +#endif + assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR)); assertEqualIntA(a, ARCHIVE_OK, @@ -219,4 +232,15 @@ DEFINE_TEST(test_read_append_filter_wrong_program) assertA(archive_read_next_header(a, &ae) < (ARCHIVE_WARN)); assertEqualIntA(a, ARCHIVE_WARN, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + +#if !defined(_WIN32) || defined(__CYGWIN__) + /* restore stderr */ + if (fp != NULL) { + fflush(stderr); + dup2(fd, fileno(stderr)); + clearerr(stderr); + (void)fsetpos(stderr, &pos); + } + close(fd); +#endif } From owner-dev-commits-src-all@freebsd.org Wed Apr 7 10:56:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D04D65D2D12; Wed, 7 Apr 2021 10:56: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 4FFhC85fFzz4r9m; Wed, 7 Apr 2021 10:56: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 AFAF71DBFF; Wed, 7 Apr 2021 10:56: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 137Au4sX046721; Wed, 7 Apr 2021 10:56:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137Au4E6046720; Wed, 7 Apr 2021 10:56:04 GMT (envelope-from git) Date: Wed, 7 Apr 2021 10:56:04 GMT Message-Id: <202104071056.137Au4E6046720@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ka Ho Ng Subject: git: c5345a05ce7d - stable/13 - ivrs_drv: Fix IVHDs with duplicated BaseAddress MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c5345a05ce7dc86c422bdb707e817407ab52fa21 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 10:56:04 -0000 The branch stable/13 has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=c5345a05ce7dc86c422bdb707e817407ab52fa21 commit c5345a05ce7dc86c422bdb707e817407ab52fa21 Author: Ka Ho Ng AuthorDate: 2021-03-22 09:33:43 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-07 10:55:38 +0000 ivrs_drv: Fix IVHDs with duplicated BaseAddress Reviewed by: jhb Approved by: philip (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28945 (cherry picked from commit ede14736fd6d74db0374f4a233491ad5dc0e9b1d) --- sys/amd64/vmm/amd/ivrs_drv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/amd64/vmm/amd/ivrs_drv.c b/sys/amd64/vmm/amd/ivrs_drv.c index da3e0e17d140..d33229623a96 100644 --- a/sys/amd64/vmm/amd/ivrs_drv.c +++ b/sys/amd64/vmm/amd/ivrs_drv.c @@ -366,10 +366,11 @@ ivhd_identify(driver_t *driver, device_t parent) for (i = ivhd_count - 1 ; i > 0 ; i--){ if (ivhd_is_newer(&ivhd_hdrs[i-1]->Header, &ivhd_hdrs[i]->Header)) { - ivhd_hdrs[i-1] = ivhd_hdrs[i]; + memmove(&ivhd_hdrs[i-1], &ivhd_hdrs[i], + sizeof(void *) * (ivhd_count - i)); ivhd_count--; } - } + } ivhd_devs = malloc(sizeof(device_t) * ivhd_count, M_DEVBUF, M_WAITOK | M_ZERO); From owner-dev-commits-src-all@freebsd.org Wed Apr 7 10:56:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFD185D2CC4; Wed, 7 Apr 2021 10:56: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 4FFhC96HBNz4r5c; Wed, 7 Apr 2021 10:56: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 C9FD61DB62; Wed, 7 Apr 2021 10:56: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 137Au54A046748; Wed, 7 Apr 2021 10:56:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137Au5cr046747; Wed, 7 Apr 2021 10:56:05 GMT (envelope-from git) Date: Wed, 7 Apr 2021 10:56:05 GMT Message-Id: <202104071056.137Au5cr046747@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ka Ho Ng Subject: git: d7ffa208d929 - stable/13 - AMD-vi: Fix IOMMU device interrupts being overridden MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d7ffa208d92933e0c72564bfd422aec49dca2fd4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 10:56:06 -0000 The branch stable/13 has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=d7ffa208d92933e0c72564bfd422aec49dca2fd4 commit d7ffa208d92933e0c72564bfd422aec49dca2fd4 Author: Ka Ho Ng AuthorDate: 2021-03-22 09:33:43 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-07 10:55:38 +0000 AMD-vi: Fix IOMMU device interrupts being overridden Currently, AMD-vi PCI-e passthrough will lead to the following lines in dmesg: "kernel: CPU0: local APIC error 0x40 ivhd0: Error: completion failed tail:0x720, head:0x0." After some tracing, the problem is due to the interaction with amdvi_alloc_intr_resources() and pci_driver_added(). In ivrs_drv, the identification of AMD-vi IVHD is done by walking over the ACPI IVRS table and ivhdX device_ts are added under the acpi bus, while there are no driver handling the corresponding IOMMU PCI function. In amdvi_alloc_intr_resources(), the MSI intr are allocated with the ivhdX device_t instead of the IOMMU PCI function device_t. bus_setup_intr() is called on ivhdX. the IOMMU pci function device_t is only used for pci_enable_msi(). Since bus_setup_intr() is not called on IOMMU pci function, the IOMMU PCI function device_t's dinfo->cfg.msi is never updated to reflect the supposed msi_data and msi_addr. So the msi_data and msi_addr stay in the value 0. When pci_driver_added() tried to loop over the children of a pci bus, and do pci_cfg_restore() on each of them, msi_addr and msi_data with value 0 will be written to the MSI capability of the IOMMU pci function, thus explaining the errors in dmesg. This change includes an amdiommu driver which currently does attaching, detaching and providing DEVMETHODs for setting up and tearing down interrupt. The purpose of the driver is to prevent pci_driver_added() from calling pci_cfg_restore() on the IOMMU PCI function device_t. The introduction of the amdiommu driver handles allocation of an IRQ resource within the IOMMU PCI function, so that the dinfo->cfg.msi is populated. This has been tested on EPYC Rome 7282 with Radeon 5700XT GPU. Sponsored by: The FreeBSD Foundation Reviewed by: jhb Approved by: philip (mentor) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28984 (cherry picked from commit 74ada297e8978b8efda3dffdd1bb24aee7c5faa4) --- sys/amd64/vmm/amd/amdiommu.c | 185 +++++++++++++++++++++++++++++++++++++++++ sys/amd64/vmm/amd/amdvi_hw.c | 89 +++----------------- sys/amd64/vmm/amd/amdvi_priv.h | 5 +- sys/amd64/vmm/amd/ivhd_if.m | 46 ++++++++++ sys/amd64/vmm/amd/ivrs_drv.c | 6 ++ sys/modules/vmm/Makefile | 3 + 6 files changed, 253 insertions(+), 81 deletions(-) diff --git a/sys/amd64/vmm/amd/amdiommu.c b/sys/amd64/vmm/amd/amdiommu.c new file mode 100644 index 000000000000..4ded23dff003 --- /dev/null +++ b/sys/amd64/vmm/amd/amdiommu.c @@ -0,0 +1,185 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Fondation + * + * Portions of this software were developed by Ka Ho Ng + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include + +#include "amdvi_priv.h" +#include "ivhd_if.h" + +struct amdiommu_softc { + struct resource *event_res; /* Event interrupt resource. */ + void *event_tag; /* Event interrupt tag. */ + int event_rid; +}; + +static int amdiommu_probe(device_t); +static int amdiommu_attach(device_t); +static int amdiommu_detach(device_t); +static int ivhd_setup_intr(device_t, driver_intr_t, void *, + const char *); +static int ivhd_teardown_intr(device_t); + +static device_method_t amdiommu_methods[] = { + /* device interface */ + DEVMETHOD(device_probe, amdiommu_probe), + DEVMETHOD(device_attach, amdiommu_attach), + DEVMETHOD(device_detach, amdiommu_detach), + DEVMETHOD(ivhd_setup_intr, ivhd_setup_intr), + DEVMETHOD(ivhd_teardown_intr, ivhd_teardown_intr), + DEVMETHOD_END +}; +static driver_t amdiommu_driver = { + "amdiommu", + amdiommu_methods, + sizeof(struct amdiommu_softc), +}; + +static int +amdiommu_probe(device_t dev) +{ + int error; + int capoff; + + /* + * Check base class and sub-class + */ + if (pci_get_class(dev) != PCIC_BASEPERIPH || + pci_get_subclass(dev) != PCIS_BASEPERIPH_IOMMU) + return (ENXIO); + + /* + * A IOMMU capability block carries a 0Fh capid. + */ + error = pci_find_cap(dev, PCIY_SECDEV, &capoff); + if (error) + return (ENXIO); + + /* + * bit [18:16] == 011b indicates the capability block is IOMMU + * capability block. If the field is not set to 011b, bail out. + */ + if ((pci_read_config(dev, capoff + 2, 2) & 0x7) != 0x3) + return (ENXIO); + + return (BUS_PROBE_SPECIFIC); +} + +static int +amdiommu_attach(device_t dev) +{ + + device_set_desc(dev, "AMD-Vi/IOMMU PCI function"); + return (0); +} + +static int +amdiommu_detach(device_t dev) +{ + + return (0); +} + +static int +ivhd_setup_intr(device_t dev, driver_intr_t handler, void *arg, + const char *desc) +{ + struct amdiommu_softc *sc; + int error, msicnt; + + sc = device_get_softc(dev); + msicnt = 1; + if (sc->event_res != NULL) + panic("%s is called without intr teardown", __func__); + sc->event_rid = 1; + + error = pci_alloc_msi(dev, &msicnt); + if (error) { + device_printf(dev, "Couldn't find event MSI IRQ resource.\n"); + return (ENOENT); + } + + sc->event_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, + &sc->event_rid, RF_ACTIVE); + if (sc->event_res == NULL) { + device_printf(dev, "Unable to allocate event INTR resource.\n"); + error = ENOMEM; + goto fail; + } + + error = bus_setup_intr(dev, sc->event_res, INTR_TYPE_MISC | INTR_MPSAFE, + NULL, handler, arg, &sc->event_tag); + if (error) { + device_printf(dev, "Fail to setup event intr\n"); + goto fail; + } + + bus_describe_intr(dev, sc->event_res, sc->event_tag, "%s", desc); + return (0); + +fail: + ivhd_teardown_intr(dev); + return (error); +} + +static int +ivhd_teardown_intr(device_t dev) +{ + struct amdiommu_softc *sc; + + sc = device_get_softc(dev); + + if (sc->event_res != NULL) { + bus_teardown_intr(dev, sc->event_res, sc->event_tag); + sc->event_tag = NULL; + } + if (sc->event_res != NULL) { + bus_release_resource(dev, SYS_RES_IRQ, sc->event_rid, + sc->event_res); + sc->event_res = NULL; + } + pci_release_msi(dev); + return (0); +} + +static devclass_t amdiommu_devclass; + +/* This driver has to be loaded before ivhd */ +DRIVER_MODULE(amdiommu, pci, amdiommu_driver, amdiommu_devclass, 0, 0); +MODULE_DEPEND(amdiommu, pci, 1, 1, 1); diff --git a/sys/amd64/vmm/amd/amdvi_hw.c b/sys/amd64/vmm/amd/amdvi_hw.c index 132ae8389f2a..3581b43ea4de 100644 --- a/sys/amd64/vmm/amd/amdvi_hw.c +++ b/sys/amd64/vmm/amd/amdvi_hw.c @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "ivhd_if.h" #include "pcib_if.h" #include "io/iommu.h" @@ -771,99 +772,33 @@ amdvi_free_evt_intr_res(device_t dev) { struct amdvi_softc *softc; + device_t mmio_dev; softc = device_get_softc(dev); - if (softc->event_tag != NULL) { - bus_teardown_intr(dev, softc->event_res, softc->event_tag); - } - if (softc->event_res != NULL) { - bus_release_resource(dev, SYS_RES_IRQ, softc->event_rid, - softc->event_res); - } - bus_delete_resource(dev, SYS_RES_IRQ, softc->event_rid); - PCIB_RELEASE_MSI(device_get_parent(device_get_parent(dev)), - dev, 1, &softc->event_irq); + mmio_dev = softc->pci_dev; + + IVHD_TEARDOWN_INTR(mmio_dev); } static bool amdvi_alloc_intr_resources(struct amdvi_softc *softc) { struct amdvi_ctrl *ctrl; - device_t dev, pcib; - device_t mmio_dev; - uint64_t msi_addr; - uint32_t msi_data; + device_t dev, mmio_dev; int err; dev = softc->dev; - pcib = device_get_parent(device_get_parent(dev)); - mmio_dev = pci_find_bsf(PCI_RID2BUS(softc->pci_rid), - PCI_RID2SLOT(softc->pci_rid), PCI_RID2FUNC(softc->pci_rid)); - if (device_is_attached(mmio_dev)) { - device_printf(dev, - "warning: IOMMU device is claimed by another driver %s\n", - device_get_driver(mmio_dev)->name); - } - - softc->event_irq = -1; - softc->event_rid = 0; - - /* - * Section 3.7.1 of IOMMU rev 2.0. With MSI, there is only one - * interrupt. XXX: Enable MSI/X support. - */ - err = PCIB_ALLOC_MSI(pcib, dev, 1, 1, &softc->event_irq); - if (err) { - device_printf(dev, - "Couldn't find event MSI IRQ resource.\n"); - return (ENOENT); - } - - err = bus_set_resource(dev, SYS_RES_IRQ, softc->event_rid, - softc->event_irq, 1); - if (err) { - device_printf(dev, "Couldn't set event MSI resource.\n"); - return (ENXIO); - } - - softc->event_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, - &softc->event_rid, RF_ACTIVE); - if (!softc->event_res) { - device_printf(dev, - "Unable to allocate event INTR resource.\n"); - return (ENOMEM); - } - - if (bus_setup_intr(dev, softc->event_res, - INTR_TYPE_MISC | INTR_MPSAFE, NULL, amdvi_event_intr, - softc, &softc->event_tag)) { - device_printf(dev, "Fail to setup event intr\n"); - bus_release_resource(softc->dev, SYS_RES_IRQ, - softc->event_rid, softc->event_res); - softc->event_res = NULL; - return (ENXIO); - } - - bus_describe_intr(dev, softc->event_res, softc->event_tag, - "fault"); - - err = PCIB_MAP_MSI(pcib, dev, softc->event_irq, &msi_addr, - &msi_data); - if (err) { - device_printf(dev, - "Event interrupt config failed, err=%d.\n", - err); - amdvi_free_evt_intr_res(softc->dev); - return (err); - } + mmio_dev = softc->pci_dev; /* Clear interrupt status bits. */ ctrl = softc->ctrl; ctrl->status &= AMDVI_STATUS_EV_OF | AMDVI_STATUS_EV_INTR; - /* Now enable MSI interrupt. */ - pci_enable_msi(mmio_dev, msi_addr, msi_data); - return (0); + err = IVHD_SETUP_INTR(mmio_dev, amdvi_event_intr, softc, "fault"); + if (err) + device_printf(dev, "Interrupt setup failed on %s\n", + device_get_nameunit(mmio_dev)); + return (err); } static void diff --git a/sys/amd64/vmm/amd/amdvi_priv.h b/sys/amd64/vmm/amd/amdvi_priv.h index 2db6914f08f4..0eae7ca6ca4c 100644 --- a/sys/amd64/vmm/amd/amdvi_priv.h +++ b/sys/amd64/vmm/amd/amdvi_priv.h @@ -375,17 +375,14 @@ enum IvrsType struct amdvi_softc { struct amdvi_ctrl *ctrl; /* Control area. */ device_t dev; /* IOMMU device. */ + device_t pci_dev; /* IOMMU PCI function device. */ enum IvrsType ivhd_type; /* IOMMU IVHD type. */ bool iotlb; /* IOTLB supported by IOMMU */ struct amdvi_cmd *cmd; /* Command descriptor area. */ int cmd_max; /* Max number of commands. */ uint64_t cmp_data; /* Command completion write back. */ struct amdvi_event *event; /* Event descriptor area. */ - struct resource *event_res; /* Event interrupt resource. */ - void *event_tag; /* Event interrupt tag. */ int event_max; /* Max number of events. */ - int event_irq; - int event_rid; /* ACPI various flags. */ uint32_t ivhd_flag; /* ACPI IVHD flag. */ uint32_t ivhd_feature; /* ACPI v1 Reserved or v2 attribute. */ diff --git a/sys/amd64/vmm/amd/ivhd_if.m b/sys/amd64/vmm/amd/ivhd_if.m new file mode 100644 index 000000000000..eaae01ae0131 --- /dev/null +++ b/sys/amd64/vmm/amd/ivhd_if.m @@ -0,0 +1,46 @@ +#- +# Copyright (c) 2021 The FreeBSD Fondation +# +# Portions of this software were developed by Ka Ho Ng +# under sponsorship from the FreeBSD Foundation. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 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$ +# + +#include +#include +#include + +INTERFACE ivhd; + +METHOD int setup_intr { + device_t dev; + driver_intr_t handler; + void *arg; + const char *desc; +}; + +METHOD int teardown_intr { + device_t dev; +}; diff --git a/sys/amd64/vmm/amd/ivrs_drv.c b/sys/amd64/vmm/amd/ivrs_drv.c index d33229623a96..6291895c212f 100644 --- a/sys/amd64/vmm/amd/ivrs_drv.c +++ b/sys/amd64/vmm/amd/ivrs_drv.c @@ -2,6 +2,7 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) 2016, Anish Gupta (anish@freebsd.org) + * Copyright (c) 2021 The FreeBSD Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -44,6 +45,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include "io/iommu.h" #include "amdvi_priv.h" @@ -628,6 +631,9 @@ ivhd_attach(device_t dev) softc->dev = dev; ivhd = ivhd_hdrs[unit]; KASSERT(ivhd, ("ivhd is NULL")); + softc->pci_dev = pci_find_bsf(PCI_RID2BUS(ivhd->Header.DeviceId), + PCI_RID2SLOT(ivhd->Header.DeviceId), + PCI_RID2FUNC(ivhd->Header.DeviceId)); softc->ivhd_type = ivhd->Header.Type; softc->pci_seg = ivhd->PciSegmentGroup; diff --git a/sys/modules/vmm/Makefile b/sys/modules/vmm/Makefile index b5d62c358272..ef0d9dcb6786 100644 --- a/sys/modules/vmm/Makefile +++ b/sys/modules/vmm/Makefile @@ -51,6 +51,9 @@ SRCS+= ept.c \ # amd-specific files .PATH: ${SRCTOP}/sys/amd64/vmm/amd SRCS+= vmcb.c \ + amdiommu.c \ + ivhd_if.c \ + ivhd_if.h \ svm.c \ svm_support.S \ npt.c \ From owner-dev-commits-src-all@freebsd.org Wed Apr 7 10:56:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 278C95D2D90; Wed, 7 Apr 2021 10:56: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 4FFhCC0JLWz4r9s; Wed, 7 Apr 2021 10:56: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 EDFBE1E280; Wed, 7 Apr 2021 10:56: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 137Au6Ii046770; Wed, 7 Apr 2021 10:56:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137Au6Tv046769; Wed, 7 Apr 2021 10:56:06 GMT (envelope-from git) Date: Wed, 7 Apr 2021 10:56:06 GMT Message-Id: <202104071056.137Au6Tv046769@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ka Ho Ng Subject: git: 1bbe0448e47f - stable/13 - AMD-vi: Fix mismatched NULL checking in amdiommu teardown path MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1bbe0448e47fd9edeee97060e823331334319038 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 10:56:07 -0000 The branch stable/13 has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=1bbe0448e47fd9edeee97060e823331334319038 commit 1bbe0448e47fd9edeee97060e823331334319038 Author: Ka Ho Ng AuthorDate: 2021-03-31 19:30:21 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-07 10:55:38 +0000 AMD-vi: Fix mismatched NULL checking in amdiommu teardown path Sponsored by: The FreeBSD Foundation Approved by: lwhsu (mentor) MFC with: 74ada297e897 (cherry picked from commit cf76495e0a30043503ef126f0a485e314730a221) --- sys/amd64/vmm/amd/amdiommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/amd64/vmm/amd/amdiommu.c b/sys/amd64/vmm/amd/amdiommu.c index 4ded23dff003..5eed6ce849cc 100644 --- a/sys/amd64/vmm/amd/amdiommu.c +++ b/sys/amd64/vmm/amd/amdiommu.c @@ -165,7 +165,7 @@ ivhd_teardown_intr(device_t dev) sc = device_get_softc(dev); - if (sc->event_res != NULL) { + if (sc->event_tag != NULL) { bus_teardown_intr(dev, sc->event_res, sc->event_tag); sc->event_tag = NULL; } From owner-dev-commits-src-all@freebsd.org Wed Apr 7 10:56:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 912B05D2CC7; Wed, 7 Apr 2021 10:56:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFhCD6GMwz4r1C; Wed, 7 Apr 2021 10:56: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 364701DF37; Wed, 7 Apr 2021 10:56: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 137Au8Bw046791; Wed, 7 Apr 2021 10:56:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137Au8Xj046790; Wed, 7 Apr 2021 10:56:08 GMT (envelope-from git) Date: Wed, 7 Apr 2021 10:56:08 GMT Message-Id: <202104071056.137Au8Xj046790@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ka Ho Ng Subject: git: 9d7eb557c157 - stable/13 - AMD-vi: Mixed format IVHD block should replace fixed format IVHD block MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9d7eb557c1574f879b4bb4adee285cc9f2d5f18e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 10:56:10 -0000 The branch stable/13 has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=9d7eb557c1574f879b4bb4adee285cc9f2d5f18e commit 9d7eb557c1574f879b4bb4adee285cc9f2d5f18e Author: Ka Ho Ng AuthorDate: 2021-04-01 01:15:19 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-07 10:55:38 +0000 AMD-vi: Mixed format IVHD block should replace fixed format IVHD block This fixes double IVHD_SETUP_INTR calls on the same IOMMU device. Sponsored by: The FreeBSD Foundation MFC with: 74ada297e897 Reported by: Oleg Ginzburg Reviewed by: grehan Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D29521 (cherry picked from commit 03efa462b2ab3ae8166598363e9e83d4e5cf0398) --- sys/amd64/vmm/amd/ivrs_drv.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/sys/amd64/vmm/amd/ivrs_drv.c b/sys/amd64/vmm/amd/ivrs_drv.c index 6291895c212f..1cd76069d0a2 100644 --- a/sys/amd64/vmm/amd/ivrs_drv.c +++ b/sys/amd64/vmm/amd/ivrs_drv.c @@ -312,14 +312,22 @@ ivhd_dev_parse(ACPI_IVRS_HARDWARE1 *ivhd, struct amdvi_softc *softc) static bool ivhd_is_newer(ACPI_IVRS_HEADER *old, ACPI_IVRS_HEADER *new) { - /* - * Newer IVRS header type take precedence. - */ - if ((old->DeviceId == new->DeviceId) && - (old->Type == IVRS_TYPE_HARDWARE_LEGACY) && - ((new->Type == IVRS_TYPE_HARDWARE_EFR) || - (new->Type == IVRS_TYPE_HARDWARE_MIXED))) { - return (true); + if (old->DeviceId == new->DeviceId) { + /* + * Newer IVRS header type take precedence. + */ + if (old->Type == IVRS_TYPE_HARDWARE_LEGACY && + ((new->Type == IVRS_TYPE_HARDWARE_EFR) || + (new->Type == IVRS_TYPE_HARDWARE_MIXED))) + return (true); + + /* + * Mixed format IVHD header type take precedence + * over fixed format IVHD header types. + */ + if (old->Type == IVRS_TYPE_HARDWARE_EFR && + new->Type == IVRS_TYPE_HARDWARE_MIXED) + return (true); } return (false); From owner-dev-commits-src-all@freebsd.org Wed Apr 7 11:13:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13F285D355C; Wed, 7 Apr 2021 11:13: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 4FFhZl01dnz4sKt; Wed, 7 Apr 2021 11:13: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 E7B421E58A; Wed, 7 Apr 2021 11:13: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 137BD2pt074019; Wed, 7 Apr 2021 11:13:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137BD2Pj074018; Wed, 7 Apr 2021 11:13:02 GMT (envelope-from git) Date: Wed, 7 Apr 2021 11:13:02 GMT Message-Id: <202104071113.137BD2Pj074018@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: 86a52e262a6f - main - Document vnode_pager_setsize(9) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 86a52e262a6faf75ee34eaa801f6d8ddaad20733 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 11:13:03 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=86a52e262a6faf75ee34eaa801f6d8ddaad20733 commit 86a52e262a6faf75ee34eaa801f6d8ddaad20733 Author: Ka Ho Ng AuthorDate: 2021-04-07 11:00:31 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-07 11:11:26 +0000 Document vnode_pager_setsize(9) MFC after: 3 days Sponsored by: The FreeBSD Foundation Reviewed by: bcr Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D29408 --- share/man/man9/Makefile | 1 + share/man/man9/vnode_pager_setsize.9 | 74 ++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 52a5d373a417..efdd8b2f6e9c 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -401,6 +401,7 @@ MAN= accept_filter.9 \ vn_isdisk.9 \ vnet.9 \ vnode.9 \ + vnode_pager_setsize.9 \ VOP_ACCESS.9 \ VOP_ACLCHECK.9 \ VOP_ADVISE.9 \ diff --git a/share/man/man9/vnode_pager_setsize.9 b/share/man/man9/vnode_pager_setsize.9 new file mode 100644 index 000000000000..c59a01796f20 --- /dev/null +++ b/share/man/man9/vnode_pager_setsize.9 @@ -0,0 +1,74 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" Copyright (c) 2021 The FreeBSD Foundation +.\" +.\" Portions of this software were developed by Ka Ho Ng +.\" under sponsorship from the FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 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. +.\" +.Dd April 6, 2021 +.Dt VNODE_PAGER_SETSIZE 9 +.Os +.Sh NAME +.Nm vnode_pager_setsize +.Nd "notify the VM system about updates in the file size" +.Sh SYNOPSIS +.In sys/param.h +.In vm/vm.h +.In vm/vm_extern.h +.Ft void +.Fn vnode_pager_setsize "struct vnode *vp" "vm_ooffset_t nsize" +.Sh DESCRIPTION +.Nm +lets the VM system know about a change in size for a file. +Content beyond the new EOF specified by the +.Fa nsize +argument will be purged from the cache. +This function is useful for use within file system code to implement +truncation in +.Xr VOP_SETATTR 9 . +.Sh IMPLEMENTATION NOTES +In case the new EOF specified by the +.Fa nsize +argument is not aligned to page boundaries, +partial-page area starting beyond the EOF will be zeroed. +In partial-page area, +for content occupying whole blocks within block +boundaries, +the dirty bits for the corresponding blocks will be cleared. +.Sh LOCKING +Writer lock of the VM object of +.Fa vp +will be held within the function. +.Sh SEE ALSO +.Xr vnode 9 +.Sh HISTORY +The +.Nm +manual page first appeared in +.Fx 14 . +.Sh AUTHORS +This +manual page was written by +.An Ka Ho Ng Aq Mt khng@FreeBSD.org . From owner-dev-commits-src-all@freebsd.org Wed Apr 7 13:08:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C0D525D67D8; Wed, 7 Apr 2021 13:08: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 4FFl8K2S7Jz3JP8; Wed, 7 Apr 2021 13:08: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 2976E1F574; Wed, 7 Apr 2021 13:08: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 137D8mCw022372; Wed, 7 Apr 2021 13:08:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137D8mK1022371; Wed, 7 Apr 2021 13:08:48 GMT (envelope-from git) Date: Wed, 7 Apr 2021 13:08:48 GMT Message-Id: <202104071308.137D8mK1022371@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: 5a5623397c73 - main - pf tests: make synproxy and nat work correctly even if inetd is running 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: 5a5623397c73e46b206289d32d1d6b9de420da9c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 13:08:49 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5a5623397c73e46b206289d32d1d6b9de420da9c commit 5a5623397c73e46b206289d32d1d6b9de420da9c Author: Kurosawa Takahiro AuthorDate: 2021-04-07 06:17:51 +0000 Commit: Kristof Provost CommitDate: 2021-04-07 11:05:23 +0000 pf tests: make synproxy and nat work correctly even if inetd is running tests/sys/netfil/pf/synproxy fails if inetd has been running outside of the jail because pidfile_open() fails with EEXIST. tests/sys/netfil/pf/nat has the same problem but the test succeeds because whether inetd is running is not so important. Fix the problem by changing the pidfile path from the default location. Reviewed by: kp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29622 --- tests/sys/netpfil/pf/nat.sh | 3 ++- tests/sys/netpfil/pf/synproxy.sh | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/sys/netpfil/pf/nat.sh b/tests/sys/netpfil/pf/nat.sh index 499c137eee9c..3fabb32db80f 100644 --- a/tests/sys/netpfil/pf/nat.sh +++ b/tests/sys/netpfil/pf/nat.sh @@ -52,7 +52,7 @@ exhaust_body() jexec nat sysctl net.inet.ip.forwarding=1 jexec echo ifconfig ${epair_echo}b 198.51.100.2/24 up - jexec echo /usr/sbin/inetd $(atf_get_srcdir)/echo_inetd.conf + jexec echo /usr/sbin/inetd -p inetd-echo.pid $(atf_get_srcdir)/echo_inetd.conf # Enable pf! jexec nat pfctl -e @@ -80,6 +80,7 @@ exhaust_body() exhaust_cleanup() { + rm -f inetd-echo.pid pft_cleanup } diff --git a/tests/sys/netpfil/pf/synproxy.sh b/tests/sys/netpfil/pf/synproxy.sh index f4d6df46fa78..aedbb8885129 100644 --- a/tests/sys/netpfil/pf/synproxy.sh +++ b/tests/sys/netpfil/pf/synproxy.sh @@ -53,7 +53,7 @@ synproxy_body() jexec singsing ifconfig ${link}b 198.51.100.2/24 up jexec singsing route add default 198.51.100.1 - jexec singsing /usr/sbin/inetd $(atf_get_srcdir)/echo_inetd.conf + jexec singsing /usr/sbin/inetd -p inetd-singsing.pid $(atf_get_srcdir)/echo_inetd.conf jexec alcatraz pfctl -e pft_set_rules alcatraz "set fail-policy return" \ @@ -75,6 +75,7 @@ synproxy_body() synproxy_cleanup() { + rm -f inetd-singsing.pid pft_cleanup } From owner-dev-commits-src-all@freebsd.org Wed Apr 7 13:33:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 374205D771E; Wed, 7 Apr 2021 13:33:51 +0000 (UTC) (envelope-from nwhitehorn@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 4FFljC16Prz3LTw; Wed, 7 Apr 2021 13:33:51 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Received: from comporellon.tachypleus.net (unknown [IPv6:2601:405:4a00:acd:143b:69ef:22c2:14cb]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: nwhitehorn/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id DFDCD280C5; Wed, 7 Apr 2021 13:33:50 +0000 (UTC) (envelope-from nwhitehorn@freebsd.org) Subject: Re: git: fa04db476201 - main - release: fix VMSIZE following 1ca8842f3ad9 To: Glen Barber , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202103041343.124Dh6cq038222@gitrepo.freebsd.org> From: Nathan Whitehorn Message-ID: <5c7bf986-d5ee-3544-91d1-84a502d7bdbb@freebsd.org> Date: Wed, 7 Apr 2021 09:33:50 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <202103041343.124Dh6cq038222@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 13:33:51 -0000 On 3/4/21 8:43 AM, Glen Barber wrote: > The branch main has been updated by gjb: > > URL: https://cgit.FreeBSD.org/src/commit/?id=fa04db476201c4cad5f6a5f67da8f2ef1e1cdad3 > > commit fa04db476201c4cad5f6a5f67da8f2ef1e1cdad3 > Author: Glen Barber > AuthorDate: 2021-03-04 13:39:43 +0000 > Commit: Glen Barber > CommitDate: 2021-03-04 13:43:02 +0000 > > release: fix VMSIZE following 1ca8842f3ad9 > > truncate(1) is not case-sensitive with regard to setting the size > of a file. makefs(8), however, does not honor upper-case values. > Update release-specific files and the release(7) manual page to > reflect this. [...] Should we also either lower-case everything when passed to makefs in vmimage.subr or modify makefs to take upper-case values? Everything else in our system is case-agnostic. -Nathan > > MFC with: 1ca8842f3ad9 > Submitted by: ehem_freebsd_m5p.com (original) > Differential Review: https://reviews.freebsd.org/D28979 > Sponsored by: Rubicon Communications, LLC ("Netgate") > --- > release/Makefile.vm | 4 ++-- > release/release.conf.sample | 4 ++-- > release/tools/basic-ci.conf | 2 +- > release/tools/ec2.conf | 2 +- > release/tools/gce.conf | 2 +- > release/tools/vagrant.conf | 2 +- > share/man/man7/release.7 | 6 +++--- > 7 files changed, 11 insertions(+), 11 deletions(-) > > diff --git a/release/Makefile.vm b/release/Makefile.vm > index d075fa1fb29c..2240a1e5fc57 100644 > --- a/release/Makefile.vm > +++ b/release/Makefile.vm > @@ -7,8 +7,8 @@ > > VMTARGETS= vm-image > VMFORMATS?= vhd vmdk qcow2 raw > -VMSIZE?= 4096M > -SWAPSIZE?= 1G > +VMSIZE?= 4096m > +SWAPSIZE?= 1g > VMBASE?= vm From owner-dev-commits-src-all@freebsd.org Wed Apr 7 15:03:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB75F5B9930; Wed, 7 Apr 2021 15:03: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 4FFnhl5QG5z3hnQ; Wed, 7 Apr 2021 15:03: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 AC86A2160A; Wed, 7 Apr 2021 15:03: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 137F3ZIi080708; Wed, 7 Apr 2021 15:03:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137F3ZfH080707; Wed, 7 Apr 2021 15:03:35 GMT (envelope-from git) Date: Wed, 7 Apr 2021 15:03:35 GMT Message-Id: <202104071503.137F3ZfH080707@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: ab8d25880ebc - main - libnv: Allow use in non-sleepable contexts 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: ab8d25880ebc9ddca1ae6af938680036349edf3f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 15:03:35 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ab8d25880ebc9ddca1ae6af938680036349edf3f commit ab8d25880ebc9ddca1ae6af938680036349edf3f Author: Kristof Provost AuthorDate: 2021-03-25 12:59:14 +0000 Commit: Kristof Provost CommitDate: 2021-04-07 13:54:10 +0000 libnv: Allow use in non-sleepable contexts 44c125c4cebc2fd87c6260b90eddae11201f5232 switched the nvlist allocations to be M_WAITOK, but this precludes the use in non-sleepable contexts. (E.g. with a nonsleepable lock held). All callers for these allocation functions already cope with memory alloation failures, so there's no reason to allow sleeping during allocations. Reviewed by: melifaro, oshogbo MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29556 --- sys/contrib/libnv/nv_impl.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/contrib/libnv/nv_impl.h b/sys/contrib/libnv/nv_impl.h index 14f2fb8f2c11..1875c739beee 100644 --- a/sys/contrib/libnv/nv_impl.h +++ b/sys/contrib/libnv/nv_impl.h @@ -52,13 +52,13 @@ typedef struct nvpair nvpair_t; #define NV_FLAG_IN_ARRAY 0x100 #ifdef _KERNEL -#define nv_malloc(size) malloc((size), M_NVLIST, M_WAITOK) +#define nv_malloc(size) malloc((size), M_NVLIST, M_NOWAIT) #define nv_calloc(n, size) mallocarray((n), (size), M_NVLIST, \ - M_WAITOK | M_ZERO) + M_NOWAIT | M_ZERO) #define nv_realloc(buf, size) realloc((buf), (size), M_NVLIST, \ - M_WAITOK) + M_NOWAIT) #define nv_free(buf) free((buf), M_NVLIST) -#define nv_strdup(buf) strdup((buf), M_NVLIST) +#define nv_strdup(buf) strdup_flags((buf), M_NVLIST, M_NOWAIT) #define nv_vasprintf(ptr, ...) vasprintf(ptr, M_NVLIST, __VA_ARGS__) #define ERRNO_SET(var) do { } while (0) From owner-dev-commits-src-all@freebsd.org Wed Apr 7 15:03:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2FD0D5B982B; Wed, 7 Apr 2021 15:03:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFnhm6nGfz3hMm; Wed, 7 Apr 2021 15:03: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 D813021691; Wed, 7 Apr 2021 15:03: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 137F3at3080729; Wed, 7 Apr 2021 15:03:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137F3abb080728; Wed, 7 Apr 2021 15:03:36 GMT (envelope-from git) Date: Wed, 7 Apr 2021 15:03:36 GMT Message-Id: <202104071503.137F3abb080728@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: 6d786845cf63 - main - pf: Do not short-circuit processing for REPLY_TO 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: 6d786845cf63c8bf57174e3e43b0b5c5eca75be3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 15:03:37 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=6d786845cf63c8bf57174e3e43b0b5c5eca75be3 commit 6d786845cf63c8bf57174e3e43b0b5c5eca75be3 Author: Kristof Provost AuthorDate: 2021-04-07 13:46:44 +0000 Commit: Kristof Provost CommitDate: 2021-04-07 15:03:17 +0000 pf: Do not short-circuit processing for REPLY_TO When we find a state for packets that was created by a reply-to rule we still need to process the packet. The state may require us to modify the packet (e.g. in rdr or nat cases), which we won't do with the shortcut. MFC after: 2 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 4b11122df544..e4bc6447b0d1 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -342,10 +342,8 @@ VNET_DEFINE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); if (PACKET_LOOPED(pd)) \ return (PF_PASS); \ if ((d) == PF_OUT && \ - (((s)->rule.ptr->rt == PF_ROUTETO && \ - (s)->rule.ptr->direction == PF_OUT) || \ - ((s)->rule.ptr->rt == PF_REPLYTO && \ - (s)->rule.ptr->direction == PF_IN)) && \ + (s)->rule.ptr->rt == PF_ROUTETO && \ + (s)->rule.ptr->direction == PF_OUT && \ (s)->rt_kif != NULL && \ (s)->rt_kif != (i)) \ return (PF_PASS); \ From owner-dev-commits-src-all@freebsd.org Wed Apr 7 15:03:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CC435B9932; Wed, 7 Apr 2021 15:03: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 4FFnhp0DTBz3hQV; Wed, 7 Apr 2021 15:03: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 EB0862143D; Wed, 7 Apr 2021 15:03:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 137F3b3a080750; Wed, 7 Apr 2021 15:03:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137F3b3l080749; Wed, 7 Apr 2021 15:03:37 GMT (envelope-from git) Date: Wed, 7 Apr 2021 15:03:37 GMT Message-Id: <202104071503.137F3b3l080749@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: f37667e23592 - main - pf tests: Test multi-wan rdr 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: f37667e2359245ad123fd775c072fd82c81bc476 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 15:03:38 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f37667e2359245ad123fd775c072fd82c81bc476 commit f37667e2359245ad123fd775c072fd82c81bc476 Author: Kristof Provost AuthorDate: 2021-04-06 11:25:49 +0000 Commit: Kristof Provost CommitDate: 2021-04-07 15:03:20 +0000 pf tests: Test multi-wan rdr This replicates an issue observed on pfSense: https://redmine.pfsense.org/issues/11436 In essence, reply-to is needed to ensure that connections always leave the WAN interface they came in on, but this confused the state tracking. MFC after: 2 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/route_to.sh | 83 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/tests/sys/netpfil/pf/route_to.sh b/tests/sys/netpfil/pf/route_to.sh index 97f30bafb413..59b16e35ee6f 100644 --- a/tests/sys/netpfil/pf/route_to.sh +++ b/tests/sys/netpfil/pf/route_to.sh @@ -99,8 +99,91 @@ v6_cleanup() pft_cleanup } +atf_test_case "multiwan" "cleanup" +multiwan_head() +{ + atf_set descr 'Multi-WAN redirection / reply-to test' + atf_set require.user root +} + +multiwan_body() +{ + pft_init + + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + epair_cl_one=$(vnet_mkepair) + epair_cl_two=$(vnet_mkepair) + + vnet_mkjail srv ${epair_one}b ${epair_two}b + vnet_mkjail wan_one ${epair_one}a ${epair_cl_one}b + vnet_mkjail wan_two ${epair_two}a ${epair_cl_two}b + vnet_mkjail client ${epair_cl_one}a ${epair_cl_two}a + + jexec client ifconfig ${epair_cl_one}a 203.0.113.1/25 + jexec wan_one ifconfig ${epair_cl_one}b 203.0.113.2/25 + jexec wan_one ifconfig ${epair_one}a 192.0.2.1/24 up + jexec wan_one sysctl net.inet.ip.forwarding=1 + jexec srv ifconfig ${epair_one}b 192.0.2.2/24 up + jexec client route add 192.0.2.0/24 203.0.113.2 + + jexec client ifconfig ${epair_cl_two}a 203.0.113.128/25 + jexec wan_two ifconfig ${epair_cl_two}b 203.0.113.129/25 + jexec wan_two ifconfig ${epair_two}a 198.51.100.1/24 up + jexec wan_two sysctl net.inet.ip.forwarding=1 + jexec srv ifconfig ${epair_two}b 198.51.100.2/24 up + jexec client route add 198.51.100.0/24 203.0.113.129 + + jexec srv ifconfig lo0 127.0.0.1/8 up + jexec srv route add default 192.0.2.1 + jexec srv sysctl net.inet.ip.forwarding=1 + + # Run echo server in srv jail + jexec srv /usr/sbin/inetd -p multiwan.pid $(atf_get_srcdir)/echo_inetd.conf + + jexec srv pfctl -e + pft_set_rules srv \ + "nat on ${epair_one}b inet from 127.0.0.0/8 to any -> (${epair_one}b)" \ + "nat on ${epair_two}b inet from 127.0.0.0/8 to any -> (${epair_two}b)" \ + "rdr on ${epair_one}b inet proto tcp from any to 192.0.2.2 port 7 -> 127.0.0.1 port 7" \ + "rdr on ${epair_two}b inet proto tcp from any to 198.51.100.2 port 7 -> 127.0.0.1 port 7" \ + "block in" \ + "block out" \ + "pass in quick on ${epair_one}b reply-to (${epair_one}b 192.0.2.1) inet proto tcp from any to 127.0.0.1 port 7" \ + "pass in quick on ${epair_two}b reply-to (${epair_two}b 198.51.100.1) inet proto tcp from any to 127.0.0.1 port 7" + + # These will always succeed, because we don't change interface to route + # correctly here. + result=$(echo "one" | jexec wan_one nc -N -w 3 192.0.2.2 7) + if [ "${result}" != "one" ]; then + atf_fail "Redirect on one failed" + fi + result=$(echo "two" | jexec wan_two nc -N -w 3 198.51.100.2 7) + if [ "${result}" != "two" ]; then + atf_fail "Redirect on two failed" + fi + + result=$(echo "one" | jexec client nc -N -w 3 192.0.2.2 7) + if [ "${result}" != "one" ]; then + atf_fail "Redirect from client on one failed" + fi + + # This should trigger the issue fixed in 829a69db855b48ff7e8242b95e193a0783c489d9 + result=$(echo "two" | jexec client nc -N -w 3 198.51.100.2 7) + if [ "${result}" != "two" ]; then + atf_fail "Redirect from client on two failed" + fi +} + +multiwan_cleanup() +{ + rm -f multiwan.pid + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4" atf_add_test_case "v6" + atf_add_test_case "multiwan" } From owner-dev-commits-src-all@freebsd.org Wed Apr 7 15:39:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 534CE5BA666; Wed, 7 Apr 2021 15:39: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 4FFpVS1zFvz3l62; Wed, 7 Apr 2021 15:39: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 3283F21C86; Wed, 7 Apr 2021 15:39: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 137FdiZA021014; Wed, 7 Apr 2021 15:39:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137Fdi7T021013; Wed, 7 Apr 2021 15:39:44 GMT (envelope-from git) Date: Wed, 7 Apr 2021 15:39:44 GMT Message-Id: <202104071539.137Fdi7T021013@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: 066a576c5f1b - main - ipfw: update man page example for nat show log 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: 066a576c5f1beac1c42370135f6eddf026561430 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 15:39:44 -0000 The branch main has been updated by allanjude: URL: https://cgit.FreeBSD.org/src/commit/?id=066a576c5f1beac1c42370135f6eddf026561430 commit 066a576c5f1beac1c42370135f6eddf026561430 Author: Roman Bogorodskiy AuthorDate: 2021-04-07 15:37:46 +0000 Commit: Allan Jude CommitDate: 2021-04-07 15:37:46 +0000 ipfw: update man page example for nat show log In d6164b77f8b779cd7357387dcfcd3407f1457579 the ability to show ranges of nat log entries was removed. PR: 254192 Reviewed by: allanjude --- sbin/ipfw/ipfw.8 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sbin/ipfw/ipfw.8 b/sbin/ipfw/ipfw.8 index d2c4885bc119..439738a54e34 100644 --- a/sbin/ipfw/ipfw.8 +++ b/sbin/ipfw/ipfw.8 @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 21, 2020 +.Dd April 7, 2021 .Dt IPFW 8 .Os .Sh NAME @@ -4536,9 +4536,9 @@ To see configuration of nat instance 123: .Pp .Dl "ipfw nat 123 show config" .Pp -To show logs of all the instances in range 111-999: +To show logs of all instances: .Pp -.Dl "ipfw nat 111-999 show" +.Dl "ipfw nat show log" .Pp To see configurations of all instances: .Pp From owner-dev-commits-src-all@freebsd.org Wed Apr 7 15:48:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E7F05BB150; Wed, 7 Apr 2021 15:48: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 4FFph83Xcnz3m7Q; Wed, 7 Apr 2021 15:48: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 61D7B21D39; Wed, 7 Apr 2021 15:48: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 137Fm8Bb033953; Wed, 7 Apr 2021 15:48:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137Fm81L033952; Wed, 7 Apr 2021 15:48:08 GMT (envelope-from git) Date: Wed, 7 Apr 2021 15:48:08 GMT Message-Id: <202104071548.137Fm81L033952@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: bcfb4750b809 - stable/13 - dummynet: Move packet counters into dn_cfg 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/stable/13 X-Git-Reftype: branch X-Git-Commit: bcfb4750b8099c1d9d3e179385269dc63dc7dcc5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 15:48:08 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bcfb4750b8099c1d9d3e179385269dc63dc7dcc5 commit bcfb4750b8099c1d9d3e179385269dc63dc7dcc5 Author: Kristof Provost AuthorDate: 2021-03-09 15:27:31 +0000 Commit: Kristof Provost CommitDate: 2021-04-07 15:25:54 +0000 dummynet: Move packet counters into dn_cfg Move the packets counters into the dn_cfg struct. This reduces the global name space use for dummynet and will make future work for things like vnet support and re-use in pf easier. Reviewed by: donner MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29245 (cherry picked from commit cd5671efc0190ba0f9eb41bba42e703277af20c3) --- sys/netpfil/ipfw/dn_aqm.h | 5 +---- sys/netpfil/ipfw/dn_sched_fq_codel.h | 2 +- sys/netpfil/ipfw/dn_sched_fq_pie.c | 2 +- sys/netpfil/ipfw/ip_dn_io.c | 24 ++++++++---------------- sys/netpfil/ipfw/ip_dn_private.h | 5 +++++ 5 files changed, 16 insertions(+), 22 deletions(-) diff --git a/sys/netpfil/ipfw/dn_aqm.h b/sys/netpfil/ipfw/dn_aqm.h index a8a362a4bde9..8bbe9fe69e86 100644 --- a/sys/netpfil/ipfw/dn_aqm.h +++ b/sys/netpfil/ipfw/dn_aqm.h @@ -53,9 +53,6 @@ typedef int32_t aqm_stime_t; /* Macro for variable bounding */ #define BOUND_VAR(x,l,h) ((x) > (h)? (h) : ((x) > (l)? (x) : (l))) -/* sysctl variable to count number of dropped packets */ -extern unsigned long io_pkt_drop; - /* * Structure for holding data and function pointers that together represent a * AQM algorithm. @@ -137,7 +134,7 @@ update_stats(struct dn_queue *q, int len, int drop) if (drop) { qni->drops++; sni->drops++; - io_pkt_drop++; + dn_cfg.io_pkt_drop++; } else { /*update queue stats */ qni->length += inc; diff --git a/sys/netpfil/ipfw/dn_sched_fq_codel.h b/sys/netpfil/ipfw/dn_sched_fq_codel.h index 725189483ba2..a8369ac83129 100644 --- a/sys/netpfil/ipfw/dn_sched_fq_codel.h +++ b/sys/netpfil/ipfw/dn_sched_fq_codel.h @@ -104,7 +104,7 @@ fq_update_stats(struct fq_codel_flow *q, struct fq_codel_si *si, int len, si->main_q.ni.drops ++; q->stats.drops ++; si->_si.ni.drops ++; - io_pkt_drop ++; + dn_cfg.io_pkt_drop ++; } if (!drop || (drop && len < 0)) { diff --git a/sys/netpfil/ipfw/dn_sched_fq_pie.c b/sys/netpfil/ipfw/dn_sched_fq_pie.c index 2f21ca77e33a..257dada44345 100644 --- a/sys/netpfil/ipfw/dn_sched_fq_pie.c +++ b/sys/netpfil/ipfw/dn_sched_fq_pie.c @@ -299,7 +299,7 @@ fq_update_stats(struct fq_pie_flow *q, struct fq_pie_si *si, int len, si->main_q.ni.drops ++; q->stats.drops ++; si->_si.ni.drops ++; - io_pkt_drop ++; + dn_cfg.io_pkt_drop ++; } if (!drop || (drop && len < 0)) { diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c index 1b39fcb0359f..f71d07ae1140 100644 --- a/sys/netpfil/ipfw/ip_dn_io.c +++ b/sys/netpfil/ipfw/ip_dn_io.c @@ -88,14 +88,6 @@ static long tick_lost; /* Lost(coalesced) ticks number. */ /* Adjusted vs non-adjusted curr_time difference (ticks). */ static long tick_diff; -static unsigned long io_pkt; -static unsigned long io_pkt_fast; - -#ifdef NEW_AQM -unsigned long io_pkt_drop; -#else -static unsigned long io_pkt_drop; -#endif /* * We use a heap to store entities for which we have pending timer events. * The heap is checked at every tick and all entities with expired events @@ -228,13 +220,13 @@ SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, fsk_count, SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, queue_count, CTLFLAG_RD, DC(queue_count), 0, "Number of queues"); SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt, - CTLFLAG_RD, &io_pkt, 0, + CTLFLAG_RD, DC(io_pkt), 0, "Number of packets passed to dummynet."); SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt_fast, - CTLFLAG_RD, &io_pkt_fast, 0, + CTLFLAG_RD, DC(io_pkt_fast), 0, "Number of packets bypassed dummynet scheduler."); SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt_drop, - CTLFLAG_RD, &io_pkt_drop, 0, + CTLFLAG_RD, DC(io_pkt_drop), 0, "Number of packets dropped by dummynet."); #undef DC SYSEND @@ -540,7 +532,7 @@ dn_enqueue(struct dn_queue *q, struct mbuf* m, int drop) return (0); drop: - io_pkt_drop++; + dn_cfg.io_pkt_drop++; q->ni.drops++; ni->drops++; FREE_PKT(m); @@ -882,7 +874,7 @@ dummynet_io(struct mbuf **m0, struct ip_fw_args *fwa) else if (fwa->flags & IPFW_ARGS_IP6) dir |= PROTO_IPV6; DN_BH_WLOCK(); - io_pkt++; + dn_cfg.io_pkt++; /* we could actually tag outside the lock, but who cares... */ if (tag_mbuf(m, dir, fwa)) goto dropit; @@ -918,7 +910,7 @@ dummynet_io(struct mbuf **m0, struct ip_fw_args *fwa) m = *m0 = NULL; /* dn_enqueue already increases io_pkt_drop */ - io_pkt_drop--; + dn_cfg.io_pkt_drop--; goto dropit; } @@ -956,7 +948,7 @@ dummynet_io(struct mbuf **m0, struct ip_fw_args *fwa) tag->m_tag_cookie = MTAG_IPFW_RULE; tag->m_tag_id = 0; - io_pkt_fast++; + dn_cfg.io_pkt_fast++; if (m->m_nextpkt != NULL) { printf("dummynet: fast io: pkt chain detected!\n"); m->m_nextpkt = NULL; @@ -972,7 +964,7 @@ done: return 0; dropit: - io_pkt_drop++; + dn_cfg.io_pkt_drop++; DN_BH_WUNLOCK(); if (m) FREE_PKT(m); diff --git a/sys/netpfil/ipfw/ip_dn_private.h b/sys/netpfil/ipfw/ip_dn_private.h index 24765bc09b0e..38c6ff1201d5 100644 --- a/sys/netpfil/ipfw/ip_dn_private.h +++ b/sys/netpfil/ipfw/ip_dn_private.h @@ -131,6 +131,11 @@ struct dn_parms { int fsk_count; int queue_count; + /* packet counters */ + unsigned long io_pkt; + unsigned long io_pkt_fast; + unsigned long io_pkt_drop; + /* ticks and other stuff */ uint64_t curr_time; /* flowsets and schedulers are in hash tables, with 'hash_size' From owner-dev-commits-src-all@freebsd.org Wed Apr 7 15:48:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D91BC5BAD51; Wed, 7 Apr 2021 15:48: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 4FFph94F2pz3lws; Wed, 7 Apr 2021 15:48: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 7F33D21CA1; Wed, 7 Apr 2021 15:48: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 137Fm9BB033976; Wed, 7 Apr 2021 15:48:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137Fm9nZ033975; Wed, 7 Apr 2021 15:48:09 GMT (envelope-from git) Date: Wed, 7 Apr 2021 15:48:09 GMT Message-Id: <202104071548.137Fm9nZ033975@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: da7865ad1f1b - stable/13 - dummynet: Move timekeeping information into dn_cfg 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/stable/13 X-Git-Reftype: branch X-Git-Commit: da7865ad1f1bf27688faf03efe7aa0db680769a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 15:48:10 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=da7865ad1f1bf27688faf03efe7aa0db680769a2 commit da7865ad1f1bf27688faf03efe7aa0db680769a2 Author: Kristof Provost AuthorDate: 2021-03-09 15:44:26 +0000 Commit: Kristof Provost CommitDate: 2021-04-07 15:25:54 +0000 dummynet: Move timekeeping information into dn_cfg Just like with the packet counters move the timekeeping information into dn_cfg. This reduces the global name space use for dummynet and will make subsequent work to add vnet support and re-use in pf easier. Reviewed by: donner MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Different Revision: https://reviews.freebsd.org/D29246 (cherry picked from commit 320bed3c007be1c2ff1f4b0d00d64d541d807fed) --- sys/netpfil/ipfw/ip_dn_io.c | 44 ++++++++++++++++------------------------ sys/netpfil/ipfw/ip_dn_private.h | 8 ++++++++ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c index f71d07ae1140..b439d2679f3c 100644 --- a/sys/netpfil/ipfw/ip_dn_io.c +++ b/sys/netpfil/ipfw/ip_dn_io.c @@ -80,14 +80,6 @@ __FBSDID("$FreeBSD$"); struct dn_parms dn_cfg; //VNET_DEFINE(struct dn_parms, _base_dn_cfg); -static long tick_last; /* Last tick duration (usec). */ -static long tick_delta; /* Last vs standard tick diff (usec). */ -static long tick_delta_sum; /* Accumulated tick difference (usec).*/ -static long tick_adjustment; /* Tick adjustments done. */ -static long tick_lost; /* Lost(coalesced) ticks number. */ -/* Adjusted vs non-adjusted curr_time difference (ticks). */ -static long tick_diff; - /* * We use a heap to store entities for which we have pending timer events. * The heap is checked at every tick and all entities with expired events @@ -192,16 +184,16 @@ SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, red_max_pkt_size, /* time adjustment */ SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_delta, - CTLFLAG_RD, &tick_delta, 0, "Last vs standard tick difference (usec)."); + CTLFLAG_RD, DC(tick_delta), 0, "Last vs standard tick difference (usec)."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_delta_sum, - CTLFLAG_RD, &tick_delta_sum, 0, "Accumulated tick difference (usec)."); + CTLFLAG_RD, DC(tick_delta_sum), 0, "Accumulated tick difference (usec)."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_adjustment, - CTLFLAG_RD, &tick_adjustment, 0, "Tick adjustments done."); + CTLFLAG_RD, DC(tick_adjustment), 0, "Tick adjustments done."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_diff, - CTLFLAG_RD, &tick_diff, 0, + CTLFLAG_RD, DC(tick_diff), 0, "Adjusted vs non-adjusted curr_time difference (ticks)."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_lost, - CTLFLAG_RD, &tick_lost, 0, + CTLFLAG_RD, DC(tick_lost), 0, "Number of ticks coalesced by dummynet taskqueue."); /* Drain parameters */ @@ -665,16 +657,16 @@ dummynet_task(void *context, int pending) DN_BH_WLOCK(); /* Update number of lost(coalesced) ticks. */ - tick_lost += pending - 1; + dn_cfg.tick_lost += pending - 1; getmicrouptime(&t); /* Last tick duration (usec). */ - tick_last = (t.tv_sec - dn_cfg.prev_t.tv_sec) * 1000000 + + dn_cfg.tick_last = (t.tv_sec - dn_cfg.prev_t.tv_sec) * 1000000 + (t.tv_usec - dn_cfg.prev_t.tv_usec); /* Last tick vs standard tick difference (usec). */ - tick_delta = (tick_last * hz - 1000000) / hz; + dn_cfg.tick_delta = (dn_cfg.tick_last * hz - 1000000) / hz; /* Accumulated tick difference (usec). */ - tick_delta_sum += tick_delta; + dn_cfg.tick_delta_sum += dn_cfg.tick_delta; dn_cfg.prev_t = t; @@ -686,18 +678,18 @@ dummynet_task(void *context, int pending) * adjustment. */ dn_cfg.curr_time++; - if (tick_delta_sum - tick >= 0) { - int diff = tick_delta_sum / tick; + if (dn_cfg.tick_delta_sum - tick >= 0) { + int diff = dn_cfg.tick_delta_sum / tick; dn_cfg.curr_time += diff; - tick_diff += diff; - tick_delta_sum %= tick; - tick_adjustment++; - } else if (tick_delta_sum + tick <= 0) { + dn_cfg.tick_diff += diff; + dn_cfg.tick_delta_sum %= tick; + dn_cfg.tick_adjustment++; + } else if (dn_cfg.tick_delta_sum + tick <= 0) { dn_cfg.curr_time--; - tick_diff--; - tick_delta_sum += tick; - tick_adjustment++; + dn_cfg.tick_diff--; + dn_cfg.tick_delta_sum += tick; + dn_cfg.tick_adjustment++; } /* serve pending events, accumulate in q */ diff --git a/sys/netpfil/ipfw/ip_dn_private.h b/sys/netpfil/ipfw/ip_dn_private.h index 38c6ff1201d5..6e48bc5116a7 100644 --- a/sys/netpfil/ipfw/ip_dn_private.h +++ b/sys/netpfil/ipfw/ip_dn_private.h @@ -125,6 +125,14 @@ struct dn_parms { struct timeval prev_t; /* last time dummynet_tick ran */ struct dn_heap evheap; /* scheduled events */ + long tick_last; /* Last tick duration (usec). */ + long tick_delta; /* Last vs standard tick diff (usec). */ + long tick_delta_sum; /* Accumulated tick difference (usec).*/ + long tick_adjustment; /* Tick adjustments done. */ + long tick_lost; /* Lost(coalesced) ticks number. */ + /* Adjusted vs non-adjusted curr_time difference (ticks). */ + long tick_diff; + /* counters of objects -- used for reporting space */ int schk_count; int si_count; From owner-dev-commits-src-all@freebsd.org Wed Apr 7 15:48:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 643C15BAF55; Wed, 7 Apr 2021 15:48: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 4FFphG1TKHz3m9M; Wed, 7 Apr 2021 15:48: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 A3FEE21D3A; Wed, 7 Apr 2021 15:48: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 137FmDDF034122; Wed, 7 Apr 2021 15:48:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137FmDWp034121; Wed, 7 Apr 2021 15:48:13 GMT (envelope-from git) Date: Wed, 7 Apr 2021 15:48:13 GMT Message-Id: <202104071548.137FmDWp034121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 06d8a9c86adf - stable/12 - dummynet: Move timekeeping information into dn_cfg 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 06d8a9c86adfecd16f55053f852f37ceadd26257 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 15:48:16 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=06d8a9c86adfecd16f55053f852f37ceadd26257 commit 06d8a9c86adfecd16f55053f852f37ceadd26257 Author: Kristof Provost AuthorDate: 2021-03-09 15:44:26 +0000 Commit: Kristof Provost CommitDate: 2021-04-07 15:25:38 +0000 dummynet: Move timekeeping information into dn_cfg Just like with the packet counters move the timekeeping information into dn_cfg. This reduces the global name space use for dummynet and will make subsequent work to add vnet support and re-use in pf easier. Reviewed by: donner MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Different Revision: https://reviews.freebsd.org/D29246 (cherry picked from commit 320bed3c007be1c2ff1f4b0d00d64d541d807fed) --- sys/netpfil/ipfw/ip_dn_io.c | 44 ++++++++++++++++------------------------ sys/netpfil/ipfw/ip_dn_private.h | 8 ++++++++ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c index 760a24ed041f..f746023db53c 100644 --- a/sys/netpfil/ipfw/ip_dn_io.c +++ b/sys/netpfil/ipfw/ip_dn_io.c @@ -79,14 +79,6 @@ __FBSDID("$FreeBSD$"); struct dn_parms dn_cfg; //VNET_DEFINE(struct dn_parms, _base_dn_cfg); -static long tick_last; /* Last tick duration (usec). */ -static long tick_delta; /* Last vs standard tick diff (usec). */ -static long tick_delta_sum; /* Accumulated tick difference (usec).*/ -static long tick_adjustment; /* Tick adjustments done. */ -static long tick_lost; /* Lost(coalesced) ticks number. */ -/* Adjusted vs non-adjusted curr_time difference (ticks). */ -static long tick_diff; - /* * We use a heap to store entities for which we have pending timer events. * The heap is checked at every tick and all entities with expired events @@ -187,16 +179,16 @@ SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, red_max_pkt_size, /* time adjustment */ SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_delta, - CTLFLAG_RD, &tick_delta, 0, "Last vs standard tick difference (usec)."); + CTLFLAG_RD, DC(tick_delta), 0, "Last vs standard tick difference (usec)."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_delta_sum, - CTLFLAG_RD, &tick_delta_sum, 0, "Accumulated tick difference (usec)."); + CTLFLAG_RD, DC(tick_delta_sum), 0, "Accumulated tick difference (usec)."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_adjustment, - CTLFLAG_RD, &tick_adjustment, 0, "Tick adjustments done."); + CTLFLAG_RD, DC(tick_adjustment), 0, "Tick adjustments done."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_diff, - CTLFLAG_RD, &tick_diff, 0, + CTLFLAG_RD, DC(tick_diff), 0, "Adjusted vs non-adjusted curr_time difference (ticks)."); SYSCTL_LONG(_net_inet_ip_dummynet, OID_AUTO, tick_lost, - CTLFLAG_RD, &tick_lost, 0, + CTLFLAG_RD, DC(tick_lost), 0, "Number of ticks coalesced by dummynet taskqueue."); /* Drain parameters */ @@ -660,16 +652,16 @@ dummynet_task(void *context, int pending) DN_BH_WLOCK(); /* Update number of lost(coalesced) ticks. */ - tick_lost += pending - 1; + dn_cfg.tick_lost += pending - 1; getmicrouptime(&t); /* Last tick duration (usec). */ - tick_last = (t.tv_sec - dn_cfg.prev_t.tv_sec) * 1000000 + + dn_cfg.tick_last = (t.tv_sec - dn_cfg.prev_t.tv_sec) * 1000000 + (t.tv_usec - dn_cfg.prev_t.tv_usec); /* Last tick vs standard tick difference (usec). */ - tick_delta = (tick_last * hz - 1000000) / hz; + dn_cfg.tick_delta = (dn_cfg.tick_last * hz - 1000000) / hz; /* Accumulated tick difference (usec). */ - tick_delta_sum += tick_delta; + dn_cfg.tick_delta_sum += dn_cfg.tick_delta; dn_cfg.prev_t = t; @@ -681,18 +673,18 @@ dummynet_task(void *context, int pending) * adjustment. */ dn_cfg.curr_time++; - if (tick_delta_sum - tick >= 0) { - int diff = tick_delta_sum / tick; + if (dn_cfg.tick_delta_sum - tick >= 0) { + int diff = dn_cfg.tick_delta_sum / tick; dn_cfg.curr_time += diff; - tick_diff += diff; - tick_delta_sum %= tick; - tick_adjustment++; - } else if (tick_delta_sum + tick <= 0) { + dn_cfg.tick_diff += diff; + dn_cfg.tick_delta_sum %= tick; + dn_cfg.tick_adjustment++; + } else if (dn_cfg.tick_delta_sum + tick <= 0) { dn_cfg.curr_time--; - tick_diff--; - tick_delta_sum += tick; - tick_adjustment++; + dn_cfg.tick_diff--; + dn_cfg.tick_delta_sum += tick; + dn_cfg.tick_adjustment++; } /* serve pending events, accumulate in q */ diff --git a/sys/netpfil/ipfw/ip_dn_private.h b/sys/netpfil/ipfw/ip_dn_private.h index a318a8e3be37..b655a91fe758 100644 --- a/sys/netpfil/ipfw/ip_dn_private.h +++ b/sys/netpfil/ipfw/ip_dn_private.h @@ -125,6 +125,14 @@ struct dn_parms { struct timeval prev_t; /* last time dummynet_tick ran */ struct dn_heap evheap; /* scheduled events */ + long tick_last; /* Last tick duration (usec). */ + long tick_delta; /* Last vs standard tick diff (usec). */ + long tick_delta_sum; /* Accumulated tick difference (usec).*/ + long tick_adjustment; /* Tick adjustments done. */ + long tick_lost; /* Lost(coalesced) ticks number. */ + /* Adjusted vs non-adjusted curr_time difference (ticks). */ + long tick_diff; + /* counters of objects -- used for reporting space */ int schk_count; int si_count; From owner-dev-commits-src-all@freebsd.org Wed Apr 7 15:48:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52A165BB0F3; Wed, 7 Apr 2021 15:48: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 4FFphD5WB6z3mNg; Wed, 7 Apr 2021 15:48: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 83F9021B5E; Wed, 7 Apr 2021 15:48: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 137FmC09034101; Wed, 7 Apr 2021 15:48:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137FmCab034100; Wed, 7 Apr 2021 15:48:12 GMT (envelope-from git) Date: Wed, 7 Apr 2021 15:48:12 GMT Message-Id: <202104071548.137FmCab034100@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 60fa37b7d60a - stable/12 - dummynet: Move packet counters into dn_cfg 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 60fa37b7d60a2d1ebbdb6be38a7603251d8d92c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 15:48:16 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=60fa37b7d60a2d1ebbdb6be38a7603251d8d92c7 commit 60fa37b7d60a2d1ebbdb6be38a7603251d8d92c7 Author: Kristof Provost AuthorDate: 2021-03-09 15:27:31 +0000 Commit: Kristof Provost CommitDate: 2021-04-07 15:25:38 +0000 dummynet: Move packet counters into dn_cfg Move the packets counters into the dn_cfg struct. This reduces the global name space use for dummynet and will make future work for things like vnet support and re-use in pf easier. Reviewed by: donner MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29245 (cherry picked from commit cd5671efc0190ba0f9eb41bba42e703277af20c3) --- sys/netpfil/ipfw/dn_aqm.h | 5 +---- sys/netpfil/ipfw/dn_sched_fq_codel.h | 2 +- sys/netpfil/ipfw/dn_sched_fq_pie.c | 2 +- sys/netpfil/ipfw/ip_dn_io.c | 24 ++++++++---------------- sys/netpfil/ipfw/ip_dn_private.h | 5 +++++ 5 files changed, 16 insertions(+), 22 deletions(-) diff --git a/sys/netpfil/ipfw/dn_aqm.h b/sys/netpfil/ipfw/dn_aqm.h index d01e98ebeafa..a8f6c39c0a8c 100644 --- a/sys/netpfil/ipfw/dn_aqm.h +++ b/sys/netpfil/ipfw/dn_aqm.h @@ -54,9 +54,6 @@ typedef int32_t aqm_stime_t; /* Macro for variable bounding */ #define BOUND_VAR(x,l,h) ((x) > (h)? (h) : ((x) > (l)? (x) : (l))) -/* sysctl variable to count number of dropped packets */ -extern unsigned long io_pkt_drop; - /* * Structure for holding data and function pointers that together represent a * AQM algorithm. @@ -138,7 +135,7 @@ update_stats(struct dn_queue *q, int len, int drop) if (drop) { qni->drops++; sni->drops++; - io_pkt_drop++; + dn_cfg.io_pkt_drop++; } else { /*update queue stats */ qni->length += inc; diff --git a/sys/netpfil/ipfw/dn_sched_fq_codel.h b/sys/netpfil/ipfw/dn_sched_fq_codel.h index 4b65781e0bef..e8685caca8d3 100644 --- a/sys/netpfil/ipfw/dn_sched_fq_codel.h +++ b/sys/netpfil/ipfw/dn_sched_fq_codel.h @@ -104,7 +104,7 @@ fq_update_stats(struct fq_codel_flow *q, struct fq_codel_si *si, int len, si->main_q.ni.drops ++; q->stats.drops ++; si->_si.ni.drops ++; - io_pkt_drop ++; + dn_cfg.io_pkt_drop ++; } if (!drop || (drop && len < 0)) { diff --git a/sys/netpfil/ipfw/dn_sched_fq_pie.c b/sys/netpfil/ipfw/dn_sched_fq_pie.c index 3960ea8ad6ae..2f61ca3de94e 100644 --- a/sys/netpfil/ipfw/dn_sched_fq_pie.c +++ b/sys/netpfil/ipfw/dn_sched_fq_pie.c @@ -299,7 +299,7 @@ fq_update_stats(struct fq_pie_flow *q, struct fq_pie_si *si, int len, si->main_q.ni.drops ++; q->stats.drops ++; si->_si.ni.drops ++; - io_pkt_drop ++; + dn_cfg.io_pkt_drop ++; } if (!drop || (drop && len < 0)) { diff --git a/sys/netpfil/ipfw/ip_dn_io.c b/sys/netpfil/ipfw/ip_dn_io.c index f14532ce9af0..760a24ed041f 100644 --- a/sys/netpfil/ipfw/ip_dn_io.c +++ b/sys/netpfil/ipfw/ip_dn_io.c @@ -87,14 +87,6 @@ static long tick_lost; /* Lost(coalesced) ticks number. */ /* Adjusted vs non-adjusted curr_time difference (ticks). */ static long tick_diff; -static unsigned long io_pkt; -static unsigned long io_pkt_fast; - -#ifdef NEW_AQM -unsigned long io_pkt_drop; -#else -static unsigned long io_pkt_drop; -#endif /* * We use a heap to store entities for which we have pending timer events. * The heap is checked at every tick and all entities with expired events @@ -223,13 +215,13 @@ SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, fsk_count, SYSCTL_INT(_net_inet_ip_dummynet, OID_AUTO, queue_count, CTLFLAG_RD, DC(queue_count), 0, "Number of queues"); SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt, - CTLFLAG_RD, &io_pkt, 0, + CTLFLAG_RD, DC(io_pkt), 0, "Number of packets passed to dummynet."); SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt_fast, - CTLFLAG_RD, &io_pkt_fast, 0, + CTLFLAG_RD, DC(io_pkt_fast), 0, "Number of packets bypassed dummynet scheduler."); SYSCTL_ULONG(_net_inet_ip_dummynet, OID_AUTO, io_pkt_drop, - CTLFLAG_RD, &io_pkt_drop, 0, + CTLFLAG_RD, DC(io_pkt_drop), 0, "Number of packets dropped by dummynet."); #undef DC SYSEND @@ -535,7 +527,7 @@ dn_enqueue(struct dn_queue *q, struct mbuf* m, int drop) return (0); drop: - io_pkt_drop++; + dn_cfg.io_pkt_drop++; q->ni.drops++; ni->drops++; FREE_PKT(m); @@ -871,7 +863,7 @@ dummynet_io(struct mbuf **m0, int dir, struct ip_fw_args *fwa) int fs_id = (fwa->rule.info & IPFW_INFO_MASK) + ((fwa->rule.info & IPFW_IS_PIPE) ? 2*DN_MAX_ID : 0); DN_BH_WLOCK(); - io_pkt++; + dn_cfg.io_pkt++; /* we could actually tag outside the lock, but who cares... */ if (tag_mbuf(m, dir, fwa)) goto dropit; @@ -907,7 +899,7 @@ dummynet_io(struct mbuf **m0, int dir, struct ip_fw_args *fwa) m = *m0 = NULL; /* dn_enqueue already increases io_pkt_drop */ - io_pkt_drop--; + dn_cfg.io_pkt_drop--; goto dropit; } @@ -945,7 +937,7 @@ dummynet_io(struct mbuf **m0, int dir, struct ip_fw_args *fwa) tag->m_tag_cookie = MTAG_IPFW_RULE; tag->m_tag_id = 0; - io_pkt_fast++; + dn_cfg.io_pkt_fast++; if (m->m_nextpkt != NULL) { printf("dummynet: fast io: pkt chain detected!\n"); m->m_nextpkt = NULL; @@ -961,7 +953,7 @@ done: return 0; dropit: - io_pkt_drop++; + dn_cfg.io_pkt_drop++; DN_BH_WUNLOCK(); if (m) FREE_PKT(m); diff --git a/sys/netpfil/ipfw/ip_dn_private.h b/sys/netpfil/ipfw/ip_dn_private.h index 61c61130525c..a318a8e3be37 100644 --- a/sys/netpfil/ipfw/ip_dn_private.h +++ b/sys/netpfil/ipfw/ip_dn_private.h @@ -131,6 +131,11 @@ struct dn_parms { int fsk_count; int queue_count; + /* packet counters */ + unsigned long io_pkt; + unsigned long io_pkt_fast; + unsigned long io_pkt_drop; + /* ticks and other stuff */ uint64_t curr_time; /* flowsets and schedulers are in hash tables, with 'hash_size' From owner-dev-commits-src-all@freebsd.org Wed Apr 7 16:18:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E29735BBEF9; Wed, 7 Apr 2021 16:18:49 +0000 (UTC) (envelope-from gjb@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFqMY65LRz3qVL; Wed, 7 Apr 2021 16:18:49 +0000 (UTC) (envelope-from gjb@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1617812329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/WNxvvY68N7xAnUvjvRXyUgDtesLL3Fc52T2u8vMv8I=; b=Z9jKJjs8fptl4j6HFV1pmU5cs+33XWDRUwrE7OsedVLCDk9tYu6dtsSOdsTNbn1gWl4ScK qQEsbmLhVNIQBGvNtqg8TR4bxfWhZWnzagdnQ8QaRJ32T+7vWh+kqemrBQAGXDfVulMicr BW/grTucMmBnrfL+u2XATTYbzmS3854viOdKYPIWVXDPMvKGFUttwDP8L64U4XJCmEIcAr Fyx1aq37e069+IdO+8WhdjxWmaXGjEoK3O+PQa7xGBbk5DZAweHVkCVGqsD3e5UHkEFrVT uXkaH3ikRky7uGLAgHaMf7Qd9qOrGOKhKawCbY+J1O77MuIUgYVc+jm//dXUOA== Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 66C0310A59; Wed, 7 Apr 2021 16:18:49 +0000 (UTC) (envelope-from gjb@freebsd.org) Date: Wed, 7 Apr 2021 16:18:46 +0000 From: Glen Barber To: Nathan Whitehorn Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: fa04db476201 - main - release: fix VMSIZE following 1ca8842f3ad9 Message-ID: <20210407161846.GZ92026@FreeBSD.org> References: <202103041343.124Dh6cq038222@gitrepo.freebsd.org> <5c7bf986-d5ee-3544-91d1-84a502d7bdbb@freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="f/XZMZU9ST6S8MjH" Content-Disposition: inline In-Reply-To: <5c7bf986-d5ee-3544-91d1-84a502d7bdbb@freebsd.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1617812329; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/WNxvvY68N7xAnUvjvRXyUgDtesLL3Fc52T2u8vMv8I=; b=TexKosBXt7YbN8jGTaMOyGVnwlAnt6f2CFxDjvdzsZkJgJJEEWFF7+bpguQI/tXur63yT4 zD6t1BXI9GnN1KGAvF5nOqQA1LpIkY6PyI+pDUhEhy925NSg8BNQnBRs/Vlx/0BXLhsG+X Hg27tvW7lOAm5gw8wT9o6Bf1Q3A7ymigapEfC6irbSxmeoQyVbyp20PDSo3zsrAGiXP19d xHFjuy59b98jchkEz2W+X6ZL8rb7JPNHQlUAeGQX9t0nOQ1nRhnMITf/HNTDERu5hgUBer sC3pHTrW2tXcazCgFZnIJ827h2OWaPxF7CqIhhP+Yq2oNN/O9Yt2MYmWci8mug== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1617812329; a=rsa-sha256; cv=none; b=yAhl+j4Ox0EfLy6ZP8O3bFICd+iTS9F5Uag0Bp72NsKoyu7YxNxqr/3RhYnIrnshl7oE8J S2X30CtFa1ii20HutkgyGzc1nYHN4GDpcIRSReWXJ8Bw87f2R5MhO8UWbTSKtlytKV8avb cT4RUOgUmr9sbMAKHUo/rp6Q+8cEg3pclpsyURWcTn1kTyiAKRw8vUCjSmWSTVh7Ox9tI+ UjTvJxjK8n4nzn6XOUsQ1kRlg8DEzDp9tGNm3kilXZ0GTPYEgTXDdy8bPP8/3Nb/oTwM8l DQjoThyJLy1DAIqxR3Y51R9rlV4CFws/XNLjMZUQumtaSvVJFo6+DvCoLBzV5g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 16:18:49 -0000 --f/XZMZU9ST6S8MjH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 07, 2021 at 09:33:50AM -0400, Nathan Whitehorn wrote: >=20 >=20 > On 3/4/21 8:43 AM, Glen Barber wrote: > > The branch main has been updated by gjb: > >=20 > > URL: https://cgit.FreeBSD.org/src/commit/?id=3Dfa04db476201c4cad5f6a5f6= 7da8f2ef1e1cdad3 > >=20 > > commit fa04db476201c4cad5f6a5f67da8f2ef1e1cdad3 > > Author: Glen Barber > > AuthorDate: 2021-03-04 13:39:43 +0000 > > Commit: Glen Barber > > CommitDate: 2021-03-04 13:43:02 +0000 > >=20 > > release: fix VMSIZE following 1ca8842f3ad9 > > truncate(1) is not case-sensitive with regard to setting the size > > of a file. makefs(8), however, does not honor upper-case values. > > Update release-specific files and the release(7) manual page to > > reflect this. >=20 > [...] >=20 > Should we also either lower-case everything when passed to makefs in > vmimage.subr or modify makefs to take upper-case values? Everything else = in > our system is case-agnostic. Personally, it does not matter to me. As far as I am concerned, the "problem" at hand here is resolved. Glen --f/XZMZU9ST6S8MjH Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAmBt22EACgkQAxRYpUeP 4pP7/w/+PMtVy40tW6nu9VYy2GqwREPaJx3UfUxzPFFeIcAYeVz5U85ZNnzy6ap6 0MD+8lpjbJkDVIZRA2AsQ0c2ZfUdxmm4ooldQIfCSNkqz2+oL/Fk+jvxPIoJ67J9 yE37aggWSeR+vCH/Y8+9ceK6vQQJyMkC6wlMg+9W9iLqdFvoYCHWrjijValXAE8g ie7gHh3cN7d/aGNN/6/L7vqL2KpXWS8E85tMZirOvyBYKtilYz3oCnKyT9y/ykU7 Xpnfu9lzNyD6NdddE2yd8XcOA4J61KKfoZEhvbpxdVcLbx/3qMGwlj/LeTL5MH9I pOluhqMuLEwSvNm6kyFe5CgM0f0DobuMXP0SNgVohZabE9ClVXHcE/9AHJHt5Wg6 m3tJLVJ4yUjj9TfnV0sS88FKvC+IBJQ0duE8tsZkbIHErpcGQfQKHCjulMekV0Fw ZgT+YSi7r7RoClQxvd4u1+PWAcbi8ijaGdivwFeASnGyobtXlw26B6Am54JojVFw 34iH+YCPr5pVJQ7C9Mv594OMrYZ8V4uAuyGdVkBqBeSprKO+m3QBLPGxM5meE8Ft 9VOQHAVp3aQBYSS0Bkf+jpJfQcqt/29PUTkoTMKtxvsWWtYo598UXrK23Vnjqoab pS6yxYNzG7wwQRqKr7zsVnDX1TaRpXXokXNFWFWEIpsN4+Zalfs= =3oF5 -----END PGP SIGNATURE----- --f/XZMZU9ST6S8MjH-- From owner-dev-commits-src-all@freebsd.org Wed Apr 7 16:24:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD0FA5BC930; Wed, 7 Apr 2021 16:24: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 4FFqVR4XWyz3rBP; Wed, 7 Apr 2021 16:24: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 8EE3022702; Wed, 7 Apr 2021 16:24: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 137GOl08087532; Wed, 7 Apr 2021 16:24:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137GOlF8087531; Wed, 7 Apr 2021 16:24:47 GMT (envelope-from git) Date: Wed, 7 Apr 2021 16:24:47 GMT Message-Id: <202104071624.137GOlF8087531@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: 12db51d20823 - main - uefisign: handle empty sections 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: 12db51d20823a5e3b9e5f8a2ea73156fe1cbfc28 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 16:24:47 -0000 The branch main has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=12db51d20823a5e3b9e5f8a2ea73156fe1cbfc28 commit 12db51d20823a5e3b9e5f8a2ea73156fe1cbfc28 Author: Eric van Gyzen AuthorDate: 2021-04-06 14:42:20 +0000 Commit: Eric van Gyzen CommitDate: 2021-04-07 16:23:11 +0000 uefisign: handle empty sections loader.efi has an empty set_Xfic section. Handle it correctly. ``` Sections: Idx Name Size VMA LMA File off Algn [...] 3 set_Xcom 00000168 00000000000d4000 00000000000d4000 000d0e00 2**2 CONTENTS, ALLOC, LOAD, DATA 4 set_Xfic 00000000 00000000000d4168 00000000000d4168 00000000 2**2 ALLOC, LOAD, DATA 5 .sdata 00000448 00000000000d5000 00000000000d5000 000d1000 2**2 CONTENTS, ALLOC, LOAD, DATA [...] ``` Reviewed by: trasz, dab Reported by: andy.y.liu@dell.com Tested by: andy.y.liu@dell.com MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D29606 --- usr.sbin/uefisign/pe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/uefisign/pe.c b/usr.sbin/uefisign/pe.c index 9f010e5d8a46..6459321441d8 100644 --- a/usr.sbin/uefisign/pe.c +++ b/usr.sbin/uefisign/pe.c @@ -244,7 +244,8 @@ parse_section_table(struct executable *x, off_t off, int number_of_sections) x->x_nsections = number_of_sections; for (i = 0; i < number_of_sections; i++) { - if (psh->psh_pointer_to_raw_data < x->x_headers_len) + if (psh->psh_size_of_raw_data > 0 && + psh->psh_pointer_to_raw_data < x->x_headers_len) errx(1, "section points inside the headers"); range_check(x, psh->psh_pointer_to_raw_data, From owner-dev-commits-src-all@freebsd.org Wed Apr 7 18:33:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 369235C031A; Wed, 7 Apr 2021 18:33:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFtLZ145bz4Xl5; Wed, 7 Apr 2021 18:33: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 1769423FDA; Wed, 7 Apr 2021 18:33: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 137IX9mo061510; Wed, 7 Apr 2021 18:33:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137IX9W2061509; Wed, 7 Apr 2021 18:33:09 GMT (envelope-from git) Date: Wed, 7 Apr 2021 18:33:09 GMT Message-Id: <202104071833.137IX9W2061509@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: 274579831b61 - main - capsicum: Limit socket operations in capability mode 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: 274579831b61fccd5ce849350430e5167d0024f0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 18:33:10 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=274579831b61fccd5ce849350430e5167d0024f0 commit 274579831b61fccd5ce849350430e5167d0024f0 Author: Mark Johnston AuthorDate: 2021-04-07 18:19:52 +0000 Commit: Mark Johnston CommitDate: 2021-04-07 18:32:56 +0000 capsicum: Limit socket operations in capability mode Capsicum did not prevent certain privileged networking operations, specifically creation of raw sockets and network configuration ioctls. However, these facilities can be used to circumvent some of the restrictions that capability mode is supposed to enforce. Add capability mode checks to disallow network configuration ioctls and creation of sockets other than PF_LOCAL and SOCK_DGRAM/STREAM/SEQPACKET internet sockets. Reviewed by: oshogbo Discussed with: emaste Reported by: manu Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29423 --- sys/kern/sys_socket.c | 2 +- sys/kern/uipc_socket.c | 4 ++++ sys/kern/uipc_usrreq.c | 9 +++++---- sys/net/if.c | 10 ++++++++++ sys/net/route.c | 5 ++++- sys/net/route.h | 4 +++- sys/netinet/in.c | 4 ++++ sys/netinet/in_proto.c | 8 +++++--- sys/netinet6/in6.c | 4 ++++ sys/netinet6/in6_proto.c | 8 +++++--- sys/sys/protosw.h | 2 +- 11 files changed, 46 insertions(+), 14 deletions(-) diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index e53b0367960b..52f4b6cdf7f9 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -271,7 +271,7 @@ soo_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *active_cred, error = ifioctl(so, cmd, data, td); else if (IOCGROUP(cmd) == 'r') { CURVNET_SET(so->so_vnet); - error = rtioctl_fib(cmd, data, so->so_fibnum); + error = rtioctl_fib(cmd, data, so->so_fibnum, td); CURVNET_RESTORE(); } else { CURVNET_SET(so->so_vnet); diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 7f06b51cf096..92a204aafef0 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -112,6 +112,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -526,6 +527,9 @@ socreate(int dom, struct socket **aso, int type, int proto, prp->pr_usrreqs->pru_attach == pru_attach_notsupp) return (EPROTONOSUPPORT); + if (IN_CAPABILITY_MODE(td) && (prp->pr_flags & PR_CAPATTACH) == 0) + return (ECAPMODE); + if (prison_check_af(cred, prp->pr_domain->dom_family) != 0) return (EPROTONOSUPPORT); diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 4466ae8822cd..3f7198c2f3ae 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -428,14 +428,15 @@ static struct protosw localsw[] = { { .pr_type = SOCK_STREAM, .pr_domain = &localdomain, - .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS, + .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS| + PR_CAPATTACH, .pr_ctloutput = &uipc_ctloutput, .pr_usrreqs = &uipc_usrreqs_stream }, { .pr_type = SOCK_DGRAM, .pr_domain = &localdomain, - .pr_flags = PR_ATOMIC|PR_ADDR|PR_RIGHTS, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_RIGHTS|PR_CAPATTACH, .pr_ctloutput = &uipc_ctloutput, .pr_usrreqs = &uipc_usrreqs_dgram }, @@ -448,8 +449,8 @@ static struct protosw localsw[] = { * due to our use of sbappendaddr. A new sbappend variants is needed * that supports both atomic record writes and control data. */ - .pr_flags = PR_ADDR|PR_ATOMIC|PR_CONNREQUIRED|PR_WANTRCVD| - PR_RIGHTS, + .pr_flags = PR_ADDR|PR_ATOMIC|PR_CONNREQUIRED| + PR_WANTRCVD|PR_RIGHTS|PR_CAPATTACH, .pr_ctloutput = &uipc_ctloutput, .pr_usrreqs = &uipc_usrreqs_seqpacket, }, diff --git a/sys/net/if.c b/sys/net/if.c index bbd677e0153c..5bf44d014db3 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -37,6 +37,7 @@ #include "opt_inet.h" #include +#include #include #include #include @@ -2967,6 +2968,15 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct thread *td) bool shutdown; #endif + /* + * Interface ioctls access a global namespace. There is currently no + * capability-based representation for interfaces, so the configuration + * interface is simply unaccessible from capability mode. If necessary, + * select ioctls may be permitted here. + */ + if (IN_CAPABILITY_MODE(td)) + return (ECAPMODE); + CURVNET_SET(so->so_vnet); #ifdef VIMAGE /* Make sure the VNET is stable. */ diff --git a/sys/net/route.c b/sys/net/route.c index 2416aa9a983f..f093a71b7585 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -43,6 +43,7 @@ #include #include +#include #include #include #include @@ -245,8 +246,10 @@ rib_add_redirect(u_int fibnum, struct sockaddr *dst, struct sockaddr *gateway, * Routing table ioctl interface. */ int -rtioctl_fib(u_long req, caddr_t data, u_int fibnum) +rtioctl_fib(u_long req, caddr_t data, u_int fibnum, struct thread *td) { + if (IN_CAPABILITY_MODE(td)) + return (ECAPMODE); /* * If more ioctl commands are added here, make sure the proper diff --git a/sys/net/route.h b/sys/net/route.h index 3fdca303596e..64e89965f9cd 100644 --- a/sys/net/route.h +++ b/sys/net/route.h @@ -431,11 +431,13 @@ void rt_updatemtu(struct ifnet *); void rt_flushifroutes(struct ifnet *ifp); +struct thread; + /* XXX MRT NEW VERSIONS THAT USE FIBs * For now the protocol indepedent versions are the same as the AF_INET ones * but this will change.. */ -int rtioctl_fib(u_long, caddr_t, u_int); +int rtioctl_fib(u_long, caddr_t, u_int, struct thread *); int rib_lookup_info(uint32_t, const struct sockaddr *, uint32_t, uint32_t, struct rt_addrinfo *); void rib_free_info(struct rt_addrinfo *info); diff --git a/sys/netinet/in.c b/sys/netinet/in.c index bcf071a81e0e..5f70dd1ec824 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -237,6 +238,9 @@ in_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, if (ifp == NULL) return (EADDRNOTAVAIL); + if (td != NULL && IN_CAPABILITY_MODE(td)) + return (ECAPMODE); + /* * Filter out 4 ioctls we implement directly. Forward the rest * to specific functions and ifp->if_ioctl(). diff --git a/sys/netinet/in_proto.c b/sys/netinet/in_proto.c index 11688e3cb1d2..351c90699fc2 100644 --- a/sys/netinet/in_proto.c +++ b/sys/netinet/in_proto.c @@ -112,6 +112,7 @@ struct protosw inetsw[] = { .pr_type = 0, .pr_domain = &inetdomain, .pr_protocol = IPPROTO_IP, + .pr_flags = PR_CAPATTACH, .pr_init = ip_init, .pr_slowtimo = ip_slowtimo, .pr_drain = ip_drain, @@ -121,7 +122,7 @@ struct protosw inetsw[] = { .pr_type = SOCK_DGRAM, .pr_domain = &inetdomain, .pr_protocol = IPPROTO_UDP, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_CAPATTACH, .pr_input = udp_input, .pr_ctlinput = udp_ctlinput, .pr_ctloutput = udp_ctloutput, @@ -132,7 +133,8 @@ struct protosw inetsw[] = { .pr_type = SOCK_STREAM, .pr_domain = &inetdomain, .pr_protocol = IPPROTO_TCP, - .pr_flags = PR_CONNREQUIRED|PR_IMPLOPCL|PR_WANTRCVD, + .pr_flags = PR_CONNREQUIRED|PR_IMPLOPCL|PR_WANTRCVD| + PR_CAPATTACH, .pr_input = tcp_input, .pr_ctlinput = tcp_ctlinput, .pr_ctloutput = tcp_ctloutput, @@ -170,7 +172,7 @@ struct protosw inetsw[] = { .pr_type = SOCK_DGRAM, .pr_domain = &inetdomain, .pr_protocol = IPPROTO_UDPLITE, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_CAPATTACH, .pr_input = udp_input, .pr_ctlinput = udplite_ctlinput, .pr_ctloutput = udp_ctloutput, diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 02cb9df7da3a..de3db6dc7d33 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include +#include #include #include #include @@ -254,6 +255,9 @@ in6_control(struct socket *so, u_long cmd, caddr_t data, int error; u_long ocmd = cmd; + if (td != NULL && IN_CAPABILITY_MODE(td)) + return (ECAPMODE); + /* * Compat to make pre-10.x ifconfig(8) operable. */ diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c index 21b7d660676f..56ef41a27e88 100644 --- a/sys/netinet6/in6_proto.c +++ b/sys/netinet6/in6_proto.c @@ -145,6 +145,7 @@ struct protosw inet6sw[] = { .pr_type = 0, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_IPV6, + .pr_flags = PR_CAPATTACH, .pr_init = ip6_init, .pr_slowtimo = frag6_slowtimo, .pr_drain = frag6_drain, @@ -154,7 +155,7 @@ struct protosw inet6sw[] = { .pr_type = SOCK_DGRAM, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_UDP, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_CAPATTACH, .pr_input = udp6_input, .pr_ctlinput = udp6_ctlinput, .pr_ctloutput = ip6_ctloutput, @@ -167,7 +168,8 @@ struct protosw inet6sw[] = { .pr_type = SOCK_STREAM, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_TCP, - .pr_flags = PR_CONNREQUIRED|PR_IMPLOPCL|PR_WANTRCVD|PR_LISTEN, + .pr_flags = PR_CONNREQUIRED|PR_IMPLOPCL|PR_WANTRCVD| + PR_LISTEN|PR_CAPATTACH, .pr_input = tcp6_input, .pr_ctlinput = tcp6_ctlinput, .pr_ctloutput = tcp_ctloutput, @@ -209,7 +211,7 @@ struct protosw inet6sw[] = { .pr_type = SOCK_DGRAM, .pr_domain = &inet6domain, .pr_protocol = IPPROTO_UDPLITE, - .pr_flags = PR_ATOMIC|PR_ADDR, + .pr_flags = PR_ATOMIC|PR_ADDR|PR_CAPATTACH, .pr_input = udp6_input, .pr_ctlinput = udplite6_ctlinput, .pr_ctloutput = udp_ctloutput, diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h index 9c3139c866bd..5c2fa2d4077e 100644 --- a/sys/sys/protosw.h +++ b/sys/sys/protosw.h @@ -121,6 +121,7 @@ struct protosw { #define PR_RIGHTS 0x10 /* passes capabilities */ #define PR_IMPLOPCL 0x20 /* implied open/close */ #define PR_LASTHDR 0x40 /* enforce ipsec policy; last header */ +#define PR_CAPATTACH 0x80 /* socket can attach in cap mode */ /* * In earlier BSD network stacks, a single pr_usrreq() function pointer was @@ -183,7 +184,6 @@ struct uio; * should eventually be merged back into struct protosw. * * Some fields initialized to defaults if they are NULL. - * See uipc_domain.c:net_init_domain() */ struct pr_usrreqs { void (*pru_abort)(struct socket *so); From owner-dev-commits-src-all@freebsd.org Wed Apr 7 18:33:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62CF15C0581; Wed, 7 Apr 2021 18:33: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 4FFtLb2PF6z4Xpw; Wed, 7 Apr 2021 18:33: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 3A9D6242E8; Wed, 7 Apr 2021 18:33: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 137IXB0t061544; Wed, 7 Apr 2021 18:33:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137IXBPD061543; Wed, 7 Apr 2021 18:33:11 GMT (envelope-from git) Date: Wed, 7 Apr 2021 18:33:11 GMT Message-Id: <202104071833.137IXBPD061543@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: 0f07c234ca1d - main - Remove more remnants of sio(4) 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: 0f07c234ca1d3ccce158bb68c03829a266942c6e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 18:33:11 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0f07c234ca1d3ccce158bb68c03829a266942c6e commit 0f07c234ca1d3ccce158bb68c03829a266942c6e Author: Mark Johnston AuthorDate: 2021-04-07 18:21:07 +0000 Commit: Mark Johnston CommitDate: 2021-04-07 18:33:02 +0000 Remove more remnants of sio(4) Reviewed by: imp MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29626 --- sys/amd64/amd64/machdep.c | 22 ---------------------- sys/isa/isavar.h | 1 - sys/kern/subr_witness.c | 1 - sys/x86/isa/atpic.c | 15 --------------- 4 files changed, 39 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 569e32207a2c..5c8a3ae6bb4e 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -959,28 +959,6 @@ ssdtosyssd(ssd, sd) sd->sd_gran = ssd->ssd_gran; } -#if !defined(DEV_ATPIC) && defined(DEV_ISA) -#include -#include -/* - * Return a bitmap of the current interrupt requests. This is 8259-specific - * and is only suitable for use at probe time. - * This is only here to pacify sio. It is NOT FATAL if this doesn't work. - * It shouldn't be here. There should probably be an APIC centric - * implementation in the apic driver code, if at all. - */ -intrmask_t -isa_irq_pending(void) -{ - u_char irr1; - u_char irr2; - - irr1 = inb(IO_ICU1); - irr2 = inb(IO_ICU2); - return ((irr2 << 8) | irr1); -} -#endif - u_int basemem; static int diff --git a/sys/isa/isavar.h b/sys/isa/isavar.h index d95a9c1ab3f2..81ba280da457 100644 --- a/sys/isa/isavar.h +++ b/sys/isa/isavar.h @@ -168,7 +168,6 @@ ISA_ACCESSOR(pnpbios_handle, PNPBIOS_HANDLE, int) /* Device class for ISA bridges. */ extern devclass_t isab_devclass; -extern intrmask_t isa_irq_pending(void); extern void isa_probe_children(device_t dev); void isa_dmacascade(int chan); diff --git a/sys/kern/subr_witness.c b/sys/kern/subr_witness.c index 7e21db5d7c91..c849a191bf16 100644 --- a/sys/kern/subr_witness.c +++ b/sys/kern/subr_witness.c @@ -664,7 +664,6 @@ static struct witness_order_list_entry order_lists[] = { { "ap boot", &lock_class_mtx_spin }, #endif { "rm.mutex_mtx", &lock_class_mtx_spin }, - { "sio", &lock_class_mtx_spin }, #ifdef __i386__ { "cy", &lock_class_mtx_spin }, #endif diff --git a/sys/x86/isa/atpic.c b/sys/x86/isa/atpic.c index bb902610b0f4..07d63b041d0b 100644 --- a/sys/x86/isa/atpic.c +++ b/sys/x86/isa/atpic.c @@ -591,21 +591,6 @@ atpic_attach(device_t dev) return (0); } -/* - * Return a bitmap of the current interrupt requests. This is 8259-specific - * and is only suitable for use at probe time. - */ -intrmask_t -isa_irq_pending(void) -{ - u_char irr1; - u_char irr2; - - irr1 = inb(IO_ICU1); - irr2 = inb(IO_ICU2); - return ((irr2 << 8) | irr1); -} - static device_method_t atpic_methods[] = { /* Device interface */ DEVMETHOD(device_probe, atpic_probe), From owner-dev-commits-src-all@freebsd.org Wed Apr 7 18:41:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C4C05C016E; Wed, 7 Apr 2021 18:41: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 4FFtXT44wyz4Y87; Wed, 7 Apr 2021 18:41: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 7EDDE24075; Wed, 7 Apr 2021 18:41: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 137IfjXq070416; Wed, 7 Apr 2021 18:41:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137Ifjwv070415; Wed, 7 Apr 2021 18:41:45 GMT (envelope-from git) Date: Wed, 7 Apr 2021 18:41:45 GMT Message-Id: <202104071841.137Ifjwv070415@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: 5984246f9626 - main - Loader: support booting OS from memory disk (MD) 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: 5984246f9626fbc3d356ee2d3b3cd159f6d0a7c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 18:41:45 -0000 The branch main has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=5984246f9626fbc3d356ee2d3b3cd159f6d0a7c2 commit 5984246f9626fbc3d356ee2d3b3cd159f6d0a7c2 Author: Yongbo Yao AuthorDate: 2021-04-07 18:33:22 +0000 Commit: Eric van Gyzen CommitDate: 2021-04-07 18:40:57 +0000 Loader: support booting OS from memory disk (MD) Until now, the boot image can be embedded into the loader with /sys/tools/embed_mfs.sh, and memory disk (MD) is already supported in loader source. But due to memory disk (MD) driver isn't registered to the loader yet, the boot image can't be boot from embedded memory disk. Reviewed by: dab, tsoome MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D29512 --- stand/efi/loader/conf.c | 7 +++++++ stand/efi/loader/main.c | 24 ++++++++++++++++++++++++ stand/man/loader.8 | 19 ++++++++++++++++++- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/stand/efi/loader/conf.c b/stand/efi/loader/conf.c index 217372939685..863c9188c72c 100644 --- a/stand/efi/loader/conf.c +++ b/stand/efi/loader/conf.c @@ -35,6 +35,10 @@ __FBSDID("$FreeBSD$"); extern struct devsw vdisk_dev; +#ifdef MD_IMAGE_SIZE +extern struct devsw md_dev; +#endif + struct devsw *devsw[] = { &efipart_fddev, &efipart_cddev, @@ -46,6 +50,9 @@ struct devsw *devsw[] = { &vdisk_dev, #ifdef EFI_ZFS_BOOT &zfs_dev, +#endif +#ifdef MD_IMAGE_SIZE + &md_dev, #endif NULL }; diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c index 32b278950745..ae32960e4049 100644 --- a/stand/efi/loader/main.c +++ b/stand/efi/loader/main.c @@ -296,6 +296,21 @@ probe_zfs_currdev(uint64_t guid) } #endif +#ifdef MD_IMAGE_SIZE +static bool +probe_md_currdev(void) +{ + extern struct devsw md_dev; + bool rv; + + set_currdev_devsw(&md_dev, 0); + rv = sanity_check_currdev(); + if (!rv) + printf("MD not present\n"); + return (rv); +} +#endif + static bool try_as_currdev(pdinfo_t *hd, pdinfo_t *pp) { @@ -569,6 +584,15 @@ find_currdev(bool do_bootmgr, bool is_last, } #endif /* EFI_ZFS_BOOT */ +#ifdef MD_IMAGE_SIZE + /* + * If there is an embedded MD, try to use that. + */ + printf("Trying MD\n"); + if (probe_md_currdev()) + return (0); +#endif /* MD_IMAGE_SIZE */ + /* * Try to find the block device by its handle based on the * image we're booting. If we can't find a sane partition, diff --git a/stand/man/loader.8 b/stand/man/loader.8 index 5e8819628822..4555f99627c7 100644 --- a/stand/man/loader.8 +++ b/stand/man/loader.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 2, 2020 +.Dd April 7, 2021 .Dt LOADER 8 .Os .Sh NAME @@ -987,6 +987,23 @@ See for details. In order for this to be effective, one should also configure the firmware (BIOS or UEFI) to prevent booting from unauthorized devices. +.Sh MD +Memory disk (MD) can be used when the +.Nm +was compiled with +.Va MD_IMAGE_SIZE . +The size of the memory disk is determined by +.Va MD_IMAGE_SIZE . +If MD available, a file system can be embedded into the +.Nm +with +.Pa /sys/tools/embed_mfs.sh . +Then, MD will be probed and be set to +.Va currdev +during initialization. +.Pp +Currently, MD is only supported in +.Xr loader.efi 8 . .Sh FILES .Bl -tag -width /usr/share/examples/bootforth/ -compact .It Pa /boot/loader From owner-dev-commits-src-all@freebsd.org Wed Apr 7 18:59:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE8D65C0EAC; Wed, 7 Apr 2021 18:59:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFtx34dl7z4ZlZ; Wed, 7 Apr 2021 18:59:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 137IxO1X088763 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 7 Apr 2021 21:59:27 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 137IxO1X088763 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 137IxO2w088762; Wed, 7 Apr 2021 21:59:24 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 7 Apr 2021 21:59:24 +0300 From: Konstantin Belousov To: Ka Ho Ng Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 86a52e262a6f - main - Document vnode_pager_setsize(9) Message-ID: References: <202104071113.137BD2Pj074018@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202104071113.137BD2Pj074018@gitrepo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4FFtx34dl7z4ZlZ 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 18:59:42 -0000 On Wed, Apr 07, 2021 at 11:13:02AM +0000, Ka Ho Ng wrote: > The branch main has been updated by khng: > > URL: https://cgit.FreeBSD.org/src/commit/?id=86a52e262a6faf75ee34eaa801f6d8ddaad20733 > > commit 86a52e262a6faf75ee34eaa801f6d8ddaad20733 > Author: Ka Ho Ng > AuthorDate: 2021-04-07 11:00:31 +0000 > Commit: Ka Ho Ng > CommitDate: 2021-04-07 11:11:26 +0000 > > Document vnode_pager_setsize(9) I am sorry to say this, but the documentation is rather content-free. Main outcome of vnode_pager_setsize() is that it defines which offsets from mapping of the file are handled by the fault handler, and which results in SIGBUS. Clearing of the page cache is a secondary-level functionality, and more, we allow to keep pages with indexes larger than the object size, on the object queue. > > MFC after: 3 days > Sponsored by: The FreeBSD Foundation > Reviewed by: bcr > Approved by: philip (mentor) > Differential Revision: https://reviews.freebsd.org/D29408 > --- > share/man/man9/Makefile | 1 + > share/man/man9/vnode_pager_setsize.9 | 74 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 75 insertions(+) > > diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile > index 52a5d373a417..efdd8b2f6e9c 100644 > --- a/share/man/man9/Makefile > +++ b/share/man/man9/Makefile > @@ -401,6 +401,7 @@ MAN= accept_filter.9 \ > vn_isdisk.9 \ > vnet.9 \ > vnode.9 \ > + vnode_pager_setsize.9 \ > VOP_ACCESS.9 \ > VOP_ACLCHECK.9 \ > VOP_ADVISE.9 \ > diff --git a/share/man/man9/vnode_pager_setsize.9 b/share/man/man9/vnode_pager_setsize.9 > new file mode 100644 > index 000000000000..c59a01796f20 > --- /dev/null > +++ b/share/man/man9/vnode_pager_setsize.9 > @@ -0,0 +1,74 @@ > +.\" > +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD > +.\" > +.\" Copyright (c) 2021 The FreeBSD Foundation > +.\" > +.\" Portions of this software were developed by Ka Ho Ng > +.\" under sponsorship from the FreeBSD Foundation. > +.\" > +.\" Redistribution and use in source and binary forms, with or without > +.\" modification, are permitted provided that the following conditions > +.\" are met: > +.\" 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. > +.\" > +.Dd April 6, 2021 > +.Dt VNODE_PAGER_SETSIZE 9 > +.Os > +.Sh NAME > +.Nm vnode_pager_setsize > +.Nd "notify the VM system about updates in the file size" > +.Sh SYNOPSIS > +.In sys/param.h > +.In vm/vm.h > +.In vm/vm_extern.h > +.Ft void > +.Fn vnode_pager_setsize "struct vnode *vp" "vm_ooffset_t nsize" > +.Sh DESCRIPTION > +.Nm > +lets the VM system know about a change in size for a file. > +Content beyond the new EOF specified by the > +.Fa nsize > +argument will be purged from the cache. This is not true. Only content between new EOF and old EOF is purged. Removing everything past new EOF would break UFS, for instance. > +This function is useful for use within file system code to implement > +truncation in > +.Xr VOP_SETATTR 9 . > +.Sh IMPLEMENTATION NOTES > +In case the new EOF specified by the > +.Fa nsize > +argument is not aligned to page boundaries, > +partial-page area starting beyond the EOF will be zeroed. > +In partial-page area, > +for content occupying whole blocks within block > +boundaries, > +the dirty bits for the corresponding blocks will be cleared. > +.Sh LOCKING > +Writer lock of the VM object of > +.Fa vp > +will be held within the function. Object is locked internally on as needed basis, but why would this matter for anybody? Again missed in the man page, but very important part of the interface is that for correct and race-less use of the function, the vnode lock must be held in exclusive mode. Otherwise truncation would interact wrongly with page faults. Unfortunately not all filesystems lock the vnode, the last offender is ZFS. For it, I had to add MNTK_VMSETSIZE_BUG to ignore the preconditions. > +.Sh SEE ALSO > +.Xr vnode 9 > +.Sh HISTORY > +The > +.Nm > +manual page first appeared in > +.Fx 14 . > +.Sh AUTHORS > +This > +manual page was written by > +.An Ka Ho Ng Aq Mt khng@FreeBSD.org . From owner-dev-commits-src-all@freebsd.org Wed Apr 7 19:10:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59C215C133B; Wed, 7 Apr 2021 19:10: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 4FFv9724b9z4c3d; Wed, 7 Apr 2021 19:10: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 3A3802493A; Wed, 7 Apr 2021 19:10: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 137JA3oL004982; Wed, 7 Apr 2021 19:10:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137JA3C5004980; Wed, 7 Apr 2021 19:10:03 GMT (envelope-from git) Date: Wed, 7 Apr 2021 19:10:03 GMT Message-Id: <202104071910.137JA3C5004980@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 5a8d32b53b91 - main - Add IDs for ASMedia ASM116x PCIe 3.0 AHCI controllers. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a8d32b53b919d82d6a3aa9f155bd2a00fb51dc2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 19:10:03 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=5a8d32b53b919d82d6a3aa9f155bd2a00fb51dc2 commit 5a8d32b53b919d82d6a3aa9f155bd2a00fb51dc2 Author: Alexander Motin AuthorDate: 2021-04-07 19:03:36 +0000 Commit: Alexander Motin CommitDate: 2021-04-07 19:09:56 +0000 Add IDs for ASMedia ASM116x PCIe 3.0 AHCI controllers. MFC after: 1 week --- sys/dev/ahci/ahci_pci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/dev/ahci/ahci_pci.c b/sys/dev/ahci/ahci_pci.c index 85dc3bf272be..ccc107a14bc8 100644 --- a/sys/dev/ahci/ahci_pci.c +++ b/sys/dev/ahci/ahci_pci.c @@ -94,6 +94,11 @@ static const struct { {0x06221b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS|AHCI_Q_NOAUX}, {0x06241b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS|AHCI_Q_NOAUX}, {0x06251b21, 0x00, "ASMedia ASM106x", AHCI_Q_NOCCS|AHCI_Q_NOAUX}, + {0x10621b21, 0x00, "ASMedia ASM116x", 0}, + {0x10641b21, 0x00, "ASMedia ASM116x", 0}, + {0x11641b21, 0x00, "ASMedia ASM116x", 0}, + {0x11651b21, 0x00, "ASMedia ASM116x", 0}, + {0x11661b21, 0x00, "ASMedia ASM116x", 0}, {0x79011d94, 0x00, "Hygon KERNCZ", 0}, {0x26528086, 0x00, "Intel ICH6", AHCI_Q_NOFORCE}, {0x26538086, 0x00, "Intel ICH6M", AHCI_Q_NOFORCE}, From owner-dev-commits-src-all@freebsd.org Wed Apr 7 19:18:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54D9A5C179F; Wed, 7 Apr 2021 19:18:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFvLS203pz4d35; Wed, 7 Apr 2021 19:18:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 374112467F; Wed, 7 Apr 2021 19:18:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 137JI83c016266; Wed, 7 Apr 2021 19:18:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137JI83Y016265; Wed, 7 Apr 2021 19:18:08 GMT (envelope-from git) Date: Wed, 7 Apr 2021 19:18:08 GMT Message-Id: <202104071918.137JI83Y016265@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mariusz Zaborski Subject: git: 2b1d0c0087a9 - main - fileargs: fix double caching of the same file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: oshogbo X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2b1d0c0087a907fe9944b96c6313711865f9674a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 19:18:08 -0000 The branch main has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=2b1d0c0087a907fe9944b96c6313711865f9674a commit 2b1d0c0087a907fe9944b96c6313711865f9674a Author: Mariusz Zaborski AuthorDate: 2021-04-07 19:12:52 +0000 Commit: Mariusz Zaborski CommitDate: 2021-04-07 19:16:37 +0000 fileargs: fix double caching of the same file In situations when the current file name wasn't the first element on the list we were cleaning the current name too early. This might cause us to pre-cache the same file twice. --- lib/libcasper/services/cap_fileargs/cap_fileargs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/libcasper/services/cap_fileargs/cap_fileargs.c b/lib/libcasper/services/cap_fileargs/cap_fileargs.c index ecab23004fcf..64ec69698165 100644 --- a/lib/libcasper/services/cap_fileargs/cap_fileargs.c +++ b/lib/libcasper/services/cap_fileargs/cap_fileargs.c @@ -562,8 +562,12 @@ fileargs_add_cache(nvlist_t *nvlout, const nvlist_t *limits, break; } - if (type != NV_TYPE_NULL || (current_name != NULL && - strcmp(fname, current_name) == 0)) { + if (type != NV_TYPE_NULL) { + i--; + continue; + } + if (current_name != NULL && + strcmp(fname, current_name) == 0) { current_name = NULL; i--; continue; From owner-dev-commits-src-all@freebsd.org Wed Apr 7 19:42:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC00B5C23AD; Wed, 7 Apr 2021 19:42: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 4FFvts6Kq8z4fV1; Wed, 7 Apr 2021 19:42: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 CC39224EDD; Wed, 7 Apr 2021 19:42: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 137JgjpI055532; Wed, 7 Apr 2021 19:42:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137JgjNd055531; Wed, 7 Apr 2021 19:42:45 GMT (envelope-from git) Date: Wed, 7 Apr 2021 19:42:45 GMT Message-Id: <202104071942.137JgjNd055531@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Libby Subject: git: 13d4f96130b6 - main - shared shadow vm object invalidation regression test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rlibby X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 13d4f96130b64b42f74dfc484305b08c4da54669 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 19:42:46 -0000 The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=13d4f96130b64b42f74dfc484305b08c4da54669 commit 13d4f96130b64b42f74dfc484305b08c4da54669 Author: Ryan Libby AuthorDate: 2021-04-07 19:39:05 +0000 Commit: Ryan Libby CommitDate: 2021-04-07 19:39:05 +0000 shared shadow vm object invalidation regression test Add a regression test for a scenario where a shadow vm object is shared by multiple mappings. If a page COW occurs through one of the mappings, then the virtual-to-physical mapping may become invalidated. This tests the scenario from CVE-2021-29626 which was fixed by 982693bb729badac4e65ecd59772979f2849a2b2. Reviewed by: markj Sponsored by: Dell EMC Isilon --- tests/sys/vm/Makefile | 3 +- tests/sys/vm/shared_shadow_inval_test.c | 360 ++++++++++++++++++++++++++++++++ 2 files changed, 362 insertions(+), 1 deletion(-) diff --git a/tests/sys/vm/Makefile b/tests/sys/vm/Makefile index c2c95d25407f..8ef8a45e5f39 100644 --- a/tests/sys/vm/Makefile +++ b/tests/sys/vm/Makefile @@ -6,6 +6,7 @@ TESTSDIR= ${TESTSBASE}/sys/vm ATF_TESTS_C+= mlock_test \ mmap_test \ - page_fault_signal + page_fault_signal \ + shared_shadow_inval_test .include diff --git a/tests/sys/vm/shared_shadow_inval_test.c b/tests/sys/vm/shared_shadow_inval_test.c new file mode 100644 index 000000000000..75e3655e3bd8 --- /dev/null +++ b/tests/sys/vm/shared_shadow_inval_test.c @@ -0,0 +1,360 @@ +/* + * Copyright (c) 2021 Dell Inc. or its subsidiaries. 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. + */ + +/* + * Test behavior when a mapping of a shared shadow vm object is + * invalidated by COW from another mapping. + * + * This is a regression test for an issue isolated by rlibby@FreeBSD.org + * from an issue detected by stress2's collapse.sh by jeff@FreeBSD.org. + * The issue became CVE-2021-29626. + * + * This file is written as an ATF test suite but may be compiled as a + * standalone program with -DSTANDALONE (and optionally -DDEBUG). + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef STANDALONE +#define ATF_REQUIRE(x) do { \ + if (!(x)) \ + errx(1, "%s", #x); \ +} while (0) +#else +#include +#endif + +#ifdef DEBUG +#define dprintf(...) printf(__VA_ARGS__) +#else +#define dprintf(...) +#endif + +#define DEPTH 5 + +struct shared_state { + void *p; + size_t len; + size_t modlen; + bool collapse; + bool block_xfer; + bool okay; + volatile bool exiting[DEPTH]; + volatile bool exit; + volatile bool p3_did_write; +}; + +static long g_pagesize; + +/* + * Program flow. There are three or four processes that are descendants + * of the process running the test (P0), where arrows go from parents to + * children, and thicker arrows indicate sharing a certain memory region + * without COW semantics: + * P0 -> P1 -> P2 => P3 + * \=> P4 + * The main idea is that P1 maps a memory region, and that region is + * shared with P2/P3, but with COW semantics. When P3 modifies the + * memory, P2 ought to see that modification. P4 optionally exists to + * defeat a COW optimization. + */ + +#define child_err(...) do { \ + ss->exit = true; \ + err(1, __VA_ARGS__); \ +} while (0) + +#define child_errx(...) do { \ + ss->exit = true; \ + errx(1, __VA_ARGS__); \ +} while (0) + +#define SLEEP_TIME_US 1000 + +static void child(struct shared_state *ss, int depth); + +static pid_t +child_fork(struct shared_state *ss, int depth) +{ + pid_t pid = fork(); + if (pid == -1) + child_err("fork"); + else if (pid == 0) + child(ss, depth); + return pid; +} + +static void +child_fault(struct shared_state *ss) +{ + size_t i; + + for (i = 0; i < ss->len; i += g_pagesize) + (void)((volatile char *)ss->p)[i]; +} + +static void +child_write(struct shared_state *ss, int val, size_t len) +{ + size_t i; + + for (i = 0; i < len; i += g_pagesize) + ((int *)ss->p)[i / sizeof(int)] = val; + atomic_thread_fence_rel(); +} + +static void +child_wait_p3_write(struct shared_state *ss) +{ + while (!ss->p3_did_write) { + if (ss->exit) + exit(1); + usleep(SLEEP_TIME_US); + } + atomic_thread_fence_acq(); +} + +static void +child_verify(struct shared_state *ss, int depth, int newval, int oldval) +{ + size_t i; + int expectval, foundval; + + for (i = 0; i < ss->len; i += g_pagesize) { + expectval = i < ss->modlen ? newval : oldval; + foundval = ((int *)ss->p)[i / sizeof(int)]; + if (foundval == expectval) + continue; + child_errx("P%d saw %d but expected %d, %d was the old value", + depth, foundval, expectval, oldval); + } +} + +static void +child(struct shared_state *ss, int depth) +{ + pid_t mypid, oldval, pid; + + if (depth < 1 || depth >= DEPTH) + child_errx("Bad depth %d", depth); + mypid = getpid(); + dprintf("P%d (pid %d) started\n", depth, mypid); + switch (depth) { + case 1: + /* Shared memory undergoing test. */ + ss->p = mmap(NULL, ss->len, PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANON, -1, 0); + if (ss->p == MAP_FAILED) + child_err("mmap"); + /* P1 stamps the shared memory. */ + child_write(ss, mypid, ss->len); + if (ss->block_xfer) { + /* + * P4 is forked so that its existence blocks a page COW + * path where the page is simply transferred between + * objects, rather than being copied. + */ + child_fork(ss, 4); + } + /* + * P1 specifies that modifications from its child processes not + * be shared with P1. Child process reads can be serviced from + * pages in P1's object, but writes must be COW'd. + */ + if (minherit(ss->p, ss->len, INHERIT_COPY) != 0) + child_err("minherit"); + /* Fork P2. */ + child_fork(ss, depth + 1); + /* P1 and P4 wait for P3's writes before exiting. */ + child_wait_p3_write(ss); + child_verify(ss, depth, mypid, mypid); + if (!ss->collapse) { + /* Hang around to prevent collapse. */ + while (!ss->exit) + usleep(SLEEP_TIME_US); + } + /* Exit so the P2 -> P1/P4 shadow chain can collapse. */ + break; + case 2: + /* + * P2 now specifies that modifications from its child processes + * be shared. P2 and P3 will share a shadow object. + */ + if (minherit(ss->p, ss->len, INHERIT_SHARE) != 0) + child_err("minherit"); + /* + * P2 faults a page in P1's object before P1 exits and the + * shadow chain is collapsed. + */ + child_fault(ss); + oldval = atomic_load_acq_int(ss->p); + /* Fork P3. */ + pid = child_fork(ss, depth + 1); + if (ss->collapse) { + /* Wait for P1 and P4 to exit, triggering collapse. */ + while (!ss->exiting[1] || + (ss->block_xfer && !ss->exiting[4])) + usleep(SLEEP_TIME_US); + /* + * This is racy, just guess at how long it may take + * them to finish exiting. + */ + usleep(100 * 1000); + } + /* P2 waits for P3's modification. */ + child_wait_p3_write(ss); + child_verify(ss, depth, pid, oldval); + ss->okay = true; + ss->exit = true; + break; + case 3: + /* + * P3 writes the memory. A page is faulted into the shared + * P2/P3 shadow object. P2's mapping of the page in P1's + * object must now be shot down, or else P2 will wrongly + * continue to have that page mapped. + */ + child_write(ss, mypid, ss->modlen); + ss->p3_did_write = true; + dprintf("P3 (pid %d) wrote its pid\n", mypid); + break; + case 4: + /* Just hang around until P3 is done writing. */ + oldval = atomic_load_acq_int(ss->p); + child_wait_p3_write(ss); + child_verify(ss, depth, oldval, oldval); + break; + default: + child_errx("Bad depth %d", depth); + } + + dprintf("P%d (pid %d) exiting\n", depth, mypid); + ss->exiting[depth] = true; + exit(0); +} + +static void +do_shared_shadow_inval(bool collapse, bool block_xfer, bool full_mod) +{ + struct shared_state *ss; + pid_t pid; + + pid = getpid(); + + dprintf("P0 (pid %d) %s(collapse=%d, block_xfer=%d, full_mod=%d)\n", + pid, __func__, (int)collapse, (int)block_xfer, (int)full_mod); + + g_pagesize = sysconf(_SC_PAGESIZE); + ATF_REQUIRE(g_pagesize > 0); + + ATF_REQUIRE(procctl(P_PID, pid, PROC_REAP_ACQUIRE, NULL) == 0); + + /* Shared memory for coordination. */ + ss = mmap(NULL, sizeof(*ss), PROT_READ | PROT_WRITE, + MAP_SHARED | MAP_ANON, -1, 0); + ATF_REQUIRE(ss != MAP_FAILED); + + ss->len = 2 * 1024 * 1024 + g_pagesize; /* 2 MB + page size */ + ss->modlen = full_mod ? ss->len : ss->len / 2; + ss->collapse = collapse; + ss->block_xfer = block_xfer; + + pid = fork(); + ATF_REQUIRE(pid != -1); + if (pid == 0) + child(ss, 1); + + /* Wait for all descendants to exit. */ + do { + pid = wait(NULL); + } while (pid != -1 || errno != ECHILD); + + atomic_thread_fence_acq(); + ATF_REQUIRE(ss->okay); + + ATF_REQUIRE(munmap(ss, sizeof(*ss)) == 0); + ATF_REQUIRE(procctl(P_PID, getpid(), PROC_REAP_RELEASE, NULL) == 0); +} + +#ifdef STANDALONE +int +main(void) +{ + + do_shared_shadow_inval(false, false, false); + do_shared_shadow_inval(false, false, true); + do_shared_shadow_inval(false, true, false); + do_shared_shadow_inval(false, true, true); + do_shared_shadow_inval(true, false, false); + do_shared_shadow_inval(true, false, true); + do_shared_shadow_inval(true, true, false); + do_shared_shadow_inval(true, true, true); + printf("pass\n"); +} +#else + +#define SHARED_SHADOW_INVAL_TC(suffix, collapse, block_xfer, full_mod) \ +ATF_TC_WITHOUT_HEAD(shared_shadow_inval__##suffix); \ +ATF_TC_BODY(shared_shadow_inval__##suffix, tc) \ +{ \ + do_shared_shadow_inval(collapse, block_xfer, full_mod); \ +} + +SHARED_SHADOW_INVAL_TC(nocollapse_noblockxfer_nofullmod, false, false, false); +SHARED_SHADOW_INVAL_TC(nocollapse_noblockxfer_fullmod, false, false, true); +SHARED_SHADOW_INVAL_TC(nocollapse_blockxfer_nofullmod, false, true, false); +SHARED_SHADOW_INVAL_TC(nocollapse_blockxfer_fullmod, false, true, true); +SHARED_SHADOW_INVAL_TC(collapse_noblockxfer_nofullmod, true, false, false); +SHARED_SHADOW_INVAL_TC(collapse_noblockxfer_fullmod, true, false, true); +SHARED_SHADOW_INVAL_TC(collapse_blockxfer_nofullmod, true, true, false); +SHARED_SHADOW_INVAL_TC(collapse_blockxfer_fullmod, true, true, true); + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, + shared_shadow_inval__nocollapse_noblockxfer_nofullmod); + ATF_TP_ADD_TC(tp, shared_shadow_inval__nocollapse_noblockxfer_fullmod); + ATF_TP_ADD_TC(tp, shared_shadow_inval__nocollapse_blockxfer_nofullmod); + ATF_TP_ADD_TC(tp, shared_shadow_inval__nocollapse_blockxfer_fullmod); + ATF_TP_ADD_TC(tp, shared_shadow_inval__collapse_noblockxfer_nofullmod); + ATF_TP_ADD_TC(tp, shared_shadow_inval__collapse_noblockxfer_fullmod); + ATF_TP_ADD_TC(tp, shared_shadow_inval__collapse_blockxfer_nofullmod); + ATF_TP_ADD_TC(tp, shared_shadow_inval__collapse_blockxfer_fullmod); + + return atf_no_error(); +} +#endif From owner-dev-commits-src-all@freebsd.org Wed Apr 7 19:53:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE7DB5C28D4; Wed, 7 Apr 2021 19:53: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 4FFw6r535Gz4gYk; Wed, 7 Apr 2021 19:53: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 A038C24E45; Wed, 7 Apr 2021 19:53: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 137Jr8CP068727; Wed, 7 Apr 2021 19:53:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137Jr88J068726; Wed, 7 Apr 2021 19:53:08 GMT (envelope-from git) Date: Wed, 7 Apr 2021 19:53:08 GMT Message-Id: <202104071953.137Jr88J068726@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: a29bff7a5216 - main - smbios: support getting address from EFI 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: a29bff7a5216bd5f4a76228788e7eacf235004de Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 19:53:08 -0000 The branch main has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=a29bff7a5216bd5f4a76228788e7eacf235004de commit a29bff7a5216bd5f4a76228788e7eacf235004de Author: Greg V AuthorDate: 2021-04-07 19:46:29 +0000 Commit: Eric van Gyzen CommitDate: 2021-04-07 19:46:29 +0000 smbios: support getting address from EFI On some systems (e.g. Lenovo ThinkPad X240, Apple MacBookPro12,1) the SMBIOS entry point is not found in the <0xFFFFF space. Follow the SMBIOS spec and use the EFI Configuration Table for locating the entry point on EFI systems. Reviewed by: rpokala, dab MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D29276 --- sys/amd64/conf/MINIMAL | 1 - sys/amd64/conf/NOTES | 2 +- sys/amd64/include/efi.h | 1 + sys/arm64/include/efi.h | 2 ++ sys/dev/smbios/smbios.c | 22 +++++++++++++++++----- sys/sys/efi.h | 8 ++++---- 6 files changed, 25 insertions(+), 11 deletions(-) diff --git a/sys/amd64/conf/MINIMAL b/sys/amd64/conf/MINIMAL index b4c58993748a..603fce8320bb 100644 --- a/sys/amd64/conf/MINIMAL +++ b/sys/amd64/conf/MINIMAL @@ -103,7 +103,6 @@ device cpufreq # Bus support. device acpi -device smbios options IOMMU device pci diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index 5627ce5377d3..aa5a09475ef3 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -513,7 +513,7 @@ device xenpci # Xen HVM Hypervisor services driver # # ipmi: Intelligent Platform Management Interface # pbio: Parallel (8255 PPI) basic I/O (mode 0) port (e.g. Advantech PCL-724) -# smbios: DMI/SMBIOS entry point +# smbios: DMI/SMBIOS entry point (requires EFIRT option) # vpd: Vital Product Data kernel interface # asmc: Apple System Management Controller # si: Specialix International SI/XIO or SX intelligent serial card diff --git a/sys/amd64/include/efi.h b/sys/amd64/include/efi.h index e630a338c17e..2c24bebfe548 100644 --- a/sys/amd64/include/efi.h +++ b/sys/amd64/include/efi.h @@ -47,6 +47,7 @@ #ifdef _KERNEL #include +#define ARCH_MAY_USE_EFI #define EFI_TIME_LOCK() mtx_lock(&atrtc_time_lock) #define EFI_TIME_UNLOCK() mtx_unlock(&atrtc_time_lock) diff --git a/sys/arm64/include/efi.h b/sys/arm64/include/efi.h index a8fddfad8d0f..6db16e5b8291 100644 --- a/sys/arm64/include/efi.h +++ b/sys/arm64/include/efi.h @@ -36,6 +36,8 @@ #define EFIABI_ATTR #ifdef _KERNEL +#define ARCH_MAY_USE_EFI + #define EFI_TIME_LOCK() #define EFI_TIME_UNLOCK() #define EFI_TIME_OWNED() diff --git a/sys/dev/smbios/smbios.c b/sys/dev/smbios/smbios.c index 10589ed8d49d..f3519634e1a4 100644 --- a/sys/dev/smbios/smbios.c +++ b/sys/dev/smbios/smbios.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -79,20 +80,28 @@ static int smbios_cksum (struct smbios_eps *); static void smbios_identify (driver_t *driver, device_t parent) { +#ifdef ARCH_MAY_USE_EFI + struct uuid efi_smbios = EFI_TABLE_SMBIOS; + void *addr_efi; +#endif struct smbios_eps *eps; device_t child; - vm_paddr_t addr; + vm_paddr_t addr = 0; int length; int rid; if (!device_is_alive(parent)) return; +#ifdef ARCH_MAY_USE_EFI + if (!efi_get_table(&efi_smbios, &addr_efi)) + addr = (vm_paddr_t)addr_efi; +#endif + #if defined(__amd64__) || defined(__i386__) - addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN, - SMBIOS_STEP, SMBIOS_OFF); -#else - addr = 0; + if (addr == 0) + addr = bios_sigsearch(SMBIOS_START, SMBIOS_SIG, SMBIOS_LEN, + SMBIOS_STEP, SMBIOS_OFF); #endif if (addr != 0) { @@ -242,6 +251,9 @@ static driver_t smbios_driver = { }; DRIVER_MODULE(smbios, nexus, smbios_driver, smbios_devclass, smbios_modevent, 0); +#ifdef ARCH_MAY_USE_EFI +MODULE_DEPEND(smbios, efirt, 1, 1, 1); +#endif MODULE_VERSION(smbios, 1); static int diff --git a/sys/sys/efi.h b/sys/sys/efi.h index f7a1fe790d23..5875e87b3595 100644 --- a/sys/sys/efi.h +++ b/sys/sys/efi.h @@ -36,10 +36,10 @@ #define EFI_PAGE_SIZE (1 << EFI_PAGE_SHIFT) #define EFI_PAGE_MASK (EFI_PAGE_SIZE - 1) -#define EFI_TABLE_ACPI20 \ - {0x8868e871,0xe4f1,0x11d3,0xbc,0x22,{0x00,0x80,0xc7,0x3c,0x88,0x81}} -#define EFI_TABLE_SAL \ - {0xeb9d2d32,0x2d88,0x11d3,0x9a,0x16,{0x00,0x90,0x27,0x3f,0xc1,0x4d}} +#define EFI_TABLE_SMBIOS \ + {0xeb9d2d31,0x2d88,0x11d3,0x9a,0x16,{0x00,0x90,0x27,0x3f,0xc1,0x4d}} +#define EFI_TABLE_SMBIOS3 \ + {0xf2fd1544,0x9794,0x4a2c,0x99,0x2e,{0xe5,0xbb,0xcf,0x20,0xe3,0x94}} enum efi_reset { EFI_RESET_COLD = 0, From owner-dev-commits-src-all@freebsd.org Wed Apr 7 20:08:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F5DC5C3482; Wed, 7 Apr 2021 20:08: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 4FFwSt0N8Nz4jLW; Wed, 7 Apr 2021 20:08: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 E922825436; Wed, 7 Apr 2021 20:08: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 137K8jDD083307; Wed, 7 Apr 2021 20:08:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137K8jD7083306; Wed, 7 Apr 2021 20:08:45 GMT (envelope-from git) Date: Wed, 7 Apr 2021 20:08:45 GMT Message-Id: <202104072008.137K8jD7083306@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: f689cb23b278 - main - ipmi, smbios: move smbios_walk_table to smbios.h 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: f689cb23b2782d0d0f586bcfabbad68f728ed1df Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 20:08:46 -0000 The branch main has been updated by vangyzen: URL: https://cgit.FreeBSD.org/src/commit/?id=f689cb23b2782d0d0f586bcfabbad68f728ed1df commit f689cb23b2782d0d0f586bcfabbad68f728ed1df Author: Greg V AuthorDate: 2021-04-07 20:05:49 +0000 Commit: Eric van Gyzen CommitDate: 2021-04-07 20:05:49 +0000 ipmi,smbios: move smbios_walk_table to smbios.h This function will be used for exposing DMI info as sysctls in the smbios module (in an upcoming review). While here, add __packed to the structs. Reviewed by: dab MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D29270 --- sys/dev/ipmi/ipmi_smbios.c | 29 ----------------------------- sys/dev/smbios/smbios.h | 31 +++++++++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 31 deletions(-) diff --git a/sys/dev/ipmi/ipmi_smbios.c b/sys/dev/ipmi/ipmi_smbios.c index 308a3b076ef7..a1b953365d7c 100644 --- a/sys/dev/ipmi/ipmi_smbios.c +++ b/sys/dev/ipmi/ipmi_smbios.c @@ -79,8 +79,6 @@ struct ipmi_entry { #define SPACING_32 0x1 #define SPACING_16 0x2 -typedef void (*smbios_callback_t)(struct smbios_structure_header *, void *); - static struct ipmi_get_info ipmi_info; static int ipmi_probed; static struct mtx ipmi_info_mtx; @@ -88,8 +86,6 @@ MTX_SYSINIT(ipmi_info, &ipmi_info_mtx, "ipmi info", MTX_DEF); static void ipmi_smbios_probe(struct ipmi_get_info *); static int smbios_cksum(struct smbios_eps *); -static void smbios_walk_table(uint8_t *, int, smbios_callback_t, - void *); static void smbios_ipmi_info(struct smbios_structure_header *, void *); static void @@ -146,31 +142,6 @@ smbios_ipmi_info(struct smbios_structure_header *h, void *arg) info->iface_type = s->interface_type; } -static void -smbios_walk_table(uint8_t *p, int entries, smbios_callback_t cb, void *arg) -{ - struct smbios_structure_header *s; - - while (entries--) { - s = (struct smbios_structure_header *)p; - cb(s, arg); - - /* - * Look for a double-nul after the end of the - * formatted area of this structure. - */ - p += s->length; - while (!(p[0] == 0 && p[1] == 0)) - p++; - - /* - * Skip over the double-nul to the start of the next - * structure. - */ - p += 2; - } -} - /* * Walk the SMBIOS table looking for an IPMI (type 38) entry. If we find * one, return the parsed data in the passed in ipmi_get_info structure and diff --git a/sys/dev/smbios/smbios.h b/sys/dev/smbios/smbios.h index 6503cdb73c4c..ec216b676f2b 100644 --- a/sys/dev/smbios/smbios.h +++ b/sys/dev/smbios/smbios.h @@ -56,12 +56,39 @@ struct smbios_eps { uint32_t structure_table_address; uint16_t number_structures; uint8_t BCD_revision; -}; +} __packed; struct smbios_structure_header { uint8_t type; uint8_t length; uint16_t handle; -}; +} __packed; + +typedef void (*smbios_callback_t)(struct smbios_structure_header *, void *); + +static inline void +smbios_walk_table(uint8_t *p, int entries, smbios_callback_t cb, void *arg) +{ + struct smbios_structure_header *s; + + while (entries--) { + s = (struct smbios_structure_header *)p; + cb(s, arg); + + /* + * Look for a double-nul after the end of the + * formatted area of this structure. + */ + p += s->length; + while (!(p[0] == 0 && p[1] == 0)) + p++; + + /* + * Skip over the double-nul to the start of the next + * structure. + */ + p += 2; + } +} #endif /* _SMBIOS_H_ */ From owner-dev-commits-src-all@freebsd.org Wed Apr 7 21:04:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 077F25C4ECF; Wed, 7 Apr 2021 21:04: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 4FFxjN6r6vz4nJZ; Wed, 7 Apr 2021 21:04: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 D310B25CF2; Wed, 7 Apr 2021 21:04: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 137L4eb2062655; Wed, 7 Apr 2021 21:04:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137L4edh062654; Wed, 7 Apr 2021 21:04:40 GMT (envelope-from git) Date: Wed, 7 Apr 2021 21:04:40 GMT Message-Id: <202104072104.137L4edh062654@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: 894b3a1a32cc - stable/13 - netmap: bridge: fix transmission in busy-wait mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 894b3a1a32cc137b16eee2462151617cb0b7db48 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 21:04:41 -0000 The branch stable/13 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=894b3a1a32cc137b16eee2462151617cb0b7db48 commit 894b3a1a32cc137b16eee2462151617cb0b7db48 Author: Vincenzo Maffione AuthorDate: 2021-03-30 06:24:56 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-07 21:04:33 +0000 netmap: bridge: fix transmission in busy-wait mode In busy-wait mode (BUSYWAIT defined), NIOCTXSYNC should be performed after packets have been moved to the TX ring (rather than before). Before the change, moved packets may stall for an indefinite time in the TX ring. MFC after: 1 week (cherry picked from commit 51cc31088bf4d23a6ad0bfe8851adaa049d750fc) --- tools/tools/netmap/bridge.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tools/tools/netmap/bridge.c b/tools/tools/netmap/bridge.c index 77d235bf6e08..0c8f56265ff4 100644 --- a/tools/tools/netmap/bridge.c +++ b/tools/tools/netmap/bridge.c @@ -17,6 +17,10 @@ #include #include +#if defined(_WIN32) +#define BUSYWAIT +#endif + static int verbose = 0; static int do_abort = 0; @@ -321,21 +325,19 @@ main(int argc, char **argv) pollfd[0].revents = pollfd[1].revents = 0; n0 = rx_slots_avail(pa); n1 = rx_slots_avail(pb); -#if defined(_WIN32) || defined(BUSYWAIT) +#ifdef BUSYWAIT if (n0) { - ioctl(pollfd[1].fd, NIOCTXSYNC, NULL); pollfd[1].revents = POLLOUT; } else { ioctl(pollfd[0].fd, NIOCRXSYNC, NULL); } if (n1) { - ioctl(pollfd[0].fd, NIOCTXSYNC, NULL); pollfd[0].revents = POLLOUT; } else { ioctl(pollfd[1].fd, NIOCRXSYNC, NULL); } ret = 1; -#else +#else /* !defined(BUSYWAIT) */ if (n0) pollfd[1].events |= POLLOUT; else @@ -347,7 +349,7 @@ main(int argc, char **argv) /* poll() also cause kernel to txsync/rxsync the NICs */ ret = poll(pollfd, 2, 2500); -#endif /* defined(_WIN32) || defined(BUSYWAIT) */ +#endif /* !defined(BUSYWAIT) */ if (ret <= 0 || verbose) D("poll %s [0] ev %x %x rx %d@%d tx %d," " [1] ev %x %x rx %d@%d tx %d", @@ -375,11 +377,19 @@ main(int argc, char **argv) D("error on fd1, rx [%d,%d,%d)", rx->head, rx->cur, rx->tail); } - if (pollfd[0].revents & POLLOUT) + if (pollfd[0].revents & POLLOUT) { ports_move(pb, pa, burst, msg_b2a); +#ifdef BUSYWAIT + ioctl(pollfd[0].fd, NIOCTXSYNC, NULL); +#endif + } - if (pollfd[1].revents & POLLOUT) + if (pollfd[1].revents & POLLOUT) { ports_move(pa, pb, burst, msg_a2b); +#ifdef BUSYWAIT + ioctl(pollfd[1].fd, NIOCTXSYNC, NULL); +#endif + } /* * We don't need ioctl(NIOCTXSYNC) on the two file descriptors. From owner-dev-commits-src-all@freebsd.org Wed Apr 7 21:05:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECE3D5C4EDD; Wed, 7 Apr 2021 21:05: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 4FFxkR6S0wz4n8H; Wed, 7 Apr 2021 21:05: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 C664625CF3; Wed, 7 Apr 2021 21:05: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 137L5ZMg062833; Wed, 7 Apr 2021 21:05:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137L5ZB0062832; Wed, 7 Apr 2021 21:05:35 GMT (envelope-from git) Date: Wed, 7 Apr 2021 21:05:35 GMT Message-Id: <202104072105.137L5ZB0062832@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: 3f70c3d58f93 - stable/12 - netmap: bridge: fix transmission in busy-wait mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3f70c3d58f9330039707037b1242ca13ac390cad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 21:05:36 -0000 The branch stable/12 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=3f70c3d58f9330039707037b1242ca13ac390cad commit 3f70c3d58f9330039707037b1242ca13ac390cad Author: Vincenzo Maffione AuthorDate: 2021-03-30 06:24:56 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-07 21:05:28 +0000 netmap: bridge: fix transmission in busy-wait mode In busy-wait mode (BUSYWAIT defined), NIOCTXSYNC should be performed after packets have been moved to the TX ring (rather than before). Before the change, moved packets may stall for an indefinite time in the TX ring. MFC after: 1 week (cherry picked from commit 51cc31088bf4d23a6ad0bfe8851adaa049d750fc) --- tools/tools/netmap/bridge.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tools/tools/netmap/bridge.c b/tools/tools/netmap/bridge.c index 77d235bf6e08..0c8f56265ff4 100644 --- a/tools/tools/netmap/bridge.c +++ b/tools/tools/netmap/bridge.c @@ -17,6 +17,10 @@ #include #include +#if defined(_WIN32) +#define BUSYWAIT +#endif + static int verbose = 0; static int do_abort = 0; @@ -321,21 +325,19 @@ main(int argc, char **argv) pollfd[0].revents = pollfd[1].revents = 0; n0 = rx_slots_avail(pa); n1 = rx_slots_avail(pb); -#if defined(_WIN32) || defined(BUSYWAIT) +#ifdef BUSYWAIT if (n0) { - ioctl(pollfd[1].fd, NIOCTXSYNC, NULL); pollfd[1].revents = POLLOUT; } else { ioctl(pollfd[0].fd, NIOCRXSYNC, NULL); } if (n1) { - ioctl(pollfd[0].fd, NIOCTXSYNC, NULL); pollfd[0].revents = POLLOUT; } else { ioctl(pollfd[1].fd, NIOCRXSYNC, NULL); } ret = 1; -#else +#else /* !defined(BUSYWAIT) */ if (n0) pollfd[1].events |= POLLOUT; else @@ -347,7 +349,7 @@ main(int argc, char **argv) /* poll() also cause kernel to txsync/rxsync the NICs */ ret = poll(pollfd, 2, 2500); -#endif /* defined(_WIN32) || defined(BUSYWAIT) */ +#endif /* !defined(BUSYWAIT) */ if (ret <= 0 || verbose) D("poll %s [0] ev %x %x rx %d@%d tx %d," " [1] ev %x %x rx %d@%d tx %d", @@ -375,11 +377,19 @@ main(int argc, char **argv) D("error on fd1, rx [%d,%d,%d)", rx->head, rx->cur, rx->tail); } - if (pollfd[0].revents & POLLOUT) + if (pollfd[0].revents & POLLOUT) { ports_move(pb, pa, burst, msg_b2a); +#ifdef BUSYWAIT + ioctl(pollfd[0].fd, NIOCTXSYNC, NULL); +#endif + } - if (pollfd[1].revents & POLLOUT) + if (pollfd[1].revents & POLLOUT) { ports_move(pa, pb, burst, msg_a2b); +#ifdef BUSYWAIT + ioctl(pollfd[1].fd, NIOCTXSYNC, NULL); +#endif + } /* * We don't need ioctl(NIOCTXSYNC) on the two file descriptors. From owner-dev-commits-src-all@freebsd.org Wed Apr 7 21:06:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C78A5C5203; Wed, 7 Apr 2021 21:06: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 4FFxlN3YyRz4nWX; Wed, 7 Apr 2021 21:06: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 6DAEB25EE1; Wed, 7 Apr 2021 21:06: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 137L6Om2062996; Wed, 7 Apr 2021 21:06:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137L6OrT062995; Wed, 7 Apr 2021 21:06:24 GMT (envelope-from git) Date: Wed, 7 Apr 2021 21:06:24 GMT Message-Id: <202104072106.137L6OrT062995@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: 588b2e6dd2f6 - stable/13 - netmap: pkt-gen: allow -Z and -z to be used together MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 588b2e6dd2f6fd0d179451f20e901f232810a49e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 21:06:24 -0000 The branch stable/13 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=588b2e6dd2f6fd0d179451f20e901f232810a49e commit 588b2e6dd2f6fd0d179451f20e901f232810a49e Author: Vincenzo Maffione AuthorDate: 2021-03-30 06:13:07 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-07 21:06:01 +0000 netmap: pkt-gen: allow -Z and -z to be used together These options are used for generating random source/destination IP/ports within transmitted packets. MFC after: 1 week (cherry picked from commit 27bf5dd3d40397fa7d20a17828de2801c8a94a4b) --- tools/tools/netmap/pkt-gen.c | 125 +++++++++++++++++++++++-------------------- 1 file changed, 66 insertions(+), 59 deletions(-) diff --git a/tools/tools/netmap/pkt-gen.c b/tools/tools/netmap/pkt-gen.c index 55504c09ae58..ebc0ac977219 100644 --- a/tools/tools/netmap/pkt-gen.c +++ b/tools/tools/netmap/pkt-gen.c @@ -802,6 +802,25 @@ dump_payload(const char *_p, int len, struct netmap_ring *ring, int cur) #define uh_sum check #endif /* linux */ +static uint16_t +new_ip_sum(uint16_t ip_sum, uint32_t oaddr, uint32_t naddr) +{ + ip_sum = cksum_add(ip_sum, ~oaddr >> 16); + ip_sum = cksum_add(ip_sum, ~oaddr & 0xffff); + ip_sum = cksum_add(ip_sum, naddr >> 16); + ip_sum = cksum_add(ip_sum, naddr & 0xffff); + return ip_sum; +} + +static uint16_t +new_udp_sum(uint16_t udp_sum, uint16_t oport, uint16_t nport) +{ + udp_sum = cksum_add(udp_sum, ~oport); + udp_sum = cksum_add(udp_sum, nport); + return udp_sum; +} + + static void update_ip(struct pkt *pkt, struct targ *t) { @@ -810,7 +829,7 @@ update_ip(struct pkt *pkt, struct targ *t) struct udphdr udp; uint32_t oaddr, naddr; uint16_t oport, nport; - uint16_t ip_sum, udp_sum; + uint16_t ip_sum = 0, udp_sum = 0; memcpy(&ip, &pkt->ipv4.ip, sizeof(ip)); memcpy(&udp, &pkt->ipv4.udp, sizeof(udp)); @@ -823,35 +842,28 @@ update_ip(struct pkt *pkt, struct targ *t) udp.uh_sport = nrand48(t->seed); naddr = ntohl(ip.ip_src.s_addr); nport = ntohs(udp.uh_sport); - break; - } - if (oport < g->src_ip.port1) { - nport = oport + 1; + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); + udp_sum = new_udp_sum(udp_sum, oport, nport); + } else { + if (oport < g->src_ip.port1) { + nport = oport + 1; + udp.uh_sport = htons(nport); + udp_sum = new_udp_sum(udp_sum, oport, nport); + break; + } + nport = g->src_ip.port0; udp.uh_sport = htons(nport); - break; - } - nport = g->src_ip.port0; - udp.uh_sport = htons(nport); - if (oaddr < g->src_ip.ipv4.end) { - naddr = oaddr + 1; + if (oaddr < g->src_ip.ipv4.end) { + naddr = oaddr + 1; + ip.ip_src.s_addr = htonl(naddr); + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); + break; + } + naddr = g->src_ip.ipv4.start; ip.ip_src.s_addr = htonl(naddr); - break; + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); } - naddr = g->src_ip.ipv4.start; - ip.ip_src.s_addr = htonl(naddr); - } while (0); - /* update checksums if needed */ - if (oaddr != naddr) { - ip_sum = cksum_add(ip_sum, ~oaddr >> 16); - ip_sum = cksum_add(ip_sum, ~oaddr & 0xffff); - ip_sum = cksum_add(ip_sum, naddr >> 16); - ip_sum = cksum_add(ip_sum, naddr & 0xffff); - } - if (oport != nport) { - udp_sum = cksum_add(udp_sum, ~oport); - udp_sum = cksum_add(udp_sum, nport); - } - do { + naddr = oaddr = ntohl(ip.ip_dst.s_addr); nport = oport = ntohs(udp.uh_dport); if (g->options & OPT_RANDOM_DST) { @@ -859,34 +871,29 @@ update_ip(struct pkt *pkt, struct targ *t) udp.uh_dport = nrand48(t->seed); naddr = ntohl(ip.ip_dst.s_addr); nport = ntohs(udp.uh_dport); - break; - } - if (oport < g->dst_ip.port1) { - nport = oport + 1; + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); + udp_sum = new_udp_sum(udp_sum, oport, nport); + } else { + if (oport < g->dst_ip.port1) { + nport = oport + 1; + udp.uh_dport = htons(nport); + udp_sum = new_udp_sum(udp_sum, oport, nport); + break; + } + nport = g->dst_ip.port0; udp.uh_dport = htons(nport); - break; - } - nport = g->dst_ip.port0; - udp.uh_dport = htons(nport); - if (oaddr < g->dst_ip.ipv4.end) { - naddr = oaddr + 1; + if (oaddr < g->dst_ip.ipv4.end) { + naddr = oaddr + 1; + ip.ip_dst.s_addr = htonl(naddr); + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); + break; + } + naddr = g->dst_ip.ipv4.start; ip.ip_dst.s_addr = htonl(naddr); - break; + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); } - naddr = g->dst_ip.ipv4.start; - ip.ip_dst.s_addr = htonl(naddr); } while (0); /* update checksums */ - if (oaddr != naddr) { - ip_sum = cksum_add(ip_sum, ~oaddr >> 16); - ip_sum = cksum_add(ip_sum, ~oaddr & 0xffff); - ip_sum = cksum_add(ip_sum, naddr >> 16); - ip_sum = cksum_add(ip_sum, naddr & 0xffff); - } - if (oport != nport) { - udp_sum = cksum_add(udp_sum, ~oport); - udp_sum = cksum_add(udp_sum, nport); - } if (udp_sum != 0) udp.uh_sum = ~cksum_add(~udp.uh_sum, htons(udp_sum)); if (ip_sum != 0) { @@ -939,14 +946,14 @@ update_ip6(struct pkt *pkt, struct targ *t) } naddr = ntohs(g->src_ip.ipv6.start.s6_addr16[group]); ip6.ip6_src.s6_addr16[group] = htons(naddr); - } while (0); - /* update checksums if needed */ - if (oaddr != naddr) - udp_sum = cksum_add(~oaddr, naddr); - if (oport != nport) - udp_sum = cksum_add(udp_sum, - cksum_add(~oport, nport)); - do { + + /* update checksums if needed */ + if (oaddr != naddr) + udp_sum = cksum_add(~oaddr, naddr); + if (oport != nport) + udp_sum = cksum_add(udp_sum, + cksum_add(~oport, nport)); + group = g->dst_ip.ipv6.egroup; naddr = oaddr = ntohs(ip6.ip6_dst.s6_addr16[group]); nport = oport = ntohs(udp.uh_dport); @@ -2504,7 +2511,7 @@ start_threads(struct glob_arg *g) { * using a single descriptor. */ for (i = 0; i < g->nthreads; i++) { - uint64_t seed = time(0) | (time(0) << 32); + uint64_t seed = (uint64_t)time(0) | ((uint64_t)time(0) << 32); t = &targs[i]; bzero(t, sizeof(*t)); From owner-dev-commits-src-all@freebsd.org Wed Apr 7 21:06:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31F945C5293; Wed, 7 Apr 2021 21:06:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FFxlt0vWyz4nRW; Wed, 7 Apr 2021 21:06:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1186D25C6B; Wed, 7 Apr 2021 21:06:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 137L6nRZ063132; Wed, 7 Apr 2021 21:06:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137L6nuk063131; Wed, 7 Apr 2021 21:06:49 GMT (envelope-from git) Date: Wed, 7 Apr 2021 21:06:49 GMT Message-Id: <202104072106.137L6nuk063131@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: b5cf839053fe - stable/12 - netmap: pkt-gen: allow -Z and -z to be used together MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b5cf839053fef6da328d7b90d2475e8bb82bfa30 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 21:06:50 -0000 The branch stable/12 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=b5cf839053fef6da328d7b90d2475e8bb82bfa30 commit b5cf839053fef6da328d7b90d2475e8bb82bfa30 Author: Vincenzo Maffione AuthorDate: 2021-03-30 06:13:07 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-07 21:06:38 +0000 netmap: pkt-gen: allow -Z and -z to be used together These options are used for generating random source/destination IP/ports within transmitted packets. MFC after: 1 week --- tools/tools/netmap/pkt-gen.c | 125 +++++++++++++++++++++++-------------------- 1 file changed, 66 insertions(+), 59 deletions(-) diff --git a/tools/tools/netmap/pkt-gen.c b/tools/tools/netmap/pkt-gen.c index 55504c09ae58..ebc0ac977219 100644 --- a/tools/tools/netmap/pkt-gen.c +++ b/tools/tools/netmap/pkt-gen.c @@ -802,6 +802,25 @@ dump_payload(const char *_p, int len, struct netmap_ring *ring, int cur) #define uh_sum check #endif /* linux */ +static uint16_t +new_ip_sum(uint16_t ip_sum, uint32_t oaddr, uint32_t naddr) +{ + ip_sum = cksum_add(ip_sum, ~oaddr >> 16); + ip_sum = cksum_add(ip_sum, ~oaddr & 0xffff); + ip_sum = cksum_add(ip_sum, naddr >> 16); + ip_sum = cksum_add(ip_sum, naddr & 0xffff); + return ip_sum; +} + +static uint16_t +new_udp_sum(uint16_t udp_sum, uint16_t oport, uint16_t nport) +{ + udp_sum = cksum_add(udp_sum, ~oport); + udp_sum = cksum_add(udp_sum, nport); + return udp_sum; +} + + static void update_ip(struct pkt *pkt, struct targ *t) { @@ -810,7 +829,7 @@ update_ip(struct pkt *pkt, struct targ *t) struct udphdr udp; uint32_t oaddr, naddr; uint16_t oport, nport; - uint16_t ip_sum, udp_sum; + uint16_t ip_sum = 0, udp_sum = 0; memcpy(&ip, &pkt->ipv4.ip, sizeof(ip)); memcpy(&udp, &pkt->ipv4.udp, sizeof(udp)); @@ -823,35 +842,28 @@ update_ip(struct pkt *pkt, struct targ *t) udp.uh_sport = nrand48(t->seed); naddr = ntohl(ip.ip_src.s_addr); nport = ntohs(udp.uh_sport); - break; - } - if (oport < g->src_ip.port1) { - nport = oport + 1; + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); + udp_sum = new_udp_sum(udp_sum, oport, nport); + } else { + if (oport < g->src_ip.port1) { + nport = oport + 1; + udp.uh_sport = htons(nport); + udp_sum = new_udp_sum(udp_sum, oport, nport); + break; + } + nport = g->src_ip.port0; udp.uh_sport = htons(nport); - break; - } - nport = g->src_ip.port0; - udp.uh_sport = htons(nport); - if (oaddr < g->src_ip.ipv4.end) { - naddr = oaddr + 1; + if (oaddr < g->src_ip.ipv4.end) { + naddr = oaddr + 1; + ip.ip_src.s_addr = htonl(naddr); + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); + break; + } + naddr = g->src_ip.ipv4.start; ip.ip_src.s_addr = htonl(naddr); - break; + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); } - naddr = g->src_ip.ipv4.start; - ip.ip_src.s_addr = htonl(naddr); - } while (0); - /* update checksums if needed */ - if (oaddr != naddr) { - ip_sum = cksum_add(ip_sum, ~oaddr >> 16); - ip_sum = cksum_add(ip_sum, ~oaddr & 0xffff); - ip_sum = cksum_add(ip_sum, naddr >> 16); - ip_sum = cksum_add(ip_sum, naddr & 0xffff); - } - if (oport != nport) { - udp_sum = cksum_add(udp_sum, ~oport); - udp_sum = cksum_add(udp_sum, nport); - } - do { + naddr = oaddr = ntohl(ip.ip_dst.s_addr); nport = oport = ntohs(udp.uh_dport); if (g->options & OPT_RANDOM_DST) { @@ -859,34 +871,29 @@ update_ip(struct pkt *pkt, struct targ *t) udp.uh_dport = nrand48(t->seed); naddr = ntohl(ip.ip_dst.s_addr); nport = ntohs(udp.uh_dport); - break; - } - if (oport < g->dst_ip.port1) { - nport = oport + 1; + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); + udp_sum = new_udp_sum(udp_sum, oport, nport); + } else { + if (oport < g->dst_ip.port1) { + nport = oport + 1; + udp.uh_dport = htons(nport); + udp_sum = new_udp_sum(udp_sum, oport, nport); + break; + } + nport = g->dst_ip.port0; udp.uh_dport = htons(nport); - break; - } - nport = g->dst_ip.port0; - udp.uh_dport = htons(nport); - if (oaddr < g->dst_ip.ipv4.end) { - naddr = oaddr + 1; + if (oaddr < g->dst_ip.ipv4.end) { + naddr = oaddr + 1; + ip.ip_dst.s_addr = htonl(naddr); + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); + break; + } + naddr = g->dst_ip.ipv4.start; ip.ip_dst.s_addr = htonl(naddr); - break; + ip_sum = new_ip_sum(ip_sum, oaddr, naddr); } - naddr = g->dst_ip.ipv4.start; - ip.ip_dst.s_addr = htonl(naddr); } while (0); /* update checksums */ - if (oaddr != naddr) { - ip_sum = cksum_add(ip_sum, ~oaddr >> 16); - ip_sum = cksum_add(ip_sum, ~oaddr & 0xffff); - ip_sum = cksum_add(ip_sum, naddr >> 16); - ip_sum = cksum_add(ip_sum, naddr & 0xffff); - } - if (oport != nport) { - udp_sum = cksum_add(udp_sum, ~oport); - udp_sum = cksum_add(udp_sum, nport); - } if (udp_sum != 0) udp.uh_sum = ~cksum_add(~udp.uh_sum, htons(udp_sum)); if (ip_sum != 0) { @@ -939,14 +946,14 @@ update_ip6(struct pkt *pkt, struct targ *t) } naddr = ntohs(g->src_ip.ipv6.start.s6_addr16[group]); ip6.ip6_src.s6_addr16[group] = htons(naddr); - } while (0); - /* update checksums if needed */ - if (oaddr != naddr) - udp_sum = cksum_add(~oaddr, naddr); - if (oport != nport) - udp_sum = cksum_add(udp_sum, - cksum_add(~oport, nport)); - do { + + /* update checksums if needed */ + if (oaddr != naddr) + udp_sum = cksum_add(~oaddr, naddr); + if (oport != nport) + udp_sum = cksum_add(udp_sum, + cksum_add(~oport, nport)); + group = g->dst_ip.ipv6.egroup; naddr = oaddr = ntohs(ip6.ip6_dst.s6_addr16[group]); nport = oport = ntohs(udp.uh_dport); @@ -2504,7 +2511,7 @@ start_threads(struct glob_arg *g) { * using a single descriptor. */ for (i = 0; i < g->nthreads; i++) { - uint64_t seed = time(0) | (time(0) << 32); + uint64_t seed = (uint64_t)time(0) | ((uint64_t)time(0) << 32); t = &targs[i]; bzero(t, sizeof(*t)); From owner-dev-commits-src-all@freebsd.org Wed Apr 7 21:42:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 553515C57DB; Wed, 7 Apr 2021 21:42: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 4FFyYT1zt1z4qk9; Wed, 7 Apr 2021 21:42: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 2C54A266D9; Wed, 7 Apr 2021 21:42: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 137LgrAM015012; Wed, 7 Apr 2021 21:42:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 137LgrJC015011; Wed, 7 Apr 2021 21:42:53 GMT (envelope-from git) Date: Wed, 7 Apr 2021 21:42:53 GMT Message-Id: <202104072142.137LgrJC015011@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 15dc713ceb57 - main - netmap: vtnet: add support for netmap offsets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 15dc713ceb57d0d61c1dc54b1d550da42d250730 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 21:42:53 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=15dc713ceb57d0d61c1dc54b1d550da42d250730 commit 15dc713ceb57d0d61c1dc54b1d550da42d250730 Author: Vincenzo Maffione AuthorDate: 2021-04-07 21:32:20 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-07 21:32:20 +0000 netmap: vtnet: add support for netmap offsets Follow-up change to a6d768d845c173823785c71bb18b40074e7a8998. This change adds support for netmap offsets. --- sys/dev/netmap/if_vtnet_netmap.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/dev/netmap/if_vtnet_netmap.h b/sys/dev/netmap/if_vtnet_netmap.h index a05781255218..a423e71331be 100644 --- a/sys/dev/netmap/if_vtnet_netmap.h +++ b/sys/dev/netmap/if_vtnet_netmap.h @@ -84,12 +84,14 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int flags) for (; nm_i != head; nm_i = nm_next(nm_i, lim)) { /* we use an empty header here */ struct netmap_slot *slot = &ring->slot[nm_i]; + uint64_t offset = nm_get_offset(kring, slot); u_int len = slot->len; uint64_t paddr; void *addr = PNMB(na, slot, &paddr); int err; - NM_CHECK_ADDR_LEN(na, addr, len); + (void)addr; + NM_CHECK_ADDR_LEN_OFF(na, len, offset); slot->flags &= ~(NS_REPORT | NS_BUF_CHANGED); /* Initialize the scatterlist, expose it to the hypervisor, @@ -97,7 +99,7 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int flags) */ sglist_reset(sg); // cheap err = sglist_append(sg, &txq->vtntx_shrhdr, sc->vtnet_hdr_size); - err |= sglist_append_phys(sg, paddr, len); + err |= sglist_append_phys(sg, paddr + offset, len); KASSERT(err == 0, ("%s: cannot append to sglist %d", __func__, err)); err = virtqueue_enqueue(vq, /*cookie=*/txq, sg, @@ -171,19 +173,21 @@ vtnet_netmap_kring_refill(struct netmap_kring *kring, u_int num) for (nm_i = rxq->vtnrx_nm_refill; num > 0; nm_i = nm_next(nm_i, lim), num--) { struct netmap_slot *slot = &ring->slot[nm_i]; + uint64_t offset = nm_get_offset(kring, slot); uint64_t paddr; void *addr = PNMB(na, slot, &paddr); int err; if (addr == NETMAP_BUF_BASE(na)) { /* bad buf */ - if (netmap_ring_reinit(kring)) - return EFAULT; + netmap_ring_reinit(kring); + return EFAULT; } slot->flags &= ~NS_BUF_CHANGED; sglist_reset(&sg); err = sglist_append(&sg, &rxq->vtnrx_shrhdr, sc->vtnet_hdr_size); - err |= sglist_append_phys(&sg, paddr, NETMAP_BUF_SIZE(na)); + err |= sglist_append_phys(&sg, paddr + offset, + NETMAP_BUF_SIZE(na) - offset); KASSERT(err == 0, ("%s: cannot append to sglist %d", __func__, err)); /* writable for the host */ @@ -432,7 +436,7 @@ vtnet_netmap_attach(struct vtnet_softc *sc) bzero(&na, sizeof(na)); na.ifp = sc->vtnet_ifp; - na.na_flags = 0; + na.na_flags = NAF_OFFSETS; na.num_tx_desc = vtnet_netmap_tx_slots(sc); na.num_rx_desc = vtnet_netmap_rx_slots(sc); na.num_tx_rings = na.num_rx_rings = sc->vtnet_max_vq_pairs; From owner-dev-commits-src-all@freebsd.org Wed Apr 7 21:46:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB9F05C5D5E for ; Wed, 7 Apr 2021 21:46:25 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) 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 4FFydY490zz4qwD for ; Wed, 7 Apr 2021 21:46:25 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x72e.google.com with SMTP id g20so193675qkk.1 for ; Wed, 07 Apr 2021 14:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=PPukvgcOB36DXlhegJFcqDAW3WFivPt5WEDI1GXUL6o=; b=JC8ICi677Wmh9b3dM7wo+sS+gZf47oeT7EwnMUajNiU35IL7vCUYvgLeeauWBnJk/l tKM+qPjgE4ir0QL6pY/kLxgl1UGsiQBSoslChkNUUWwMrGQxkQJ0AEsC8F0OMmY4mDyt pcUc4pqrFxTdDm/lhx9VsOMl81uBsVpO3jHxgmtXPKpmZ9viHX+gsRyVq6F1in6fdsSL RGmPOdae+Ht+RwMscIabPBLgzsEuNP4F6lygYgL7Czl7qrBx8Shzeiyphm8vwlGCK7J9 boSgiWAQBB0O3DnAIHxW2sfj0SmQYvTqrB1DSoc7RzEqmZJGeeYhnXEDFR/bTAwHPnrO U/8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=PPukvgcOB36DXlhegJFcqDAW3WFivPt5WEDI1GXUL6o=; b=CWXUD7Sxpbuk+l8QYMIFJ+CucKQwnxIGUubIkH7/Gxz1xElelU/61bpIKVwEGZFhAX /gO7i/UdDybTMkzQ/RhUKstgVPBw9E8Bk9AF48j22ljtoju0E/3kQwWDmGg3SY/Mxn4H 3h4ikEJTO+2QZwD+mFzTB3v8b5eUIVD+mGdUoVDuFsAnYQtZ0VLRpCQUEm8XUOvGxnls aqoOrFGNaWdeJLHrk3AS+liL9ppaRbZirEFVqPi9bzOuhdjI4YDeRWwGHuVvpqnTAOBS AFIMzSk2klohp/XXYas+QzzR6KvilCxfArq+/9S97f57YVAaJc0WzV+tmdR0jrzN+I1r hUvw== X-Gm-Message-State: AOAM532LO6zt+pj5QrGtNG33xJLqbKoyzakuSFWBRtcILmRB/m6HFZf5 4BOaNDJCyci9WlQhq4Ai8WUENQ== X-Google-Smtp-Source: ABdhPJx8r5UiZqr1YBjFKPyzSAdD38VNgjFe4SdxdXqxJAlZy6AdqaC01Rw1FtfE1UxSp6WQyzQzbQ== X-Received: by 2002:a05:620a:718:: with SMTP id 24mr5434030qkc.121.1617831984121; Wed, 07 Apr 2021 14:46:24 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-222-53.bltmmd.fios.verizon.net. [100.16.222.53]) by smtp.gmail.com with ESMTPSA id w78sm19395934qkb.11.2021.04.07.14.46.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Apr 2021 14:46:23 -0700 (PDT) Date: Wed, 7 Apr 2021 17:46:22 -0400 From: Shawn Webb To: Vincenzo Maffione Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 15dc713ceb57 - main - netmap: vtnet: add support for netmap offsets Message-ID: <20210407214622.gsedn2cuuj7mblq2@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202104072142.137LgrJC015011@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="c75qflhphftjc4ew" Content-Disposition: inline In-Reply-To: <202104072142.137LgrJC015011@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4FFydY490zz4qwD 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 21:46:25 -0000 --c75qflhphftjc4ew Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hey Vincenzo, On Wed, Apr 07, 2021 at 09:42:53PM +0000, Vincenzo Maffione wrote: > The branch main has been updated by vmaffione: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D15dc713ceb57d0d61c1dc54b1d= 550da42d250730 >=20 > commit 15dc713ceb57d0d61c1dc54b1d550da42d250730 > Author: Vincenzo Maffione > AuthorDate: 2021-04-07 21:32:20 +0000 > Commit: Vincenzo Maffione > CommitDate: 2021-04-07 21:32:20 +0000 >=20 > netmap: vtnet: add support for netmap offsets > =20 > Follow-up change to a6d768d845c173823785c71bb18b40074e7a8998. > This change adds support for netmap offsets. > --- > sys/dev/netmap/if_vtnet_netmap.h | 16 ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) >=20 > diff --git a/sys/dev/netmap/if_vtnet_netmap.h b/sys/dev/netmap/if_vtnet_n= etmap.h > index a05781255218..a423e71331be 100644 > --- a/sys/dev/netmap/if_vtnet_netmap.h > +++ b/sys/dev/netmap/if_vtnet_netmap.h > @@ -84,12 +84,14 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int f= lags) > for (; nm_i !=3D head; nm_i =3D nm_next(nm_i, lim)) { > /* we use an empty header here */ > struct netmap_slot *slot =3D &ring->slot[nm_i]; > + uint64_t offset =3D nm_get_offset(kring, slot); > u_int len =3D slot->len; > uint64_t paddr; > void *addr =3D PNMB(na, slot, &paddr); > int err; > =20 > - NM_CHECK_ADDR_LEN(na, addr, len); > + (void)addr; What is this change for? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --c75qflhphftjc4ew Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmBuKCwACgkQ/y5nonf4 4fqgEg/8CrYlJhESq1xULuYK7ejRkNXLyHJuZA7Urto41g8itB7JDB/wbneI9Prt SUmPDix+mG26MdSHAOF1b3pLRFNqK02fxuToxZAtR3WlyBcEuUDDVFRCF16Ev2u4 FrpJri0YX30r6C/AVIK1qYJnOw/6JQp9ocGkg4g3dYbgPsr6Zr0rbRhSfUoKKG1F bNBg0mPoRsAjFRL+2P39vSaipiH8l7coWmMScdvy3o85YxmcdiguMOC5X41TAUdi 8F73xn4OaNqd/TW6N12dFuUrok17ePwzaNwiqM1BfChkBb9IofKCC3JtgQCOv9I5 xpSY1gkOYDwHzpOYUOSj43JUwdwXTKvLEmhAiY3+Hi+MWO9cBPXSiHZzSZvEDSYn GiEP5oVaI50LtETTcIbQrNzMyF9kz81tTF80Mf57lUAyvfwNgLz9ClB9WB8elBY2 jr+QfTRE4OmLLWszq8meWoPmVOA7Vdn6jeHnsXWtsVkgCPvKNf5Vd5YdlhaxH+MW N+A6axfEmo/xvJJbQX5frYEmPqojuCr2uwX/JOiJQgqpz1hDLqQOP21lGD5CWf8r EaKBAM4UoDoPVTHDHRdweYOPa5L9earuev4/9cRnfodvaEXNhPX/O21MMKFqf1yG Rxf2XAj5kwDf3sehXg/prN8WM/bA4W+SeGI0dK2u2Qo8KXtE8k4= =h+2Y -----END PGP SIGNATURE----- --c75qflhphftjc4ew-- From owner-dev-commits-src-all@freebsd.org Wed Apr 7 21:58:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 978695C6465; Wed, 7 Apr 2021 21:58:59 +0000 (UTC) (envelope-from vmaffione@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 4FFyw33qF5z4rfG; Wed, 7 Apr 2021 21:58:59 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: vmaffione) by smtp.freebsd.org (Postfix) with ESMTPSA id 70E3A2C35D; Wed, 7 Apr 2021 21:58:59 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: by mail-pf1-f181.google.com with SMTP id o123so322892pfb.4; Wed, 07 Apr 2021 14:58:59 -0700 (PDT) X-Gm-Message-State: AOAM531cvsF/A8WBXFKtpNOJQ5QabQAIJVKNqtZePB+rainkhBtRgmCc 89V0RbMiY3jpkA50KTtFzY7aytrlzsXdkutZmGg= X-Google-Smtp-Source: ABdhPJzo3nLcm7Dxg3KdCCwshYW8D+vefPVZAb3yIE1VWExSEKSnPiGv1Jt4KNaUHH+EB3uyjOeqZ2CfAHb0sQcFvCo= X-Received: by 2002:a65:6483:: with SMTP id e3mr5271327pgv.208.1617832738383; Wed, 07 Apr 2021 14:58:58 -0700 (PDT) MIME-Version: 1.0 References: <202104072142.137LgrJC015011@gitrepo.freebsd.org> <20210407214622.gsedn2cuuj7mblq2@mutt-hbsd> In-Reply-To: <20210407214622.gsedn2cuuj7mblq2@mutt-hbsd> From: Vincenzo Maffione Date: Wed, 7 Apr 2021 23:58:45 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 15dc713ceb57 - main - netmap: vtnet: add support for netmap offsets To: Shawn Webb Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 21:58:59 -0000 Hi, Do you mean the whole commit? This adds vtnet support for "offsets" in the netmap buffers. Main use case is that applications can easily zerocopy push and pop protocol headers from packets. Cheers, Vincenzo On Wed, Apr 7, 2021, 11:46 PM Shawn Webb wrote: > Hey Vincenzo, > > On Wed, Apr 07, 2021 at 09:42:53PM +0000, Vincenzo Maffione wrote: > > The branch main has been updated by vmaffione: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=15dc713ceb57d0d61c1dc54b1d550da42d250730 > > > > commit 15dc713ceb57d0d61c1dc54b1d550da42d250730 > > Author: Vincenzo Maffione > > AuthorDate: 2021-04-07 21:32:20 +0000 > > Commit: Vincenzo Maffione > > CommitDate: 2021-04-07 21:32:20 +0000 > > > > netmap: vtnet: add support for netmap offsets > > > > Follow-up change to a6d768d845c173823785c71bb18b40074e7a8998. > > This change adds support for netmap offsets. > > --- > > sys/dev/netmap/if_vtnet_netmap.h | 16 ++++++++++------ > > 1 file changed, 10 insertions(+), 6 deletions(-) > > > > diff --git a/sys/dev/netmap/if_vtnet_netmap.h > b/sys/dev/netmap/if_vtnet_netmap.h > > index a05781255218..a423e71331be 100644 > > --- a/sys/dev/netmap/if_vtnet_netmap.h > > +++ b/sys/dev/netmap/if_vtnet_netmap.h > > @@ -84,12 +84,14 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int > flags) > > for (; nm_i != head; nm_i = nm_next(nm_i, lim)) { > > /* we use an empty header here */ > > struct netmap_slot *slot = &ring->slot[nm_i]; > > + uint64_t offset = nm_get_offset(kring, slot); > > u_int len = slot->len; > > uint64_t paddr; > > void *addr = PNMB(na, slot, &paddr); > > int err; > > > > - NM_CHECK_ADDR_LEN(na, addr, len); > > + (void)addr; > > What is this change for? > > Thanks, > > -- > Shawn Webb > Cofounder / Security Engineer > HardenedBSD > > > https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc > From owner-dev-commits-src-all@freebsd.org Wed Apr 7 22:07:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E59475C698F for ; Wed, 7 Apr 2021 22:07:33 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) (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 4FFz5x5v34z4s9Y for ; Wed, 7 Apr 2021 22:07:32 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qv1-xf2a.google.com with SMTP id o11so5643449qvh.11 for ; Wed, 07 Apr 2021 15:07:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=AcxALaPkBV283ibBsoWpKilY3QZX81ihDp3ac51ByRU=; b=CoFce29xRMiCAtcfv5vBGxTqu5plYMrPAF0yaybYlF1vxwbFToCQR21xhsevfAnYHw DDFac79ovsjyxBL8LDLcR5/7n4mm4p3GjMw5eFwV6kmi49gmOv2GwYHH1sG0Pgy9e9d6 gEnFGR8PYLbIMIhm7D+QJJoCcuWPK0sfY8i1PS+KsvY1AzmI9ObQisLMEGN15KEmJwaD vLpwSTs+QjXo7vQ5jZ2wFY/vH7PX2SrhcDZA7lHaz5R8JwtrhsZM6x2UMKmFmbZ5y4yy l8E6eO7CwWe9sHuLEGtlwSZVaGVf1KtSg+bPb/zEfjnhgDGUrrwyRNh2f0YKJ+ckKVGV nvKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AcxALaPkBV283ibBsoWpKilY3QZX81ihDp3ac51ByRU=; b=BmfMppbLbABJMkYbLqmBUR+T2AhOAgmqbCvvV5/szqe6wYPiL+pTI5cn9fqzhlADNW GUofOY7fN9NrCUnb/4A17b2fEd/NBjX725GjeyD0JXPItJzSBd4yRAKCKBgnlbHHE8UW JyImlGSyQwme5eCtM/f+ElDTTIhvWmkSt8JpK8LSa6lwEGwlJ9U3ExCUA2HxWGWYTD9M iT+XN4GgkAyljycPRoZ8NSGXV4W1IUJK0kjGvr3lo7At2AHxz/Y4pYbeHcYp0Td8h7jV Cbpg6MnpsxH1aB4iXVphMMr21Y8TM5HtNJ72hti8kSMFOD/SxYUGx8fNEXSjzEmOD5nx 683g== X-Gm-Message-State: AOAM533XS2a+gPjAB3rvHfmO8yg8eJIO1tGa0RycG4b+es13k9S74MWT UzKlkeNgdr4yPtR96rVXMfFlfA== X-Google-Smtp-Source: ABdhPJy2IF0UuzS+BI8UP/UKUoK0qbnyUAw4deq3M+i/mZU7PemZ6IgrzBWnKAYGLOQ+NvSbsDvpOQ== X-Received: by 2002:a0c:eb05:: with SMTP id j5mr5352590qvp.32.1617833251918; Wed, 07 Apr 2021 15:07:31 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-222-53.bltmmd.fios.verizon.net. [100.16.222.53]) by smtp.gmail.com with ESMTPSA id e7sm17557334qth.27.2021.04.07.15.07.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Apr 2021 15:07:31 -0700 (PDT) Date: Wed, 7 Apr 2021 18:07:30 -0400 From: Shawn Webb To: Vincenzo Maffione Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 15dc713ceb57 - main - netmap: vtnet: add support for netmap offsets Message-ID: <20210407220730.6z6j2ejytu3j67ik@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202104072142.137LgrJC015011@gitrepo.freebsd.org> <20210407214622.gsedn2cuuj7mblq2@mutt-hbsd> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="esmlgnma4wdtnhxg" Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4FFz5x5v34z4s9Y 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 22:07:34 -0000 --esmlgnma4wdtnhxg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable No, just the one line: (void)addr; On Wed, Apr 07, 2021 at 11:58:45PM +0200, Vincenzo Maffione wrote: > Hi, > Do you mean the whole commit? This adds vtnet support for "offsets" in > the netmap buffers. Main use case is that applications can easily zerocopy > push and pop protocol headers from packets. >=20 > Cheers, > Vincenzo >=20 > On Wed, Apr 7, 2021, 11:46 PM Shawn Webb wro= te: >=20 > > Hey Vincenzo, > > > > On Wed, Apr 07, 2021 at 09:42:53PM +0000, Vincenzo Maffione wrote: > > > The branch main has been updated by vmaffione: > > > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=3D15dc713ceb57d0d61c1dc54b1d550= da42d250730 > > > > > > commit 15dc713ceb57d0d61c1dc54b1d550da42d250730 > > > Author: Vincenzo Maffione > > > AuthorDate: 2021-04-07 21:32:20 +0000 > > > Commit: Vincenzo Maffione > > > CommitDate: 2021-04-07 21:32:20 +0000 > > > > > > netmap: vtnet: add support for netmap offsets > > > > > > Follow-up change to a6d768d845c173823785c71bb18b40074e7a8998. > > > This change adds support for netmap offsets. > > > --- > > > sys/dev/netmap/if_vtnet_netmap.h | 16 ++++++++++------ > > > 1 file changed, 10 insertions(+), 6 deletions(-) > > > > > > diff --git a/sys/dev/netmap/if_vtnet_netmap.h > > b/sys/dev/netmap/if_vtnet_netmap.h > > > index a05781255218..a423e71331be 100644 > > > --- a/sys/dev/netmap/if_vtnet_netmap.h > > > +++ b/sys/dev/netmap/if_vtnet_netmap.h > > > @@ -84,12 +84,14 @@ vtnet_netmap_txsync(struct netmap_kring *kring, i= nt > > flags) > > > for (; nm_i !=3D head; nm_i =3D nm_next(nm_i, lim)) { > > > /* we use an empty header here */ > > > struct netmap_slot *slot =3D &ring->slot[nm_i]; > > > + uint64_t offset =3D nm_get_offset(kring, slot); > > > u_int len =3D slot->len; > > > uint64_t paddr; > > > void *addr =3D PNMB(na, slot, &paddr); > > > int err; > > > > > > - NM_CHECK_ADDR_LEN(na, addr, len); > > > + (void)addr; > > > > What is this change for? > > > > Thanks, > > > > -- > > Shawn Webb > > Cofounder / Security Engineer > > HardenedBSD > > > > > > https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb= /03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc > > --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --esmlgnma4wdtnhxg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmBuLSIACgkQ/y5nonf4 4fo3Mg//bSObVg3MZ1sG6AziQOMrCrexwj0wLgni1DTsrlhJ5ZUNi72Kd8cnptaF h78O0Qi6ryDyV2rDWneFDBvdQrmkZlV3BfDCIeKFaRj1PqQkezYfAZgcaXOdZQuH 0r+wtiHQEf3mCqENfzcp8B4aKgb95JH1xBMZ23irpz1hFF8DpqvmOeqoXPfbU+ca ME/e9uHNwhO7q8+Px36/N3Dc4g3SEimSIwkDRLuNlw+T9sTcJ71l4OtgJz9PfNsm j99gnCi35R/hodDrFkWKN1h/biTzM6lahuVPK5cltFkUoyVGPWlOEAIncptrwLJ0 nPlWN3dZmDqQqnde15YWxYDO1tqT81x8GMAGHFebiAOx1VtYCCYzQ5vEZblaQ0vj Im+ObsuyGM7XwRuUjJtcLhzTCwlbwqPgZWQ766jlOv+2h7dv52sxqB60gmku6YwX vzhXdtytx+pweLg7SfbeRyYMCkYNNdnnXV/JBV6l3nSF8cZW9mb9+BeECoa/V4mA NOdszRTbiQgs2sfmI62gXc461Q0e0lU5nVYtufMNoHVbPOgzTo4XBnlsek8pxyaA 8V0ZE44wO8rGLgZh5QhkZg42RscpacAWRlpnUP9hjyjBq8a32zEYRJddFuMOi6DF lBg/JeDPB+xXZxUHINEO+mjTc0Sa3alpMjGhFuGlhTYBXHOgNpI= =YhmQ -----END PGP SIGNATURE----- --esmlgnma4wdtnhxg-- From owner-dev-commits-src-all@freebsd.org Wed Apr 7 22:14:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E33435C6B8E; Wed, 7 Apr 2021 22:14:10 +0000 (UTC) (envelope-from vmaffione@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 4FFzFZ6305z4sWK; Wed, 7 Apr 2021 22:14:10 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: vmaffione) by smtp.freebsd.org (Postfix) with ESMTPSA id BA0662B9E7; Wed, 7 Apr 2021 22:14:10 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: by mail-pj1-f53.google.com with SMTP id o18so49239pjs.4; Wed, 07 Apr 2021 15:14:10 -0700 (PDT) X-Gm-Message-State: AOAM531gBdNqCwXky0xcgqRGArIT0S3I0lBcqctCDta9XO/Cr3JM11oh 4PzgQyiz+8KzeJA9tMe12cevJSWdcsE6wSBpf+o= X-Google-Smtp-Source: ABdhPJxozCRO4X33h+MNYGZGvjyUMOoXBTObHMDNmf3unY8u+fTjqAARriNAIseZEPGP6fhmXOJN+XJCIsqhKXHCLOY= X-Received: by 2002:a17:90a:5a41:: with SMTP id m1mr5333964pji.186.1617833649794; Wed, 07 Apr 2021 15:14:09 -0700 (PDT) MIME-Version: 1.0 References: <202104072142.137LgrJC015011@gitrepo.freebsd.org> <20210407214622.gsedn2cuuj7mblq2@mutt-hbsd> <20210407220730.6z6j2ejytu3j67ik@mutt-hbsd> In-Reply-To: <20210407220730.6z6j2ejytu3j67ik@mutt-hbsd> From: Vincenzo Maffione Date: Thu, 8 Apr 2021 00:13:57 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 15dc713ceb57 - main - netmap: vtnet: add support for netmap offsets To: Shawn Webb Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 22:14:10 -0000 Oh, I'm sorry. That's just to silence the compiler because of the unused variable addr. We only need the paddr output value in that context. On Thu, Apr 8, 2021, 12:07 AM Shawn Webb wrote: > No, just the one line: (void)addr; > > On Wed, Apr 07, 2021 at 11:58:45PM +0200, Vincenzo Maffione wrote: > > Hi, > > Do you mean the whole commit? This adds vtnet support for "offsets" in > > the netmap buffers. Main use case is that applications can easily > zerocopy > > push and pop protocol headers from packets. > > > > Cheers, > > Vincenzo > > > > On Wed, Apr 7, 2021, 11:46 PM Shawn Webb > wrote: > > > > > Hey Vincenzo, > > > > > > On Wed, Apr 07, 2021 at 09:42:53PM +0000, Vincenzo Maffione wrote: > > > > The branch main has been updated by vmaffione: > > > > > > > > URL: > > > > https://cgit.FreeBSD.org/src/commit/?id=15dc713ceb57d0d61c1dc54b1d550da42d250730 > > > > > > > > commit 15dc713ceb57d0d61c1dc54b1d550da42d250730 > > > > Author: Vincenzo Maffione > > > > AuthorDate: 2021-04-07 21:32:20 +0000 > > > > Commit: Vincenzo Maffione > > > > CommitDate: 2021-04-07 21:32:20 +0000 > > > > > > > > netmap: vtnet: add support for netmap offsets > > > > > > > > Follow-up change to a6d768d845c173823785c71bb18b40074e7a8998. > > > > This change adds support for netmap offsets. > > > > --- > > > > sys/dev/netmap/if_vtnet_netmap.h | 16 ++++++++++------ > > > > 1 file changed, 10 insertions(+), 6 deletions(-) > > > > > > > > diff --git a/sys/dev/netmap/if_vtnet_netmap.h > > > b/sys/dev/netmap/if_vtnet_netmap.h > > > > index a05781255218..a423e71331be 100644 > > > > --- a/sys/dev/netmap/if_vtnet_netmap.h > > > > +++ b/sys/dev/netmap/if_vtnet_netmap.h > > > > @@ -84,12 +84,14 @@ vtnet_netmap_txsync(struct netmap_kring *kring, > int > > > flags) > > > > for (; nm_i != head; nm_i = nm_next(nm_i, lim)) { > > > > /* we use an empty header here */ > > > > struct netmap_slot *slot = &ring->slot[nm_i]; > > > > + uint64_t offset = nm_get_offset(kring, slot); > > > > u_int len = slot->len; > > > > uint64_t paddr; > > > > void *addr = PNMB(na, slot, &paddr); > > > > int err; > > > > > > > > - NM_CHECK_ADDR_LEN(na, addr, len); > > > > + (void)addr; > > > > > > What is this change for? > > > > > > Thanks, > > > > > > -- > > > Shawn Webb > > > Cofounder / Security Engineer > > > HardenedBSD > > > > > > > > > > https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc > > > > > -- > Shawn Webb > Cofounder / Security Engineer > HardenedBSD > > > https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc > From owner-dev-commits-src-all@freebsd.org Thu Apr 8 02:17:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDD135CA9A4; Thu, 8 Apr 2021 02:17: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 4FG4f85Rd6z3Nq6; Thu, 8 Apr 2021 02:17: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 A974F2A0AE; Thu, 8 Apr 2021 02:17: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 1382HKvm075880; Thu, 8 Apr 2021 02:17:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1382HKCa075879; Thu, 8 Apr 2021 02:17:20 GMT (envelope-from git) Date: Thu, 8 Apr 2021 02:17:20 GMT Message-Id: <202104080217.1382HKCa075879@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 94db41ccdb93 - stable/13 - mount_nullfs: rename a local variable 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 94db41ccdb931f75e597d3b159ea1fa14722174f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 02:17:20 -0000 The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=94db41ccdb931f75e597d3b159ea1fa14722174f commit 94db41ccdb931f75e597d3b159ea1fa14722174f Author: Alan Somers AuthorDate: 2021-02-12 18:30:52 +0000 Commit: Alan Somers CommitDate: 2021-04-08 02:15:00 +0000 mount_nullfs: rename a local variable The "source" variable was introduced in r26072, probably as the traditional counterpart to "target". But the "source"/"target" names suggest the opposite of their actual meaning. With ln, for example, the source is the real file and the target is the newly created link. In mount_nullfs the meaning is the opposite: the target is the existing file system and the source is the newly created mountpoint. Better to use "target"/"mountpoint" terminology, which matches the man page. Sponsored by: Axcient (cherry picked from commit f540cb27a23719d88b7e5143be6e62f75dd25f08) --- sbin/mount_nullfs/mount_nullfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sbin/mount_nullfs/mount_nullfs.c b/sbin/mount_nullfs/mount_nullfs.c index 1fb44eb864af..77ec0991ea9b 100644 --- a/sbin/mount_nullfs/mount_nullfs.c +++ b/sbin/mount_nullfs/mount_nullfs.c @@ -66,7 +66,7 @@ main(int argc, char *argv[]) { struct iovec *iov; char *p, *val; - char source[MAXPATHLEN]; + char mountpoint[MAXPATHLEN]; char target[MAXPATHLEN]; char errmsg[255]; int ch, iovlen; @@ -97,21 +97,21 @@ main(int argc, char *argv[]) if (argc != 2) usage(); - /* resolve target and source with realpath(3) */ + /* resolve target and mountpoint with realpath(3) */ if (checkpath(argv[0], target) != 0) err(EX_USAGE, "%s", target); - if (checkpath(argv[1], source) != 0) - err(EX_USAGE, "%s", source); + if (checkpath(argv[1], mountpoint) != 0) + err(EX_USAGE, "%s", mountpoint); build_iovec(&iov, &iovlen, "fstype", nullfs, (size_t)-1); - build_iovec(&iov, &iovlen, "fspath", source, (size_t)-1); + build_iovec(&iov, &iovlen, "fspath", mountpoint, (size_t)-1); build_iovec(&iov, &iovlen, "target", target, (size_t)-1); build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); if (nmount(iov, iovlen, 0) < 0) { if (errmsg[0] != 0) - err(1, "%s: %s", source, errmsg); + err(1, "%s: %s", mountpoint, errmsg); else - err(1, "%s", source); + err(1, "%s", mountpoint); } exit(0); } From owner-dev-commits-src-all@freebsd.org Thu Apr 8 02:17:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E93935CAB96; Thu, 8 Apr 2021 02:17: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 4FG4f96LY9z3Nst; Thu, 8 Apr 2021 02:17: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 CCEC02A0AF; Thu, 8 Apr 2021 02:17: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 1382HLPR075907; Thu, 8 Apr 2021 02:17:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1382HLd9075906; Thu, 8 Apr 2021 02:17:21 GMT (envelope-from git) Date: Thu, 8 Apr 2021 02:17:21 GMT Message-Id: <202104080217.1382HLd9075906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 438e52f814f6 - stable/13 - [skip ci] fix a typo in a comment in mdconfig.c 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 438e52f814f68f4f8dc00b973539905a8ac6fcd8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 02:17:22 -0000 The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=438e52f814f68f4f8dc00b973539905a8ac6fcd8 commit 438e52f814f68f4f8dc00b973539905a8ac6fcd8 Author: Alan Somers AuthorDate: 2021-02-27 16:04:10 +0000 Commit: Alan Somers CommitDate: 2021-04-08 02:15:35 +0000 [skip ci] fix a typo in a comment in mdconfig.c Sponsored by: Axcient Reviewed by: mav, imp Differential Revision: https://reviews.freebsd.org/D28968 (cherry picked from commit d977417d74a704930b5952cbd653638ccd25eaa7) --- sbin/mdconfig/mdconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c index 852909aa9032..0f76ca6149f1 100644 --- a/sbin/mdconfig/mdconfig.c +++ b/sbin/mdconfig/mdconfig.c @@ -423,7 +423,7 @@ md_set_file(const char *fn) /* * Lists md(4) disks. Is used also as a query routine, since it handles XML * interface. 'units' can be NULL for listing memory disks. It might be - * coma-separated string containing md(4) disk names. 'opt' distinguished + * comma-separated string containing md(4) disk names. 'opt' distinguished * between list and query mode. */ static int From owner-dev-commits-src-all@freebsd.org Thu Apr 8 02:17:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F7445CA948; Thu, 8 Apr 2021 02:17: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 4FG4fC1Lldz3Nh6; Thu, 8 Apr 2021 02:17: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 0000B2A20A; Thu, 8 Apr 2021 02:17: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 1382HMbw075928; Thu, 8 Apr 2021 02:17:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1382HMbW075927; Thu, 8 Apr 2021 02:17:22 GMT (envelope-from git) Date: Thu, 8 Apr 2021 02:17:22 GMT Message-Id: <202104080217.1382HMbW075927@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 774abe650b84 - stable/13 - Modernize geom_stats_snapshot_get 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 774abe650b840a753bdddbd8cf0bee0a72132009 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 02:17:23 -0000 The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=774abe650b840a753bdddbd8cf0bee0a72132009 commit 774abe650b840a753bdddbd8cf0bee0a72132009 Author: Alan Somers AuthorDate: 2021-03-03 20:06:38 +0000 Commit: Alan Somers CommitDate: 2021-04-08 02:15:39 +0000 Modernize geom_stats_snapshot_get * A logically useless memset() is used to fault in some memory pages. Change it to explicit_bzero so the compiler won't eliminate it. * Eliminate the second memset. It made sense in the days of the Big Kernel Lock, but not in the days of fine-grained SMP and especially not in the days of VDSO. Sponsored by: Axcient Reviewed by: phk Differential Revision: https://reviews.freebsd.org/D29047 (cherry picked from commit f05b724ecb310fb91da1947ae6c68647f58f5f12) --- lib/libgeom/geom_stats.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libgeom/geom_stats.c b/lib/libgeom/geom_stats.c index 450ee491ea1c..7c9191e29686 100644 --- a/lib/libgeom/geom_stats.c +++ b/lib/libgeom/geom_stats.c @@ -136,9 +136,8 @@ geom_stats_snapshot_get(void) free(sp); return (NULL); } - memset(sp->ptr, 0, pagesize * npages); /* page in, cache */ + explicit_bzero(sp->ptr, pagesize * npages); /* page in, cache */ clock_gettime(CLOCK_REALTIME, &sp->time); - memset(sp->ptr, 0, pagesize * npages); /* page in, cache */ memcpy(sp->ptr, statp, pagesize * npages); sp->pages = npages; sp->perpage = spp; From owner-dev-commits-src-all@freebsd.org Thu Apr 8 02:17:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0B2F5CA9B1; Thu, 8 Apr 2021 02:17: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 4FG4fG05p3z3P5D; Thu, 8 Apr 2021 02:17:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C22029EF7; Thu, 8 Apr 2021 02:17:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1382HNmo075950; Thu, 8 Apr 2021 02:17:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1382HNig075949; Thu, 8 Apr 2021 02:17:23 GMT (envelope-from git) Date: Thu, 8 Apr 2021 02:17:23 GMT Message-Id: <202104080217.1382HNig075949@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 32be2332d10f - stable/13 - fusefs: fix two bugs regarding fcntl file locks 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 32be2332d10f6423def9d4c41d7e7707a97abae6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 02:17:27 -0000 The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=32be2332d10f6423def9d4c41d7e7707a97abae6 commit 32be2332d10f6423def9d4c41d7e7707a97abae6 Author: Alan Somers AuthorDate: 2021-03-18 20:27:27 +0000 Commit: Alan Somers CommitDate: 2021-04-08 02:15:42 +0000 fusefs: fix two bugs regarding fcntl file locks 1) F_SETLKW (blocking) operations would be sent to the FUSE server as F_SETLK (non-blocking). 2) Release operations, F_SETLK with lk_type = F_UNLCK, would simply return EINVAL. PR: 253500 Reported by: John Millikin (cherry picked from commit 929acdb19acb67cc0e6ee5439df98e28a84d4772) --- sys/fs/fuse/fuse_vnops.c | 10 +++++++--- tests/sys/fs/fusefs/flush.cc | 12 ++++++++++- tests/sys/fs/fusefs/locks.cc | 45 +++++++++++++++++++++++++++++++++++++++++- tests/sys/fs/fusefs/release.cc | 12 ++++++++++- 4 files changed, 73 insertions(+), 6 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index 5bbde1e278c9..cdbc42f5adf4 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -437,10 +437,14 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) op = FUSE_GETLK; break; case F_SETLK: - op = FUSE_SETLK; + if (flags & F_WAIT) + op = FUSE_SETLKW; + else + op = FUSE_SETLK; break; - case F_SETLKW: - op = FUSE_SETLKW; + case F_UNLCK: + op = FUSE_SETLK; + flags |= F_UNLCK; break; default: return EINVAL; diff --git a/tests/sys/fs/fusefs/flush.cc b/tests/sys/fs/fusefs/flush.cc index 4d5a87bd66d5..d31a9fdaa386 100644 --- a/tests/sys/fs/fusefs/flush.cc +++ b/tests/sys/fs/fusefs/flush.cc @@ -210,6 +210,16 @@ TEST_F(FlushWithLocks, unlock_on_close) ResultOf([=](auto in) { return (in.header.opcode == FUSE_SETLK && in.header.nodeid == ino && + in.body.setlk.lk.type == F_RDLCK && + in.body.setlk.fh == FH); + }, Eq(true)), + _) + ).WillOnce(Invoke(ReturnErrno(0))); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_SETLK && + in.header.nodeid == ino && + in.body.setlk.lk.type == F_UNLCK && in.body.setlk.fh == FH); }, Eq(true)), _) @@ -224,7 +234,7 @@ TEST_F(FlushWithLocks, unlock_on_close) fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; - ASSERT_NE(-1, fcntl(fd, F_SETLKW, &fl)) << strerror(errno); + ASSERT_NE(-1, fcntl(fd, F_SETLK, &fl)) << strerror(errno); fd2 = open(FULLPATH, O_WRONLY); ASSERT_LE(0, fd2) << strerror(errno); diff --git a/tests/sys/fs/fusefs/locks.cc b/tests/sys/fs/fusefs/locks.cc index f3f1d42637d9..49f495412259 100644 --- a/tests/sys/fs/fusefs/locks.cc +++ b/tests/sys/fs/fusefs/locks.cc @@ -72,6 +72,23 @@ void expect_setlk(uint64_t ino, pid_t pid, uint64_t start, uint64_t end, return (in.header.opcode == FUSE_SETLK && in.header.nodeid == ino && in.body.setlk.fh == FH && + in.body.setlk.owner == (uint32_t)pid && + in.body.setlk.lk.start == start && + in.body.setlk.lk.end == end && + in.body.setlk.lk.type == type && + in.body.setlk.lk.pid == (uint64_t)pid); + }, Eq(true)), + _) + ).WillOnce(Invoke(ReturnErrno(err))); +} +void expect_setlkw(uint64_t ino, pid_t pid, uint64_t start, uint64_t end, + uint32_t type, int err) +{ + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_SETLKW && + in.header.nodeid == ino && + in.body.setlkw.fh == FH && in.body.setlkw.owner == (uint32_t)pid && in.body.setlkw.lk.start == start && in.body.setlkw.lk.end == end && @@ -343,6 +360,32 @@ TEST_F(SetlkFallback, local) leak(fd); } +/* Clear a lock with FUSE_SETLK */ +TEST_F(Setlk, clear) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + uint64_t ino = 42; + struct flock fl; + int fd; + pid_t pid = 1234; + + expect_lookup(RELPATH, ino); + expect_open(ino, 0, 1); + expect_setlk(ino, pid, 10, 1009, F_UNLCK, 0); + + fd = open(FULLPATH, O_RDWR); + ASSERT_LE(0, fd) << strerror(errno); + fl.l_start = 10; + fl.l_len = 1000; + fl.l_pid = pid; + fl.l_type = F_UNLCK; + fl.l_whence = SEEK_SET; + fl.l_sysid = 0; + ASSERT_NE(-1, fcntl(fd, F_SETLK, &fl)) << strerror(errno); + leak(fd); +} + /* Set a new lock with FUSE_SETLK */ TEST_F(Setlk, set) { @@ -465,7 +508,7 @@ TEST_F(Setlkw, set) expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); - expect_setlk(ino, pid, 10, 1009, F_RDLCK, 0); + expect_setlkw(ino, pid, 10, 1009, F_RDLCK, 0); fd = open(FULLPATH, O_RDWR); ASSERT_LE(0, fd) << strerror(errno); diff --git a/tests/sys/fs/fusefs/release.cc b/tests/sys/fs/fusefs/release.cc index 3caf8589352d..daa3ce39f573 100644 --- a/tests/sys/fs/fusefs/release.cc +++ b/tests/sys/fs/fusefs/release.cc @@ -206,6 +206,16 @@ TEST_F(ReleaseWithLocks, unlock_on_close) ResultOf([=](auto in) { return (in.header.opcode == FUSE_SETLK && in.header.nodeid == ino && + in.body.setlk.lk.type == F_RDLCK && + in.body.setlk.fh == FH); + }, Eq(true)), + _) + ).WillOnce(Invoke(ReturnErrno(0))); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_SETLK && + in.header.nodeid == ino && + in.body.setlk.lk.type == F_UNLCK && in.body.setlk.fh == FH); }, Eq(true)), _) @@ -221,7 +231,7 @@ TEST_F(ReleaseWithLocks, unlock_on_close) fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; - ASSERT_NE(-1, fcntl(fd, F_SETLKW, &fl)) << strerror(errno); + ASSERT_NE(-1, fcntl(fd, F_SETLK, &fl)) << strerror(errno); ASSERT_EQ(0, close(fd)) << strerror(errno); } From owner-dev-commits-src-all@freebsd.org Thu Apr 8 02:17:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B24145CA9B6; Thu, 8 Apr 2021 02:17: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 4FG4fJ26w1z3NhN; Thu, 8 Apr 2021 02:17: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 4C4852A0B0; Thu, 8 Apr 2021 02:17: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 1382HP9U075971; Thu, 8 Apr 2021 02:17:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1382HPfj075970; Thu, 8 Apr 2021 02:17:25 GMT (envelope-from git) Date: Thu, 8 Apr 2021 02:17:25 GMT Message-Id: <202104080217.1382HPfj075970@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 802271fddbf4 - stable/13 - fusefs: fix a dead store in fuse_vnop_advlock 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 802271fddbf4f1cc99aa880e11a4b651b440d1bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 02:17:30 -0000 The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=802271fddbf4f1cc99aa880e11a4b651b440d1bb commit 802271fddbf4f1cc99aa880e11a4b651b440d1bb Author: Alan Somers AuthorDate: 2021-03-20 01:38:57 +0000 Commit: Alan Somers CommitDate: 2021-04-08 02:15:46 +0000 fusefs: fix a dead store in fuse_vnop_advlock kevans actually caught this in the original review and I fixed it, but then I committed an older copy of the branch. Whoops. Reported by: kevans Differential Revision: https://reviews.freebsd.org/D29031 (cherry picked from commit 9c5aac8f2e84ca4bbdf82514302c08c0453ec59b) --- sys/fs/fuse/fuse_vnops.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index cdbc42f5adf4..a51c1b15e7f0 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -444,7 +444,6 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) break; case F_UNLCK: op = FUSE_SETLK; - flags |= F_UNLCK; break; default: return EINVAL; From owner-dev-commits-src-all@freebsd.org Thu Apr 8 02:17:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 881355CABA8; Thu, 8 Apr 2021 02:17:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FG4fK1ZKlz3P5b; Thu, 8 Apr 2021 02:17: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 5E8DA2A0B1; Thu, 8 Apr 2021 02:17: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 1382HQ2i075992; Thu, 8 Apr 2021 02:17:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1382HQR7075991; Thu, 8 Apr 2021 02:17:26 GMT (envelope-from git) Date: Thu, 8 Apr 2021 02:17:26 GMT Message-Id: <202104080217.1382HQR7075991@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: c835e54fdcb8 - stable/13 - mpsutil.8: fix typos in the man page 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c835e54fdcb825172d0bfea33b2d713eab3c8870 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 02:17:31 -0000 The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=c835e54fdcb825172d0bfea33b2d713eab3c8870 commit c835e54fdcb825172d0bfea33b2d713eab3c8870 Author: Alan Somers AuthorDate: 2021-03-25 14:43:40 +0000 Commit: Alan Somers CommitDate: 2021-04-08 02:15:50 +0000 mpsutil.8: fix typos in the man page Sponsored by: Axcient (cherry picked from commit f073ab8712a032faecf1fb94c4491fd555461ad8) --- usr.sbin/mpsutil/mpsutil.8 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/mpsutil/mpsutil.8 b/usr.sbin/mpsutil/mpsutil.8 index e4f966355fdd..1dd4f0509174 100644 --- a/usr.sbin/mpsutil/mpsutil.8 +++ b/usr.sbin/mpsutil/mpsutil.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 17, 2015 +.Dd March 25, 2021 .Dt MPSUTIL 8 .Os .Sh NAME @@ -45,7 +45,7 @@ .Cm show all .Nm .Op Fl u Ar unit -.Cm show cfgpages page +.Cm show cfgpage page .Op Ar num .Op Ar addr .Nm @@ -129,7 +129,7 @@ Displays all enclosures. .It Cm show iocfacts Displays IOC Facts messages. .It Cm show cfgpage page Oo Ar num Oc Op Ar addr -Show IOC Facts Message +Dump raw config page in hex. .El .Pp Controller management commands include: From owner-dev-commits-src-all@freebsd.org Thu Apr 8 03:23:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 675F35CC6BA; Thu, 8 Apr 2021 03:23:52 +0000 (UTC) (envelope-from bdragon@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 4FG66w2Gnbz3ks2; Thu, 8 Apr 2021 03:23:52 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com [66.111.4.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: bdragon/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 40D412DED1; Thu, 8 Apr 2021 03:23:52 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailauth.nyi.internal (Postfix) with ESMTP id 1CE1427C0054; Wed, 7 Apr 2021 23:23:52 -0400 (EDT) Received: from imap38 ([10.202.2.88]) by compute3.internal (MEProxy); Wed, 07 Apr 2021 23:23:52 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrudejkedgjeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdluddtmdenucfjughrpefofgggkfgjfhffhffvufgtsehttdertder reejnecuhfhrohhmpedfuehrrghnughonhcuuegvrhhgrhgvnhdfuceosggurhgrghhonh eshfhrvggvuefuffdrohhrgheqnecuggftrfgrthhtvghrnhepjefhfedtuddtleegkeeg tdegjeekffdvjedttdehgffgveeugffgfeelvdeghffgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepsggurhgrghhonhdomhgvshhmthhprghu thhhphgvrhhsohhnrghlihhthidquddtgedvfeehkeeigedqudekuddtkeehuddqsggurh grghhonheppefhrhgvvgeuufffrdhorhhgsehimhgrphdrtggt X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id B14DECA005E; Wed, 7 Apr 2021 23:23:51 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-273-g8500d2492d-fm-20210323.002-g8500d249 Mime-Version: 1.0 Message-Id: <975e9c9c-4236-4ab8-9862-cef39d862838@www.fastmail.com> In-Reply-To: References: <202104072142.137LgrJC015011@gitrepo.freebsd.org> <20210407214622.gsedn2cuuj7mblq2@mutt-hbsd> <20210407220730.6z6j2ejytu3j67ik@mutt-hbsd> Date: Wed, 07 Apr 2021 22:23:23 -0500 From: "Brandon Bergren" To: "Vincenzo Maffione" , "Shawn Webb" Cc: src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: =?UTF-8?Q?Re:_git:_15dc713ceb57_-_main_-_netmap:_vtnet:_add_support_for_?= =?UTF-8?Q?netmap_offsets?= Content-Type: text/plain X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 03:23:52 -0000 On Wed, Apr 7, 2021, at 5:13 PM, Vincenzo Maffione wrote: > Oh, I'm sorry. That's just to silence the compiler because of the > unused variable addr. We only need the paddr output value in that > context. How about casting away the return value from the call directly then, instead of having addr in the first place? -- Brandon Bergren bdragon@FreeBSD.org From owner-dev-commits-src-all@freebsd.org Thu Apr 8 07:40:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9E3885D2BD1; Thu, 8 Apr 2021 07:40:18 +0000 (UTC) (envelope-from khng@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 4FGCpp4Cr2z4WhZ; Thu, 8 Apr 2021 07:40:18 +0000 (UTC) (envelope-from khng@FreeBSD.org) Received: from Kas-MacBook-Pro.lan (n219076164134.netvigator.com [219.76.164.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: khng/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 390CCB31; Thu, 8 Apr 2021 07:40:16 +0000 (UTC) (envelope-from khng@FreeBSD.org) Subject: Re: git: 86a52e262a6f - main - Document vnode_pager_setsize(9) To: Konstantin Belousov Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org References: <202104071113.137BD2Pj074018@gitrepo.freebsd.org> From: Ka Ho Ng Message-ID: <60a81778-d17a-2151-115a-ff7dad489771@FreeBSD.org> Date: Thu, 8 Apr 2021 15:40:12 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 07:40:18 -0000 On 4/8/21 2:59 am, Konstantin Belousov wrote: > On Wed, Apr 07, 2021 at 11:13:02AM +0000, Ka Ho Ng wrote: >> The branch main has been updated by khng: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=86a52e262a6faf75ee34eaa801f6d8ddaad20733 >> >> commit 86a52e262a6faf75ee34eaa801f6d8ddaad20733 >> Author: Ka Ho Ng >> AuthorDate: 2021-04-07 11:00:31 +0000 >> Commit: Ka Ho Ng >> CommitDate: 2021-04-07 11:11:26 +0000 >> >> Document vnode_pager_setsize(9) > I am sorry to say this, but the documentation is rather content-free. > > Main outcome of vnode_pager_setsize() is that it defines which offsets > from mapping of the file are handled by the fault handler, and which > results in SIGBUS. > > Clearing of the page cache is a secondary-level functionality, and more, > we allow to keep pages with indexes larger than the object size, on the > object queue. > >> >> MFC after: 3 days >> Sponsored by: The FreeBSD Foundation >> Reviewed by: bcr >> Approved by: philip (mentor) >> Differential Revision: https://reviews.freebsd.org/D29408 >> --- >> share/man/man9/Makefile | 1 + >> share/man/man9/vnode_pager_setsize.9 | 74 ++++++++++++++++++++++++++++++++++++ >> 2 files changed, 75 insertions(+) >> >> diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile >> index 52a5d373a417..efdd8b2f6e9c 100644 >> --- a/share/man/man9/Makefile >> +++ b/share/man/man9/Makefile >> @@ -401,6 +401,7 @@ MAN= accept_filter.9 \ >> vn_isdisk.9 \ >> vnet.9 \ >> vnode.9 \ >> + vnode_pager_setsize.9 \ >> VOP_ACCESS.9 \ >> VOP_ACLCHECK.9 \ >> VOP_ADVISE.9 \ >> diff --git a/share/man/man9/vnode_pager_setsize.9 b/share/man/man9/vnode_pager_setsize.9 >> new file mode 100644 >> index 000000000000..c59a01796f20 >> --- /dev/null >> +++ b/share/man/man9/vnode_pager_setsize.9 >> @@ -0,0 +1,74 @@ >> +.\" >> +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD >> +.\" >> +.\" Copyright (c) 2021 The FreeBSD Foundation >> +.\" >> +.\" Portions of this software were developed by Ka Ho Ng >> +.\" under sponsorship from the FreeBSD Foundation. >> +.\" >> +.\" Redistribution and use in source and binary forms, with or without >> +.\" modification, are permitted provided that the following conditions >> +.\" are met: >> +.\" 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. >> +.\" >> +.Dd April 6, 2021 >> +.Dt VNODE_PAGER_SETSIZE 9 >> +.Os >> +.Sh NAME >> +.Nm vnode_pager_setsize >> +.Nd "notify the VM system about updates in the file size" >> +.Sh SYNOPSIS >> +.In sys/param.h >> +.In vm/vm.h >> +.In vm/vm_extern.h >> +.Ft void >> +.Fn vnode_pager_setsize "struct vnode *vp" "vm_ooffset_t nsize" >> +.Sh DESCRIPTION >> +.Nm >> +lets the VM system know about a change in size for a file. >> +Content beyond the new EOF specified by the >> +.Fa nsize >> +argument will be purged from the cache. > This is not true. Only content between new EOF and old EOF is purged. > Removing everything past new EOF would break UFS, for instance. > >> +This function is useful for use within file system code to implement >> +truncation in >> +.Xr VOP_SETATTR 9 . >> +.Sh IMPLEMENTATION NOTES >> +In case the new EOF specified by the >> +.Fa nsize >> +argument is not aligned to page boundaries, >> +partial-page area starting beyond the EOF will be zeroed. >> +In partial-page area, >> +for content occupying whole blocks within block >> +boundaries, >> +the dirty bits for the corresponding blocks will be cleared. >> +.Sh LOCKING >> +Writer lock of the VM object of >> +.Fa vp >> +will be held within the function. > Object is locked internally on as needed basis, but why would this matter > for anybody? > > Again missed in the man page, but very important part of the interface > is that for correct and race-less use of the function, the vnode lock > must be held in exclusive mode. Otherwise truncation would interact > wrongly with page faults. > > Unfortunately not all filesystems lock the vnode, the last offender is > ZFS. For it, I had to add MNTK_VMSETSIZE_BUG to ignore the preconditions. > >> +.Sh SEE ALSO >> +.Xr vnode 9 >> +.Sh HISTORY >> +The >> +.Nm >> +manual page first appeared in >> +.Fx 14 . >> +.Sh AUTHORS >> +This >> +manual page was written by >> +.An Ka Ho Ng Aq Mt khng@FreeBSD.org . A new differential is posted as https://reviews.freebsd.org/D29637 to address them. Ka Ho From owner-dev-commits-src-all@freebsd.org Thu Apr 8 10:18:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 02B425D792E; Thu, 8 Apr 2021 10:18:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FGHJr6lf2z4jHH; Thu, 8 Apr 2021 10:18: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 DAA25882; Thu, 8 Apr 2021 10:18: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 138AI4nm012698; Thu, 8 Apr 2021 10:18:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138AI4Eg012697; Thu, 8 Apr 2021 10:18:04 GMT (envelope-from git) Date: Thu, 8 Apr 2021 10:18:04 GMT Message-Id: <202104081018.138AI4Eg012697@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: d6a53211a716 - main - Discard the arm64 VFP state before resetting it 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: d6a53211a716c987de76294cff32b652fe38bb09 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 10:18:05 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=d6a53211a716c987de76294cff32b652fe38bb09 commit d6a53211a716c987de76294cff32b652fe38bb09 Author: Andrew Turner AuthorDate: 2021-03-23 18:23:47 +0000 Commit: Andrew Turner CommitDate: 2021-04-08 07:51:26 +0000 Discard the arm64 VFP state before resetting it When resetting the VFP state we need to discard any old state so we don't try to save it on a context switch. Move this first so resetting the pcb is safe to perform outside a critical section. Reviewed by: arichardson Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D29401 --- sys/arm64/arm64/vfp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/arm64/arm64/vfp.c b/sys/arm64/arm64/vfp.c index 4935946d2430..9de27349fb8d 100644 --- a/sys/arm64/arm64/vfp.c +++ b/sys/arm64/arm64/vfp.c @@ -208,7 +208,15 @@ vfp_save_state(struct thread *td, struct pcb *pcb) void vfp_reset_state(struct thread *td, struct pcb *pcb) { + /* Discard the threads VFP state before resetting it */ critical_enter(); + vfp_discard(td); + critical_exit(); + + /* + * Clear the thread state. The VFP is disabled and is not the current + * VFP thread so we won't change any of these on context switch. + */ bzero(&pcb->pcb_fpustate.vfp_regs, sizeof(pcb->pcb_fpustate.vfp_regs)); KASSERT(pcb->pcb_fpusaved == &pcb->pcb_fpustate, ("pcb_fpusaved should point to pcb_fpustate.")); @@ -216,8 +224,6 @@ vfp_reset_state(struct thread *td, struct pcb *pcb) pcb->pcb_fpustate.vfp_fpsr = 0; pcb->pcb_vfpcpu = UINT_MAX; pcb->pcb_fpflags = 0; - vfp_discard(td); - critical_exit(); } void From owner-dev-commits-src-all@freebsd.org Thu Apr 8 10:18:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB3CB5D7A8C; Thu, 8 Apr 2021 10:18: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 4FGHJt2nSZz4jKl; Thu, 8 Apr 2021 10:18: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 3806C52A; Thu, 8 Apr 2021 10:18: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 138AI5v8012728; Thu, 8 Apr 2021 10:18:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138AI5IP012727; Thu, 8 Apr 2021 10:18:05 GMT (envelope-from git) Date: Thu, 8 Apr 2021 10:18:05 GMT Message-Id: <202104081018.138AI5IP012727@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: 24b2f4ea4922 - main - arm64: Fix finding the pmc event ID 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: 24b2f4ea49229618c5608846acfc10be2eb0d567 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 10:18:06 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=24b2f4ea49229618c5608846acfc10be2eb0d567 commit 24b2f4ea49229618c5608846acfc10be2eb0d567 Author: Andrew Turner AuthorDate: 2021-04-01 14:38:09 +0000 Commit: Andrew Turner CommitDate: 2021-04-08 07:52:21 +0000 arm64: Fix finding the pmc event ID The lower pmc event bits were masked off to find the PMC event ID. The doesn't work when there are more events. Switch it to use the offser relative to the first event while also checking the ID is in the expected range. Reviewed by: gnn, ray Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D29600 --- sys/dev/hwpmc/hwpmc_arm64.c | 4 +++- sys/dev/hwpmc/hwpmc_arm64.h | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_arm64.c b/sys/dev/hwpmc/hwpmc_arm64.c index 49375219a485..050f861a74fe 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.c +++ b/sys/dev/hwpmc/hwpmc_arm64.c @@ -181,7 +181,9 @@ arm64_allocate_pmc(int cpu, int ri, struct pmc *pm, } pe = a->pm_ev; - config = (pe & EVENT_ID_MASK); + config = (uint32_t)pe - PMC_EV_ARMV8_FIRST; + if (config > (PMC_EV_ARMV8_LAST - PMC_EV_ARMV8_FIRST)) + return (EINVAL); pm->pm_md.pm_arm64.pm_arm64_evsel = config; PMCDBG2(MDP, ALL, 2, "arm64-allocate ri=%d -> config=0x%x", ri, config); diff --git a/sys/dev/hwpmc/hwpmc_arm64.h b/sys/dev/hwpmc/hwpmc_arm64.h index f0d43aa58ef8..fb7637a39c60 100644 --- a/sys/dev/hwpmc/hwpmc_arm64.h +++ b/sys/dev/hwpmc/hwpmc_arm64.h @@ -40,7 +40,6 @@ #define ARMV8_RELOAD_COUNT_TO_PERFCTR_VALUE(R) (-(R)) #define ARMV8_PERFCTR_VALUE_TO_RELOAD_COUNT(P) (-(P)) -#define EVENT_ID_MASK 0xFF #ifdef _KERNEL /* MD extension for 'struct pmc' */ From owner-dev-commits-src-all@freebsd.org Thu Apr 8 10:18:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 184EF5D78BA; Thu, 8 Apr 2021 10:18:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FGHJx0rwdz4j6k; Thu, 8 Apr 2021 10:18: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 733F94FD; Thu, 8 Apr 2021 10:18: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 138AI7KH012751; Thu, 8 Apr 2021 10:18:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138AI74p012750; Thu, 8 Apr 2021 10:18:07 GMT (envelope-from git) Date: Thu, 8 Apr 2021 10:18:07 GMT Message-Id: <202104081018.138AI74p012750@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: 4d9488674f3a - main - Remove the last users of ARM_TP_ADDRESS 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: 4d9488674f3a36a2d12d11cad170cb1bd1c14a6d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 10:18:10 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=4d9488674f3a36a2d12d11cad170cb1bd1c14a6d commit 4d9488674f3a36a2d12d11cad170cb1bd1c14a6d Author: Andrew Turner AuthorDate: 2021-04-07 10:29:03 +0000 Commit: Andrew Turner CommitDate: 2021-04-08 07:52:54 +0000 Remove the last users of ARM_TP_ADDRESS This was only needed on 32-bit arm prior to ARMv6. As we only support ARMv6 or later remove it. Reviewed by: mannu Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D29624 --- lib/libc/arm/gen/__aeabi_read_tp.S | 10 ---------- lib/libc/arm/gen/_set_tp.c | 4 ---- lib/libc/arm/static_tls.h | 4 ---- lib/libthr/arch/arm/include/pthread_md.h | 8 -------- libexec/rtld-elf/arm/reloc.c | 14 -------------- 5 files changed, 40 deletions(-) diff --git a/lib/libc/arm/gen/__aeabi_read_tp.S b/lib/libc/arm/gen/__aeabi_read_tp.S index 224d6a632185..6229c951b344 100644 --- a/lib/libc/arm/gen/__aeabi_read_tp.S +++ b/lib/libc/arm/gen/__aeabi_read_tp.S @@ -31,18 +31,8 @@ __FBSDID("$FreeBSD$"); #include ENTRY(__aeabi_read_tp) -#ifdef ARM_TP_ADDRESS - ldr r0, .Larm_tp_address - ldr r0, [r0] -#else mrc p15, 0, r0, c13, c0, 3 -#endif RET END(__aeabi_read_tp) -#ifdef ARM_TP_ADDRESS -.Larm_tp_address: - .word ARM_TP_ADDRESS -#endif - .section .note.GNU-stack,"",%progbits diff --git a/lib/libc/arm/gen/_set_tp.c b/lib/libc/arm/gen/_set_tp.c index d0801d7444ba..1346ece5c9ef 100644 --- a/lib/libc/arm/gen/_set_tp.c +++ b/lib/libc/arm/gen/_set_tp.c @@ -38,9 +38,5 @@ void _set_tp(void *tp) { -#ifdef ARM_TP_ADDRESS - *((struct tcb **)ARM_TP_ADDRESS) = tp; -#else sysarch(ARM_SET_TP, tp); -#endif } diff --git a/lib/libc/arm/static_tls.h b/lib/libc/arm/static_tls.h index e6be9adfcff6..9f24cd4aae39 100644 --- a/lib/libc/arm/static_tls.h +++ b/lib/libc/arm/static_tls.h @@ -38,11 +38,7 @@ _libc_get_static_tls_base(size_t offset) { uintptr_t tlsbase; -#ifdef ARM_TP_ADDRESS - tlsbase = *(uintptr_t *)ARM_TP_ADDRESS; -#else __asm __volatile("mrc p15, 0, %0, c13, c0, 3" : "=r" (tlsbase)); -#endif tlsbase += offset; return (tlsbase); diff --git a/lib/libthr/arch/arm/include/pthread_md.h b/lib/libthr/arch/arm/include/pthread_md.h index 55d93d0853bc..6f99eb7a139b 100644 --- a/lib/libthr/arch/arm/include/pthread_md.h +++ b/lib/libthr/arch/arm/include/pthread_md.h @@ -54,11 +54,7 @@ struct tcb { static __inline void _tcb_set(struct tcb *tcb) { -#ifdef ARM_TP_ADDRESS - *((struct tcb **)ARM_TP_ADDRESS) = tcb; /* avoids a system call */ -#else sysarch(ARM_SET_TP, tcb); -#endif } /* @@ -67,15 +63,11 @@ _tcb_set(struct tcb *tcb) static __inline struct tcb * _tcb_get(void) { -#ifdef ARM_TP_ADDRESS - return (*((struct tcb **)ARM_TP_ADDRESS)); -#else struct tcb *tcb; __asm __volatile("mrc p15, 0, %0, c13, c0, 3" \ : "=r" (tcb)); return (tcb); -#endif } static __inline struct pthread * diff --git a/libexec/rtld-elf/arm/reloc.c b/libexec/rtld-elf/arm/reloc.c index 7779169667be..4e551b0948ad 100644 --- a/libexec/rtld-elf/arm/reloc.c +++ b/libexec/rtld-elf/arm/reloc.c @@ -491,10 +491,6 @@ ifunc_init(Elf_Auxinfo aux_info[__min_size(AT_COUNT)] __unused) void allocate_initial_tls(Obj_Entry *objs) { -#ifdef ARM_TP_ADDRESS - void **_tp = (void **)ARM_TP_ADDRESS; -#endif - /* * Fix the size of the static TLS block by using the maximum * offset allocated so far and adding a bit for dynamic modules to @@ -503,27 +499,17 @@ allocate_initial_tls(Obj_Entry *objs) tls_static_space = tls_last_offset + tls_last_size + RTLD_STATIC_TLS_EXTRA; -#ifdef ARM_TP_ADDRESS - (*_tp) = (void *) allocate_tls(objs, NULL, TLS_TCB_SIZE, 8); -#else sysarch(ARM_SET_TP, allocate_tls(objs, NULL, TLS_TCB_SIZE, 8)); -#endif } void * __tls_get_addr(tls_index* ti) { char *p; -#ifdef ARM_TP_ADDRESS - void **_tp = (void **)ARM_TP_ADDRESS; - - p = tls_get_addr_common((Elf_Addr **)(*_tp), ti->ti_module, ti->ti_offset); -#else void *_tp; __asm __volatile("mrc p15, 0, %0, c13, c0, 3" \ : "=r" (_tp)); p = tls_get_addr_common((Elf_Addr **)(_tp), ti->ti_module, ti->ti_offset); -#endif return (p); } From owner-dev-commits-src-all@freebsd.org Thu Apr 8 11:16:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC1945D85F3; Thu, 8 Apr 2021 11:16: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 4FGJbn4xMcz4mwN; Thu, 8 Apr 2021 11:16: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 9C6D6FC9; Thu, 8 Apr 2021 11:16: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 138BG5oH092749; Thu, 8 Apr 2021 11:16:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138BG50R092748; Thu, 8 Apr 2021 11:16:05 GMT (envelope-from git) Date: Thu, 8 Apr 2021 11:16:05 GMT Message-Id: <202104081116.138BG50R092748@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: 72b3b5a94192 - main - vfs: replace vfs_smr_quiesce with vfs_smr_synchronize 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: 72b3b5a941927f7a79611131f144eeb2dc9143c9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 11:16:05 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=72b3b5a941927f7a79611131f144eeb2dc9143c9 commit 72b3b5a941927f7a79611131f144eeb2dc9143c9 Author: Mateusz Guzik AuthorDate: 2021-04-08 07:08:41 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-08 11:14:45 +0000 vfs: replace vfs_smr_quiesce with vfs_smr_synchronize This ends up using a smr specific method. Suggested by: markj Tested by: pho --- sys/kern/vfs_cache.c | 12 ++++++------ sys/sys/vnode.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index c4b6fdd468db..8819ef483af5 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -2683,7 +2683,7 @@ cache_vnode_init(struct vnode *vp) * * This will force a fs lookup. * - * Synchronisation is done in 2 steps, calling vfs_smr_quiesce each time + * Synchronisation is done in 2 steps, calling vfs_smr_synchronize each time * to observe all CPUs not performing the lookup. */ static void @@ -2699,14 +2699,14 @@ cache_changesize_set_temp(struct nchashhead *temptbl, u_long temphash) */ atomic_store_long(&nchash, temphash); atomic_thread_fence_rel(); - vfs_smr_quiesce(); + vfs_smr_synchronize(); /* * At this point everyone sees the updated hash value, but they still * see the old table. */ atomic_store_ptr(&nchashtbl, temptbl); atomic_thread_fence_rel(); - vfs_smr_quiesce(); + vfs_smr_synchronize(); /* * At this point everyone sees the updated table pointer and size pair. */ @@ -2729,14 +2729,14 @@ cache_changesize_set_new(struct nchashhead *new_tbl, u_long new_hash) */ atomic_store_ptr(&nchashtbl, new_tbl); atomic_thread_fence_rel(); - vfs_smr_quiesce(); + vfs_smr_synchronize(); /* * At this point everyone sees the updated pointer value, but they * still see the old size. */ atomic_store_long(&nchash, new_hash); atomic_thread_fence_rel(); - vfs_smr_quiesce(); + vfs_smr_synchronize(); /* * At this point everyone sees the updated table pointer and size pair. */ @@ -3881,7 +3881,7 @@ cache_fplookup_lockout(void) if (on) { atomic_store_char(&cache_fast_lookup_enabled, false); atomic_thread_fence_rel(); - vfs_smr_quiesce(); + vfs_smr_synchronize(); } } diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 3bb6936a27b2..f45824e3dc89 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1112,7 +1112,7 @@ int vn_dir_check_exec(struct vnode *vp, struct componentname *cnp); #define VFS_SMR() vfs_smr #define vfs_smr_enter() smr_enter(VFS_SMR()) #define vfs_smr_exit() smr_exit(VFS_SMR()) -#define vfs_smr_quiesce() quiesce_all_critical() +#define vfs_smr_synchronize() smr_synchronize(VFS_SMR()) #define vfs_smr_entered_load(ptr) smr_entered_load((ptr), VFS_SMR()) #define VFS_SMR_ASSERT_ENTERED() SMR_ASSERT_ENTERED(VFS_SMR()) #define VFS_SMR_ASSERT_NOT_ENTERED() SMR_ASSERT_NOT_ENTERED(VFS_SMR()) From owner-dev-commits-src-all@freebsd.org Thu Apr 8 11:31:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B53885D8E47; Thu, 8 Apr 2021 11:31: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 4FGJxn4k2mz4nrb; Thu, 8 Apr 2021 11:31: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 94BC31375; Thu, 8 Apr 2021 11:31: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 138BVfHG015838; Thu, 8 Apr 2021 11:31:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138BVf0c015837; Thu, 8 Apr 2021 11:31:41 GMT (envelope-from git) Date: Thu, 8 Apr 2021 11:31:41 GMT Message-Id: <202104081131.138BVf0c015837@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: 4967f672ef30 - main - pf: Remove unused variable rt_listid from struct pf_krule 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: 4967f672ef3095300fe74a9d1ae873d0897cc0a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 11:31:41 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4967f672ef3095300fe74a9d1ae873d0897cc0a5 commit 4967f672ef3095300fe74a9d1ae873d0897cc0a5 Author: Kristof Provost AuthorDate: 2021-04-08 09:08:33 +0000 Commit: Kristof Provost CommitDate: 2021-04-08 11:24:35 +0000 pf: Remove unused variable rt_listid from struct pf_krule Reviewed by: donner MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29639 --- sys/net/pfvar.h | 1 - sys/netpfil/pf/pf_ioctl.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 6102d6186cd2..0e78bcbdf34c 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -356,7 +356,6 @@ struct pf_krule { } max_src_conn_rate; u_int32_t qid; u_int32_t pqid; - u_int32_t rt_listid; u_int32_t nr; u_int32_t prob; uid_t cuid; diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index ce889c8d797e..08d9f9530ba9 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1546,7 +1546,6 @@ pf_krule_to_rule(const struct pf_krule *krule, struct pf_rule *rule) rule->max_src_conn_rate.seconds = krule->max_src_conn_rate.seconds; rule->qid = krule->qid; rule->pqid = krule->pqid; - rule->rt_listid = krule->rt_listid; rule->nr = krule->nr; rule->prob = krule->prob; rule->cuid = krule->cuid; @@ -1680,7 +1679,6 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) krule->max_src_conn_rate.seconds = rule->max_src_conn_rate.seconds; krule->qid = rule->qid; krule->pqid = rule->pqid; - krule->rt_listid = rule->rt_listid; krule->nr = rule->nr; krule->prob = rule->prob; krule->cuid = rule->cuid; From owner-dev-commits-src-all@freebsd.org Thu Apr 8 12:43:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C56705DB630; Thu, 8 Apr 2021 12:43: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 4FGLXq5Bjrz4vDl; Thu, 8 Apr 2021 12:43: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 A533322E1; Thu, 8 Apr 2021 12:43: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 138ChdJt012801; Thu, 8 Apr 2021 12:43:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138Chdbc012800; Thu, 8 Apr 2021 12:43:39 GMT (envelope-from git) Date: Thu, 8 Apr 2021 12:43:39 GMT Message-Id: <202104081243.138Chdbc012800@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: 1fd001db9c33 - main - arm64: clear debug register state on fork 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: 1fd001db9c330f133708f3c04c8852f8b07cfed9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 12:43:39 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=1fd001db9c330f133708f3c04c8852f8b07cfed9 commit 1fd001db9c330f133708f3c04c8852f8b07cfed9 Author: Mitchell Horne AuthorDate: 2021-04-07 19:23:46 +0000 Commit: Mitchell Horne CommitDate: 2021-04-08 12:41:41 +0000 arm64: clear debug register state on fork Following the analogous change for amd64 and i386 in 8223717ce62c, ensure that new processes start with these registers inactive. PR: 254661 Reported by: Michał Górny Reviewed by: kib, emaste MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29630 --- sys/arm64/arm64/vm_machdep.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index c37f1d849359..a7b02e98959f 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -91,6 +91,9 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) td2->td_pcb = pcb2; bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); + /* Clear the debug register state. */ + bzero(&pcb2->pcb_dbg_regs, sizeof(pcb2->pcb_dbg_regs)); + tf = (struct trapframe *)STACKALIGN((struct trapframe *)pcb2 - 1); bcopy(td1->td_frame, tf, sizeof(*tf)); tf->tf_x[0] = 0; From owner-dev-commits-src-all@freebsd.org Thu Apr 8 12:51:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59BCC5DB75B; Thu, 8 Apr 2021 12:51: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 4FGLjm23TKz4vcp; Thu, 8 Apr 2021 12:51: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 39AA02921; Thu, 8 Apr 2021 12:51: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 138CpOe5025508; Thu, 8 Apr 2021 12:51:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138CpOmn025507; Thu, 8 Apr 2021 12:51:24 GMT (envelope-from git) Date: Thu, 8 Apr 2021 12:51:24 GMT Message-Id: <202104081251.138CpOmn025507@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: 5998328e55f8 - main - Clean up the style in the arm64 bus.h 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: 5998328e55f8850718a6b48842823eb0a6524ae6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 12:51:24 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=5998328e55f8850718a6b48842823eb0a6524ae6 commit 5998328e55f8850718a6b48842823eb0a6524ae6 Author: Andrew Turner AuthorDate: 2021-04-08 09:41:23 +0000 Commit: Andrew Turner CommitDate: 2021-04-08 10:27:11 +0000 Clean up the style in the arm64 bus.h MFC after: 2 weeks Sponsored by: Innovate UK --- sys/arm64/include/bus.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/sys/arm64/include/bus.h b/sys/arm64/include/bus.h index e2862aa65fb0..a2bd432a5de5 100644 --- a/sys/arm64/include/bus.h +++ b/sys/arm64/include/bus.h @@ -79,12 +79,12 @@ #define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFFUL #define BUS_SPACE_MAXSIZE_40BIT 0xFFFFFFFFFFUL -#define BUS_SPACE_MAXADDR 0xFFFFFFFFFFFFFFFFUL -#define BUS_SPACE_MAXSIZE 0xFFFFFFFFFFFFFFFFUL +#define BUS_SPACE_MAXADDR 0xFFFFFFFFFFFFFFFFUL +#define BUS_SPACE_MAXSIZE 0xFFFFFFFFFFFFFFFFUL #define BUS_SPACE_MAP_CACHEABLE 0x01 #define BUS_SPACE_MAP_LINEAR 0x02 -#define BUS_SPACE_MAP_PREFETCHABLE 0x04 +#define BUS_SPACE_MAP_PREFETCHABLE 0x04 #define BUS_SPACE_UNRESTRICTED (~0) @@ -141,7 +141,7 @@ struct bus_space { bus_size_t, u_int32_t *, bus_size_t); void (*bs_rm_8) (void *, bus_space_handle_t, bus_size_t, u_int64_t *, bus_size_t); - + /* read region */ void (*bs_rr_1) (void *, bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t); @@ -151,7 +151,7 @@ struct bus_space { bus_size_t, u_int32_t *, bus_size_t); void (*bs_rr_8) (void *, bus_space_handle_t, bus_size_t, u_int64_t *, bus_size_t); - + /* write single */ void (*bs_w_1) (void *, bus_space_handle_t, bus_size_t, u_int8_t); @@ -171,7 +171,7 @@ struct bus_space { bus_size_t, const u_int32_t *, bus_size_t); void (*bs_wm_8) (void *, bus_space_handle_t, bus_size_t, const u_int64_t *, bus_size_t); - + /* write region */ void (*bs_wr_1) (void *, bus_space_handle_t, bus_size_t, const u_int8_t *, bus_size_t); @@ -227,7 +227,7 @@ struct bus_space { bus_size_t, u_int32_t *, bus_size_t); void (*bs_rm_8_s) (void *, bus_space_handle_t, bus_size_t, u_int64_t *, bus_size_t); - + /* read region stream */ void (*bs_rr_1_s) (void *, bus_space_handle_t, bus_size_t, u_int8_t *, bus_size_t); @@ -237,7 +237,7 @@ struct bus_space { bus_size_t, u_int32_t *, bus_size_t); void (*bs_rr_8_s) (void *, bus_space_handle_t, bus_size_t, u_int64_t *, bus_size_t); - + /* write single stream */ void (*bs_w_1_s) (void *, bus_space_handle_t, bus_size_t, u_int8_t); @@ -257,7 +257,7 @@ struct bus_space { bus_size_t, const u_int32_t *, bus_size_t); void (*bs_wm_8_s) (void *, bus_space_handle_t, bus_size_t, const u_int64_t *, bus_size_t); - + /* write region stream */ void (*bs_wr_1_s) (void *, bus_space_handle_t, bus_size_t, const u_int8_t *, bus_size_t); @@ -267,6 +267,7 @@ struct bus_space { bus_size_t, const u_int32_t *, bus_size_t); void (*bs_wr_8_s) (void *, bus_space_handle_t, bus_size_t, const u_int64_t *, bus_size_t); + /* peek */ int (*bs_peek_1)(void *, bus_space_handle_t, bus_size_t , uint8_t *); @@ -276,6 +277,7 @@ struct bus_space { bus_size_t , uint32_t *); int (*bs_peek_8)(void *, bus_space_handle_t, bus_size_t , uint64_t *); + /* poke */ int (*bs_poke_1)(void *, bus_space_handle_t, bus_size_t, uint8_t); @@ -349,9 +351,9 @@ struct bus_space { #define bus_space_read_4(t, h, o) __bs_rs(4,(t),(h),(o)) #define bus_space_read_8(t, h, o) __bs_rs(8,(t),(h),(o)) -#define bus_space_read_stream_1(t, h, o) __bs_rs_s(1,(t), (h), (o)) -#define bus_space_read_stream_2(t, h, o) __bs_rs_s(2,(t), (h), (o)) -#define bus_space_read_stream_4(t, h, o) __bs_rs_s(4,(t), (h), (o)) +#define bus_space_read_stream_1(t, h, o) __bs_rs_s(1,(t), (h), (o)) +#define bus_space_read_stream_2(t, h, o) __bs_rs_s(2,(t), (h), (o)) +#define bus_space_read_stream_4(t, h, o) __bs_rs_s(4,(t), (h), (o)) #define bus_space_read_stream_8(t, h, o) __bs_rs_s(8,(t), (h), (o)) /* From owner-dev-commits-src-all@freebsd.org Thu Apr 8 13:26:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D2E35DC463; Thu, 8 Apr 2021 13:26: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 4FGMVB1BRGz3FKB; Thu, 8 Apr 2021 13:26: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 179FC2FC1; Thu, 8 Apr 2021 13:26: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 138DQPT3065860; Thu, 8 Apr 2021 13:26:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138DQPMF065859; Thu, 8 Apr 2021 13:26:25 GMT (envelope-from git) Date: Thu, 8 Apr 2021 13:26:25 GMT Message-Id: <202104081326.138DQPMF065859@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: 9f2eeb02623d - main - [tcp] Fix ECN on finalizing sessions. 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: 9f2eeb02623d6a847a90da68a5892c25b14ce2d4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 13:26:26 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=9f2eeb02623d6a847a90da68a5892c25b14ce2d4 commit 9f2eeb02623d6a847a90da68a5892c25b14ce2d4 Author: Richard Scheffenegger AuthorDate: 2021-04-08 12:50:34 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-08 13:26:09 +0000 [tcp] Fix ECN on finalizing sessions. A subtle oversight would subtly change new data packets sent after a shutdown() or close() call, while the send buffer is still draining. MFC after: 3 days Reviewed By: #transport, tuexen Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29616 --- sys/netinet/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index d4b5a328e2a6..e23cdc749e98 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1181,7 +1181,7 @@ send: tp->t_flags2 &= ~TF2_ECN_SND_ECE; } - if (tp->t_state == TCPS_ESTABLISHED && + if (TCPS_HAVEESTABLISHED(tp->t_state) && (tp->t_flags2 & TF2_ECN_PERMIT)) { /* * If the peer has ECN, mark data packets with From owner-dev-commits-src-all@freebsd.org Thu Apr 8 14:46:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 237045DE2CC; Thu, 8 Apr 2021 14:46: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 4FGPGP0X8lz3LsX; Thu, 8 Apr 2021 14:46: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 04DD340E1; Thu, 8 Apr 2021 14:46: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 138EkKex071122; Thu, 8 Apr 2021 14:46:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138EkKus071121; Thu, 8 Apr 2021 14:46:20 GMT (envelope-from git) Date: Thu, 8 Apr 2021 14:46:20 GMT Message-Id: <202104081446.138EkKus071121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roman Bogorodskiy Subject: git: f2ecc0d1b7d5 - main - bhyve: fix regression in legacy virtio-9p config parsing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: novel X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f2ecc0d1b7d569b4b2c930c7450390c04778ee8a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 14:46:21 -0000 The branch main has been updated by novel (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f2ecc0d1b7d569b4b2c930c7450390c04778ee8a commit f2ecc0d1b7d569b4b2c930c7450390c04778ee8a Author: Roman Bogorodskiy AuthorDate: 2021-04-08 14:44:58 +0000 Commit: Roman Bogorodskiy CommitDate: 2021-04-08 14:44:58 +0000 bhyve: fix regression in legacy virtio-9p config parsing Commit 621b5090487de9fed1b503769702a9a2a27cc7bb introduced a regression in legacy virtio-9p config parsing by not initializing *sharename to NULL. As a result, "sharename != NULL" check in the first iteration fails and bhyve exits with "virtio-9p: more than one share name given". Fix by adding NULL back. Approved by: grehan --- usr.sbin/bhyve/pci_virtio_9p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_virtio_9p.c b/usr.sbin/bhyve/pci_virtio_9p.c index fed18ce5a8cc..f96d53858225 100644 --- a/usr.sbin/bhyve/pci_virtio_9p.c +++ b/usr.sbin/bhyve/pci_virtio_9p.c @@ -224,7 +224,7 @@ pci_vt9p_notify(void *vsc, struct vqueue_info *vq) static int pci_vt9p_legacy_config(nvlist_t *nvl, const char *opts) { - char *sharename, *tofree, *token, *tokens; + char *sharename = NULL, *tofree, *token, *tokens; if (opts == NULL) return (0); From owner-dev-commits-src-all@freebsd.org Thu Apr 8 16:22:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACC215B816A; Thu, 8 Apr 2021 16:22: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 4FGRPK4Zdmz3jNN; Thu, 8 Apr 2021 16:22: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 901405916; Thu, 8 Apr 2021 16:22: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 138GMTqh003664; Thu, 8 Apr 2021 16:22:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138GMTOx003663; Thu, 8 Apr 2021 16:22:29 GMT (envelope-from git) Date: Thu, 8 Apr 2021 16:22:29 GMT Message-Id: <202104081622.138GMTOx003663@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tai-hwa Liang Subject: git: f87d56d4bf5c - stable/13 - net: fixing a memory leak in if_deregister_com_alloc() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avatar X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f87d56d4bf5cb4dfdbcdd04ad386a41556fc170b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 16:22:29 -0000 The branch stable/13 has been updated by avatar: URL: https://cgit.FreeBSD.org/src/commit/?id=f87d56d4bf5cb4dfdbcdd04ad386a41556fc170b commit f87d56d4bf5cb4dfdbcdd04ad386a41556fc170b Author: Tai-hwa Liang AuthorDate: 2021-03-06 14:36:35 +0000 Commit: Tai-hwa Liang CommitDate: 2021-04-08 16:21:33 +0000 net: fixing a memory leak in if_deregister_com_alloc() Drain the callbacks upon if_deregister_com_alloc() such that the if_com_free[type] won't be nullified before if_destroy(). Taking fwip(4) as an example, before this fix, kldunload if_fwip will go through the following: 1. fwip_detach() 2. if_free() -> schedule if_destroy() through NET_EPOCH_CALL 3. fwip_detach() returns 4. firewire_modevent(MOD_UNLOAD) -> if_deregister_com_alloc() 5. kernel complains about: Warning: memory type fw_com leaked memory on destroy (1 allocations, 64 bytes leaked). 6. EPOCH runs if_destroy() -> if_free_internal()i By this time, if_com_free[if_alloctype] is NULL since it's already nullified by if_deregister_com_alloc(); hence, firewire_free() won't have a chance to release the allocated fw_com. Reviewed by: hselasky, glebius MFC after: 2 weeks (cherry picked from commit 092f3f081265c68cd8de0234ba8e46560ccc061e) --- sys/net/if.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/net/if.c b/sys/net/if.c index 948be6876b65..776fcf2fc78d 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4045,6 +4045,14 @@ if_deregister_com_alloc(u_char type) ("if_deregister_com_alloc: %d not registered", type)); KASSERT(if_com_free[type] != NULL, ("if_deregister_com_alloc: %d free not registered", type)); + + /* + * Ensure all pending EPOCH(9) callbacks have been executed. This + * fixes issues about late invocation of if_destroy(), which leads + * to memory leak from if_com_alloc[type] allocated if_l2com. + */ + epoch_drain_callbacks(net_epoch_preempt); + if_com_alloc[type] = NULL; if_com_free[type] = NULL; } From owner-dev-commits-src-all@freebsd.org Thu Apr 8 16:31:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 48C6D5B8569; Thu, 8 Apr 2021 16:31: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 4FGRcG1Yt8z3kBW; Thu, 8 Apr 2021 16:31: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 285635D89; Thu, 8 Apr 2021 16:31: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 138GVwkD016489; Thu, 8 Apr 2021 16:31:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138GVwNl016488; Thu, 8 Apr 2021 16:31:58 GMT (envelope-from git) Date: Thu, 8 Apr 2021 16:31:58 GMT Message-Id: <202104081631.138GVwNl016488@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 7702d940ec9a - main - Avoid -pedantic warnings about using _Generic in __fp_type_select MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7702d940ec9a27fd4ab9e3991fc582b369b5eedc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 16:31:58 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=7702d940ec9a27fd4ab9e3991fc582b369b5eedc commit 7702d940ec9a27fd4ab9e3991fc582b369b5eedc Author: Dimitry Andric AuthorDate: 2021-04-08 11:13:15 +0000 Commit: Dimitry Andric CommitDate: 2021-04-08 16:20:32 +0000 Avoid -pedantic warnings about using _Generic in __fp_type_select When compiling parts of math.h with clang using a C standard before C11, and using -pedantic, it will result in warnings similar to: bug254714.c:5:11: warning: '_Generic' is a C11 extension [-Wc11-extensions] return !isfinite(1.0); ^ /usr/include/math.h:111:21: note: expanded from macro 'isfinite' ^ /usr/include/math.h:82:39: note: expanded from macro '__fp_type_select' ^ This is because the block that enables use of _Generic is conditional not only on C11, but also on whether the compiler advertises support for C generic selections via __has_extension(c_generic_selections). To work around the warning without having to pessimize the code, use the __extension__ keyword, which is supported by both clang and gcc. While here, remove the check for __clang__, as _Generic has been supported for a long time by gcc too now. Reported by: yuri PR: 254714 MFC after: 1 week --- lib/msun/src/math.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/msun/src/math.h b/lib/msun/src/math.h index fee69498708a..8156094313e4 100644 --- a/lib/msun/src/math.h +++ b/lib/msun/src/math.h @@ -77,9 +77,8 @@ extern const union __nan_un { #define FP_SUBNORMAL 0x08 #define FP_ZERO 0x10 -#if (__STDC_VERSION__ >= 201112L && defined(__clang__)) || \ - __has_extension(c_generic_selections) -#define __fp_type_select(x, f, d, ld) _Generic((x), \ +#if __STDC_VERSION__ >= 201112L || __has_extension(c_generic_selections) +#define __fp_type_select(x, f, d, ld) __extension__ _Generic((x), \ float: f(x), \ double: d(x), \ long double: ld(x), \ From owner-dev-commits-src-all@freebsd.org Thu Apr 8 17:17:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2B5A25B94B6; Thu, 8 Apr 2021 17:17: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 4FGScJ6Qzqz3mxw; Thu, 8 Apr 2021 17:17: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 0BECB63D0; Thu, 8 Apr 2021 17:17: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 138HH2UI069943; Thu, 8 Apr 2021 17:17:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138HH27v069942; Thu, 8 Apr 2021 17:17:02 GMT (envelope-from git) Date: Thu, 8 Apr 2021 17:17:02 GMT Message-Id: <202104081717.138HH27v069942@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: 90cca08e91f5 - main - tcp: Prepare PRR to work with NewReno LossRecovery 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: 90cca08e91f54214747af0419c988aba868398ed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 17:17:06 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=90cca08e91f54214747af0419c988aba868398ed commit 90cca08e91f54214747af0419c988aba868398ed Author: Richard Scheffenegger AuthorDate: 2021-04-08 16:52:20 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-08 17:16:31 +0000 tcp: Prepare PRR to work with NewReno LossRecovery Add proper PRR vnet declarations for consistency. Also add pointer to tcpopt struct to tcp_do_prr_ack, in preparation for it to deal with non-SACK window reduction (after loss). No functional change. MFC after: 2 weeks Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29440 --- sys/netinet/tcp_input.c | 8 ++++---- sys/netinet/tcp_var.h | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 57779de1759a..e53296670a0f 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2576,7 +2576,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, if (V_tcp_do_prr && IN_FASTRECOVERY(tp->t_flags) && (tp->t_flags & TF_SACK_PERMIT)) { - tcp_do_prr_ack(tp, th); + tcp_do_prr_ack(tp, th, &to); } else if ((tp->t_flags & TF_SACK_PERMIT) && (to.to_flags & TOF_SACK) && IN_FASTRECOVERY(tp->t_flags)) { @@ -2777,7 +2777,7 @@ resume_partialack: if (V_tcp_do_prr && to.to_flags & TOF_SACK) { tcp_timer_activate(tp, TT_REXMT, 0); tp->t_rtttime = 0; - tcp_do_prr_ack(tp, th); + tcp_do_prr_ack(tp, th, &to); tp->t_flags |= TF_ACKNOW; (void) tcp_output(tp); } else @@ -2791,7 +2791,7 @@ resume_partialack: if (V_tcp_do_prr) { tp->sackhint.delivered_data = BYTES_THIS_ACK(tp, th); tp->snd_fack = th->th_ack; - tcp_do_prr_ack(tp, th); + tcp_do_prr_ack(tp, th, &to); (void) tcp_output(tp); } } else @@ -3920,7 +3920,7 @@ tcp_mssopt(struct in_conninfo *inc) } void -tcp_do_prr_ack(struct tcpcb *tp, struct tcphdr *th) +tcp_do_prr_ack(struct tcpcb *tp, struct tcphdr *th, struct tcpopt *to) { int snd_cnt = 0, limit = 0, del_data = 0, pipe = 0; int maxseg = tcp_maxseg(tp); diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index aefec69063e6..48e4c5c8e89a 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -838,6 +838,8 @@ VNET_DECLARE(int, tcp_delack_enabled); VNET_DECLARE(int, tcp_do_autorcvbuf); VNET_DECLARE(int, tcp_do_autosndbuf); VNET_DECLARE(int, tcp_do_ecn); +VNET_DECLARE(int, tcp_do_prr); +VNET_DECLARE(int, tcp_do_prr_conservative); VNET_DECLARE(int, tcp_do_newcwv); VNET_DECLARE(int, tcp_do_rfc1323); VNET_DECLARE(int, tcp_tolerate_missing_ts); @@ -1063,7 +1065,7 @@ void tcp_clean_dsack_blocks(struct tcpcb *tp); void tcp_clean_sackreport(struct tcpcb *tp); void tcp_sack_adjust(struct tcpcb *tp); struct sackhole *tcp_sack_output(struct tcpcb *tp, int *sack_bytes_rexmt); -void tcp_do_prr_ack(struct tcpcb *, struct tcphdr *); +void tcp_do_prr_ack(struct tcpcb *, struct tcphdr *, struct tcpopt *); void tcp_sack_partialack(struct tcpcb *, struct tcphdr *); void tcp_free_sackholes(struct tcpcb *tp); int tcp_newreno(struct tcpcb *, struct tcphdr *); From owner-dev-commits-src-all@freebsd.org Thu Apr 8 17:36:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C07D85B9E18; Thu, 8 Apr 2021 17:36:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FGT2W57P0z3pY6; Thu, 8 Apr 2021 17:36:19 +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 2B5F6567A; Thu, 8 Apr 2021 17:36:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 5a898b2b78ce - main - Set PCIe device's Max_Payload_Size to match PCIe root's. To: Alexander Motin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104051440.135EeeTZ095177@gitrepo.freebsd.org> From: John Baldwin Message-ID: <4091ea80-5269-9c78-9fe6-6bba2ed85fbd@FreeBSD.org> Date: Thu, 8 Apr 2021 10:36:12 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <202104051440.135EeeTZ095177@gitrepo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 17:36:19 -0000 On 4/5/21 7:40 AM, Alexander Motin wrote: > The branch main has been updated by mav: > > URL: https://cgit.FreeBSD.org/src/commit/?id=5a898b2b78ce04d608bbaaa0813424b11f921ae7 > > commit 5a898b2b78ce04d608bbaaa0813424b11f921ae7 > Author: Alexander Motin > AuthorDate: 2021-04-05 14:34:40 +0000 > Commit: Alexander Motin > CommitDate: 2021-04-05 14:34:40 +0000 > > Set PCIe device's Max_Payload_Size to match PCIe root's. > > Usually on boot the MPS is already configured by BIOS. But we've > found that on hot-plug it is not true at least for our Supermicro > X11 boards. As result, mismatch between root's configuration of > 256 bytes and device's default of 128 bytes cause problems for some > devices, while others seem to work fine. > > MFC after: 1 month > Sponsored by: iXsystems, Inc. > --- > sys/dev/pci/pci.c | 40 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 40 insertions(+) > > diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c > index ab19d13fc13a..ef138e926b6f 100644 > --- a/sys/dev/pci/pci.c > +++ b/sys/dev/pci/pci.c > @@ -4267,6 +4267,45 @@ pci_create_iov_child_method(device_t bus, device_t pf, uint16_t rid, > } > #endif > > +/* > + * For PCIe device set Max_Payload_Size to match PCIe root's. > + */ > +static void > +pcie_setup_mps(device_t dev) > +{ > + struct pci_devinfo *dinfo = device_get_ivars(dev); > + device_t root; > + uint16_t rmps, mmps, mps; > + > + if (dinfo->cfg.pcie.pcie_location == 0) > + return; > + root = pci_find_pcie_root_port(dev); > + if (root == NULL) > + return; > + /* Check whether the MPS is already configured. */ We tend to add blank lines before comments. > + rmps = pcie_read_config(root, PCIER_DEVICE_CTL, 2) & > + PCIEM_CTL_MAX_PAYLOAD; > + mps = pcie_read_config(dev, PCIER_DEVICE_CTL, 2) & > + PCIEM_CTL_MAX_PAYLOAD; > + if (mps == rmps) > + return; > + /* Check whether the device is capable of the root's MPS. */ > + mmps = (pcie_read_config(dev, PCIER_DEVICE_CAP, 2) & > + PCIEM_CAP_MAX_PAYLOAD) << 5; > + if (rmps > mmps) { > + /* > + * The device is unable to handle root's MPS. Limit root. > + * XXX: We should traverse through all the tree, applying > + * it to all the devices. > + */ Hmmm, limiting the root seems very dubious here. Do you really need this? If not, I'd put it behind a tunable sysctl that defaults to off. Ideally what you'd do here is use an and of the two masks and select one of those bits to choose the value rather than assuming the root can do the device's value. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Thu Apr 8 17:48:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C6095B9FF1; Thu, 8 Apr 2021 17:48:36 +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 4FGTJh2Hj8z3qB2; Thu, 8 Apr 2021 17:48:36 +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 C6E585D81; Thu, 8 Apr 2021 17:48:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) To: Ed Maste , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104051716.135HGoYJ012524@gitrepo.freebsd.org> From: John Baldwin Subject: Re: git: 4bbfa3d3baf7 - main - release: move installworld before installkernel Message-ID: <44444ea1-0c4c-98fb-9cae-fe3650441422@FreeBSD.org> Date: Thu, 8 Apr 2021 10:48:31 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <202104051716.135HGoYJ012524@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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 17:48:36 -0000 On 4/5/21 10:16 AM, Ed Maste wrote: > The branch main has been updated by emaste: > > URL: https://cgit.FreeBSD.org/src/commit/?id=4bbfa3d3baf70492ad4c3eacace0f966f3ca7070 > > commit 4bbfa3d3baf70492ad4c3eacace0f966f3ca7070 > Author: Ed Maste > AuthorDate: 2021-04-05 17:16:01 +0000 > Commit: Ed Maste > CommitDate: 2021-04-05 17:16:01 +0000 > > release: move installworld before installkernel > > To support -DNO_ROOT work. The top-level installworld target creates a > new METALOG starting with `#mtree 2.0` so it needs to be first, to avoid > overwriting installkernel METALOG entries. Alternatively, installworld and installkernel should perhaps write to separate intermediate METALOG files that are assembled into the final METALOG file when a single file is needed. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Thu Apr 8 17:59:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CCD65BA89F; Thu, 8 Apr 2021 17:59:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FGTXh6q90z3r11; Thu, 8 Apr 2021 17:59: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 DCD6D6BCE; Thu, 8 Apr 2021 17:59: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 138Hx0Lr022668; Thu, 8 Apr 2021 17:59:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138Hx0Iw022667; Thu, 8 Apr 2021 17:59:00 GMT (envelope-from git) Date: Thu, 8 Apr 2021 17:59:00 GMT Message-Id: <202104081759.138Hx0Iw022667@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 2cca4c0ee03d - main - Remove tcp_hostcache.h. Everything is private. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2cca4c0ee03dde51ec64db6684933fcb0a2de290 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 17:59:01 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=2cca4c0ee03dde51ec64db6684933fcb0a2de290 commit 2cca4c0ee03dde51ec64db6684933fcb0a2de290 Author: Gleb Smirnoff AuthorDate: 2021-03-22 18:45:29 +0000 Commit: Gleb Smirnoff CommitDate: 2021-04-08 17:58:44 +0000 Remove tcp_hostcache.h. Everything is private. Reviewed by: rscheff --- ObsoleteFiles.inc | 3 ++ sys/netinet/tcp_hostcache.c | 43 ++++++++++++++++++++++- sys/netinet/tcp_hostcache.h | 84 --------------------------------------------- 3 files changed, 45 insertions(+), 85 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 3b251eee1457..f50b9befdd66 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20210408: remove tcp_hostcache.h +OLD_FILES+=usr/include/netinet/tcp_hostcache.h + # 20210403: remove kgmon(8) OLD_FILES+=usr/sbin/kgmon OLD_FILES+=usr/share/man/man8/kgmon.8.gz diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index a873558621d1..5c8a6570425f 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -99,13 +99,54 @@ __FBSDID("$FreeBSD$"); #endif #include #include -#include #ifdef INET6 #include #endif #include +TAILQ_HEAD(hc_qhead, hc_metrics); + +struct hc_head { + struct hc_qhead hch_bucket; + u_int hch_length; + struct mtx hch_mtx; +}; + +struct hc_metrics { + /* housekeeping */ + TAILQ_ENTRY(hc_metrics) rmx_q; + struct hc_head *rmx_head; /* head of bucket tail queue */ + struct in_addr ip4; /* IP address */ + struct in6_addr ip6; /* IP6 address */ + uint32_t ip6_zoneid; /* IPv6 scope zone id */ + /* endpoint specific values for tcp */ + uint32_t rmx_mtu; /* MTU for this path */ + uint32_t rmx_ssthresh; /* outbound gateway buffer limit */ + uint32_t rmx_rtt; /* estimated round trip time */ + uint32_t rmx_rttvar; /* estimated rtt variance */ + uint32_t rmx_cwnd; /* congestion window */ + uint32_t rmx_sendpipe; /* outbound delay-bandwidth product */ + uint32_t rmx_recvpipe; /* inbound delay-bandwidth product */ + /* TCP hostcache internal data */ + int rmx_expire; /* lifetime for object */ + u_long rmx_hits; /* number of hits */ + u_long rmx_updates; /* number of updates */ +}; + +struct tcp_hostcache { + struct hc_head *hashbase; + uma_zone_t zone; + u_int hashsize; + u_int hashmask; + u_int bucket_limit; + u_int cache_count; + u_int cache_limit; + int expire; + int prune; + int purgeall; +}; + /* Arbitrary values */ #define TCP_HOSTCACHE_HASHSIZE 512 #define TCP_HOSTCACHE_BUCKETLIMIT 30 diff --git a/sys/netinet/tcp_hostcache.h b/sys/netinet/tcp_hostcache.h deleted file mode 100644 index 2f7035c0c6af..000000000000 --- a/sys/netinet/tcp_hostcache.h +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 2002 Andre Oppermann, Internet Business Solutions AG - * 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. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * 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$ - */ - -/* - * Many thanks to jlemon for basic structure of tcp_syncache which is being - * followed here. - */ - -#ifndef _NETINET_TCP_HOSTCACHE_H_ -#define _NETINET_TCP_HOSTCACHE_H_ - -TAILQ_HEAD(hc_qhead, hc_metrics); - -struct hc_head { - struct hc_qhead hch_bucket; - u_int hch_length; - struct mtx hch_mtx; -}; - -struct hc_metrics { - /* housekeeping */ - TAILQ_ENTRY(hc_metrics) rmx_q; - struct hc_head *rmx_head; /* head of bucket tail queue */ - struct in_addr ip4; /* IP address */ - struct in6_addr ip6; /* IP6 address */ - uint32_t ip6_zoneid; /* IPv6 scope zone id */ - /* endpoint specific values for tcp */ - uint32_t rmx_mtu; /* MTU for this path */ - uint32_t rmx_ssthresh; /* outbound gateway buffer limit */ - uint32_t rmx_rtt; /* estimated round trip time */ - uint32_t rmx_rttvar; /* estimated rtt variance */ - uint32_t rmx_cwnd; /* congestion window */ - uint32_t rmx_sendpipe; /* outbound delay-bandwidth product */ - uint32_t rmx_recvpipe; /* inbound delay-bandwidth product */ - /* TCP hostcache internal data */ - int rmx_expire; /* lifetime for object */ - u_long rmx_hits; /* number of hits */ - u_long rmx_updates; /* number of updates */ -}; - -struct tcp_hostcache { - struct hc_head *hashbase; - uma_zone_t zone; - u_int hashsize; - u_int hashmask; - u_int bucket_limit; - u_int cache_count; - u_int cache_limit; - int expire; - int prune; - int purgeall; -}; - -#endif /* !_NETINET_TCP_HOSTCACHE_H_*/ From owner-dev-commits-src-all@freebsd.org Thu Apr 8 17:59:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B7265BA7AD; Thu, 8 Apr 2021 17:59: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 4FGTXk0L3hz3qvl; Thu, 8 Apr 2021 17:59:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2FBB6B49; Thu, 8 Apr 2021 17:59:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 138Hx1AR022689; Thu, 8 Apr 2021 17:59:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138Hx1c7022688; Thu, 8 Apr 2021 17:59:01 GMT (envelope-from git) Date: Thu, 8 Apr 2021 17:59:01 GMT Message-Id: <202104081759.138Hx1c7022688@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 489bde5753d2 - main - tcp_hostcache: hide rmx_hits/rmx_updates under ifdef. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 489bde5753d2ee591f9a36c9a9082903c8e24636 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 17:59:02 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=489bde5753d2ee591f9a36c9a9082903c8e24636 commit 489bde5753d2ee591f9a36c9a9082903c8e24636 Author: Gleb Smirnoff AuthorDate: 2021-03-22 20:35:25 +0000 Commit: Gleb Smirnoff CommitDate: 2021-04-08 17:58:44 +0000 tcp_hostcache: hide rmx_hits/rmx_updates under ifdef. They have little value unless you do some profiling investigations, but they are performance bottleneck. Reviewed by: rscheff --- sys/netinet/tcp_hostcache.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 5c8a6570425f..e048f926b02b 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -130,8 +130,10 @@ struct hc_metrics { uint32_t rmx_recvpipe; /* inbound delay-bandwidth product */ /* TCP hostcache internal data */ int rmx_expire; /* lifetime for object */ +#ifdef TCP_HC_COUNTERS u_long rmx_hits; /* number of hits */ u_long rmx_updates; /* number of updates */ +#endif }; struct tcp_hostcache { @@ -513,7 +515,9 @@ tcp_hc_get(struct in_conninfo *inc, struct hc_metrics_lite *hc_metrics_lite) bzero(hc_metrics_lite, sizeof(*hc_metrics_lite)); return; } +#ifdef TCP_HC_COUNTERS hc_entry->rmx_hits++; +#endif hc_entry->rmx_expire = V_tcp_hostcache.expire; /* start over again */ hc_metrics_lite->rmx_mtu = hc_entry->rmx_mtu; @@ -548,7 +552,9 @@ tcp_hc_getmtu(struct in_conninfo *inc) if (hc_entry == NULL) { return 0; } +#ifdef TCP_HC_COUNTERS hc_entry->rmx_hits++; +#endif hc_entry->rmx_expire = V_tcp_hostcache.expire; /* start over again */ mtu = hc_entry->rmx_mtu; @@ -581,7 +587,9 @@ tcp_hc_updatemtu(struct in_conninfo *inc, uint32_t mtu) if (hc_entry == NULL) return; } +#ifdef TCP_HC_COUNTERS hc_entry->rmx_updates++; +#endif hc_entry->rmx_expire = V_tcp_hostcache.expire; /* start over again */ hc_entry->rmx_mtu = mtu; @@ -616,7 +624,9 @@ tcp_hc_update(struct in_conninfo *inc, struct hc_metrics_lite *hcml) if (hc_entry == NULL) return; } +#ifdef TCP_HC_COUNTERS hc_entry->rmx_updates++; +#endif hc_entry->rmx_expire = V_tcp_hostcache.expire; /* start over again */ if (hcml->rmx_rtt != 0) { @@ -712,7 +722,11 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) sbuf_printf(&sb, "\nIP address MTU SSTRESH RTT RTTVAR " - " CWND SENDPIPE RECVPIPE HITS UPD EXP\n"); + " CWND SENDPIPE RECVPIPE " +#ifdef TCP_HC_COUNTERS + "HITS UPD " +#endif + "EXP\n"); sbuf_drain(&sb); #define msec(u) (((u) + 500) / 1000) @@ -721,8 +735,11 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) TAILQ_FOREACH(hc_entry, &V_tcp_hostcache.hashbase[i].hch_bucket, rmx_q) { sbuf_printf(&sb, - "%-15s %5u %8u %6lums %6lums %8u %8u %8u %4lu " - "%4lu %4i\n", + "%-15s %5u %8u %6lums %6lums %8u %8u %8u " +#ifdef TCP_HC_COUNTERS + "%4lu %4lu " +#endif + "%4i\n", hc_entry->ip4.s_addr ? inet_ntoa_r(hc_entry->ip4, ip4buf) : #ifdef INET6 @@ -739,8 +756,10 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) hc_entry->rmx_cwnd, hc_entry->rmx_sendpipe, hc_entry->rmx_recvpipe, +#ifdef TCP_HC_COUNTERS hc_entry->rmx_hits, hc_entry->rmx_updates, +#endif hc_entry->rmx_expire); } THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); From owner-dev-commits-src-all@freebsd.org Thu Apr 8 17:59:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 289815BA83D; Thu, 8 Apr 2021 17:59: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 4FGTXn4Ftwz3rDW; Thu, 8 Apr 2021 17:59: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 69AA06B4F; Thu, 8 Apr 2021 17:59:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 138Hx3mp022710; Thu, 8 Apr 2021 17:59:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138Hx3cx022709; Thu, 8 Apr 2021 17:59:03 GMT (envelope-from git) Date: Thu, 8 Apr 2021 17:59:03 GMT Message-Id: <202104081759.138Hx3cx022709@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 29acb543931e - main - tcp_hostcache: add bool argument for tcp_hc_lookup() to tell are we looking to only read from the result, or to update it as well. For now doesn't affect locking, but allows to push stats and expire update into single place. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 29acb543931e390bcfb8672e1474811dc3da88a4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 17:59:07 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=29acb543931e390bcfb8672e1474811dc3da88a4 commit 29acb543931e390bcfb8672e1474811dc3da88a4 Author: Gleb Smirnoff AuthorDate: 2021-03-22 20:51:42 +0000 Commit: Gleb Smirnoff CommitDate: 2021-04-08 17:58:44 +0000 tcp_hostcache: add bool argument for tcp_hc_lookup() to tell are we looking to only read from the result, or to update it as well. For now doesn't affect locking, but allows to push stats and expire update into single place. Reviewed by: rscheff --- sys/netinet/tcp_hostcache.c | 45 ++++++++++++++++++++------------------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index e048f926b02b..d138745491f2 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -161,7 +161,7 @@ VNET_DEFINE_STATIC(struct tcp_hostcache, tcp_hostcache); VNET_DEFINE_STATIC(struct callout, tcp_hc_callout); #define V_tcp_hc_callout VNET(tcp_hc_callout) -static struct hc_metrics *tcp_hc_lookup(struct in_conninfo *); +static struct hc_metrics *tcp_hc_lookup(struct in_conninfo *, bool); static struct hc_metrics *tcp_hc_insert(struct in_conninfo *); static int sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS); static int sysctl_tcp_hc_histo(SYSCTL_HANDLER_ARGS); @@ -332,7 +332,7 @@ tcp_hc_destroy(void) * unlocking the bucket row after he is done reading/modifying the entry. */ static struct hc_metrics * -tcp_hc_lookup(struct in_conninfo *inc) +tcp_hc_lookup(struct in_conninfo *inc, bool update) { int hash; struct hc_head *hc_head; @@ -368,11 +368,11 @@ tcp_hc_lookup(struct in_conninfo *inc) /* XXX: check ip6_zoneid */ if (memcmp(&inc->inc6_faddr, &hc_entry->ip6, sizeof(inc->inc6_faddr)) == 0) - return hc_entry; + goto found; } else { if (memcmp(&inc->inc_faddr, &hc_entry->ip4, sizeof(inc->inc_faddr)) == 0) - return hc_entry; + goto found; } } @@ -380,7 +380,18 @@ tcp_hc_lookup(struct in_conninfo *inc) * We were unsuccessful and didn't find anything. */ THC_UNLOCK(&hc_head->hch_mtx); - return NULL; + return (NULL); + +found: +#ifdef TCP_HC_COUNTERS + if (update) + hc_entry->rmx_updates++; + else + hc_entry->rmx_hits++; +#endif + hc_entry->rmx_expire = V_tcp_hostcache.expire; + + return (hc_entry); } /* @@ -506,7 +517,7 @@ tcp_hc_get(struct in_conninfo *inc, struct hc_metrics_lite *hc_metrics_lite) /* * Find the right bucket. */ - hc_entry = tcp_hc_lookup(inc); + hc_entry = tcp_hc_lookup(inc, false); /* * If we don't have an existing object. @@ -515,10 +526,6 @@ tcp_hc_get(struct in_conninfo *inc, struct hc_metrics_lite *hc_metrics_lite) bzero(hc_metrics_lite, sizeof(*hc_metrics_lite)); return; } -#ifdef TCP_HC_COUNTERS - hc_entry->rmx_hits++; -#endif - hc_entry->rmx_expire = V_tcp_hostcache.expire; /* start over again */ hc_metrics_lite->rmx_mtu = hc_entry->rmx_mtu; hc_metrics_lite->rmx_ssthresh = hc_entry->rmx_ssthresh; @@ -548,14 +555,10 @@ tcp_hc_getmtu(struct in_conninfo *inc) if (!V_tcp_use_hostcache) return 0; - hc_entry = tcp_hc_lookup(inc); + hc_entry = tcp_hc_lookup(inc, false); if (hc_entry == NULL) { return 0; } -#ifdef TCP_HC_COUNTERS - hc_entry->rmx_hits++; -#endif - hc_entry->rmx_expire = V_tcp_hostcache.expire; /* start over again */ mtu = hc_entry->rmx_mtu; THC_UNLOCK(&hc_entry->rmx_head->hch_mtx); @@ -577,7 +580,7 @@ tcp_hc_updatemtu(struct in_conninfo *inc, uint32_t mtu) /* * Find the right bucket. */ - hc_entry = tcp_hc_lookup(inc); + hc_entry = tcp_hc_lookup(inc, true); /* * If we don't have an existing object, try to insert a new one. @@ -587,10 +590,6 @@ tcp_hc_updatemtu(struct in_conninfo *inc, uint32_t mtu) if (hc_entry == NULL) return; } -#ifdef TCP_HC_COUNTERS - hc_entry->rmx_updates++; -#endif - hc_entry->rmx_expire = V_tcp_hostcache.expire; /* start over again */ hc_entry->rmx_mtu = mtu; @@ -618,16 +617,12 @@ tcp_hc_update(struct in_conninfo *inc, struct hc_metrics_lite *hcml) if (!V_tcp_use_hostcache) return; - hc_entry = tcp_hc_lookup(inc); + hc_entry = tcp_hc_lookup(inc, true); if (hc_entry == NULL) { hc_entry = tcp_hc_insert(inc); if (hc_entry == NULL) return; } -#ifdef TCP_HC_COUNTERS - hc_entry->rmx_updates++; -#endif - hc_entry->rmx_expire = V_tcp_hostcache.expire; /* start over again */ if (hcml->rmx_rtt != 0) { if (hc_entry->rmx_rtt == 0) From owner-dev-commits-src-all@freebsd.org Thu Apr 8 17:59:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8EDCA5BA8B1; Thu, 8 Apr 2021 17:59: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 4FGTXp6rN3z3r3p; Thu, 8 Apr 2021 17:59: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 3C9476B53; Thu, 8 Apr 2021 17:59: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 138Hx432022735; Thu, 8 Apr 2021 17:59:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138Hx4X0022734; Thu, 8 Apr 2021 17:59:04 GMT (envelope-from git) Date: Thu, 8 Apr 2021 17:59:04 GMT Message-Id: <202104081759.138Hx4X0022734@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 373ffc62c158 - main - tcp_hostcache.c: remove unneeded includes. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 373ffc62c158e52cde86a5b934ab4a51307f9f2e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 17:59:08 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=373ffc62c158e52cde86a5b934ab4a51307f9f2e commit 373ffc62c158e52cde86a5b934ab4a51307f9f2e Author: Gleb Smirnoff AuthorDate: 2021-03-22 21:36:21 +0000 Commit: Gleb Smirnoff CommitDate: 2021-04-08 17:58:44 +0000 tcp_hostcache.c: remove unneeded includes. Reviewed by: rscheff --- sys/netinet/tcp_hostcache.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index d138745491f2..dfd3cf6ee260 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -82,26 +82,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include -#include -#include #include #include -#include -#include -#include #include -#include -#ifdef INET6 -#include -#include -#endif #include #include -#ifdef INET6 -#include -#endif #include From owner-dev-commits-src-all@freebsd.org Thu Apr 8 18:02:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14D605BABB2; Thu, 8 Apr 2021 18:02:04 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qv1-xf29.google.com (mail-qv1-xf29.google.com [IPv6:2607:f8b0:4864:20::f29]) (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 4FGTcC6Vykz3rsM; Thu, 8 Apr 2021 18:02:03 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qv1-xf29.google.com with SMTP id bs7so859589qvb.12; Thu, 08 Apr 2021 11:02:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=Y4hx8P6DU0HKAY4Y3+AtGHUUh8mRGOiX6RYjFL05CfU=; b=jvQYBf3jvb731tELkoIjawsqcLpogs1DJMNrzF6pUFr2VWa9lLChTSU88dYIzeoqbG jluakpFthu2jK/5DT5UBgiTHZM2KGU/ZUnNdd3jCxmgRUA2q4i97pFiqoxwzigMfPx4B gYnmdokqYxQ710ijK5lO71Ghz0HT0wkbBipxu+TJkz8rx4bAqb6vtGAvGS38xWUFRSqA Awb5gXVyTopoJObz2B5zlzoITIZpEXyKF6myJ4tC37iQfjsRRLHBIcAx3WfdRBZIft9y jowHGulyxMsZVQ1eBRK8Leh+ZTcB6INL+N9gfaru00NdhxslvHv2b2uGep6l6jD+Dmk9 Ajvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Y4hx8P6DU0HKAY4Y3+AtGHUUh8mRGOiX6RYjFL05CfU=; b=ku4jQEOVcclk1GXNU5m2An5vjuy+FG//eiOAa7vxfprddn4YWYx3SXO5gW+d4xlJm8 wXRlfQmYMFAaP1bRNJibPwmCDc8595ndtgpeUpvhoQLWcoFqQ4DEusRDmdSXGl8jCtdq FWR9d5vgXnBakwwZvLJ0pS/1cxNJzo8PlSgD8kww+mWIq06Viz2EO0uwvx/B9w7q3h9Q LEO6i/HryYI0WGMiqCMwgDqV2yxtdSNI8t20WEzfCs/k5vvN/zRGYreCYaBd1W67NMsS BEj51On3m7xAr/KRk+3FMUor6sLBmqHyUbivqhNRqrgOjyKbf4yijsxFBSDdMgAYV1cW y00Q== X-Gm-Message-State: AOAM530z/GDwovTB1taUlcb3eTSz4P/Nda33GRvZ9J/TgB+5PRDW3nGK 5Dp+pyYAtEsFzif6lm7pCC6B3vHblkUOTg== X-Google-Smtp-Source: ABdhPJyftN8ckBb9AzOoPZ+Ol9DRDQWK1zc5GPEnQXU0x5VN2Fkh0Vme6zQIG9j8JaMSeA+/eMshmQ== X-Received: by 2002:a0c:a1c2:: with SMTP id e60mr10171699qva.41.1617904922622; Thu, 08 Apr 2021 11:02:02 -0700 (PDT) Received: from mavoffice.ixsystems.com ([38.32.73.2]) by smtp.gmail.com with ESMTPSA id l6sm34261qkk.28.2021.04.08.11.02.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Apr 2021 11:02:01 -0700 (PDT) Sender: Alexander Motin Subject: Re: git: 5a898b2b78ce - main - Set PCIe device's Max_Payload_Size to match PCIe root's. To: John Baldwin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104051440.135EeeTZ095177@gitrepo.freebsd.org> <4091ea80-5269-9c78-9fe6-6bba2ed85fbd@FreeBSD.org> From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raS5AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5 9R8AEQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczM AAoJEIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLq A6xe6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHu uC5vgPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15Gc sS9YcQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9 TevwGsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCg lz65AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6ZAXgD tmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8FlvmI/c 40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt3ytU 8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZR1Ed EIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm59R8A EQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczMAAoJ EIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLqA6xe 6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHuuC5v gPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15GcsS9Y cQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9Tevw Gsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCglz4= Message-ID: <6239ed61-4d35-2cfa-69a7-16da733d8091@FreeBSD.org> Date: Thu, 8 Apr 2021 14:02:01 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: <4091ea80-5269-9c78-9fe6-6bba2ed85fbd@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4FGTcC6Vykz3rsM 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 18:02:04 -0000 On 08.04.2021 13:36, John Baldwin wrote: > On 4/5/21 7:40 AM, Alexander Motin wrote: >> +    rmps = pcie_read_config(root, PCIER_DEVICE_CTL, 2) & >> +        PCIEM_CTL_MAX_PAYLOAD; >> +    mps = pcie_read_config(dev, PCIER_DEVICE_CTL, 2) & >> +        PCIEM_CTL_MAX_PAYLOAD; >> +    if (mps == rmps) >> +        return; >> +    /* Check whether the device is capable of the root's MPS. */ >> +    mmps = (pcie_read_config(dev, PCIER_DEVICE_CAP, 2) & >> +        PCIEM_CAP_MAX_PAYLOAD) << 5; >> +    if (rmps > mmps) { >> +        /* >> +         * The device is unable to handle root's MPS.  Limit root. >> +         * XXX: We should traverse through all the tree, applying >> +         * it to all the devices. >> +         */ > > Hmmm, limiting the root seems very dubious here.  Do you really need this? All devices under the same root (at least ones that talk to each other) must have the same MPS value, otherwise some may consider larger transfer as an error. In case of direct PCIe connection the root is the only other device, so this code should be sufficient. > If not, I'd put it behind a tunable sysctl that defaults to off.  Ideally > what you'd do here is use an and of the two masks and select one of those > bits to choose the value rather than assuming the root can do the device's > value. It is not a bitmask, it is a power-of-2 between 128 bytes and the maximum device capability. So if the root is already configured for higher value, then it must support the lover one too. -- Alexander Motin From owner-dev-commits-src-all@freebsd.org Thu Apr 8 18:39:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 89CF65BBA69; Thu, 8 Apr 2021 18:39: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 4FGVR03Y8Yz3vV9; Thu, 8 Apr 2021 18:39: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 6CB257709; Thu, 8 Apr 2021 18:39: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 138Id8Jt076143; Thu, 8 Apr 2021 18:39:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138Id8UC076142; Thu, 8 Apr 2021 18:39:08 GMT (envelope-from git) Date: Thu, 8 Apr 2021 18:39:08 GMT Message-Id: <202104081839.138Id8UC076142@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: b878ec024bbe - main - tcp: Use jenkins_hash32() in hostcache 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: b878ec024bbee063f4181c9be08476a864fa6a7b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 18:39:08 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=b878ec024bbee063f4181c9be08476a864fa6a7b commit b878ec024bbee063f4181c9be08476a864fa6a7b Author: Richard Scheffenegger AuthorDate: 2021-04-08 18:28:43 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-08 18:29:19 +0000 tcp: Use jenkins_hash32() in hostcache As other parts of the base tcp stack (eg. tcp fastopen) already use jenkins_hash32, and the properties appear reasonably good, switching to use that. Reviewed By: tuexen, #transport, ae MFC after: 2 weeks Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29515 --- share/man/man4/tcp.4 | 52 +++++++++++++++++++++++++++++++++++++++++++-- sys/netinet/tcp_hostcache.c | 19 +++++++++++------ 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/share/man/man4/tcp.4 b/share/man/man4/tcp.4 index 16cf02184516..d01505e58427 100644 --- a/share/man/man4/tcp.4 +++ b/share/man/man4/tcp.4 @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd February 13, 2021 +.Dd April 8, 2021 .Dt TCP 4 .Os .Sh NAME @@ -628,7 +628,6 @@ Defaults to 60 seconds. Enable support for TCP Explicit Congestion Notification (ECN). ECN allows a TCP sender to reduce the transmission rate in order to avoid packet drops. -Settings: .Bl -tag -compact .It 0 Disable ECN. @@ -638,6 +637,7 @@ Outgoing connections will request ECN. .It 2 Allow incoming connections to request ECN. Outgoing connections will not request ECN. +(default) .El .It Va ecn.maxretries Number of retries (SYN or SYN/ACK retransmits) before disabling ECN on a @@ -674,6 +674,54 @@ Enable path MTU blackhole detection only for IPv6. MSS to try for IPv4 if PMTU blackhole detection is turned on. .It Va v6pmtud_blackhole_mss MSS to try for IPv6 if PMTU blackhole detection is turned on. +.It Va hostcache.enable +The TCP host cache is used to cache connection details and metrics to +improve future performance of connections between the same hosts. +At the completion of a TCP connection, a host will cache information +for the connection for some defined period of time. +.Bl -tag -compact +.It 0 +Disable the host cache. +.It 1 +Enable the host cache. (default) +.It Va hostcache.purgenow +Immediately purge all entries once set to any value. +Setting this to 2 will also reseed the hash salt. +.It Va hostcache.purge +Expire all entires on next pruning of host cache entries. +Any non-zero setting will be reset to zero, once the pruge +is running. +.Bl -tag -compact +.It 0 +Do not purge all entries when pruning the host cache. (default) +.It 1 +Purge all entries when doing the next pruning. +.It 2 +Purge all entries, and also reseed the hash salt. +.It Va hostcache.prune +Time in seconds between pruning expired host cache entries. +Defaults to 300 (5 minutes). +.It Va hostcache.expire +Time in seconds, how long a entry should be kept in the +host cache since last accessed. +Defaults to 3600 (1 hour). +.It Va hostcache.count +The current number of entries in the host cache. +.It Va hostcache.bucketlimit +The maximum number of entries for the same hash. +Defaults to 30. +.It Va hostcache.hashsize +Size of TCP hostcache hashtable. +This number has to be a power of two, or will be rejected. +Defaults to 512. +.It Va hostcache.cachelimit +Overall entry limit for hostcache. +Defaults to hashsize * bucketlimit. +.It Va hostcache.histo +Provide a Histogram of the hostcache hash utilization. +.It Va hostcache.list +Provide a complete list of all current entries in the host +cache. .It Va functions_available List of available TCP function blocks (TCP stacks). .It Va functions_default diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index dfd3cf6ee260..7bc79b781a30 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -127,6 +128,7 @@ struct tcp_hostcache { uma_zone_t zone; u_int hashsize; u_int hashmask; + u_int hashsalt; u_int bucket_limit; u_int cache_count; u_int cache_limit; @@ -210,16 +212,14 @@ SYSCTL_PROC(_net_inet_tcp_hostcache, OID_AUTO, purgenow, static MALLOC_DEFINE(M_HOSTCACHE, "hostcache", "TCP hostcache"); +/* Use jenkins_hash32(), as in other parts of the tcp stack */ #define HOSTCACHE_HASH(ip) \ - (((ip)->s_addr ^ ((ip)->s_addr >> 7) ^ ((ip)->s_addr >> 17)) & \ - V_tcp_hostcache.hashmask) + (jenkins_hash32((uint32_t *)(ip), 1, V_tcp_hostcache.hashsalt) & \ + V_tcp_hostcache.hashmask) -/* XXX: What is the recommended hash to get good entropy for IPv6 addresses? */ #define HOSTCACHE_HASH6(ip6) \ - (((ip6)->s6_addr32[0] ^ \ - (ip6)->s6_addr32[1] ^ \ - (ip6)->s6_addr32[2] ^ \ - (ip6)->s6_addr32[3]) & \ + (jenkins_hash32((uint32_t *)&((ip6)->s6_addr32[0]), 4, \ + V_tcp_hostcache.hashsalt) & \ V_tcp_hostcache.hashmask) #define THC_LOCK(lp) mtx_lock(lp) @@ -239,6 +239,7 @@ tcp_hc_init(void) V_tcp_hostcache.bucket_limit = TCP_HOSTCACHE_BUCKETLIMIT; V_tcp_hostcache.expire = TCP_HOSTCACHE_EXPIRE; V_tcp_hostcache.prune = TCP_HOSTCACHE_PRUNE; + V_tcp_hostcache.hashsalt = arc4random(); TUNABLE_INT_FETCH("net.inet.tcp.hostcache.hashsize", &V_tcp_hostcache.hashsize); @@ -836,6 +837,8 @@ tcp_hc_purge(void *arg) int all = 0; if (V_tcp_hostcache.purgeall) { + if (V_tcp_hostcache.purgeall == 2) + V_tcp_hostcache.hashsalt = arc4random(); all = 1; V_tcp_hostcache.purgeall = 0; } @@ -860,6 +863,8 @@ sysctl_tcp_hc_purgenow(SYSCTL_HANDLER_ARGS) if (error || !req->newptr) return (error); + if (val == 2) + V_tcp_hostcache.hashsalt = arc4random(); tcp_hc_purge_internal(1); callout_reset(&V_tcp_hc_callout, V_tcp_hostcache.prune * hz, From owner-dev-commits-src-all@freebsd.org Thu Apr 8 19:08:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C247F5BC63A; Thu, 8 Apr 2021 19:08:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FGW4g59pqz4S65; Thu, 8 Apr 2021 19:08:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A46447E39; Thu, 8 Apr 2021 19:08:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 138J8JpF016874; Thu, 8 Apr 2021 19:08:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138J8Jme016873; Thu, 8 Apr 2021 19:08:19 GMT (envelope-from git) Date: Thu, 8 Apr 2021 19:08:19 GMT Message-Id: <202104081908.138J8Jme016873@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: 9048d9a933f5 - main - sed(1): Add a reference for a 4.4BSD manual document 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: 9048d9a933f57991ee042618ab89dd49d8cbad89 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 19:08:19 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=9048d9a933f57991ee042618ab89dd49d8cbad89 commit 9048d9a933f57991ee042618ab89dd49d8cbad89 Author: Gordon Bergling AuthorDate: 2021-04-08 18:57:14 +0000 Commit: Gordon Bergling CommitDate: 2021-04-08 19:07:31 +0000 sed(1): Add a reference for a 4.4BSD manual document Obtained from: OpenBSD MFC after: 1 week --- share/man/man9/mbuf.9 | 11 ++++++++++- usr.bin/sed/sed.1 | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/share/man/man9/mbuf.9 b/share/man/man9/mbuf.9 index 9089ab56d58c..f6361cdc7c06 100644 --- a/share/man/man9/mbuf.9 +++ b/share/man/man9/mbuf.9 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 28, 2021 +.Dd April 8, 2021 .Dt MBUF 9 .Os .\" @@ -1216,6 +1216,15 @@ See above. .Sh SEE ALSO .Xr ifnet 9 , .Xr mbuf_tags 9 +.Rs +.\" 4.4BSD SMM:18 +.%A S. J. Leffler +.%A W. N. Joy +.%A R. S. Fabry +.%A M. J. Karels +.%T Networking Implementation Notes +.%B 4.4BSD System Manager's Manual (SMM) +.Re .Sh HISTORY .\" Please correct me if I'm wrong .Vt Mbufs diff --git a/usr.bin/sed/sed.1 b/usr.bin/sed/sed.1 index 10a625825c6a..04c1b46fc5b4 100644 --- a/usr.bin/sed/sed.1 +++ b/usr.bin/sed/sed.1 @@ -31,7 +31,7 @@ .\" @(#)sed.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd June 10, 2020 +.Dd April 8, 2021 .Dt SED 1 .Os .Sh NAME @@ -629,6 +629,15 @@ sed -i '' -e 's/foo/bar/g' test.txt .Xr grep 1 , .Xr regex 3 , .Xr re_format 7 +.Rs +.\" 4.4BSD USD:15 +.%A Lee E. McMahon +.%I AT&T Bell Laboratories +.%T SED \(em A Non-interactive Text Editor +.%R Computing Science Technical Report +.%N 77 +.%D January 1979 +.Re .Sh STANDARDS The .Nm From owner-dev-commits-src-all@freebsd.org Thu Apr 8 19:12:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 277465BC5E5; Thu, 8 Apr 2021 19:12:09 +0000 (UTC) (envelope-from gbe@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 4FGW950jftz4SFW; Thu, 8 Apr 2021 19:12:09 +0000 (UTC) (envelope-from gbe@freebsd.org) Received: from localhost (p200300d5d70db0e3553dea191a411b6e.dip0.t-ipconnect.de [IPv6:2003:d5:d70d:b0e3:553d:ea19:1a41:1b6e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gbe) by smtp.freebsd.org (Postfix) with ESMTPSA id A44F7645F; Thu, 8 Apr 2021 19:12:08 +0000 (UTC) (envelope-from gbe@freebsd.org) Date: Thu, 8 Apr 2021 21:12:07 +0200 From: Gordon Bergling To: Gordon Bergling Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 9048d9a933f5 - main - sed(1): Add a reference for a 4.4BSD manual document Message-ID: References: <202104081908.138J8Jme016873@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202104081908.138J8Jme016873@gitrepo.freebsd.org> X-Url: X-Operating-System: FreeBSD 12.2-STABLE amd64 X-Host-Uptime: 9:09PM up 2 days, 6:14, 4 users, load averages: 0.33, 0.28, 0.24 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 19:12:09 -0000 The change for mbuf(9) should be a separate commit. Sorry for the hassle. --Gordon On Thu, Apr 08, 2021 at 07:08:19PM +0000, Gordon Bergling wrote: > The branch main has been updated by gbe (doc committer): > > URL: https://cgit.FreeBSD.org/src/commit/?id=9048d9a933f57991ee042618ab89dd49d8cbad89 > > commit 9048d9a933f57991ee042618ab89dd49d8cbad89 > Author: Gordon Bergling > AuthorDate: 2021-04-08 18:57:14 +0000 > Commit: Gordon Bergling > CommitDate: 2021-04-08 19:07:31 +0000 > > sed(1): Add a reference for a 4.4BSD manual document > > Obtained from: OpenBSD > MFC after: 1 week > --- > share/man/man9/mbuf.9 | 11 ++++++++++- > usr.bin/sed/sed.1 | 11 ++++++++++- > 2 files changed, 20 insertions(+), 2 deletions(-) > > diff --git a/share/man/man9/mbuf.9 b/share/man/man9/mbuf.9 > index 9089ab56d58c..f6361cdc7c06 100644 > --- a/share/man/man9/mbuf.9 > +++ b/share/man/man9/mbuf.9 > @@ -24,7 +24,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd January 28, 2021 > +.Dd April 8, 2021 > .Dt MBUF 9 > .Os > .\" > @@ -1216,6 +1216,15 @@ See above. > .Sh SEE ALSO > .Xr ifnet 9 , > .Xr mbuf_tags 9 > +.Rs > +.\" 4.4BSD SMM:18 > +.%A S. J. Leffler > +.%A W. N. Joy > +.%A R. S. Fabry > +.%A M. J. Karels > +.%T Networking Implementation Notes > +.%B 4.4BSD System Manager's Manual (SMM) > +.Re > .Sh HISTORY > .\" Please correct me if I'm wrong > .Vt Mbufs > diff --git a/usr.bin/sed/sed.1 b/usr.bin/sed/sed.1 > index 10a625825c6a..04c1b46fc5b4 100644 > --- a/usr.bin/sed/sed.1 > +++ b/usr.bin/sed/sed.1 > @@ -31,7 +31,7 @@ > .\" @(#)sed.1 8.2 (Berkeley) 12/30/93 > .\" $FreeBSD$ > .\" > -.Dd June 10, 2020 > +.Dd April 8, 2021 > .Dt SED 1 > .Os > .Sh NAME > @@ -629,6 +629,15 @@ sed -i '' -e 's/foo/bar/g' test.txt > .Xr grep 1 , > .Xr regex 3 , > .Xr re_format 7 > +.Rs > +.\" 4.4BSD USD:15 > +.%A Lee E. McMahon > +.%I AT&T Bell Laboratories > +.%T SED \(em A Non-interactive Text Editor > +.%R Computing Science Technical Report > +.%N 77 > +.%D January 1979 > +.Re > .Sh STANDARDS > The > .Nm > _______________________________________________ > 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@freebsd.org" From owner-dev-commits-src-all@freebsd.org Thu Apr 8 19:20:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4DCB5BCCAE; Thu, 8 Apr 2021 19:20: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 4FGWLc5GZ2z4T9Q; Thu, 8 Apr 2021 19:20: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 A76637BCA; Thu, 8 Apr 2021 19:20: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 138JKOe6038149; Thu, 8 Apr 2021 19:20:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138JKODn038148; Thu, 8 Apr 2021 19:20:24 GMT (envelope-from git) Date: Thu, 8 Apr 2021 19:20:24 GMT Message-Id: <202104081920.138JKODn038148@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: 97fa288a663d - main - m4(1): Add a SEE ALSO section and reference an AT&T manual 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: 97fa288a663dfae192c471ec5cbfdf0d2f45367e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 19:20:24 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=97fa288a663dfae192c471ec5cbfdf0d2f45367e commit 97fa288a663dfae192c471ec5cbfdf0d2f45367e Author: Gordon Bergling AuthorDate: 2021-04-08 19:16:54 +0000 Commit: Gordon Bergling CommitDate: 2021-04-08 19:16:54 +0000 m4(1): Add a SEE ALSO section and reference an AT&T manual Obtained from: OpenBSD MFC after: 1 week --- usr.bin/m4/m4.1 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/usr.bin/m4/m4.1 b/usr.bin/m4/m4.1 index 6b5dbd99331c..83f124dd3dfc 100644 --- a/usr.bin/m4/m4.1 +++ b/usr.bin/m4/m4.1 @@ -33,7 +33,7 @@ .\" .\" $FreeBSD$ .\" -.Dd $Mdocdate: June 15 2017 $ +.Dd April 8, 2021 .Dt M4 1 .Os .Sh NAME @@ -455,6 +455,17 @@ But note that the macro can modify the exit status, as can the .Fl E flag. +.Sh SEE ALSO +.Rs +.\" 4.4BSD PSD:17 +.%A B. W. Kernighan +.%A D. M. Ritchie +.%I AT&T Bell Laboratories +.%T The M4 Macro Processor +.%R Computing Science Technical Report +.%N 59 +.%D July 1977 +.Re .Sh STANDARDS The .Nm From owner-dev-commits-src-all@freebsd.org Thu Apr 8 19:26:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCE605BCEB8; Thu, 8 Apr 2021 19:26:46 +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 4FGWTy54D8z4TpX; Thu, 8 Apr 2021 19:26:46 +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 2F51D6904; Thu, 8 Apr 2021 19:26:46 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: git: 5a898b2b78ce - main - Set PCIe device's Max_Payload_Size to match PCIe root's. To: Alexander Motin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104051440.135EeeTZ095177@gitrepo.freebsd.org> <4091ea80-5269-9c78-9fe6-6bba2ed85fbd@FreeBSD.org> <6239ed61-4d35-2cfa-69a7-16da733d8091@FreeBSD.org> From: John Baldwin Message-ID: Date: Thu, 8 Apr 2021 12:26:41 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: <6239ed61-4d35-2cfa-69a7-16da733d8091@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 19:26:46 -0000 On 4/8/21 11:02 AM, Alexander Motin wrote: > On 08.04.2021 13:36, John Baldwin wrote: >> On 4/5/21 7:40 AM, Alexander Motin wrote: >>> +    rmps = pcie_read_config(root, PCIER_DEVICE_CTL, 2) & >>> +        PCIEM_CTL_MAX_PAYLOAD; >>> +    mps = pcie_read_config(dev, PCIER_DEVICE_CTL, 2) & >>> +        PCIEM_CTL_MAX_PAYLOAD; >>> +    if (mps == rmps) >>> +        return; >>> +    /* Check whether the device is capable of the root's MPS. */ >>> +    mmps = (pcie_read_config(dev, PCIER_DEVICE_CAP, 2) & >>> +        PCIEM_CAP_MAX_PAYLOAD) << 5; >>> +    if (rmps > mmps) { >>> +        /* >>> +         * The device is unable to handle root's MPS.  Limit root. >>> +         * XXX: We should traverse through all the tree, applying >>> +         * it to all the devices. >>> +         */ >> >> Hmmm, limiting the root seems very dubious here.  Do you really need this? > > All devices under the same root (at least ones that talk to each other) > must have the same MPS value, otherwise some may consider larger > transfer as an error. In case of direct PCIe connection the root is the > only other device, so this code should be sufficient. I mean, had you seen any cases where you needed to adjust the root? I do worry about this breaking other systems due to it not doing the walk of the full sub-tree. Maybe only do it if the root port is the grandparent of the device in question since that is the safe case here and punt if there are switches in the middle? >> If not, I'd put it behind a tunable sysctl that defaults to off.  Ideally >> what you'd do here is use an and of the two masks and select one of those >> bits to choose the value rather than assuming the root can do the device's >> value. > > It is not a bitmask, it is a power-of-2 between 128 bytes and the > maximum device capability. So if the root is already configured for > higher value, then it must support the lover one too. I thought the DEVICE_CAP is a bitmask, and that is what I was thinking of using the and with. Nominally I think we should be doing the AND of the DEVICE_CAP field for all the devices under a port and then programming them to some value remaining in the mask. Most devices just DMA to/from memory though rather than to each other, so generally you just care about the path from a device to a root port. -- John Baldwin From owner-dev-commits-src-all@freebsd.org Thu Apr 8 19:45:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7E0A5BD579; Thu, 8 Apr 2021 19:45:08 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-qt1-x830.google.com (mail-qt1-x830.google.com [IPv6:2607:f8b0:4864:20::830]) (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 4FGWv84fHKz4WJJ; Thu, 8 Apr 2021 19:45:08 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-qt1-x830.google.com with SMTP id h7so2403863qtx.3; Thu, 08 Apr 2021 12:45:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qvjnpIVRvNYI1v/VkpsN9uFXafOG2umrY9fYzqNFE5U=; b=D6R/uYJxDmlFBHkyORoOGoKREueO9q7ojpEM088uoS7bF8vS4bBzKboCV6vUjJxkXS LEuaYWRxd3Wq/y7AMRyrsR2FFvi95LRaED58ebPwShs5qH4hbx1cMXxbB5w7c+XwHAKM MxdYILvIteuYG69kGqjAe7ERmLqdu7v6IzFUBMyif7Gfn/8zxHZBkxFg+xno1go/OvPh F5GclqZ5J05+6Qq3KzsbBBxPrQw9eQL4jl0EIzHjoAukcgZdt0t9Mz98lUyYaqoS724p hkMg4JBkIRUM+YuGMGfL11W7lZMNAXA4+z8wg1OBzyA7XCWRZKibhgetFPYtzALRtXKm WjKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=qvjnpIVRvNYI1v/VkpsN9uFXafOG2umrY9fYzqNFE5U=; b=kA8IC/qTqkU12RdaFmVunMX/0H/iQ+vXNzMi150OLhLfCgn4R9rhcsQiWfHHEseaQ0 7HYJ7LWtUQQniUW+UAwA/MNlSpOkEAgdhr3LL3qjOTpobjd/IeoFMOttCp2A1V2Ud3Rd kzovNJSKNSSbbcaFWWLpaKYw6bK3DBjIHPT0Ak7zOOtwVGS23rFNLYcCpiHvC8YvM6v2 QIqWdhtbeMcQeKKvVdg+qHv0smYdCv+nUCBWf47hIH+xYZYHdF1GD6LOCUL5cgVTovy7 zJwyTl9CoP+6jsuglEj5x/D9RtFbV3eu1iVUSgZGVGu3ZET1CqUbptywHWhL3VpkKyd6 Gtog== X-Gm-Message-State: AOAM533/QVa8MSzD0bsxyPluzjJNbaLEuKfiJzvhTrjcbwLm3Ivz7DYr wogWfen+DIyLeYlsp+6fXNSTtAD1/gjrZQ== X-Google-Smtp-Source: ABdhPJw1Hp7dpOi+/Js+yr7DF9gPE2vOvbSqb+oTIOmvk7Qo7nYWIG0JtOQP0WBxHU4BM2kj2mpn9A== X-Received: by 2002:ac8:7381:: with SMTP id t1mr9345340qtp.3.1617911106766; Thu, 08 Apr 2021 12:45:06 -0700 (PDT) Received: from mavoffice.ixsystems.com ([38.32.73.2]) by smtp.gmail.com with ESMTPSA id j30sm318535qtv.90.2021.04.08.12.45.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Apr 2021 12:45:06 -0700 (PDT) Sender: Alexander Motin Subject: Re: git: 5a898b2b78ce - main - Set PCIe device's Max_Payload_Size to match PCIe root's. To: John Baldwin , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202104051440.135EeeTZ095177@gitrepo.freebsd.org> <4091ea80-5269-9c78-9fe6-6bba2ed85fbd@FreeBSD.org> <6239ed61-4d35-2cfa-69a7-16da733d8091@FreeBSD.org> From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raS5AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5 9R8AEQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczM AAoJEIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLq A6xe6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHu uC5vgPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15Gc sS9YcQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9 TevwGsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCg lz65AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6ZAXgD tmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8FlvmI/c 40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt3ytU 8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZR1Ed EIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm59R8A EQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczMAAoJ EIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLqA6xe 6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHuuC5v gPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15GcsS9Y cQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9Tevw Gsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCglz4= Message-ID: Date: Thu, 8 Apr 2021 15:45:05 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4FGWv84fHKz4WJJ 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 19:45:08 -0000 On 08.04.2021 15:26, John Baldwin wrote: > On 4/8/21 11:02 AM, Alexander Motin wrote: >> On 08.04.2021 13:36, John Baldwin wrote: >>> On 4/5/21 7:40 AM, Alexander Motin wrote: >>>> +    rmps = pcie_read_config(root, PCIER_DEVICE_CTL, 2) & >>>> +        PCIEM_CTL_MAX_PAYLOAD; >>>> +    mps = pcie_read_config(dev, PCIER_DEVICE_CTL, 2) & >>>> +        PCIEM_CTL_MAX_PAYLOAD; >>>> +    if (mps == rmps) >>>> +        return; >>>> +    /* Check whether the device is capable of the root's MPS. */ >>>> +    mmps = (pcie_read_config(dev, PCIER_DEVICE_CAP, 2) & >>>> +        PCIEM_CAP_MAX_PAYLOAD) << 5; >>>> +    if (rmps > mmps) { >>>> +        /* >>>> +         * The device is unable to handle root's MPS.  Limit root. >>>> +         * XXX: We should traverse through all the tree, applying >>>> +         * it to all the devices. >>>> +         */ >>> >>> Hmmm, limiting the root seems very dubious here.  Do you really need >>> this? >> >> All devices under the same root (at least ones that talk to each other) >> must have the same MPS value, otherwise some may consider larger >> transfer as an error.  In case of direct PCIe connection the root is the >> only other device, so this code should be sufficient. > > I mean, had you seen any cases where you needed to adjust the root? No. I don't think I have NVMe device incapable of 256 byte transfers to which my Supermicro boards BIOS default. But I can easily imagine either such device or BIOS with bigger default. > I > do worry about this breaking other systems due to it not doing the walk > of the full sub-tree.  Maybe only do it if the root port is the grandparent > of the device in question since that is the safe case here and punt if > there are switches in the middle? I have no problem limiting it to grandparent, if you prefer, just not sure it is much better. If there are more devices under that root, then without full tree traversal either some old or the new device get MPS mismatch. The only question whether it will cause a receive of too large transfer by the root capable of it but limited by the MPS setting (formally a protocol violation, but at least Intel Optane 905p seem to ignore it), or the new device that is not even capable of it. >>> If not, I'd put it behind a tunable sysctl that defaults to off.  >>> Ideally >>> what you'd do here is use an and of the two masks and select one of >>> those >>> bits to choose the value rather than assuming the root can do the >>> device's >>> value. >> >> It is not a bitmask, it is a power-of-2 between 128 bytes and the >> maximum device capability.  So if the root is already configured for >> higher value, then it must support the lover one too. > > I thought the DEVICE_CAP is a bitmask, and that is what I was thinking > of using > the and with.  Nominally I think we should be doing the AND of the > DEVICE_CAP > field for all the devices under a port and then programming them to some > value > remaining in the mask.  Most devices just DMA to/from memory though > rather than > to each other, so generally you just care about the path from a device > to a root > port. "Max_Payload_Size Supported – This field indicates the maximum payload size that the Function can support for TLPs." -- this field in DEVICE_CAP is not a bitmask. So nominally we should take minimum for all the devices. -- Alexander Motin From owner-dev-commits-src-all@freebsd.org Thu Apr 8 20:24:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB8A65BE534; Thu, 8 Apr 2021 20:24:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FGXmb6HcBz4YcM; Thu, 8 Apr 2021 20:24:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CA6DF11221; Thu, 8 Apr 2021 20:24:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 138KOVNK022030; Thu, 8 Apr 2021 20:24:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138KOVkq022029; Thu, 8 Apr 2021 20:24:31 GMT (envelope-from git) Date: Thu, 8 Apr 2021 20:24:31 GMT Message-Id: <202104082024.138KOVkq022029@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: 9e5243d7b659 - main - Enforce check for using the return result for ifa?_try_ref(). 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: 9e5243d7b65939c3d3dbf844616084e9580876dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 20:24:32 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=9e5243d7b65939c3d3dbf844616084e9580876dd commit 9e5243d7b65939c3d3dbf844616084e9580876dd Author: Alexander V. Chernikov AuthorDate: 2021-03-30 14:03:28 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-05 02:35:19 +0000 Enforce check for using the return result for ifa?_try_ref(). Suggested by: hps MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29504 --- sys/net/if_var.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/if_var.h b/sys/net/if_var.h index 1f82dd028379..052ec6b407a0 100644 --- a/sys/net/if_var.h +++ b/sys/net/if_var.h @@ -577,7 +577,7 @@ struct ifaddr { struct ifaddr * ifa_alloc(size_t size, int flags); void ifa_free(struct ifaddr *ifa); void ifa_ref(struct ifaddr *ifa); -int ifa_try_ref(struct ifaddr *ifa); +int __result_use_check ifa_try_ref(struct ifaddr *ifa); /* * Multicast address structure. This is analogous to the ifaddr @@ -662,7 +662,7 @@ int if_printf(struct ifnet *, const char *, ...) __printflike(2, 3); int if_log(struct ifnet *, int, const char *, ...) __printflike(3, 4); void if_ref(struct ifnet *); void if_rele(struct ifnet *); -bool if_try_ref(struct ifnet *); +bool __result_use_check if_try_ref(struct ifnet *); int if_setlladdr(struct ifnet *, const u_char *, int); int if_tunnel_check_nesting(struct ifnet *, struct mbuf *, uint32_t, int); void if_up(struct ifnet *); From owner-dev-commits-src-all@freebsd.org Thu Apr 8 20:38:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 703475BEB15; Thu, 8 Apr 2021 20:38: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 4FGY592nSmz4Z2W; Thu, 8 Apr 2021 20:38: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 528F8110EF; Thu, 8 Apr 2021 20:38: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 138KcrEk035311; Thu, 8 Apr 2021 20:38:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138Kcriv035310; Thu, 8 Apr 2021 20:38:53 GMT (envelope-from git) Date: Thu, 8 Apr 2021 20:38:53 GMT Message-Id: <202104082038.138Kcriv035310@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Alexander V. Chernikov" Subject: git: c3254131a4af - stable/13 - Fix fib algo rebuild delay calculation. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c3254131a4af1a0fb66a2b5431b0a918676f4256 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 20:38:53 -0000 The branch stable/13 has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=c3254131a4af1a0fb66a2b5431b0a918676f4256 commit c3254131a4af1a0fb66a2b5431b0a918676f4256 Author: Alexander V. Chernikov AuthorDate: 2021-03-15 21:09:07 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-08 20:15:04 +0000 Fix fib algo rebuild delay calculation. Submitted by: Marco Zec (cherry picked from commit e4ac3f74637778981b2d89745188bb2a39e24e42) --- sys/net/route/fib_algo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index b2aa2de087de..03c265d28d09 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -462,7 +462,7 @@ static void schedule_callout(struct fib_data *fd, int delay_ms) { - callout_reset_sbt(&fd->fd_callout, 0, SBT_1MS * delay_ms, + callout_reset_sbt(&fd->fd_callout, SBT_1MS * delay_ms, 0, rebuild_fd_callout, fd, 0); } From owner-dev-commits-src-all@freebsd.org Thu Apr 8 21:08:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7543B5BFAE7; Thu, 8 Apr 2021 21:08: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 4FGYkq2tDdz4dNW; Thu, 8 Apr 2021 21:08: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 55A3D11AC7; Thu, 8 Apr 2021 21:08: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 138L837B075723; Thu, 8 Apr 2021 21:08:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138L83xd075722; Thu, 8 Apr 2021 21:08:03 GMT (envelope-from git) Date: Thu, 8 Apr 2021 21:08:03 GMT Message-Id: <202104082108.138L83xd075722@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: 05a39c2c1c18 - main - nfsd: fix replies from session cache for retried RPCs 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: 05a39c2c1c18cd0c4382a4f58e0952d3f77e7dfa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 21:08:03 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=05a39c2c1c18cd0c4382a4f58e0952d3f77e7dfa commit 05a39c2c1c18cd0c4382a4f58e0952d3f77e7dfa Author: Rick Macklem AuthorDate: 2021-04-08 21:04:22 +0000 Commit: Rick Macklem CommitDate: 2021-04-08 21:04:22 +0000 nfsd: fix replies from session cache for retried RPCs Recent testing of network partitioning a FreeBSD NFSv4.1 server from a Linux NFSv4.1 client identified problems with both the FreeBSD server and Linux client. The FreeBSD server failec to reply using the cached reply in the session slot when an RPC was retried on the session slot, as indicated by same slot sequence#. This patch fixes this. It should also fix a similar failure for NFSv4.0 mounts, when the sequence# in the open/lock_owner requires a reply be done from an entry locked into the DRC. This fix affects the fairly rare case where a NFSv4 client retries a non-idempotent RPC, such as a lock operation. Note that retries only occur after the client has needed to create a new TCP connection. MFC after: 2 weeks --- sys/fs/nfsserver/nfs_nfsdkrpc.c | 7 ++++++- sys/fs/nfsserver/nfs_nfsdsubs.c | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfsserver/nfs_nfsdkrpc.c b/sys/fs/nfsserver/nfs_nfsdkrpc.c index 7265e439d6a0..44f585ff0beb 100644 --- a/sys/fs/nfsserver/nfs_nfsdkrpc.c +++ b/sys/fs/nfsserver/nfs_nfsdkrpc.c @@ -410,8 +410,13 @@ nfs_proc(struct nfsrv_descript *nd, u_int32_t xid, SVCXPRT *xprt, m = NULL; if ((nd->nd_flag & ND_HASSEQUENCE) != 0) nfsrv_cache_session(nd, &m); - if (nd->nd_repstat == NFSERR_REPLYFROMCACHE) + if (nd->nd_repstat == NFSERR_REPLYFROMCACHE) { nd->nd_repstat = 0; + if (m != NULL) { + m_freem(nd->nd_mreq); + nd->nd_mreq = m; + } + } cacherep = RC_REPLY; } else { if (nd->nd_repstat == NFSERR_DONTREPLY) diff --git a/sys/fs/nfsserver/nfs_nfsdsubs.c b/sys/fs/nfsserver/nfs_nfsdsubs.c index ac28119028c4..49c5cac999c7 100644 --- a/sys/fs/nfsserver/nfs_nfsdsubs.c +++ b/sys/fs/nfsserver/nfs_nfsdsubs.c @@ -1553,6 +1553,8 @@ nfsd_errmap(struct nfsrv_descript *nd) else if (nd->nd_repstat == NFSERR_MINORVERMISMATCH || nd->nd_repstat == NFSERR_OPILLEGAL) return (txdr_unsigned(nd->nd_repstat)); + else if (nd->nd_repstat == NFSERR_REPLYFROMCACHE) + return (txdr_unsigned(NFSERR_IO)); else if ((nd->nd_flag & ND_NFSV41) != 0) { if (nd->nd_repstat == EOPNOTSUPP) nd->nd_repstat = NFSERR_NOTSUPP; From owner-dev-commits-src-all@freebsd.org Thu Apr 8 21:34:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C98785C0B8D; Thu, 8 Apr 2021 21:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FGZKF4SQ8z4gnj; Thu, 8 Apr 2021 21:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 824FC12245; Thu, 8 Apr 2021 21:34:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 138LYP0J015381; Thu, 8 Apr 2021 21:34:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138LYPCH015380; Thu, 8 Apr 2021 21:34:25 GMT (envelope-from git) Date: Thu, 8 Apr 2021 21:34:25 GMT Message-Id: <202104082134.138LYPCH015380@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 5061d5a0cfaf - stable/12 - mount_nullfs: rename a local variable 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 5061d5a0cfaf68a6891db82f6bd26ad3e72e87b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 21:34:25 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=5061d5a0cfaf68a6891db82f6bd26ad3e72e87b1 commit 5061d5a0cfaf68a6891db82f6bd26ad3e72e87b1 Author: Alan Somers AuthorDate: 2021-02-12 18:30:52 +0000 Commit: Alan Somers CommitDate: 2021-04-08 21:32:55 +0000 mount_nullfs: rename a local variable The "source" variable was introduced in r26072, probably as the traditional counterpart to "target". But the "source"/"target" names suggest the opposite of their actual meaning. With ln, for example, the source is the real file and the target is the newly created link. In mount_nullfs the meaning is the opposite: the target is the existing file system and the source is the newly created mountpoint. Better to use "target"/"mountpoint" terminology, which matches the man page. Sponsored by: Axcient (cherry picked from commit f540cb27a23719d88b7e5143be6e62f75dd25f08) --- sbin/mount_nullfs/mount_nullfs.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sbin/mount_nullfs/mount_nullfs.c b/sbin/mount_nullfs/mount_nullfs.c index e62f60bd022d..3bb46fdfd66c 100644 --- a/sbin/mount_nullfs/mount_nullfs.c +++ b/sbin/mount_nullfs/mount_nullfs.c @@ -67,7 +67,7 @@ main(int argc, char *argv[]) { struct iovec *iov; char *p, *val; - char source[MAXPATHLEN]; + char mountpoint[MAXPATHLEN]; char target[MAXPATHLEN]; char errmsg[255]; int ch, iovlen; @@ -98,25 +98,25 @@ main(int argc, char *argv[]) if (argc != 2) usage(); - /* resolve target and source with realpath(3) */ + /* resolve target and mountpoint with realpath(3) */ if (checkpath(argv[0], target) != 0) err(EX_USAGE, "%s", target); - if (checkpath(argv[1], source) != 0) - err(EX_USAGE, "%s", source); + if (checkpath(argv[1], mountpoint) != 0) + err(EX_USAGE, "%s", mountpoint); if (subdir(target, source) || subdir(source, target)) errx(EX_USAGE, "%s (%s) and %s are not distinct paths", argv[0], target, argv[1]); build_iovec(&iov, &iovlen, "fstype", nullfs, (size_t)-1); - build_iovec(&iov, &iovlen, "fspath", source, (size_t)-1); + build_iovec(&iov, &iovlen, "fspath", mountpoint, (size_t)-1); build_iovec(&iov, &iovlen, "target", target, (size_t)-1); build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); if (nmount(iov, iovlen, 0) < 0) { if (errmsg[0] != 0) - err(1, "%s: %s", source, errmsg); + err(1, "%s: %s", mountpoint, errmsg); else - err(1, "%s", source); + err(1, "%s", mountpoint); } exit(0); } From owner-dev-commits-src-all@freebsd.org Thu Apr 8 21:34:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C24105C0C04; Thu, 8 Apr 2021 21:34: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 4FGZKG53z3z4gcf; Thu, 8 Apr 2021 21:34:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E7BD11FBA; Thu, 8 Apr 2021 21:34:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 138LYQCs015402; Thu, 8 Apr 2021 21:34:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138LYQls015401; Thu, 8 Apr 2021 21:34:26 GMT (envelope-from git) Date: Thu, 8 Apr 2021 21:34:26 GMT Message-Id: <202104082134.138LYQls015401@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: e02c4d8d9bc7 - stable/12 - fusefs: set d_off during VOP_READDIR 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/stable/12 X-Git-Reftype: branch X-Git-Commit: e02c4d8d9bc7c8a0ba4477c31cbac5b67283ea06 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 21:34:26 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=e02c4d8d9bc7c8a0ba4477c31cbac5b67283ea06 commit e02c4d8d9bc7c8a0ba4477c31cbac5b67283ea06 Author: Alan Somers AuthorDate: 2021-02-12 01:01:10 +0000 Commit: Alan Somers CommitDate: 2021-04-08 21:32:59 +0000 fusefs: set d_off during VOP_READDIR This allows d_off to be used with lseek to position the file so that getdirentries(2) will return the next entry. It is not used by readdir(3). PR: 253411 Reported by: John Millikin Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D28605 (cherry picked from commit 71befc35061b3c9d8cc07e34c5dce622c848fcdb) --- sys/fs/fuse/fuse_internal.c | 13 ++++---- tests/sys/fs/fusefs/Makefile | 3 ++ tests/sys/fs/fusefs/readdir.cc | 74 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 74 insertions(+), 16 deletions(-) diff --git a/sys/fs/fuse/fuse_internal.c b/sys/fs/fuse/fuse_internal.c index 22bc2d630971..57ff01cd70b7 100644 --- a/sys/fs/fuse/fuse_internal.c +++ b/sys/fs/fuse/fuse_internal.c @@ -584,7 +584,7 @@ fuse_internal_readdir_processdata(struct uio *uio, u_long **cookiesp) { int err = 0; - int bytesavail; + int oreclen; size_t freclen; struct dirent *de; @@ -621,10 +621,10 @@ fuse_internal_readdir_processdata(struct uio *uio, err = EINVAL; break; } - bytesavail = GENERIC_DIRSIZ((struct pseudo_dirent *) + oreclen = GENERIC_DIRSIZ((struct pseudo_dirent *) &fudge->namelen); - if (bytesavail > uio_resid(uio)) { + if (oreclen > uio_resid(uio)) { /* Out of space for the dir so we are done. */ err = -1; break; @@ -634,12 +634,13 @@ fuse_internal_readdir_processdata(struct uio *uio, * the requested offset in the directory is found. */ if (*fnd_start != 0) { - fiov_adjust(cookediov, bytesavail); - bzero(cookediov->base, bytesavail); + fiov_adjust(cookediov, oreclen); + bzero(cookediov->base, oreclen); de = (struct dirent *)cookediov->base; de->d_fileno = fudge->ino; - de->d_reclen = bytesavail; + de->d_off = fudge->off; + de->d_reclen = oreclen; de->d_type = fudge->type; de->d_namlen = fudge->namelen; memcpy((char *)cookediov->base + sizeof(struct dirent) - diff --git a/tests/sys/fs/fusefs/Makefile b/tests/sys/fs/fusefs/Makefile index ebe4061c1668..c3cf1f14e5bf 100644 --- a/tests/sys/fs/fusefs/Makefile +++ b/tests/sys/fs/fusefs/Makefile @@ -69,6 +69,9 @@ FUSEFS= ${SRCTOP}/sys/fs/fuse MOUNT= ${SRCTOP}/sbin/mount # Suppress warnings that GCC generates for the libc++ and gtest headers. CXXWARNFLAGS.gcc+= -Wno-placement-new -Wno-attributes +# Suppress Wcast-align for readdir.cc, because it is unavoidable when using +# getdirentries. +CXXWARNFLAGS.readdir.cc+= -Wno-cast-align .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 80000 CXXWARNFLAGS+= -Wno-class-memaccess .endif diff --git a/tests/sys/fs/fusefs/readdir.cc b/tests/sys/fs/fusefs/readdir.cc index 8f0b9742890e..b6b807f350e9 100644 --- a/tests/sys/fs/fusefs/readdir.cc +++ b/tests/sys/fs/fusefs/readdir.cc @@ -62,6 +62,9 @@ void expect_lookup(const char *relpath, uint64_t ino) } }; +const char dot[] = "."; +const char dotdot[] = ".."; + /* FUSE_READDIR returns nothing but "." and ".." */ TEST_F(Readdir, dots) { @@ -72,8 +75,6 @@ TEST_F(Readdir, dots) struct dirent *de; vector ents(2); vector empty_ents(0); - const char dot[] = "."; - const char dotdot[] = ".."; expect_lookup(RELPATH, ino); expect_opendir(ino); @@ -98,11 +99,6 @@ TEST_F(Readdir, dots) de = readdir(dir); ASSERT_NE(nullptr, de) << strerror(errno); EXPECT_EQ(2ul, de->d_fileno); - /* - * fuse(4) doesn't actually set d_off, which is ok for now because - * nothing uses it. - */ - //EXPECT_EQ(2000, de->d_off); EXPECT_EQ(DT_DIR, de->d_type); EXPECT_EQ(sizeof(dotdot), de->d_namlen); EXPECT_EQ(0, strcmp(dotdot, de->d_name)); @@ -111,7 +107,6 @@ TEST_F(Readdir, dots) de = readdir(dir); ASSERT_NE(nullptr, de) << strerror(errno); EXPECT_EQ(3ul, de->d_fileno); - //EXPECT_EQ(3000, de->d_off); EXPECT_EQ(DT_DIR, de->d_type); EXPECT_EQ(sizeof(dot), de->d_namlen); EXPECT_EQ(0, strcmp(dot, de->d_name)); @@ -153,8 +148,11 @@ TEST_F(Readdir, eio) leakdir(dir); } -/* getdirentries(2) can use a larger buffer size than readdir(3) */ -TEST_F(Readdir, getdirentries) +/* + * getdirentries(2) can use a larger buffer size than readdir(3). It also has + * some additional non-standardized fields in the returned dirent. + */ +TEST_F(Readdir, getdirentries_empty) { const char FULLPATH[] = "mountpoint/some_dir"; const char RELPATH[] = "some_dir"; @@ -186,6 +184,62 @@ TEST_F(Readdir, getdirentries) leak(fd); } +/* + * The dirent.d_off field can be used with lseek to position the directory so + * that getdirentries will return the subsequent dirent. + */ +TEST_F(Readdir, getdirentries_seek) +{ + const char FULLPATH[] = "mountpoint/some_dir"; + const char RELPATH[] = "some_dir"; + vector ents0(2); + vector ents1(1); + uint64_t ino = 42; + int fd; + const size_t bufsize = 8192; + char buf[bufsize]; + struct dirent *de0, *de1; + ssize_t r; + + expect_lookup(RELPATH, ino); + expect_opendir(ino); + + ents0[0].d_fileno = 2; + ents0[0].d_off = 2000; + ents0[0].d_namlen = sizeof(dotdot); + ents0[0].d_type = DT_DIR; + strncpy(ents0[0].d_name, dotdot, ents0[0].d_namlen); + expect_readdir(ino, 0, ents0); + ents0[1].d_fileno = 3; + ents0[1].d_off = 3000; + ents0[1].d_namlen = sizeof(dot); + ents0[1].d_type = DT_DIR; + ents1[0].d_fileno = 3; + ents1[0].d_off = 3000; + ents1[0].d_namlen = sizeof(dot); + ents1[0].d_type = DT_DIR; + strncpy(ents1[0].d_name, dot, ents1[0].d_namlen); + expect_readdir(ino, 0, ents0); + expect_readdir(ino, 2000, ents1); + + fd = open(FULLPATH, O_DIRECTORY); + ASSERT_LE(0, fd) << strerror(errno); + r = getdirentries(fd, buf, sizeof(buf), 0); + ASSERT_LT(0, r) << strerror(errno); + de0 = (struct dirent*)&buf[0]; + ASSERT_EQ(2000, de0->d_off); + ASSERT_LT(de0->d_reclen + offsetof(struct dirent, d_fileno), bufsize); + de1 = (struct dirent*)(&(buf[de0->d_reclen])); + ASSERT_EQ(3ul, de1->d_fileno); + + r = lseek(fd, de0->d_off, SEEK_SET); + ASSERT_LE(0, r); + r = getdirentries(fd, buf, sizeof(buf), 0); + ASSERT_LT(0, r) << strerror(errno); + de0 = (struct dirent*)&buf[0]; + ASSERT_EQ(3000, de0->d_off); +} + /* * Nothing bad should happen if getdirentries is called on two file descriptors * which were concurrently open, but one has already been closed. From owner-dev-commits-src-all@freebsd.org Thu Apr 8 21:34:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B6405C0D12; Thu, 8 Apr 2021 21:34:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FGZKL1sSbz4gbB; Thu, 8 Apr 2021 21:34: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 1345912246; Thu, 8 Apr 2021 21:34: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 138LYSoN015444; Thu, 8 Apr 2021 21:34:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138LYSkA015443; Thu, 8 Apr 2021 21:34:28 GMT (envelope-from git) Date: Thu, 8 Apr 2021 21:34:28 GMT Message-Id: <202104082134.138LYSkA015443@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 8cfe6a4729f5 - stable/12 - Speed up geom_stats_resync in the presence of many devices 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 8cfe6a4729f598d8a65d846a01184f1fabe2ebc7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 21:34:31 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=8cfe6a4729f598d8a65d846a01184f1fabe2ebc7 commit 8cfe6a4729f598d8a65d846a01184f1fabe2ebc7 Author: Alan Somers AuthorDate: 2021-02-27 15:59:40 +0000 Commit: Alan Somers CommitDate: 2021-04-08 21:33:09 +0000 Speed up geom_stats_resync in the presence of many devices The old code had a O(n) loop, where n is the size of /dev/devstat. Multiply that by another O(n) loop in devstat_mmap for a total of O(n^2). This change adds DIOCGMEDIASIZE support to /dev/devstat so userland can quickly determine the right amount of memory to map, eliminating the O(n) loop in userland. This change decreases the time to run "gstat -bI0.001" with 16,384 md devices from 29.7s to 4.2s. Also, fix a memory leak first reported as PR 203097. Sponsored by: Axcient Reviewed by: mav, imp Differential Revision: https://reviews.freebsd.org/D28968 (cherry picked from commit ab63da3564e8ab0907f9d8eb565774848ffdadeb) --- lib/libgeom/geom_stats.c | 26 +++++++++++++++++--------- sys/kern/subr_devstat.c | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/lib/libgeom/geom_stats.c b/lib/libgeom/geom_stats.c index ebf7868c3c65..450ee491ea1c 100644 --- a/lib/libgeom/geom_stats.c +++ b/lib/libgeom/geom_stats.c @@ -32,9 +32,12 @@ */ #include +#include +#include #include #include #include +#include #include #include #include @@ -53,7 +56,7 @@ geom_stats_close(void) { if (statsfd == -1) return; - munmap(statp, npages *pagesize); + munmap(statp, npages * pagesize); statp = NULL; close (statsfd); statsfd = -1; @@ -63,17 +66,22 @@ void geom_stats_resync(void) { void *p; + off_t mediasize; + int error; if (statsfd == -1) return; - for (;;) { - p = mmap(statp, (npages + 1) * pagesize, - PROT_READ, MAP_SHARED, statsfd, 0); - if (p == MAP_FAILED) - break; - else - statp = p; - npages++; + error = ioctl(statsfd, DIOCGMEDIASIZE, &mediasize); + if (error) + err(1, "DIOCGMEDIASIZE(" _PATH_DEV DEVSTAT_DEVICE_NAME ")"); + + munmap(statp, npages * pagesize); + p = mmap(statp, mediasize, PROT_READ, MAP_SHARED, statsfd, 0); + if (p == MAP_FAILED) + err(1, "mmap(/dev/devstat):"); + else { + statp = p; + npages = mediasize / pagesize; } } diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index 617e1e439a94..1bbac1839f77 100644 --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -476,10 +477,12 @@ SYSCTL_INT(_kern_devstat, OID_AUTO, version, CTLFLAG_RD, #define statsperpage (PAGE_SIZE / sizeof(struct devstat)) +static d_ioctl_t devstat_ioctl; static d_mmap_t devstat_mmap; static struct cdevsw devstat_cdevsw = { .d_version = D_VERSION, + .d_ioctl = devstat_ioctl, .d_mmap = devstat_mmap, .d_name = "devstat", }; @@ -490,9 +493,26 @@ struct statspage { u_int nfree; }; +static size_t pagelist_pages = 0; static TAILQ_HEAD(, statspage) pagelist = TAILQ_HEAD_INITIALIZER(pagelist); static MALLOC_DEFINE(M_DEVSTAT, "devstat", "Device statistics"); +static int +devstat_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, + struct thread *td) +{ + int error = ENOTTY; + + switch (cmd) { + case DIOCGMEDIASIZE: + error = 0; + *(off_t *)data = pagelist_pages * PAGE_SIZE; + break; + } + + return (error); +} + static int devstat_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr) @@ -559,6 +579,7 @@ devstat_alloc(void) * head but the order on the list determine the * sequence of the mapping so we can't do that. */ + pagelist_pages++; TAILQ_INSERT_TAIL(&pagelist, spp, list); } else break; From owner-dev-commits-src-all@freebsd.org Thu Apr 8 21:34:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A641E5C0B91; Thu, 8 Apr 2021 21:34: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 4FGZKK10VSz4gXb; Thu, 8 Apr 2021 21:34: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 F4034121BF; Thu, 8 Apr 2021 21:34: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 138LYRoM015423; Thu, 8 Apr 2021 21:34:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138LYRMf015422; Thu, 8 Apr 2021 21:34:27 GMT (envelope-from git) Date: Thu, 8 Apr 2021 21:34:27 GMT Message-Id: <202104082134.138LYRMf015422@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 9e9ef41bec1f - stable/12 - fortune: add a tip about gstat 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 9e9ef41bec1f1c7b4bbccecebb6d8fad92104f7b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 21:34:31 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=9e9ef41bec1f1c7b4bbccecebb6d8fad92104f7b commit 9e9ef41bec1f1c7b4bbccecebb6d8fad92104f7b Author: Alan Somers AuthorDate: 2021-02-26 15:06:07 +0000 Commit: Alan Somers CommitDate: 2021-04-08 21:33:04 +0000 fortune: add a tip about gstat (cherry picked from commit 60a632f047cdb6e5314711f593a4d3b1f1d8dde9) --- usr.bin/fortune/datfiles/freebsd-tips | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index 5349bc6410c8..93075532cee4 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -799,3 +799,9 @@ always have space left this way. -- Benedict Reuschling % +Sometimes a single slow HDD can cripple the performance of your entire system. You can spot one like this: + +# gstat -I5s | sort -rn -k9 | head + + -- Alan Somers +% From owner-dev-commits-src-all@freebsd.org Thu Apr 8 21:34:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65D3A5C0D15; Thu, 8 Apr 2021 21:34: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 4FGZKN1Rkdz4gtL; Thu, 8 Apr 2021 21:34: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 37A0C11FBB; Thu, 8 Apr 2021 21:34: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 138LYTM6015472; Thu, 8 Apr 2021 21:34:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138LYT6A015471; Thu, 8 Apr 2021 21:34:29 GMT (envelope-from git) Date: Thu, 8 Apr 2021 21:34:29 GMT Message-Id: <202104082134.138LYT6A015471@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: dee863a2b5a5 - stable/12 - [skip ci] fix a typo in a comment in mdconfig.c 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/stable/12 X-Git-Reftype: branch X-Git-Commit: dee863a2b5a5d8ad8a1e661dac677a48f55431b3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 21:34:35 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=dee863a2b5a5d8ad8a1e661dac677a48f55431b3 commit dee863a2b5a5d8ad8a1e661dac677a48f55431b3 Author: Alan Somers AuthorDate: 2021-02-27 16:04:10 +0000 Commit: Alan Somers CommitDate: 2021-04-08 21:33:16 +0000 [skip ci] fix a typo in a comment in mdconfig.c Sponsored by: Axcient Reviewed by: mav, imp Differential Revision: https://reviews.freebsd.org/D28968 (cherry picked from commit d977417d74a704930b5952cbd653638ccd25eaa7) --- sbin/mdconfig/mdconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c index 933d448fde32..f61b947469b3 100644 --- a/sbin/mdconfig/mdconfig.c +++ b/sbin/mdconfig/mdconfig.c @@ -414,7 +414,7 @@ md_set_file(const char *fn) /* * Lists md(4) disks. Is used also as a query routine, since it handles XML * interface. 'units' can be NULL for listing memory disks. It might be - * coma-separated string containing md(4) disk names. 'opt' distinguished + * comma-separated string containing md(4) disk names. 'opt' distinguished * between list and query mode. */ static int From owner-dev-commits-src-all@freebsd.org Thu Apr 8 21:34:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D8485C0B1E; Thu, 8 Apr 2021 21:34: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 4FGZKP3ydNz4gpB; Thu, 8 Apr 2021 21:34: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 3D8E61214E; Thu, 8 Apr 2021 21:34:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 138LYVIk015493; Thu, 8 Apr 2021 21:34:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138LYVg4015492; Thu, 8 Apr 2021 21:34:31 GMT (envelope-from git) Date: Thu, 8 Apr 2021 21:34:31 GMT Message-Id: <202104082134.138LYVg4015492@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: e0c4ed73f3a6 - stable/12 - Modernize geom_stats_snapshot_get 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/stable/12 X-Git-Reftype: branch X-Git-Commit: e0c4ed73f3a6a83f24d9a0bfe89f288ff1b93463 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 21:34:36 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=e0c4ed73f3a6a83f24d9a0bfe89f288ff1b93463 commit e0c4ed73f3a6a83f24d9a0bfe89f288ff1b93463 Author: Alan Somers AuthorDate: 2021-03-03 20:06:38 +0000 Commit: Alan Somers CommitDate: 2021-04-08 21:33:22 +0000 Modernize geom_stats_snapshot_get * A logically useless memset() is used to fault in some memory pages. Change it to explicit_bzero so the compiler won't eliminate it. * Eliminate the second memset. It made sense in the days of the Big Kernel Lock, but not in the days of fine-grained SMP and especially not in the days of VDSO. Sponsored by: Axcient Reviewed by: phk Differential Revision: https://reviews.freebsd.org/D29047 (cherry picked from commit f05b724ecb310fb91da1947ae6c68647f58f5f12) --- lib/libgeom/geom_stats.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/libgeom/geom_stats.c b/lib/libgeom/geom_stats.c index 450ee491ea1c..7c9191e29686 100644 --- a/lib/libgeom/geom_stats.c +++ b/lib/libgeom/geom_stats.c @@ -136,9 +136,8 @@ geom_stats_snapshot_get(void) free(sp); return (NULL); } - memset(sp->ptr, 0, pagesize * npages); /* page in, cache */ + explicit_bzero(sp->ptr, pagesize * npages); /* page in, cache */ clock_gettime(CLOCK_REALTIME, &sp->time); - memset(sp->ptr, 0, pagesize * npages); /* page in, cache */ memcpy(sp->ptr, statp, pagesize * npages); sp->pages = npages; sp->perpage = spp; From owner-dev-commits-src-all@freebsd.org Thu Apr 8 21:34:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 837E95C0B22; Thu, 8 Apr 2021 21:34: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 4FGZKS2bG8z4gtg; Thu, 8 Apr 2021 21:34: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 32E8412063; Thu, 8 Apr 2021 21:34: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 138LYWAw015514; Thu, 8 Apr 2021 21:34:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138LYWL6015513; Thu, 8 Apr 2021 21:34:32 GMT (envelope-from git) Date: Thu, 8 Apr 2021 21:34:32 GMT Message-Id: <202104082134.138LYWL6015513@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 9a9c9e744b51 - stable/12 - fusefs: fix two bugs regarding fcntl file locks 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 9a9c9e744b51e00f3446afb922500e40845cddfa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 21:34:37 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=9a9c9e744b51e00f3446afb922500e40845cddfa commit 9a9c9e744b51e00f3446afb922500e40845cddfa Author: Alan Somers AuthorDate: 2021-03-18 20:27:27 +0000 Commit: Alan Somers CommitDate: 2021-04-08 21:33:55 +0000 fusefs: fix two bugs regarding fcntl file locks 1) F_SETLKW (blocking) operations would be sent to the FUSE server as F_SETLK (non-blocking). 2) Release operations, F_SETLK with lk_type = F_UNLCK, would simply return EINVAL. PR: 253500 Reported by: John Millikin (cherry picked from commit 929acdb19acb67cc0e6ee5439df98e28a84d4772) fusefs: fix a dead store in fuse_vnop_advlock kevans actually caught this in the original review and I fixed it, but then I committed an older copy of the branch. Whoops. Reported by: kevans Differential Revision: https://reviews.freebsd.org/D29031 (cherry picked from commit 9c5aac8f2e84ca4bbdf82514302c08c0453ec59b) --- sys/fs/fuse/fuse_vnops.c | 9 ++++++--- tests/sys/fs/fusefs/flush.cc | 12 ++++++++++- tests/sys/fs/fusefs/locks.cc | 45 +++++++++++++++++++++++++++++++++++++++++- tests/sys/fs/fusefs/release.cc | 12 ++++++++++- 4 files changed, 72 insertions(+), 6 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index eb99e1cc09c0..d30fc32d1dc5 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -412,10 +412,13 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) op = FUSE_GETLK; break; case F_SETLK: - op = FUSE_SETLK; + if (flags & F_WAIT) + op = FUSE_SETLKW; + else + op = FUSE_SETLK; break; - case F_SETLKW: - op = FUSE_SETLKW; + case F_UNLCK: + op = FUSE_SETLK; break; default: return EINVAL; diff --git a/tests/sys/fs/fusefs/flush.cc b/tests/sys/fs/fusefs/flush.cc index 4d5a87bd66d5..d31a9fdaa386 100644 --- a/tests/sys/fs/fusefs/flush.cc +++ b/tests/sys/fs/fusefs/flush.cc @@ -210,6 +210,16 @@ TEST_F(FlushWithLocks, unlock_on_close) ResultOf([=](auto in) { return (in.header.opcode == FUSE_SETLK && in.header.nodeid == ino && + in.body.setlk.lk.type == F_RDLCK && + in.body.setlk.fh == FH); + }, Eq(true)), + _) + ).WillOnce(Invoke(ReturnErrno(0))); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_SETLK && + in.header.nodeid == ino && + in.body.setlk.lk.type == F_UNLCK && in.body.setlk.fh == FH); }, Eq(true)), _) @@ -224,7 +234,7 @@ TEST_F(FlushWithLocks, unlock_on_close) fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; - ASSERT_NE(-1, fcntl(fd, F_SETLKW, &fl)) << strerror(errno); + ASSERT_NE(-1, fcntl(fd, F_SETLK, &fl)) << strerror(errno); fd2 = open(FULLPATH, O_WRONLY); ASSERT_LE(0, fd2) << strerror(errno); diff --git a/tests/sys/fs/fusefs/locks.cc b/tests/sys/fs/fusefs/locks.cc index f3f1d42637d9..49f495412259 100644 --- a/tests/sys/fs/fusefs/locks.cc +++ b/tests/sys/fs/fusefs/locks.cc @@ -72,6 +72,23 @@ void expect_setlk(uint64_t ino, pid_t pid, uint64_t start, uint64_t end, return (in.header.opcode == FUSE_SETLK && in.header.nodeid == ino && in.body.setlk.fh == FH && + in.body.setlk.owner == (uint32_t)pid && + in.body.setlk.lk.start == start && + in.body.setlk.lk.end == end && + in.body.setlk.lk.type == type && + in.body.setlk.lk.pid == (uint64_t)pid); + }, Eq(true)), + _) + ).WillOnce(Invoke(ReturnErrno(err))); +} +void expect_setlkw(uint64_t ino, pid_t pid, uint64_t start, uint64_t end, + uint32_t type, int err) +{ + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_SETLKW && + in.header.nodeid == ino && + in.body.setlkw.fh == FH && in.body.setlkw.owner == (uint32_t)pid && in.body.setlkw.lk.start == start && in.body.setlkw.lk.end == end && @@ -343,6 +360,32 @@ TEST_F(SetlkFallback, local) leak(fd); } +/* Clear a lock with FUSE_SETLK */ +TEST_F(Setlk, clear) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + uint64_t ino = 42; + struct flock fl; + int fd; + pid_t pid = 1234; + + expect_lookup(RELPATH, ino); + expect_open(ino, 0, 1); + expect_setlk(ino, pid, 10, 1009, F_UNLCK, 0); + + fd = open(FULLPATH, O_RDWR); + ASSERT_LE(0, fd) << strerror(errno); + fl.l_start = 10; + fl.l_len = 1000; + fl.l_pid = pid; + fl.l_type = F_UNLCK; + fl.l_whence = SEEK_SET; + fl.l_sysid = 0; + ASSERT_NE(-1, fcntl(fd, F_SETLK, &fl)) << strerror(errno); + leak(fd); +} + /* Set a new lock with FUSE_SETLK */ TEST_F(Setlk, set) { @@ -465,7 +508,7 @@ TEST_F(Setlkw, set) expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); - expect_setlk(ino, pid, 10, 1009, F_RDLCK, 0); + expect_setlkw(ino, pid, 10, 1009, F_RDLCK, 0); fd = open(FULLPATH, O_RDWR); ASSERT_LE(0, fd) << strerror(errno); diff --git a/tests/sys/fs/fusefs/release.cc b/tests/sys/fs/fusefs/release.cc index 3caf8589352d..daa3ce39f573 100644 --- a/tests/sys/fs/fusefs/release.cc +++ b/tests/sys/fs/fusefs/release.cc @@ -206,6 +206,16 @@ TEST_F(ReleaseWithLocks, unlock_on_close) ResultOf([=](auto in) { return (in.header.opcode == FUSE_SETLK && in.header.nodeid == ino && + in.body.setlk.lk.type == F_RDLCK && + in.body.setlk.fh == FH); + }, Eq(true)), + _) + ).WillOnce(Invoke(ReturnErrno(0))); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_SETLK && + in.header.nodeid == ino && + in.body.setlk.lk.type == F_UNLCK && in.body.setlk.fh == FH); }, Eq(true)), _) @@ -221,7 +231,7 @@ TEST_F(ReleaseWithLocks, unlock_on_close) fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; - ASSERT_NE(-1, fcntl(fd, F_SETLKW, &fl)) << strerror(errno); + ASSERT_NE(-1, fcntl(fd, F_SETLK, &fl)) << strerror(errno); ASSERT_EQ(0, close(fd)) << strerror(errno); } From owner-dev-commits-src-all@freebsd.org Thu Apr 8 21:34:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82F365C0CB1; Thu, 8 Apr 2021 21:34: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 4FGZKS3LpVz4gpM; Thu, 8 Apr 2021 21:34: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 71B6C12064; Thu, 8 Apr 2021 21:34: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 138LYXar015535; Thu, 8 Apr 2021 21:34:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138LYXdQ015534; Thu, 8 Apr 2021 21:34:33 GMT (envelope-from git) Date: Thu, 8 Apr 2021 21:34:33 GMT Message-Id: <202104082134.138LYXdQ015534@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: ebe13089b5fa - stable/12 - mpsutil.8: fix typos in the man page 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/stable/12 X-Git-Reftype: branch X-Git-Commit: ebe13089b5fa449f4c773a466f1ef82908924dfe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 21:34:37 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=ebe13089b5fa449f4c773a466f1ef82908924dfe commit ebe13089b5fa449f4c773a466f1ef82908924dfe Author: Alan Somers AuthorDate: 2021-03-25 14:43:40 +0000 Commit: Alan Somers CommitDate: 2021-04-08 21:34:14 +0000 mpsutil.8: fix typos in the man page Sponsored by: Axcient (cherry picked from commit f073ab8712a032faecf1fb94c4491fd555461ad8) --- usr.sbin/mpsutil/mpsutil.8 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/mpsutil/mpsutil.8 b/usr.sbin/mpsutil/mpsutil.8 index e4f966355fdd..1dd4f0509174 100644 --- a/usr.sbin/mpsutil/mpsutil.8 +++ b/usr.sbin/mpsutil/mpsutil.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 17, 2015 +.Dd March 25, 2021 .Dt MPSUTIL 8 .Os .Sh NAME @@ -45,7 +45,7 @@ .Cm show all .Nm .Op Fl u Ar unit -.Cm show cfgpages page +.Cm show cfgpage page .Op Ar num .Op Ar addr .Nm @@ -129,7 +129,7 @@ Displays all enclosures. .It Cm show iocfacts Displays IOC Facts messages. .It Cm show cfgpage page Oo Ar num Oc Op Ar addr -Show IOC Facts Message +Dump raw config page in hex. .El .Pp Controller management commands include: From owner-dev-commits-src-all@freebsd.org Thu Apr 8 21:39:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D634B5C0EE3; Thu, 8 Apr 2021 21:39: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 4FGZQw5khbz4hlv; Thu, 8 Apr 2021 21:39: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 B367E11CDC; Thu, 8 Apr 2021 21:39: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 138LdKC9016116; Thu, 8 Apr 2021 21:39:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138LdKun016115; Thu, 8 Apr 2021 21:39:20 GMT (envelope-from git) Date: Thu, 8 Apr 2021 21:39:20 GMT Message-Id: <202104082139.138LdKun016115@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: fbd57fb445ce - stable/13 - tcp: Perform simple fast retransmit when SACK Blocks are missing on SACK session 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/stable/13 X-Git-Reftype: branch X-Git-Commit: fbd57fb445ce049c9d477e8357de6a299290405c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 21:39:20 -0000 The branch stable/13 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=fbd57fb445ce049c9d477e8357de6a299290405c commit fbd57fb445ce049c9d477e8357de6a299290405c Author: Richard Scheffenegger AuthorDate: 2021-03-25 22:18:06 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-08 21:12:26 +0000 tcp: Perform simple fast retransmit when SACK Blocks are missing on SACK session MFC after: 2 weeks Reviewed By: #transport, rrs Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D28634 (cherry picked from commit 0533fab89e37caab886568df88d9f939e85eeb6c) --- sys/netinet/tcp_input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 4b0f102ca51b..ea9b03ae4a4d 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -2564,6 +2564,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, */ if (th->th_ack != tp->snd_una || ((tp->t_flags & TF_SACK_PERMIT) && + (to.to_flags & TOF_SACK) && !sack_changed)) break; else if (!tcp_timer_active(tp, TT_REXMT)) @@ -2617,6 +2618,7 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, tp->snd_cwnd = imax(maxseg, tp->snd_nxt - tp->snd_recover + tp->sackhint.sack_bytes_rexmit + (snd_cnt * maxseg)); } else if ((tp->t_flags & TF_SACK_PERMIT) && + (to.to_flags & TOF_SACK) && IN_FASTRECOVERY(tp->t_flags)) { int awnd; @@ -2694,7 +2696,8 @@ enter_recovery: tp->sackhint.recover_fs = max(1, tp->snd_nxt - tp->snd_una); } - if (tp->t_flags & TF_SACK_PERMIT) { + if ((tp->t_flags & TF_SACK_PERMIT) && + (to.to_flags & TOF_SACK)) { TCPSTAT_INC( tcps_sack_recovery_episode); tp->snd_recover = tp->snd_nxt; From owner-dev-commits-src-all@freebsd.org Thu Apr 8 22:06:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93D615C1FAB; Thu, 8 Apr 2021 22:06: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 4FGb2Z3pRHz4lZ1; Thu, 8 Apr 2021 22:06: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 711791281B; Thu, 8 Apr 2021 22:06: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 138M6kZE056634; Thu, 8 Apr 2021 22:06:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138M6k43056633; Thu, 8 Apr 2021 22:06:46 GMT (envelope-from git) Date: Thu, 8 Apr 2021 22:06:46 GMT Message-Id: <202104082206.138M6k43056633@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: 5af1131de7fc - main - struct mount uppers: correct locking annotations 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: 5af1131de7fc18c795ed28e69d9393f78875d3e5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 22:06:46 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=5af1131de7fc18c795ed28e69d9393f78875d3e5 commit 5af1131de7fc18c795ed28e69d9393f78875d3e5 Author: Konstantin Belousov AuthorDate: 2021-04-08 22:03:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-08 22:06:26 +0000 struct mount uppers: correct locking annotations It is all locked by the uppers' interlock. Noted by: Alexander Lochmann Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/sys/mount.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 630cd521fbd0..a6d750a1ff37 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -198,6 +198,7 @@ _Static_assert(sizeof(struct mount_pcpu) == 16, * l - mnt_listmtx * m - mountlist_mtx * i - interlock + * i* - interlock of uppers' list head * v - vnode freelist mutex * * Unmarked fields are considered stable as long as a ref is held. @@ -242,8 +243,8 @@ struct mount { struct vnodelst mnt_lazyvnodelist; /* (l) list of lazy vnodes */ int mnt_lazyvnodelistsize; /* (l) # of lazy vnodes */ struct lock mnt_explock; /* vfs_export walkers lock */ - TAILQ_ENTRY(mount) mnt_upper_link; /* (m) we in the all uppers */ - TAILQ_HEAD(, mount) mnt_uppers; /* (m) upper mounts over us*/ + TAILQ_ENTRY(mount) mnt_upper_link; /* (i*) we in the all uppers */ + TAILQ_HEAD(, mount) mnt_uppers; /* (i) upper mounts over us */ }; #endif /* _WANT_MOUNT || _KERNEL */ From owner-dev-commits-src-all@freebsd.org Thu Apr 8 22:19:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD2965C244A for ; Thu, 8 Apr 2021 22:19:23 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (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 4FGbK70VPZz4ms5 for ; Thu, 8 Apr 2021 22:19:22 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oo1-f44.google.com with SMTP id 125-20020a4a1a830000b02901b6a144a417so872989oof.13 for ; Thu, 08 Apr 2021 15:19:22 -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:cc; bh=bSLpcVXyXg244hDTLqlRCq2ypmpZ5dHDYGCp1Kth4/0=; b=KiklNnPXO7k9LjAEes2jRqaCEdDYY6/NywRSi1WiaAHo30uYfxSy8GEisqdq315SL+ e9DtCxLDzq9DiEgD4XCJreQpaIdePshwTW4i8L6RdthNcZcaeRSyPW44ZYfnO8J9V9QV fCIdXTz3rDHO7Yy6RaGC5/6vAq80jFJBIKHEWU4WrOHetSiX4rL2Yw+1Fw6hSU/LYG8u LlOZajZDoUh0ppjEzruHDR+3tSrb1DWN551daqLjiA9FUa0RSY36Nrkr4qeP5dK05eFU kVRmTPMxkQTBdtfUCUnUA3THAuXlj9Ev9scxchm6JrShqTtygNt+i5h0RBO3v1TXlrVg u3Ww== X-Gm-Message-State: AOAM532cjF2STW+GGRRCBiOnCrp0fEFtANiwi7gtQF08m/nv5ZOMnWLf vMPRD4FS1HwEuxfpMpRUl8E73TqI0Ul4WEJQbhI= X-Received: by 2002:a4a:4005:: with SMTP id n5mt8209042ooa.61.1617920361881; Thu, 08 Apr 2021 15:19:21 -0700 (PDT) MIME-Version: 1.0 References: <202104082134.138LYPCH015380@gitrepo.freebsd.org> In-Reply-To: <202104082134.138LYPCH015380@gitrepo.freebsd.org> From: Alan Somers Date: Thu, 8 Apr 2021 16:19:10 -0600 Message-ID: Subject: Re: git: 5061d5a0cfaf - stable/12 - mount_nullfs: rename a local variable Cc: src-committers , "" , dev-commits-src-branches@freebsd.org X-Rspamd-Queue-Id: 4FGbK70VPZz4ms5 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.161.44 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-1.00 / 15.00]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; RWL_MAILSPIKE_GOOD(0.00)[209.85.161.44:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MISSING_TO(2.00)[]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.161.44:from]; R_DKIM_NA(0.00)[]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FREEFALL_USER(0.00)[asomers]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[dev-commits-src-all@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; SPAMHAUS_ZRD(0.00)[209.85.161.44:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[209.85.161.44:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[dev-commits-src-all] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 22:19:23 -0000 On Thu, Apr 8, 2021 at 3:34 PM Alan Somers wrote: > The branch stable/12 has been updated by asomers: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=5061d5a0cfaf68a6891db82f6bd26ad3e72e87b1 > > commit 5061d5a0cfaf68a6891db82f6bd26ad3e72e87b1 > Author: Alan Somers > AuthorDate: 2021-02-12 18:30:52 +0000 > Commit: Alan Somers > CommitDate: 2021-04-08 21:32:55 +0000 > > mount_nullfs: rename a local variable > > The "source" variable was introduced in r26072, probably as the > traditional counterpart to "target". But the "source"/"target" names > suggest the opposite of their actual meaning. With ln, for example, > the > source is the real file and the target is the newly created link. In > mount_nullfs the meaning is the opposite: the target is the existing > file system and the source is the newly created mountpoint. Better to > use "target"/"mountpoint" terminology, which matches the man page. > > Sponsored by: Axcient > > (cherry picked from commit f540cb27a23719d88b7e5143be6e62f75dd25f08) > Oops, this broke the build. I did a build test, but forgot to check that the build actually passed. I'll fix it shortly. -Alan From owner-dev-commits-src-all@freebsd.org Thu Apr 8 23:12:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E39E35C3871; Thu, 8 Apr 2021 23:12: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 4FGcVm61N1z4rSt; Thu, 8 Apr 2021 23:12: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 C1D6F13941; Thu, 8 Apr 2021 23:12: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 138NCmie049240; Thu, 8 Apr 2021 23:12:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 138NCmpu049239; Thu, 8 Apr 2021 23:12:48 GMT (envelope-from git) Date: Thu, 8 Apr 2021 23:12:48 GMT Message-Id: <202104082312.138NCmpu049239@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 4934396cd3e6 - stable/12 - Fix the build after 5061d5a0cfaf68a6891db82f6bd26ad3e72e87b1 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 4934396cd3e6514bbedec11bec4cbb40e4707f53 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 23:12:48 -0000 The branch stable/12 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=4934396cd3e6514bbedec11bec4cbb40e4707f53 commit 4934396cd3e6514bbedec11bec4cbb40e4707f53 Author: Alan Somers AuthorDate: 2021-04-08 23:11:00 +0000 Commit: Alan Somers CommitDate: 2021-04-08 23:11:00 +0000 Fix the build after 5061d5a0cfaf68a6891db82f6bd26ad3e72e87b1 A merge conflict in the MFC broke the build. Direct commit to stable/12 because main and stable/13 are unaffected. --- sbin/mount_nullfs/mount_nullfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/mount_nullfs/mount_nullfs.c b/sbin/mount_nullfs/mount_nullfs.c index 3bb46fdfd66c..cae818c35a49 100644 --- a/sbin/mount_nullfs/mount_nullfs.c +++ b/sbin/mount_nullfs/mount_nullfs.c @@ -104,7 +104,7 @@ main(int argc, char *argv[]) if (checkpath(argv[1], mountpoint) != 0) err(EX_USAGE, "%s", mountpoint); - if (subdir(target, source) || subdir(source, target)) + if (subdir(target, mountpoint) || subdir(mountpoint, target)) errx(EX_USAGE, "%s (%s) and %s are not distinct paths", argv[0], target, argv[1]); From owner-dev-commits-src-all@freebsd.org Fri Apr 9 00:14:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACC425C52A7; Fri, 9 Apr 2021 00: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 4FGdtR4Xllz3CY5; Fri, 9 Apr 2021 00: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 8F5BC143BD; Fri, 9 Apr 2021 00: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 1390EtoA030055; Fri, 9 Apr 2021 00: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 1390EtSC030054; Fri, 9 Apr 2021 00:14:55 GMT (envelope-from git) Date: Fri, 9 Apr 2021 00:14:55 GMT Message-Id: <202104090014.1390EtSC030054@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 5003c6014ca6 - releng/13.0 - 13.0/UPDATING: anticipate 13.0-RELEASE date MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 5003c6014ca60853b7e684aa4a639e4f0695d515 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 00:14:55 -0000 The branch releng/13.0 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=5003c6014ca60853b7e684aa4a639e4f0695d515 commit 5003c6014ca60853b7e684aa4a639e4f0695d515 Author: Glen Barber AuthorDate: 2021-04-09 00:13:47 +0000 Commit: Glen Barber CommitDate: 2021-04-09 00:13:47 +0000 13.0/UPDATING: anticipate 13.0-RELEASE date Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- UPDATING | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/UPDATING b/UPDATING index 14efebc5d37b..0e6c4df32190 100644 --- a/UPDATING +++ b/UPDATING @@ -11,18 +11,24 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. -20210406: 13.0-RC5-p1 FreeBSD-SA-21:08.vm +20210413: + 13.0-RELEASE. + +20210406: + 13.0-RC5-p1 FreeBSD-SA-21:08.vm FreeBSD-SA-21:10.jail_mount Memory disclosure by stale virtual memory mapping [SA-21:08.vm] Jail escape possible by mounting over jail root [SA-21:10.jail_mount] -20210325: 13.0-RC3-p1 FreeBSD-SA-21:07.openssl +20210325: + 13.0-RC3-p1 FreeBSD-SA-21:07.openssl Fix multiple OpenSSL issues [SA-21:07.openssl] -20210223: 13.0-BETA3-p1 FreeBSD-SA-21:03.pam_login_access +20210223: + 13.0-BETA3-p1 FreeBSD-SA-21:03.pam_login_access FreeBSD-SA-21:06.xen login.access fails to apply rules [SA-21:03.pam_login_access] From owner-dev-commits-src-all@freebsd.org Fri Apr 9 00:14:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 954995C5381; Fri, 9 Apr 2021 00: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 4FGdtQ3s7dz3CY4; Fri, 9 Apr 2021 00: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 7749A14278; Fri, 9 Apr 2021 00: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 1390Esp4030034; Fri, 9 Apr 2021 00: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 1390Esul030033; Fri, 9 Apr 2021 00:14:54 GMT (envelope-from git) Date: Fri, 9 Apr 2021 00:14:54 GMT Message-Id: <202104090014.1390Esul030033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: df7114e92efe - releng/13.0 - 13.0: set static __FreeBSD_version MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: df7114e92efea8c74618c228880675594400d017 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 00:14:54 -0000 The branch releng/13.0 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=df7114e92efea8c74618c228880675594400d017 commit df7114e92efea8c74618c228880675594400d017 Author: Glen Barber AuthorDate: 2021-04-09 00:12:37 +0000 Commit: Glen Barber CommitDate: 2021-04-09 00:12:37 +0000 13.0: set static __FreeBSD_version Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- lib/csu/common/crtbrand.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/csu/common/crtbrand.S b/lib/csu/common/crtbrand.S index bf223d84bc12..5548009eef44 100644 --- a/lib/csu/common/crtbrand.S +++ b/lib/csu/common/crtbrand.S @@ -45,5 +45,5 @@ __FBSDID("$FreeBSD$"); .4byte NT_FREEBSD_ABI_TAG 1: .asciz NOTE_FREEBSD_VENDOR 2: .p2align 2 -3: .4byte __FreeBSD_version +3: .4byte 1300139 4: From owner-dev-commits-src-all@freebsd.org Fri Apr 9 00:14:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0EBD5C4DEE; Fri, 9 Apr 2021 00: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 4FGdtT10DNz3CMW; Fri, 9 Apr 2021 00: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 BE49A1417C; Fri, 9 Apr 2021 00: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 1390EuMG030078; Fri, 9 Apr 2021 00: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 1390EucZ030077; Fri, 9 Apr 2021 00:14:56 GMT (envelope-from git) Date: Fri, 9 Apr 2021 00:14:56 GMT Message-Id: <202104090014.1390EucZ030077@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: ea31abc261ff - releng/13.0 - 13.0: update to RELEASE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: ea31abc261ffc01b6ff5671bffb15cf910a07f4b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 00:15:01 -0000 The branch releng/13.0 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=ea31abc261ffc01b6ff5671bffb15cf910a07f4b commit ea31abc261ffc01b6ff5671bffb15cf910a07f4b Author: Glen Barber AuthorDate: 2021-04-09 00:14:30 +0000 Commit: Glen Barber CommitDate: 2021-04-09 00:14:30 +0000 13.0: update to RELEASE Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/conf/newvers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 0d6ec4b72680..306e11fda092 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -54,7 +54,7 @@ TYPE="FreeBSD" REVISION="13.0" -BRANCH="RC5-p1" +BRANCH="RELEASE" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-dev-commits-src-all@freebsd.org Fri Apr 9 00:27:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A02875C5914; Fri, 9 Apr 2021 00:27: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 4FGf8x4hf0z3DSP; Fri, 9 Apr 2021 00:27: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 BC59514537; Fri, 9 Apr 2021 00:27: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 1390RSmX043572; Fri, 9 Apr 2021 00:27:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1390RSqC043571; Fri, 9 Apr 2021 00:27:28 GMT (envelope-from git) Date: Fri, 9 Apr 2021 00:27:28 GMT Message-Id: <202104090027.1390RSqC043571@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Glen Barber Subject: git: 6dadf78f115c - main - UPDATING: dereference portupgrade(8) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6dadf78f115cbdcb17dff8974a2044dd5129f7dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 00:27:33 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=6dadf78f115cbdcb17dff8974a2044dd5129f7dc commit 6dadf78f115cbdcb17dff8974a2044dd5129f7dc Author: Glen Barber AuthorDate: 2021-04-09 00:26:41 +0000 Commit: Glen Barber CommitDate: 2021-04-09 00:26:41 +0000 UPDATING: dereference portupgrade(8) Make the UPDATING file less tool-specific regarding upgrading third-party software. MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") --- UPDATING | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/UPDATING b/UPDATING index 33956aa7f08c..6ef64664e6b7 100644 --- a/UPDATING +++ b/UPDATING @@ -9,7 +9,8 @@ handbook: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/makeworld.html Items affecting the ports and packages system can be found in -/usr/ports/UPDATING. Please read that file before running portupgrade. +/usr/ports/UPDATING. Please read that file before updating system packages +and/or ports. NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: FreeBSD 14.x has many debugging features turned on, in both the kernel From owner-dev-commits-src-all@freebsd.org Fri Apr 9 00:28:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 360835C5A07; Fri, 9 Apr 2021 00:28: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 4FGfBM5q02z3DmB; Fri, 9 Apr 2021 00:28: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 943371469E; Fri, 9 Apr 2021 00:28: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 1390ShXb043888; Fri, 9 Apr 2021 00:28:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1390ShWj043887; Fri, 9 Apr 2021 00:28:43 GMT (envelope-from git) Date: Fri, 9 Apr 2021 00:28:43 GMT Message-Id: <202104090028.1390ShWj043887@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d6b6bd19e871 - stable/13 - dtrace: Document the libdir, nolibs and syslibdir options 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d6b6bd19e87158b3fdd03966bffaeff3afeb7b81 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 00:28:44 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d6b6bd19e87158b3fdd03966bffaeff3afeb7b81 commit d6b6bd19e87158b3fdd03966bffaeff3afeb7b81 Author: Domagoj Stolfa AuthorDate: 2021-04-02 21:19:47 +0000 Commit: Mark Johnston CommitDate: 2021-04-09 00:28:03 +0000 dtrace: Document the libdir, nolibs and syslibdir options Differential Revision: https://reviews.freebsd.org/D29541 (cherry picked from commit 7653f9317bc3fb3b945cb1485123a80050cfd4e8) --- cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 index b236fd49c260..c91dfc8270bb 100644 --- a/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 +++ b/cddl/contrib/opensolaris/cmd/dtrace/dtrace.1 @@ -20,7 +20,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 25, 2020 +.Dd April 2, 2021 .Dt DTRACE 1 .Os .Sh NAME @@ -602,8 +602,12 @@ Number of default stack frames for .It Sy jstackstrsize Ns = Ns Ar scalar Default string space size for .Fn jstack . +.It Sy libdir Ns = Ns Ar path +Add a directory to the system library path. .It Sy nspec Ns = Ns Ar scalar Number of speculations. +.It Sy nolibs +Do not load D system libraries. .It Sy quiet Set quiet mode. Same as the @@ -627,6 +631,10 @@ output. Rate of status checking. .It Sy switchrate Ns = Ns Ar time Rate of buffer switching. +.It Sy syslibdir Ns = Ns Ar path +Path to system libraries. +Defaults to +.Pa /usr/lib/dtrace . .It Sy ustackframes Ns = Ns Ar scalar Maximum number of userspace stack frames to unwind when executing the .Fn ustack From owner-dev-commits-src-all@freebsd.org Fri Apr 9 00:48:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33D245C5F55; Fri, 9 Apr 2021 00:48: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 4FGfdh12RTz3Glb; Fri, 9 Apr 2021 00:48: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 07C6114655; Fri, 9 Apr 2021 00:48: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 1390mtZq070176; Fri, 9 Apr 2021 00:48:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1390mtGe070175; Fri, 9 Apr 2021 00:48:55 GMT (envelope-from git) Date: Fri, 9 Apr 2021 00:48:55 GMT Message-Id: <202104090048.1390mtGe070175@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: 27aa4fcbbc73 - stable/13 - Ensure that all allocated data structures in fsck_ffs are freed. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 27aa4fcbbc73efd6c2eb7a958443c6b02ef70e74 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 00:48:56 -0000 The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=27aa4fcbbc73efd6c2eb7a958443c6b02ef70e74 commit 27aa4fcbbc73efd6c2eb7a958443c6b02ef70e74 Author: Kirk McKusick AuthorDate: 2021-04-02 18:57:34 +0000 Commit: Kirk McKusick CommitDate: 2021-04-09 00:49:00 +0000 Ensure that all allocated data structures in fsck_ffs are freed. (cherry picked from commit fc56fd262d0bc8ee523f6c8e6a65c0ff5417af6e) --- sbin/fsck_ffs/fsck.h | 4 +++- sbin/fsck_ffs/fsutil.c | 47 +++++++++++++++++++++++++++++++++++++---------- sbin/fsck_ffs/globs.c | 2 -- sbin/fsck_ffs/main.c | 6 ------ 4 files changed, 40 insertions(+), 19 deletions(-) diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h index 676350b75767..9ecc5793e644 100644 --- a/sbin/fsck_ffs/fsck.h +++ b/sbin/fsck_ffs/fsck.h @@ -236,10 +236,12 @@ extern int sujrecovery; /* 1 => doing check using the journal */ } while (0) #define initbarea(bp, type) do { \ (bp)->b_bno = (ufs2_daddr_t)-1; \ + (bp)->b_size = 0; \ + (bp)->b_errs = 0; \ (bp)->b_flags = 0; \ + (bp)->b_type = type; \ (bp)->b_refcnt = 0; \ (bp)->b_index = 0; \ - (bp)->b_type = type; \ } while (0) #define sbdirty() dirty(&sblk) diff --git a/sbin/fsck_ffs/fsutil.c b/sbin/fsck_ffs/fsutil.c index 127884400651..ca19f6726af5 100644 --- a/sbin/fsck_ffs/fsutil.c +++ b/sbin/fsck_ffs/fsutil.c @@ -84,7 +84,6 @@ static LIST_HEAD(bufhash, bufarea) bufhashhd[HASHSIZE]; /* buffer hash list */ static int numbufs; /* size of buffer cache */ static int cachelookups; /* number of cache lookups */ static int cachereads; /* number of cache reads */ -static struct bufarea *cgbufs; /* header for cylinder group cache */ static int flushtries; /* number of tries to reclaim memory */ char *buftype[BT_NUMBUFTYPES] = BT_NAMES; @@ -187,13 +186,9 @@ bufinit(void) { int i; - pdirbp = (struct bufarea *)0; - bzero(&cgblk, sizeof(struct bufarea)); - cgblk.b_un.b_buf = Malloc((unsigned int)sblock.fs_bsize); - if (cgblk.b_un.b_buf == NULL) + if ((cgblk.b_un.b_buf = Malloc((unsigned int)sblock.fs_bsize)) == NULL) errx(EEXIT, "Initial malloc(%d) failed", sblock.fs_bsize); initbarea(&cgblk, BT_CYLGRP); - cgbufs = NULL; numbufs = cachelookups = cachereads = 0; TAILQ_INIT(&bufqueuehd); for (i = 0; i < HASHSIZE; i++) @@ -559,7 +554,8 @@ void ckfini(int markclean) { struct bufarea *bp, *nbp; - int ofsmodified, cnt; + struct inoinfo *inp, *ninp; + int ofsmodified, cnt, cg, i; if (bkgrdflag) { unlink(snapname); @@ -609,16 +605,20 @@ ckfini(int markclean) free(cgbufs[cnt].b_un.b_cg); } free(cgbufs); + cgbufs = NULL; } flush(fswritefd, &cgblk); free(cgblk.b_un.b_buf); + cgblk.b_un.b_buf = NULL; cnt = 0; /* Step 2: indirect, directory, external attribute, and data blocks */ if (debug) printf("Flush indirect, directory, external attribute, " "and data blocks\n"); - if (pdirbp != NULL) + if (pdirbp != NULL) { brelse(pdirbp); + pdirbp = NULL; + } TAILQ_FOREACH_REVERSE_SAFE(bp, &bufqueuehd, bufqueue, b_list, nbp) { switch (bp->b_type) { /* These should not be in the buffer cache list */ @@ -658,8 +658,10 @@ ckfini(int markclean) /* Step 3: inode blocks */ if (debug) printf("Flush inode blocks\n"); - if (icachebp != NULL) + if (icachebp != NULL) { brelse(icachebp); + icachebp = NULL; + } TAILQ_FOREACH_REVERSE_SAFE(bp, &bufqueuehd, bufqueue, b_list, nbp) { if (debug && bp->b_refcnt != 0) { prtbuf("ckfini: clearing in-use buffer", bp); @@ -686,7 +688,6 @@ ckfini(int markclean) sbdirty(); flush(fswritefd, &sblk); } - pdirbp = (struct bufarea *)0; if (cursnapshot == 0 && sblock.fs_clean != markclean) { if ((sblock.fs_clean = markclean) != 0) { sblock.fs_flags &= ~(FS_UNCLEAN | FS_NEEDSFSCK); @@ -711,6 +712,32 @@ ckfini(int markclean) rerun = 1; } } + /* + * Free allocated tracking structures. + */ + if (blockmap != NULL) + free(blockmap); + blockmap = NULL; + if (inostathead != NULL) { + for (cg = 0; cg < sblock.fs_ncg; cg++) + if (inostathead[cg].il_stat != NULL) + free((char *)inostathead[cg].il_stat); + free(inostathead); + } + inostathead = NULL; + if (inpsort != NULL) + free(inpsort); + inpsort = NULL; + if (inphead != NULL) { + for (i = 0; i < dirhash; i++) { + for (inp = inphead[i]; inp != NULL; inp = ninp) { + ninp = inp->i_nexthash; + free(inp); + } + } + free(inphead); + } + inphead = NULL; finalIOstats(); (void)close(fsreadfd); (void)close(fswritefd); diff --git a/sbin/fsck_ffs/globs.c b/sbin/fsck_ffs/globs.c index 45d6b80d8fe8..be4434ce38ca 100644 --- a/sbin/fsck_ffs/globs.c +++ b/sbin/fsck_ffs/globs.c @@ -128,7 +128,6 @@ fsckinit(void) bzero(totalreadtime, sizeof(struct timespec) * BT_NUMBUFTYPES); bzero(&startprog, sizeof(struct timespec)); bzero(&sblk, sizeof(struct bufarea)); - pdirbp = NULL; cursnapshot = 0; listmax = numdirs = dirhash = inplast = 0; countdirs = 0; @@ -159,7 +158,6 @@ fsckinit(void) fsreadfd = 0; fswritefd = 0; maxfsblock = 0; - blockmap = NULL; maxino = 0; lfdir = 0; lfname = "lost+found"; diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c index 65cee9b7b8c6..401ee10f9be3 100644 --- a/sbin/fsck_ffs/main.c +++ b/sbin/fsck_ffs/main.c @@ -243,7 +243,6 @@ checkfilesys(char *filesys) char errmsg[255]; int ofsmodified; int iovlen; - int cylno; intmax_t blks, files; size_t size; @@ -627,11 +626,6 @@ checkfilesys(char *filesys) resolved = 0; ckfini(resolved); - for (cylno = 0; cylno < sblock.fs_ncg; cylno++) - if (inostathead[cylno].il_stat != NULL) - free((char *)inostathead[cylno].il_stat); - free((char *)inostathead); - inostathead = NULL; if (fsmodified && !preen) printf("\n***** FILE SYSTEM WAS MODIFIED *****\n"); if (rerun) { From owner-dev-commits-src-all@freebsd.org Fri Apr 9 03:24:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B91A5C95CD; Fri, 9 Apr 2021 03:24: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 4FGk5f5yBmz3hQ4; Fri, 9 Apr 2021 03:24: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 BFF9A16D95; Fri, 9 Apr 2021 03:24: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 1393Osg1083246; Fri, 9 Apr 2021 03:24:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1393OsTx083245; Fri, 9 Apr 2021 03:24:54 GMT (envelope-from git) Date: Fri, 9 Apr 2021 03:24:54 GMT Message-Id: <202104090324.1393OsTx083245@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jamie Gritton Subject: git: 6186592c106b - stable/12 - MFC jail: fix jail(8) synposis and usage message to match reality. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6186592c106be2425dc4959c19c358c8ab86a307 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 03:24:55 -0000 The branch stable/12 has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=6186592c106be2425dc4959c19c358c8ab86a307 commit 6186592c106be2425dc4959c19c358c8ab86a307 Author: Jamie Gritton AuthorDate: 2021-04-04 17:49:38 +0000 Commit: Jamie Gritton CommitDate: 2021-04-09 03:24:13 +0000 MFC jail: fix jail(8) synposis and usage message to match reality. Reported by: yuri PR: 254741 (cherry picked from commit 8c1d956ffa0355ece3b63ea8587938176f87f072) --- usr.sbin/jail/jail.8 | 4 ++-- usr.sbin/jail/jail.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/jail/jail.8 b/usr.sbin/jail/jail.8 index 3ac4f988a325..0b96f4d4adcc 100644 --- a/usr.sbin/jail/jail.8 +++ b/usr.sbin/jail/jail.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 14, 2020 +.Dd April 4, 2021 .Dt JAIL 8 .Os .Sh NAME @@ -58,7 +58,7 @@ .Op Fl U Ar username .Op Fl n Ar jailname .Op Fl s Ar securelevel -.Op Ar path hostname [ Ar ip Ns [ Ns Ar ,... Ns ]] Ar command ... +.Ar path hostname ip Ns [ Ns Ar ,... Ns ] Ar command ... .Nm .Op Fl f Ar conf_file .Fl e diff --git a/usr.sbin/jail/jail.c b/usr.sbin/jail/jail.c index 920e573b9149..eb3b19f2cb82 100644 --- a/usr.sbin/jail/jail.c +++ b/usr.sbin/jail/jail.c @@ -1046,7 +1046,7 @@ usage(void) " jail [-qv] [-f file] -[rR] ['*' | jail ...]\n" " jail [-dhilqv] [-J jid_file] [-u username] [-U username]\n" " [-n jailname] [-s securelevel]\n" - " path hostname [ip[,...]] command ...\n" + " path hostname ip[,...] command ...\n" " jail [-f file] -e separator\n"); exit(1); } From owner-dev-commits-src-all@freebsd.org Fri Apr 9 03:25:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6602B5C9756; Fri, 9 Apr 2021 03:25: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 4FGk6t2TfPz3hXw; Fri, 9 Apr 2021 03:25: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 47D8A16942; Fri, 9 Apr 2021 03:25: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 1393Pw3a083437; Fri, 9 Apr 2021 03:25:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1393PwTI083436; Fri, 9 Apr 2021 03:25:58 GMT (envelope-from git) Date: Fri, 9 Apr 2021 03:25:58 GMT Message-Id: <202104090325.1393PwTI083436@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jamie Gritton Subject: git: bdb392c1d354 - stable/13 - MFC jail: fix jail(8) synposis and usage message to match reality. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bdb392c1d3547097c5d08ab5ccfdef7235ea1190 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 03:25:58 -0000 The branch stable/13 has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=bdb392c1d3547097c5d08ab5ccfdef7235ea1190 commit bdb392c1d3547097c5d08ab5ccfdef7235ea1190 Author: Jamie Gritton AuthorDate: 2021-04-04 17:49:38 +0000 Commit: Jamie Gritton CommitDate: 2021-04-09 03:25:38 +0000 MFC jail: fix jail(8) synposis and usage message to match reality. Reported by: yuri PR: 254741 MFC after: 5 days (cherry picked from commit 8c1d956ffa0355ece3b63ea8587938176f87f072) --- usr.sbin/jail/jail.8 | 4 ++-- usr.sbin/jail/jail.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/jail/jail.8 b/usr.sbin/jail/jail.8 index cc3561f03f6a..61fe91cf973e 100644 --- a/usr.sbin/jail/jail.8 +++ b/usr.sbin/jail/jail.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 18, 2020 +.Dd April 4, 2021 .Dt JAIL 8 .Os .Sh NAME @@ -58,7 +58,7 @@ .Op Fl U Ar username .Op Fl n Ar jailname .Op Fl s Ar securelevel -.Op Ar path hostname [ Ar ip Ns [ Ns Ar ,... Ns ]] Ar command ... +.Ar path hostname ip Ns [ Ns Ar ,... Ns ] Ar command ... .Nm .Op Fl f Ar conf_file .Fl e diff --git a/usr.sbin/jail/jail.c b/usr.sbin/jail/jail.c index 920e573b9149..eb3b19f2cb82 100644 --- a/usr.sbin/jail/jail.c +++ b/usr.sbin/jail/jail.c @@ -1046,7 +1046,7 @@ usage(void) " jail [-qv] [-f file] -[rR] ['*' | jail ...]\n" " jail [-dhilqv] [-J jid_file] [-u username] [-U username]\n" " [-n jailname] [-s securelevel]\n" - " path hostname [ip[,...]] command ...\n" + " path hostname ip[,...] command ...\n" " jail [-f file] -e separator\n"); exit(1); } From owner-dev-commits-src-all@freebsd.org Fri Apr 9 03:27:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69EE15C991F; Fri, 9 Apr 2021 03:27: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 4FGk8K2WwXz3hT4; Fri, 9 Apr 2021 03:27: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 498A016E0B; Fri, 9 Apr 2021 03:27: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 1393RDfe083635; Fri, 9 Apr 2021 03:27:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1393RDxj083634; Fri, 9 Apr 2021 03:27:13 GMT (envelope-from git) Date: Fri, 9 Apr 2021 03:27:13 GMT Message-Id: <202104090327.1393RDxj083634@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Jamie Gritton Subject: git: 73b04801b316 - stable/11 - MFC jail: fix jail(8) synposis and usage message to match reality. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jamie X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 73b04801b3163417cff33b279f1bc42451f20009 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 03:27:13 -0000 The branch stable/11 has been updated by jamie: URL: https://cgit.FreeBSD.org/src/commit/?id=73b04801b3163417cff33b279f1bc42451f20009 commit 73b04801b3163417cff33b279f1bc42451f20009 Author: Jamie Gritton AuthorDate: 2021-04-04 17:49:38 +0000 Commit: Jamie Gritton CommitDate: 2021-04-09 03:26:58 +0000 MFC jail: fix jail(8) synposis and usage message to match reality. Reported by: yuri PR: 254741 MFC after: 5 days (cherry picked from commit 8c1d956ffa0355ece3b63ea8587938176f87f072) --- usr.sbin/jail/jail.8 | 4 ++-- usr.sbin/jail/jail.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/jail/jail.8 b/usr.sbin/jail/jail.8 index d5babaadf950..e8de0d765e2d 100644 --- a/usr.sbin/jail/jail.8 +++ b/usr.sbin/jail/jail.8 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 17, 2020 +.Dd April 4, 2021 .Dt JAIL 8 .Os .Sh NAME @@ -58,7 +58,7 @@ .Op Fl U Ar username .Op Fl n Ar jailname .Op Fl s Ar securelevel -.Op Ar path hostname [ Ar ip Ns [ Ns Ar ,... Ns ]] Ar command ... +.Ar path hostname ip Ns [ Ns Ar ,... Ns ] Ar command ... .Nm .Op Fl f Ar conf_file .Fl e diff --git a/usr.sbin/jail/jail.c b/usr.sbin/jail/jail.c index 1bf7fad2b2a5..d523a0b63e27 100644 --- a/usr.sbin/jail/jail.c +++ b/usr.sbin/jail/jail.c @@ -1052,7 +1052,7 @@ usage(void) " jail [-qv] [-f file] -[rR] ['*' | jail ...]\n" " jail [-dhilqv] [-J jid_file] [-u username] [-U username]\n" " [-n jailname] [-s securelevel]\n" - " path hostname [ip[,...]] command ...\n" + " path hostname ip[,...] command ...\n" " jail [-f file] -e separator\n"); exit(1); } From owner-dev-commits-src-all@freebsd.org Fri Apr 9 04:57:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4C1475CB114; Fri, 9 Apr 2021 04:57: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 4FGm8J1YTYz3mxq; Fri, 9 Apr 2021 04:57: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 23C4917FB0; Fri, 9 Apr 2021 04:57: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 1394vKZE001452; Fri, 9 Apr 2021 04:57:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1394vJu0001451; Fri, 9 Apr 2021 04:57:19 GMT (envelope-from git) Date: Fri, 9 Apr 2021 04:57:19 GMT Message-Id: <202104090457.1394vJu0001451@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: ee389afecf85 - stable/13 - nullfs: protect against user creating inconsistent state 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/stable/13 X-Git-Reftype: branch X-Git-Commit: ee389afecf85571936957b183921165893c680a6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 04:57:20 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ee389afecf85571936957b183921165893c680a6 commit ee389afecf85571936957b183921165893c680a6 Author: Konstantin Belousov AuthorDate: 2021-04-01 17:42:14 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 04:52:05 +0000 nullfs: protect against user creating inconsistent state PR: 253593 (cherry picked from commit 76b1b5ce6d81f66b09be8a20aecd064b65fd6b50) --- sys/fs/nullfs/null_vnops.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index 45065e0be7b5..607755fd62d9 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -389,10 +389,21 @@ null_lookup(struct vop_lookup_args *ap) */ ldvp = NULLVPTOLOWERVP(dvp); vp = lvp = NULL; - KASSERT((ldvp->v_vflag & VV_ROOT) == 0 || - ((dvp->v_vflag & VV_ROOT) != 0 && (flags & ISDOTDOT) == 0), - ("ldvp %p fl %#x dvp %p fl %#x flags %#x", ldvp, ldvp->v_vflag, - dvp, dvp->v_vflag, flags)); + + /* + * Renames in the lower mounts might create an inconsistent + * configuration where lower vnode is moved out of the + * directory tree remounted by our null mount. Do not try to + * handle it fancy, just avoid VOP_LOOKUP() with DOTDOT name + * which cannot be handled by VOP, at least passing over lower + * root. + */ + if ((ldvp->v_vflag & VV_ROOT) != 0 && (flags & ISDOTDOT) != 0) { + KASSERT((dvp->v_vflag & VV_ROOT) == 0, + ("ldvp %p fl %#x dvp %p fl %#x flags %#x", + ldvp, ldvp->v_vflag, dvp, dvp->v_vflag, flags)); + return (ENOENT); + } /* * Hold ldvp. The reference on it, owned by dvp, is lost in From owner-dev-commits-src-all@freebsd.org Fri Apr 9 05:08:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A91EF5CB617; Fri, 9 Apr 2021 05:08: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 4FGmPT4JNtz3nvq; Fri, 9 Apr 2021 05:08: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 824C2180E9; Fri, 9 Apr 2021 05:08: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 13958jHf015842; Fri, 9 Apr 2021 05:08:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13958jNk015841; Fri, 9 Apr 2021 05:08:45 GMT (envelope-from git) Date: Fri, 9 Apr 2021 05:08:45 GMT Message-Id: <202104090508.13958jNk015841@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 1a4f94944ec7 - stable/12 - mbuf: add a way to mark flowid as calculated from the internal headers 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 1a4f94944ec7c36027726e77264b62236dee24a1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 05:08:45 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1a4f94944ec7c36027726e77264b62236dee24a1 commit 1a4f94944ec7c36027726e77264b62236dee24a1 Author: Konstantin Belousov AuthorDate: 2021-02-12 13:38:07 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 04:57:31 +0000 mbuf: add a way to mark flowid as calculated from the internal headers (cherry picked from commit e243367b644562c9410b39f8d78dafdb7e785d85) --- sys/kern/uipc_mbuf.c | 23 +++++++++++++++++++++++ sys/net/if_gif.c | 3 ++- sys/net/if_vxlan.c | 3 ++- sys/sys/mbuf.h | 12 +++++++++--- 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index 0161186fdb7f..9a83380371d6 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -795,6 +795,29 @@ m_adj(struct mbuf *mp, int req_len) } } +void +m_adj_decap(struct mbuf *mp, int len) +{ + uint8_t rsstype; + + m_adj(mp, len); + if ((mp->m_flags & M_PKTHDR) != 0) { + /* + * If flowid was calculated by card from the inner + * headers, move flowid to the decapsulated mbuf + * chain, otherwise clear. This depends on the + * internals of m_adj, which keeps pkthdr as is, in + * particular not changing rsstype and flowid. + */ + rsstype = mp->m_pkthdr.rsstype; + if ((rsstype & M_HASHTYPE_INNER) != 0) { + M_HASHTYPE_SET(mp, rsstype & ~M_HASHTYPE_INNER); + } else { + M_HASHTYPE_CLEAR(mp); + } + } +} + /* * Rearange an mbuf chain so that len bytes are contiguous * and in the data area of an mbuf (so that mtod will work diff --git a/sys/net/if_gif.c b/sys/net/if_gif.c index f23be1e143f7..c9ccee4c98bd 100644 --- a/sys/net/if_gif.c +++ b/sys/net/if_gif.c @@ -540,7 +540,8 @@ gif_input(struct mbuf *m, struct ifnet *ifp, int proto, uint8_t ecn) m_freem(m); goto drop; } - m_adj(m, sizeof(struct etherip_header)); + + m_adj_decap(m, sizeof(struct etherip_header)); m->m_flags &= ~(M_BCAST|M_MCAST); m->m_pkthdr.rcvif = ifp; diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index 5e35baae2dbc..e333f7272e52 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -2532,8 +2532,9 @@ vxlan_rcv_udp_packet(struct mbuf *m, int offset, struct inpcb *inpcb, goto out; vni = ntohl(vxh->vxlh_vni) >> VXLAN_HDR_VNI_SHIFT; + /* Adjust to the start of the inner Ethernet frame. */ - m_adj(m, offset + sizeof(struct vxlan_header)); + m_adj_decap(m, offset + sizeof(struct vxlan_header)); error = vxlan_input(vso, vni, &m, srcsa); MPASS(error != 0 || m == NULL); diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 057e4800f8d3..127dae75726f 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -385,6 +385,7 @@ struct mbuf { * https://docs.microsoft.com/en-us/windows-hardware/drivers/network/rss-hashing-types#ndishashipv6ex */ #define M_HASHTYPE_HASHPROP 0x80 /* has hash properties */ +#define M_HASHTYPE_INNER 0x40 /* calculated from inner headers */ #define M_HASHTYPE_HASH(t) (M_HASHTYPE_HASHPROP | (t)) /* Microsoft RSS standard hash types */ #define M_HASHTYPE_NONE 0 @@ -401,15 +402,19 @@ struct mbuf { #define M_HASHTYPE_RSS_UDP_IPV6_EX M_HASHTYPE_HASH(10)/* IPv6 UDP 4-tuple + * ext hdrs */ -#define M_HASHTYPE_OPAQUE 63 /* ordering, not affinity */ +#define M_HASHTYPE_OPAQUE 0x3f /* ordering, not affinity */ #define M_HASHTYPE_OPAQUE_HASH M_HASHTYPE_HASH(M_HASHTYPE_OPAQUE) /* ordering+hash, not affinity*/ #define M_HASHTYPE_CLEAR(m) ((m)->m_pkthdr.rsstype = 0) -#define M_HASHTYPE_GET(m) ((m)->m_pkthdr.rsstype) +#define M_HASHTYPE_GET(m) ((m)->m_pkthdr.rsstype & ~M_HASHTYPE_INNER) #define M_HASHTYPE_SET(m, v) ((m)->m_pkthdr.rsstype = (v)) #define M_HASHTYPE_TEST(m, v) (M_HASHTYPE_GET(m) == (v)) -#define M_HASHTYPE_ISHASH(m) (M_HASHTYPE_GET(m) & M_HASHTYPE_HASHPROP) +#define M_HASHTYPE_ISHASH(m) \ + (((m)->m_pkthdr.rsstype & M_HASHTYPE_HASHPROP) != 0) +#define M_HASHTYPE_SETINNER(m) do { \ + (m)->m_pkthdr.rsstype |= M_HASHTYPE_INNER; \ + } while (0) /* * COS/QOS class and quality of service tags. @@ -659,6 +664,7 @@ extern uma_zone_t zone_jumbo16; void mb_dupcl(struct mbuf *, struct mbuf *); void mb_free_ext(struct mbuf *); void m_adj(struct mbuf *, int); +void m_adj_decap(struct mbuf *, int); int m_apply(struct mbuf *, int, int, int (*)(void *, void *, u_int), void *); int m_append(struct mbuf *, int, c_caddr_t); From owner-dev-commits-src-all@freebsd.org Fri Apr 9 05:08:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B351C5CB58C; Fri, 9 Apr 2021 05:08: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 4FGmPV4cHXz3nvv; Fri, 9 Apr 2021 05:08: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 8F7B01810E; Fri, 9 Apr 2021 05:08: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 13958k28015869; Fri, 9 Apr 2021 05:08:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13958kbp015868; Fri, 9 Apr 2021 05:08:46 GMT (envelope-from git) Date: Fri, 9 Apr 2021 05:08:46 GMT Message-Id: <202104090508.13958kbp015868@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: e1fb4bc3e478 - stable/12 - Style 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/stable/12 X-Git-Reftype: branch X-Git-Commit: e1fb4bc3e478b00cc4e89ef7609efafc0c87c3b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 05:08:46 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e1fb4bc3e478b00cc4e89ef7609efafc0c87c3b4 commit e1fb4bc3e478b00cc4e89ef7609efafc0c87c3b4 Author: Konstantin Belousov AuthorDate: 2021-04-04 16:27:42 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 04:57:31 +0000 Style (cherry picked from commit 51a7be5f6036ebd47c8b3f704d52e7ec3f837114) --- sys/vm/vm_kern.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 5f79482a2d3f..83d58a194f62 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -848,7 +848,7 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS) i = 0; error = sysctl_handle_int(oidp, &i, 0, req); - if (error) + if (error != 0) return (error); if ((i & ~(VM_LOW_KMEM | VM_LOW_PAGES)) != 0) return (EINVAL); @@ -857,5 +857,6 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS) return (0); } -SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, CTLTYPE_INT | CTLFLAG_RW, 0, 0, - debug_vm_lowmem, "I", "set to trigger vm_lowmem event with given flags"); +SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, + CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, 0, debug_vm_lowmem, "I", + "set to trigger vm_lowmem event with given flags"); From owner-dev-commits-src-all@freebsd.org Fri Apr 9 05:08:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14C535CB783; Fri, 9 Apr 2021 05:08: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 4FGmPW6Rjcz3nr8; Fri, 9 Apr 2021 05:08: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 B4B0717CFC; Fri, 9 Apr 2021 05:08: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 13958lTf015891; Fri, 9 Apr 2021 05:08:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13958lCl015890; Fri, 9 Apr 2021 05:08:47 GMT (envelope-from git) Date: Fri, 9 Apr 2021 05:08:47 GMT Message-Id: <202104090508.13958lCl015890@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: ecc571a85858 - stable/12 - nullfs: protect against user creating inconsistent state 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/stable/12 X-Git-Reftype: branch X-Git-Commit: ecc571a858586e7b62cae3794c0f6250a91a483b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 05:08:48 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ecc571a858586e7b62cae3794c0f6250a91a483b commit ecc571a858586e7b62cae3794c0f6250a91a483b Author: Konstantin Belousov AuthorDate: 2021-04-01 17:42:14 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 04:57:37 +0000 nullfs: protect against user creating inconsistent state PR: 253593 (cherry picked from commit 76b1b5ce6d81f66b09be8a20aecd064b65fd6b50) --- sys/fs/nullfs/null_vnops.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c index b663d8d718d3..62351cd9d832 100644 --- a/sys/fs/nullfs/null_vnops.c +++ b/sys/fs/nullfs/null_vnops.c @@ -376,10 +376,21 @@ null_lookup(struct vop_lookup_args *ap) */ ldvp = NULLVPTOLOWERVP(dvp); vp = lvp = NULL; - KASSERT((ldvp->v_vflag & VV_ROOT) == 0 || - ((dvp->v_vflag & VV_ROOT) != 0 && (flags & ISDOTDOT) == 0), - ("ldvp %p fl %#x dvp %p fl %#x flags %#x", ldvp, ldvp->v_vflag, - dvp, dvp->v_vflag, flags)); + + /* + * Renames in the lower mounts might create an inconsistent + * configuration where lower vnode is moved out of the + * directory tree remounted by our null mount. Do not try to + * handle it fancy, just avoid VOP_LOOKUP() with DOTDOT name + * which cannot be handled by VOP, at least passing over lower + * root. + */ + if ((ldvp->v_vflag & VV_ROOT) != 0 && (flags & ISDOTDOT) != 0) { + KASSERT((dvp->v_vflag & VV_ROOT) == 0, + ("ldvp %p fl %#x dvp %p fl %#x flags %#x", + ldvp, ldvp->v_vflag, dvp, dvp->v_vflag, flags)); + return (ENOENT); + } /* * Hold ldvp. The reference on it, owned by dvp, is lost in From owner-dev-commits-src-all@freebsd.org Fri Apr 9 07:39:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D2F25CE617; Fri, 9 Apr 2021 07:39: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 4FGqkv2Cfsz3w7G; Fri, 9 Apr 2021 07:39: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 3F02A199FC; Fri, 9 Apr 2021 07:39: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 1397d3F5012981; Fri, 9 Apr 2021 07:39:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1397d3EF012980; Fri, 9 Apr 2021 07:39:03 GMT (envelope-from git) Date: Fri, 9 Apr 2021 07:39:03 GMT Message-Id: <202104090739.1397d3EF012980@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wojciech Macek Subject: git: 243000b19f8b - main - pci_dw: Trim ATU windows bigger than 4GB MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wma X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 243000b19f8b4ab104b584b2d16bc6aa9131c9b5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 07:39:03 -0000 The branch main has been updated by wma: URL: https://cgit.FreeBSD.org/src/commit/?id=243000b19f8b4ab104b584b2d16bc6aa9131c9b5 commit 243000b19f8b4ab104b584b2d16bc6aa9131c9b5 Author: Wojciech Macek AuthorDate: 2021-04-09 07:28:44 +0000 Commit: Wojciech Macek CommitDate: 2021-04-09 07:37:59 +0000 pci_dw: Trim ATU windows bigger than 4GB The size of the ATU MEM/IO windows is implicitly casted to uint32_t. Because of that some window sizes were silently demoted to 0 and ignored. Check the size if its too large, trim it to 4GB and print a warning message. Submitted by: Kornel Duleba Reviewed by: mw Obtained from: Semihalf Sponsored by: Marvell Differential revision: https://reviews.freebsd.org/D29625 --- sys/dev/pci/pci_dw.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/dev/pci/pci_dw.c b/sys/dev/pci/pci_dw.c index 161a68d2929d..f0aae5bf8418 100644 --- a/sys/dev/pci/pci_dw.c +++ b/sys/dev/pci/pci_dw.c @@ -342,6 +342,18 @@ pci_dw_decode_ranges(struct pci_dw_softc *sc, struct ofw_pci_range *ranges, " Not all required ranges are found in DT\n"); return (ENXIO); } + if (sc->io_range.size > UINT32_MAX) { + device_printf(sc->dev, + "ATU IO window size is too large. Up to 4GB windows " + "are supported, trimming window size to 4GB\n"); + sc->io_range.size = UINT32_MAX; + } + if (sc->mem_range.size > UINT32_MAX) { + device_printf(sc->dev, + "ATU MEM window size is too large. Up to 4GB windows " + "are supported, trimming window size to 4GB\n"); + sc->mem_range.size = UINT32_MAX; + } return (0); } From owner-dev-commits-src-all@freebsd.org Fri Apr 9 07:44:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A32155CEB86; Fri, 9 Apr 2021 07:44:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FGqrp4Ft8z3wMW; Fri, 9 Apr 2021 07:44: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 84B7B1A4B9; Fri, 9 Apr 2021 07:44: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 1397iAim025667; Fri, 9 Apr 2021 07:44:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1397iAEq025666; Fri, 9 Apr 2021 07:44:10 GMT (envelope-from git) Date: Fri, 9 Apr 2021 07:44:10 GMT Message-Id: <202104090744.1397iAEq025666@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: 3ce579325e42 - main - ed(1): Add two references in the SEE ALSO section 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: 3ce579325e424ce9297546553fb453a4ec62c20b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 07:44:10 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=3ce579325e424ce9297546553fb453a4ec62c20b commit 3ce579325e424ce9297546553fb453a4ec62c20b Author: Gordon Bergling AuthorDate: 2021-04-09 07:43:49 +0000 Commit: Gordon Bergling CommitDate: 2021-04-09 07:43:49 +0000 ed(1): Add two references in the SEE ALSO section Obtained from: OpenBSD MFC after: 1 week --- bin/ed/ed.1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/ed/ed.1 b/bin/ed/ed.1 index 0cdd1b9c3e3c..9ced0f96a872 100644 --- a/bin/ed/ed.1 +++ b/bin/ed/ed.1 @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd November 3, 2018 +.Dd April 9, 2021 .Dt ED 1 .Os .Sh NAME @@ -961,6 +961,16 @@ USD:12-13 .%O Addison-Wesley .%D 1981 .Re +.Rs +.\" 4.4BSD USD:9 +.%A B. W. Kernighan +.%T A Tutorial Introduction to the UNIX Text Editor +.Re +.Rs +.\" 4.4BSD USD:10 +.%A B. W. Kernighan +.%T Advanced Editing on UNIX +.Re .Sh LIMITATIONS The .Nm From owner-dev-commits-src-all@freebsd.org Fri Apr 9 09:23:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 304D05D1487; Fri, 9 Apr 2021 09:23: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 4FGt3r6kCcz4VlD; Fri, 9 Apr 2021 09:23: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 D9B391B3E0; Fri, 9 Apr 2021 09:23: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 1399Nqba065886; Fri, 9 Apr 2021 09:23:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1399NqYQ065885; Fri, 9 Apr 2021 09:23:52 GMT (envelope-from git) Date: Fri, 9 Apr 2021 09:23:52 GMT Message-Id: <202104090923.1399NqYQ065885@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: 2b59392cb0da - main - config(8): Mention the authors of a paper in the SEE ALSO section 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: 2b59392cb0da804e825c63469beb1934ec4267db Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 09:23:53 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2b59392cb0da804e825c63469beb1934ec4267db commit 2b59392cb0da804e825c63469beb1934ec4267db Author: Gordon Bergling AuthorDate: 2021-04-09 09:20:49 +0000 Commit: Gordon Bergling CommitDate: 2021-04-09 09:20:49 +0000 config(8): Mention the authors of a paper in the SEE ALSO section Obtained from: OpenBSD MFC after: 1 week --- usr.sbin/config/config.8 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/usr.sbin/config/config.8 b/usr.sbin/config/config.8 index b33c972c8efa..929607712ef8 100644 --- a/usr.sbin/config/config.8 +++ b/usr.sbin/config/config.8 @@ -28,7 +28,7 @@ .\" @(#)config.8 8.2 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd June 29, 2020 +.Dd April 9, 2021 .Dt CONFIG 8 .Os .Sh NAME @@ -249,7 +249,11 @@ The .Sx SYNOPSIS portion of each device in section 4. .Rs +.\" 4.4BSD SMM:2 +.%A S. J. Leffler +.%A M. J. Karels .%T "Building 4.3 BSD UNIX System with Config" +.%B 4.4BSD System Manager's Manual (SMM) .Re .Sh HISTORY The From owner-dev-commits-src-all@freebsd.org Fri Apr 9 09:30:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 101395D1474; Fri, 9 Apr 2021 09:30: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 4FGtCf00mpz4VkC; Fri, 9 Apr 2021 09:30: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 E677E1B2E3; Fri, 9 Apr 2021 09:30: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 1399UbCf074607; Fri, 9 Apr 2021 09:30:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1399Ub6u074606; Fri, 9 Apr 2021 09:30:37 GMT (envelope-from git) Date: Fri, 9 Apr 2021 09:30:37 GMT Message-Id: <202104090930.1399Ub6u074606@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: c07aa0a5878f - main - lpd(8): Mention the author of a paper in the SEE ALSO section 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: c07aa0a5878f55ef22b8d0ba5f66a728b1407427 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 09:30:38 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c07aa0a5878f55ef22b8d0ba5f66a728b1407427 commit c07aa0a5878f55ef22b8d0ba5f66a728b1407427 Author: Gordon Bergling AuthorDate: 2021-04-09 09:29:18 +0000 Commit: Gordon Bergling CommitDate: 2021-04-09 09:29:18 +0000 lpd(8): Mention the author of a paper in the SEE ALSO section Obtained from: OpenBSD MFC after: 1 week --- usr.sbin/lpr/lpd/lpd.8 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.sbin/lpr/lpd/lpd.8 b/usr.sbin/lpr/lpd/lpd.8 index 46c254c6dceb..2554aba2f834 100644 --- a/usr.sbin/lpr/lpd/lpd.8 +++ b/usr.sbin/lpr/lpd/lpd.8 @@ -28,7 +28,7 @@ .\" @(#)lpd.8 8.3 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd June 6, 2001 +.Dd April 9, 2021 .Dt LPD 8 .Os .Sh NAME @@ -333,6 +333,8 @@ but not under same administrative control. .Xr lpc 8 , .Xr pac 8 .Rs +.\" 4.4BSD SMM:7 +.%A Ralph Campbell .%T "4.2 BSD Line Printer Spooler Manual" .Re .Sh HISTORY From owner-dev-commits-src-all@freebsd.org Fri Apr 9 14:23:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A88F95BA160; Fri, 9 Apr 2021 14:23: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 4FH0jC4LfKz4m66; Fri, 9 Apr 2021 14:23: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 87FDE1F99C; Fri, 9 Apr 2021 14:23: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 139ENBTJ066040; Fri, 9 Apr 2021 14:23:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139ENBQn066039; Fri, 9 Apr 2021 14:23:11 GMT (envelope-from git) Date: Fri, 9 Apr 2021 14:23:11 GMT Message-Id: <202104091423.139ENBQn066039@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: f2400e6e832d - main - Removed the reference to the deprecated splx API from ifnet(9). 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: f2400e6e832d42ca72b0d04ecd070598f4a81eb7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 14:23:11 -0000 The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=f2400e6e832d42ca72b0d04ecd070598f4a81eb7 commit f2400e6e832d42ca72b0d04ecd070598f4a81eb7 Author: Dmitry Chagin AuthorDate: 2021-04-09 14:22:12 +0000 Commit: Dmitry Chagin CommitDate: 2021-04-09 14:22:12 +0000 Removed the reference to the deprecated splx API from ifnet(9). Reviewed by: emaste, markj PR: 254880 MFC After: 1 week Differential Revision: https://reviews.freebsd.org/D29666 --- share/man/man9/ifnet.9 | 9 --------- 1 file changed, 9 deletions(-) diff --git a/share/man/man9/ifnet.9 b/share/man/man9/ifnet.9 index 126fcb9bc671..90a95106b1d5 100644 --- a/share/man/man9/ifnet.9 +++ b/share/man/man9/ifnet.9 @@ -1393,15 +1393,6 @@ The socket's protocol control routine is called to implement the requested action. .El .El -.Pp -.Fn if_down , -.Fn ifioctl , -.Fn ifpromisc , -and -.Fn if_up -must be called at -.Fn splnet -or higher. .Ss "Interface Address Functions" Several functions exist to look up an interface address structure given an address. From owner-dev-commits-src-all@freebsd.org Fri Apr 9 14:56:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A6245BB582; Fri, 9 Apr 2021 14:56:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FH1RL33Cmz4njZ; Fri, 9 Apr 2021 14:56:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 577061FEA4; Fri, 9 Apr 2021 14:56:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 139EuEqf005745; Fri, 9 Apr 2021 14:56:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139EuExL005744; Fri, 9 Apr 2021 14:56:14 GMT (envelope-from git) Date: Fri, 9 Apr 2021 14:56:14 GMT Message-Id: <202104091456.139EuExL005744@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: df23288bc0c6 - stable/12 - vfs: honor error code returned by mac_vnode_check_rename_from 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/stable/12 X-Git-Reftype: branch X-Git-Commit: df23288bc0c6d3c16287756c7f43c679fba6a0de Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 14:56:14 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=df23288bc0c6d3c16287756c7f43c679fba6a0de commit df23288bc0c6d3c16287756c7f43c679fba6a0de Author: Mateusz Guzik AuthorDate: 2020-07-29 17:04:33 +0000 Commit: Mark Johnston CommitDate: 2021-04-09 14:49:52 +0000 vfs: honor error code returned by mac_vnode_check_rename_from (cherry picked from commit fd8c6a48abe0ad2ba64b611fe044830f89b30138) --- sys/kern/vfs_syscalls.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 64b2f5d4a18a..f07ee87fce08 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -3499,20 +3499,27 @@ again: NDINIT_ATRIGHTS(&fromnd, DELETE, LOCKPARENT | LOCKLEAF | SAVESTART | AUDITVNODE1, pathseg, old, oldfd, &cap_renameat_source_rights, td); -#else - NDINIT_ATRIGHTS(&fromnd, DELETE, WANTPARENT | SAVESTART | AUDITVNODE1, - pathseg, old, oldfd, - &cap_renameat_source_rights, td); -#endif - if ((error = namei(&fromnd)) != 0) return (error); -#ifdef MAC error = mac_vnode_check_rename_from(td->td_ucred, fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd); VOP_UNLOCK(fromnd.ni_dvp, 0); if (fromnd.ni_dvp != fromnd.ni_vp) VOP_UNLOCK(fromnd.ni_vp, 0); + if (error != 0) { + NDFREE(&fromnd, NDF_ONLY_PNBUF); + vrele(fromnd.ni_dvp); + vrele(fromnd.ni_vp); + if (fromnd.ni_startdir) + vrele(fromnd.ni_startdir); + return (error); + } +#else + NDINIT_ATRIGHTS(&fromnd, DELETE, WANTPARENT | SAVESTART | AUDITVNODE1, + pathseg, old, oldfd, + &cap_renameat_source_rights, td); + if ((error = namei(&fromnd)) != 0) + return (error); #endif fvp = fromnd.ni_vp; NDINIT_ATRIGHTS(&tond, RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | From owner-dev-commits-src-all@freebsd.org Fri Apr 9 15:34:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A723D5BC07A; Fri, 9 Apr 2021 15:34: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 4FH2H34LXfz4qYx; Fri, 9 Apr 2021 15:34: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 881522071C; Fri, 9 Apr 2021 15:34: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 139FY7CL059306; Fri, 9 Apr 2021 15:34:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139FY7Qn059305; Fri, 9 Apr 2021 15:34:07 GMT (envelope-from git) Date: Fri, 9 Apr 2021 15:34:07 GMT Message-Id: <202104091534.139FY7Qn059305@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: 46c99528078a - main - sysctl.conf(5): Mention sysctl.conf.local in the sysctl.conf(5) manual page 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: 46c99528078ad478f50910110a933abef0b89cde Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 15:34:07 -0000 The branch main has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=46c99528078ad478f50910110a933abef0b89cde commit 46c99528078ad478f50910110a933abef0b89cde Author: Gordon Bergling AuthorDate: 2021-04-09 15:28:18 +0000 Commit: Gordon Bergling CommitDate: 2021-04-09 15:28:18 +0000 sysctl.conf(5): Mention sysctl.conf.local in the sysctl.conf(5) manual page The possibility of using a sysctl.conf.local on a machine that has a shared sysctl.conf(5) isn't documented. So mention the sysctl.conf.local in the manual page. PR: 254901 Submitted by: Jose Luis Duran Reported by: Jose Luis Duran Reviewed by: markj MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29673 --- share/man/man5/sysctl.conf.5 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/share/man/man5/sysctl.conf.5 b/share/man/man5/sysctl.conf.5 index 664eee8080fc..99df8b794d83 100644 --- a/share/man/man5/sysctl.conf.5 +++ b/share/man/man5/sysctl.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 21, 2018 +.Dd April 8, 2021 .Dt SYSCTL.CONF 5 .Os .Sh NAME @@ -52,10 +52,13 @@ as seen in the .Sx EXAMPLES section, below. .Sh FILES -.Bl -tag -width /etc/sysctl.conf -compact +.Bl -tag -width /etc/sysctl.conf.local -compact .It Pa /etc/sysctl.conf Initial settings for .Xr sysctl 8 . +.It Pa /etc/sysctl.conf.local +Machine-specific settings for sites with a common +.Pa /etc/sysctl.conf . .El .Sh EXAMPLES To turn off logging of programs that exit due to fatal signals you may use From owner-dev-commits-src-all@freebsd.org Fri Apr 9 18:54:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE58D5C06F9; Fri, 9 Apr 2021 18:54: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 4FH6k14sLVz3Hgc; Fri, 9 Apr 2021 18:54: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 95B6323408; Fri, 9 Apr 2021 18:54: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 139IsH2Q024142; Fri, 9 Apr 2021 18:54:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139IsHqA024141; Fri, 9 Apr 2021 18:54:17 GMT (envelope-from git) Date: Fri, 9 Apr 2021 18:54:17 GMT Message-Id: <202104091854.139IsHqA024141@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: fc1b4743b270 - Create tag release/13.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/tags/release/13.0.0 X-Git-Reftype: annotated tag X-Git-Commit: fc1b4743b2707bac402b7a20855964bc75e82685 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 18:54:18 -0000 The annotated tag release/13.0.0 has been created by gjb: URL: https://cgit.FreeBSD.org/src/tag/?h=release/13.0.0 tag release/13.0.0 Tagger: Glen Barber TaggerDate: 2021-04-09 18:52:16 +0000 13.0-RELEASE: tag release/13.0.0 Approved by: re (implicit) -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAmBwooAACgkQAxRYpUeP 4pPzQA//T4/Lha3kSWoDwQOZGiP43Jhu0/x3V9OA2O7FYK6zgRfl2nFHwfKRA/3I xky711SpdYkM/dew1J6qUKLw8EwNBVPK2SyjfYN5r5d5T/CA6XhMUqDcM9f6jixn /8YBb7nc5oh80XLdSz05sNfhoxcJ04ytGx2Mes6wCu29Zniua+9aaLo6qax9LVHX cHwmK31tM5vScmlKFefSdehja3sE9aNS89y/q57EtO7vAk+Dm6yn3nH1zGKDNPtA hvCn0r7zehqL0Sb/Ujba3D1RCgnbGnLpGbqmhkd4oSbJerfvqg6EekWCMAHlXIAv Z4mCfht0hKDQpuOF3OQbSq7ojx6ktK2Ix8hlTDg8+E7azceFF9+q/S37E6U5rA1Y zHk26eQwywilUy1vHKC4w81kif5cYthZbUtOPsQmBPjqINYt1/0RV+QtJ90+C5NT tOOMipFOXcTEWAORxu4BJzxfLbYbpT6XC1Ld7VoBybL8puOS0UD0Xi7cdX9RoXXx Who/HvUXWbCJUOoL56mTzr7Sa+wpMI3/t2YndiFCTg+ximAE8vdmqd98qPgh+7r6 RJAvfhKQf/akQIymMfVeIIrdhKkDG5TdlVQ8WUTpap6ur56cfh7NTYFFWizRttzy 0d4Pc5ppFIlBMBBb5FMReOIBlUexmyM61LmiqeXeX1br1O6Qzf0= =kX6v -----END PGP SIGNATURE----- commit ea31abc261ffc01b6ff5671bffb15cf910a07f4b Author: Glen Barber AuthorDate: 2021-04-09 00:14:30 +0000 Commit: Glen Barber CommitDate: 2021-04-09 00:14:30 +0000 13.0: update to RELEASE Approved by: re (implicit) Sponsored by: Rubicon Communications, LLC ("Netgate") From owner-dev-commits-src-all@freebsd.org Fri Apr 9 19:33:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 162155CD22C; Fri, 9 Apr 2021 19:33: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 4FH7bc09Fnz3vn8; Fri, 9 Apr 2021 19:33: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 EC14B23C55; Fri, 9 Apr 2021 19:33: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 139JXlHt077785; Fri, 9 Apr 2021 19:33:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139JXlca077784; Fri, 9 Apr 2021 19:33:47 GMT (envelope-from git) Date: Fri, 9 Apr 2021 19:33:47 GMT Message-Id: <202104091933.139JXlca077784@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 172c5eb272df - main - netmap: vtnet: remove unused variable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 172c5eb272dfaa5c7e6450141f09204e1b2e3320 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 19:33:48 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=172c5eb272dfaa5c7e6450141f09204e1b2e3320 commit 172c5eb272dfaa5c7e6450141f09204e1b2e3320 Author: Vincenzo Maffione AuthorDate: 2021-04-09 19:26:23 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-09 19:33:41 +0000 netmap: vtnet: remove unused variable Reported by: bdragon --- sys/dev/netmap/if_vtnet_netmap.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/dev/netmap/if_vtnet_netmap.h b/sys/dev/netmap/if_vtnet_netmap.h index a423e71331be..8bff697b3fdb 100644 --- a/sys/dev/netmap/if_vtnet_netmap.h +++ b/sys/dev/netmap/if_vtnet_netmap.h @@ -87,10 +87,9 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int flags) uint64_t offset = nm_get_offset(kring, slot); u_int len = slot->len; uint64_t paddr; - void *addr = PNMB(na, slot, &paddr); int err; - (void)addr; + (void)PNMB(na, slot, &paddr); NM_CHECK_ADDR_LEN_OFF(na, len, offset); slot->flags &= ~(NS_REPORT | NS_BUF_CHANGED); From owner-dev-commits-src-all@freebsd.org Fri Apr 9 19:29:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA8535CB430; Fri, 9 Apr 2021 19:29:19 +0000 (UTC) (envelope-from vmaffione@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 4FH7VR58Vsz3tZY; Fri, 9 Apr 2021 19:29:19 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: vmaffione) by smtp.freebsd.org (Postfix) with ESMTPSA id 8FF1D213FA; Fri, 9 Apr 2021 19:29:19 +0000 (UTC) (envelope-from vmaffione@freebsd.org) Received: by mail-pj1-f52.google.com with SMTP id ot17-20020a17090b3b51b0290109c9ac3c34so5458058pjb.4; Fri, 09 Apr 2021 12:29:19 -0700 (PDT) X-Gm-Message-State: AOAM533kN9esMtnYb2pGQdRsnxHQogaIvpnurKgf0Za6WgDQkOpxvEXi qdJTUzMH6u6L4mHXzVRLtC2+CCh0dpr2BJr5TDA= X-Google-Smtp-Source: ABdhPJzj5sq2gA3paqevlaUgIiBpVUm10LhLmnCA6P/HYzjycrAKuxquptLoL2RE/+WrzyDHnJsxFV4FHLlmcTzbXGs= X-Received: by 2002:a17:90b:33d0:: with SMTP id lk16mr14665346pjb.115.1617996558363; Fri, 09 Apr 2021 12:29:18 -0700 (PDT) MIME-Version: 1.0 References: <202104072142.137LgrJC015011@gitrepo.freebsd.org> <20210407214622.gsedn2cuuj7mblq2@mutt-hbsd> <20210407220730.6z6j2ejytu3j67ik@mutt-hbsd> <975e9c9c-4236-4ab8-9862-cef39d862838@www.fastmail.com> In-Reply-To: <975e9c9c-4236-4ab8-9862-cef39d862838@www.fastmail.com> From: Vincenzo Maffione Date: Fri, 9 Apr 2021 21:29:06 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 15dc713ceb57 - main - netmap: vtnet: add support for netmap offsets To: Brandon Bergren Cc: Shawn Webb , src-committers , dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 19:29:20 -0000 That's right, thanks for the suggestion. Il giorno gio 8 apr 2021 alle ore 05:23 Brandon Bergren ha scritto: > On Wed, Apr 7, 2021, at 5:13 PM, Vincenzo Maffione wrote: > > Oh, I'm sorry. That's just to silence the compiler because of the > > unused variable addr. We only need the paddr output value in that > > context. > > How about casting away the return value from the call directly then, > instead of having addr in the first place? > > -- > Brandon Bergren > bdragon@FreeBSD.org > From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:39:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2FC3B5BBFC2; Fri, 9 Apr 2021 20:39: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 4FH93p0Yfzz4b9X; Fri, 9 Apr 2021 20:39: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 0609624726; Fri, 9 Apr 2021 20:39: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 139Kdnl0057689; Fri, 9 Apr 2021 20:39:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139KdndR057688; Fri, 9 Apr 2021 20:39:49 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:39:49 GMT Message-Id: <202104092039.139KdndR057688@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: ee2cf2b3609e - main - Implement better rebuild-delay fib algo policy. 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: ee2cf2b3609ee179f39080e0ebe8bf79dcb13461 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:39:50 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=ee2cf2b3609ee179f39080e0ebe8bf79dcb13461 commit ee2cf2b3609ee179f39080e0ebe8bf79dcb13461 Author: Alexander V. Chernikov AuthorDate: 2021-04-09 20:25:47 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-09 20:33:03 +0000 Implement better rebuild-delay fib algo policy. The intent is to better handle time intervals with large amount of RIB updates (e.g. BGP peer going up or down), while still keeping low sync delay for the rest scenarios. The implementation is the following: updates are bucketed into the buckets of size 50ms. If the number of updates within a current bucket exceeds the threshold of 500 routes/sec (e.g. 10 updates per bucket interval), the update is delayed for another 50ms. This can be repeated until the maximum update delay (1 sec) is reached. All 3 variables are runtime tunables: * net.route.algo.fib_max_sync_delay_ms: 1000 * net.route.algo.bucket_change_threshold_rate: 500 * net.route.algo.bucket_time_ms: 50 Differential Review: https://reviews.freebsd.org/D29588 MFC after: 2 weeks --- sys/net/route/fib_algo.c | 289 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 228 insertions(+), 61 deletions(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index 03c265d28d09..622026668764 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -105,10 +105,26 @@ SYSCTL_DECL(_net_route); SYSCTL_NODE(_net_route, OID_AUTO, algo, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Fib algorithm lookups"); -VNET_DEFINE(int, fib_sync_limit) = 100; -#define V_fib_sync_limit VNET(fib_sync_limit) -SYSCTL_INT(_net_route_algo, OID_AUTO, fib_sync_limit, CTLFLAG_RW | CTLFLAG_VNET, - &VNET_NAME(fib_sync_limit), 0, "Guarantee synchronous fib till route limit"); +/* Algorithm sync policy */ + +/* Time interval to bucket updates */ +VNET_DEFINE(unsigned int, bucket_time_ms) = 50; +#define V_bucket_time_ms VNET(bucket_time_ms) +SYSCTL_UINT(_net_route_algo, OID_AUTO, bucket_time_ms, CTLFLAG_RW | CTLFLAG_VNET, + &VNET_NAME(bucket_time_ms), 0, "Time interval to calculate update rate"); + +/* Minimum update rate to delay sync */ +VNET_DEFINE(unsigned int, bucket_change_threshold_rate) = 500; +#define V_bucket_change_threshold_rate VNET(bucket_change_threshold_rate) +SYSCTL_UINT(_net_route_algo, OID_AUTO, bucket_change_threshold_rate, CTLFLAG_RW | CTLFLAG_VNET, + &VNET_NAME(bucket_change_threshold_rate), 0, "Minimum update rate to delay sync"); + +/* Max allowed delay to sync */ +VNET_DEFINE(unsigned int, fib_max_sync_delay_ms) = 1000; +#define V_fib_max_sync_delay_ms VNET(fib_max_sync_delay_ms) +SYSCTL_UINT(_net_route_algo, OID_AUTO, fib_max_sync_delay_ms, CTLFLAG_RW | CTLFLAG_VNET, + &VNET_NAME(fib_max_sync_delay_ms), 0, "Maximum time to delay sync (ms)"); + #ifdef INET6 VNET_DEFINE_STATIC(bool, algo_fixed_inet6) = false; @@ -131,6 +147,19 @@ struct nhop_ref_table { int32_t refcnt[0]; }; +enum fib_callout_action { + FDA_NONE, /* No callout scheduled */ + FDA_REBUILD, /* Asks to rebuild algo instance */ + FDA_EVAL, /* Asks to evaluate if the current algo is still be best */ +}; + +struct fib_sync_status { + struct timeval diverge_time; /* ts when diverged */ + uint32_t num_changes; /* number of changes since sync */ + uint32_t bucket_changes; /* num changes within the current bucket */ + uint64_t bucket_id; /* 50ms bucket # */ +}; + /* * Data structure for the fib lookup instance tied to the particular rib. */ @@ -141,12 +170,12 @@ struct fib_data { uint32_t fd_dead:1; /* Scheduled for deletion */ uint32_t fd_linked:1; /* true if linked */ uint32_t fd_need_rebuild:1; /* true if rebuild scheduled */ - uint32_t fd_force_eval:1;/* true if rebuild scheduled */ uint8_t fd_family; /* family */ uint32_t fd_fibnum; /* fibnum */ uint32_t fd_failed_rebuilds; /* stat: failed rebuilds */ uint32_t fd_gen; /* instance gen# */ struct callout fd_callout; /* rebuild callout */ + enum fib_callout_action fd_callout_action; /* Callout action to take */ void *fd_algo_data; /* algorithm data */ struct nhop_object **nh_idx; /* nhop idx->ptr array */ struct nhop_ref_table *nh_ref_table; /* array with # of nhop references */ @@ -156,12 +185,14 @@ struct fib_data { struct vnet *fd_vnet; /* vnet fib belongs to */ struct epoch_context fd_epoch_ctx; /* epoch context for deletion */ struct fib_lookup_module *fd_flm;/* pointer to the lookup module */ + struct fib_sync_status fd_ss; /* State relevant to the rib sync */ uint32_t fd_num_changes; /* number of changes since last callout */ TAILQ_ENTRY(fib_data) entries; /* list of all fds in vnet */ }; -static bool rebuild_fd(struct fib_data *fd); -static void rebuild_fd_callout(void *_data); +static bool rebuild_fd(struct fib_data *fd, const char *reason); +static bool rebuild_fd_flm(struct fib_data *fd, struct fib_lookup_module *flm_new); +static void handle_fd_callout(void *_data); static void destroy_fd_instance_epoch(epoch_context_t ctx); static enum flm_op_result attach_datapath(struct fib_data *fd); static bool is_idx_free(struct fib_data *fd, uint32_t index); @@ -195,6 +226,7 @@ MTX_SYSINIT(fib_mtx, &fib_mtx, "algo list mutex", MTX_DEF); #define FIB_MAX_NHOPS 262144 #define FIB_CALLOUT_DELAY_MS 50 + /* Debug */ static int flm_debug_level = LOG_NOTICE; SYSCTL_INT(_net_route_algo, OID_AUTO, debug_level, CTLFLAG_RW | CTLFLAG_RWTUN, @@ -459,11 +491,13 @@ callout_calc_delay_ms(struct fib_data *fd) } static void -schedule_callout(struct fib_data *fd, int delay_ms) +schedule_callout(struct fib_data *fd, enum fib_callout_action action, int delay_ms) { + FD_PRINTF(LOG_DEBUG, fd, "delay=%d action=%d", delay_ms, action); + fd->fd_callout_action = action; callout_reset_sbt(&fd->fd_callout, SBT_1MS * delay_ms, 0, - rebuild_fd_callout, fd, 0); + handle_fd_callout, fd, 0); } static void @@ -481,37 +515,138 @@ schedule_fd_rebuild(struct fib_data *fd, const char *reason) */ FD_PRINTF(LOG_INFO, fd, "Scheduling rebuild: %s (failures=%d)", reason, fd->fd_failed_rebuilds); - schedule_callout(fd, callout_calc_delay_ms(fd)); + schedule_callout(fd, FDA_REBUILD, callout_calc_delay_ms(fd)); + } +} + +static int64_t +get_tv_diff_ms(const struct timeval *old_tv, const struct timeval *new_tv) +{ + int64_t diff = 0; + + diff = ((int64_t)(new_tv->tv_sec - old_tv->tv_sec)) * 1000; + diff += (new_tv->tv_usec - old_tv->tv_usec) / 1000; + + return (diff); +} + +static void +add_tv_diff_ms(struct timeval *tv, int ms) +{ + tv->tv_sec += ms / 1000; + ms = ms % 1000; + if (ms * 1000 + tv->tv_usec < 1000000) + tv->tv_usec += ms * 1000; + else { + tv->tv_sec += 1; + tv->tv_usec = ms * 1000 + tv->tv_usec - 1000000; } } +/* + * Marks the time when algo state diverges from the rib state. + */ static void -schedule_algo_eval(struct fib_data *fd) +mark_diverge_time(struct fib_data *fd) +{ + struct fib_sync_status *fd_ss = &fd->fd_ss; + + getmicrouptime(&fd_ss->diverge_time); + fd_ss->bucket_id = 0; + fd_ss->bucket_changes = 0; +} + +/* + * Calculates and updates the next algorithm sync time, based on the current activity. + * + * The intent is to provide reasonable balance between the update + * latency and efficient batching when changing large amount of routes. + * + * High-level algorithm looks the following: + * 1) all changes are bucketed in 50ms intervals + * 2) If amount of changes within the bucket is greater than the threshold, + * the update gets delayed, up to maximum delay threshold. + */ +static void +update_rebuild_delay(struct fib_data *fd) +{ + uint32_t bucket_id, new_delay = 0; + struct timeval tv; + + /* Fetch all variables at once to ensure consistent reads */ + uint32_t bucket_time_ms = V_bucket_time_ms; + uint32_t threshold_rate = V_bucket_change_threshold_rate; + uint32_t max_delay_ms = V_fib_max_sync_delay_ms; + + if (bucket_time_ms == 0) + bucket_time_ms = 50; + /* calculate per-bucket threshold rate */ + threshold_rate = threshold_rate * bucket_time_ms / 1000; + + getmicrouptime(&tv); + + struct fib_sync_status *fd_ss = &fd->fd_ss; + + bucket_id = get_tv_diff_ms(&fd_ss->diverge_time, &tv) / bucket_time_ms; + + if (fd_ss->bucket_id == bucket_id) { + fd_ss->bucket_changes++; + if (fd_ss->bucket_changes == threshold_rate) { + new_delay = (bucket_id + 2) * bucket_time_ms; + if (new_delay <= max_delay_ms) { + FD_PRINTF(LOG_DEBUG, fd, + "hit threshold of %u routes, delay update," + "bucket: %u, total delay: %u", + threshold_rate, bucket_id + 1, new_delay); + } else { + new_delay = 0; + FD_PRINTF(LOG_DEBUG, fd, + "maximum sync delay (%u ms) reached", max_delay_ms); + } + } else if ((bucket_id == 0) && (fd_ss->bucket_changes == 1)) + new_delay = bucket_time_ms; + } else { + fd_ss->bucket_id = bucket_id; + fd_ss->bucket_changes = 1; + } + + if (new_delay > 0) { + /* Calculated time has been updated */ + struct timeval new_tv = fd_ss->diverge_time; + add_tv_diff_ms(&new_tv, new_delay); + + int32_t delay_ms = get_tv_diff_ms(&tv, &new_tv); + schedule_callout(fd, FDA_REBUILD, delay_ms); + } +} + +static void +update_algo_state(struct fib_data *fd) { RIB_WLOCK_ASSERT(fd->fd_rh); + if (fd->fd_need_rebuild) { + update_rebuild_delay(fd); + return; + } + if (fd->fd_num_changes++ == 0) { /* Start callout to consider switch */ if (!callout_pending(&fd->fd_callout)) - schedule_callout(fd, ALGO_EVAL_DELAY_MS); - } else if (fd->fd_num_changes > ALGO_EVAL_NUM_ROUTES && !fd->fd_force_eval) { + schedule_callout(fd, FDA_EVAL, ALGO_EVAL_DELAY_MS); + } else if (fd->fd_num_changes == ALGO_EVAL_NUM_ROUTES) { /* Reset callout to exec immediately */ - if (!fd->fd_need_rebuild) { - fd->fd_force_eval = true; - schedule_callout(fd, 1); - } + if (fd->fd_callout_action == FDA_EVAL) + schedule_callout(fd, FDA_EVAL, 1); } } static bool -need_immediate_rebuild(struct fib_data *fd, struct rib_cmd_info *rc) +need_immediate_sync(struct fib_data *fd, struct rib_cmd_info *rc) { struct nhop_object *nh; - if ((V_fib_sync_limit == 0) || (fd->fd_rh->rnh_prefixes <= V_fib_sync_limit)) - return (true); - /* Sync addition/removal of interface routes */ switch (rc->rc_cmd) { case RTM_ADD: @@ -550,6 +685,12 @@ handle_rtable_change_cb(struct rib_head *rnh, struct rib_cmd_info *rc, */ if (!fd->init_done) return; + + bool immediate_sync = need_immediate_sync(fd, rc); + + /* Consider scheduling algorithm re-evaluation */ + update_algo_state(fd); + /* * If algo requested rebuild, stop sending updates by default. * This simplifies nexthop refcount handling logic. @@ -557,9 +698,6 @@ handle_rtable_change_cb(struct rib_head *rnh, struct rib_cmd_info *rc, if (fd->fd_need_rebuild) return; - /* Consider scheduling algorithm re-evaluation */ - schedule_algo_eval(fd); - /* * Maintain guarantee that every nexthop returned by the dataplane * lookup has > 0 refcount, so can be safely referenced within current @@ -587,15 +725,14 @@ handle_rtable_change_cb(struct rib_head *rnh, struct rib_cmd_info *rc, * Algo is not able to apply the update. * Schedule algo rebuild. */ - if (!need_immediate_rebuild(fd, rc)) { + if (!immediate_sync) { + mark_diverge_time(fd); schedule_fd_rebuild(fd, "algo requested rebuild"); break; } - fd->fd_need_rebuild = true; FD_PRINTF(LOG_INFO, fd, "running sync rebuild"); - if (!rebuild_fd(fd)) - schedule_fd_rebuild(fd, "sync rebuild failed"); + rebuild_fd(fd, "rtable change type enforced sync"); break; case FLM_ERROR: @@ -1029,22 +1166,54 @@ setup_fd_instance(struct fib_lookup_module *flm, struct rib_head *rh, return (result); } +/* + * Tries to sync algo with the current rtable state, either + * by executing batch update or rebuilding. + * Returns true on success. + */ +static bool +execute_callout_action(struct fib_data *fd) +{ + enum fib_callout_action action = fd->fd_callout_action; + struct fib_lookup_module *flm_new = NULL; + bool result = true; + + NET_EPOCH_ASSERT(); + RIB_WLOCK_ASSERT(fd->fd_rh); + + fd->fd_need_rebuild = false; + fd->fd_num_changes = 0; + + /* First, check if we're still OK to use this algo */ + if (!is_algo_fixed(fd->fd_rh)) + flm_new = fib_check_best_algo(fd->fd_rh, fd->fd_flm); + if (flm_new != NULL) + action = FDA_REBUILD; + + if (action == FDA_REBUILD) + result = rebuild_fd_flm(fd, flm_new != NULL ? flm_new : fd->fd_flm); + if (flm_new != NULL) + fib_unref_algo(flm_new); + + return (result); +} + /* * Callout for all scheduled fd-related work. * - Checks if the current algo is still the best algo * - Creates a new instance of an algo for af/fib if desired. */ static void -rebuild_fd_callout(void *_data) +handle_fd_callout(void *_data) { struct fib_data *fd = (struct fib_data *)_data; struct epoch_tracker et; - FD_PRINTF(LOG_INFO, fd, "running callout rebuild"); + FD_PRINTF(LOG_INFO, fd, "running callout type=%d", fd->fd_callout_action); NET_EPOCH_ENTER(et); CURVNET_SET(fd->fd_vnet); - rebuild_fd(fd); + execute_callout_action(fd); CURVNET_RESTORE(); NET_EPOCH_EXIT(et); } @@ -1054,41 +1223,17 @@ rebuild_fd_callout(void *_data) * Returns true on success. */ static bool -rebuild_fd(struct fib_data *fd) +rebuild_fd_flm(struct fib_data *fd, struct fib_lookup_module *flm_new) { - struct fib_data *fd_new, *fd_tmp; - struct fib_lookup_module *flm_new = NULL; - enum flm_op_result result; - bool need_rebuild = false; - - NET_EPOCH_ASSERT(); - RIB_WLOCK_ASSERT(fd->fd_rh); - - need_rebuild = fd->fd_need_rebuild; - fd->fd_need_rebuild = false; - fd->fd_force_eval = false; - fd->fd_num_changes = 0; - - /* First, check if we're still OK to use this algo */ - if (!is_algo_fixed(fd->fd_rh)) - flm_new = fib_check_best_algo(fd->fd_rh, fd->fd_flm); - if ((flm_new == NULL) && (!need_rebuild)) { - /* Keep existing algo, no need to rebuild. */ - return (true); - } + struct fib_data *fd_new, *fd_tmp = NULL; + bool result; - if (flm_new == NULL) { - flm_new = fd->fd_flm; + if (flm_new == fd->fd_flm) fd_tmp = fd; - } else { - fd_tmp = NULL; + else FD_PRINTF(LOG_NOTICE, fd, "switching algo to %s", flm_new->flm_name); - } + result = setup_fd_instance(flm_new, fd->fd_rh, fd_tmp, &fd_new, true); - if (fd_tmp == NULL) { - /* fd_new represents new algo */ - fib_unref_algo(flm_new); - } if (result != FLM_SUCCESS) { FD_PRINTF(LOG_NOTICE, fd, "table rebuild failed"); return (false); @@ -1101,6 +1246,28 @@ rebuild_fd(struct fib_data *fd) return (true); } +static bool +rebuild_fd(struct fib_data *fd, const char *reason) +{ + struct fib_lookup_module *flm_new = NULL; + bool result; + + if (!is_algo_fixed(fd->fd_rh)) + flm_new = fib_check_best_algo(fd->fd_rh, fd->fd_flm); + + FD_PRINTF(LOG_INFO, fd, "running sync rebuild: %s", reason); + result = rebuild_fd_flm(fd, flm_new != NULL ? flm_new : fd->fd_flm); + if (flm_new != NULL) + fib_unref_algo(flm_new); + + if (!result) { + FD_PRINTF(LOG_ERR, fd, "sync rebuild failed"); + schedule_fd_rebuild(fd, "sync rebuild failed"); + } + + return (result); +} + /* * Finds algo by name/family. * Returns referenced algo or NULL. From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:44:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 330D45BC1B5; Fri, 9 Apr 2021 20: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 4FH99F0wDwz4b6d; Fri, 9 Apr 2021 20:44: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 121CC2490E; Fri, 9 Apr 2021 20:44: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 139KiWGa070967; Fri, 9 Apr 2021 20: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 139KiWv5070966; Fri, 9 Apr 2021 20:44:32 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:44:32 GMT Message-Id: <202104092044.139KiWv5070966@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: dc47fdf1319f - main - Stop arming periodic process timers on suspend or terminate 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: dc47fdf1319f18be1aadbcdef17c721a83415d84 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:44:33 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=dc47fdf1319f18be1aadbcdef17c721a83415d84 commit dc47fdf1319f18be1aadbcdef17c721a83415d84 Author: Konstantin Belousov AuthorDate: 2021-03-05 21:19:35 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:42:44 +0000 Stop arming periodic process timers on suspend or terminate Reported and reviewed by: markj Tested by: markj, pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29106 --- sys/kern/kern_sig.c | 6 ++++-- sys/kern/kern_time.c | 38 ++++++++++++++++++++++++++++++++++++-- sys/kern/sys_process.c | 1 + sys/sys/proc.h | 2 ++ 4 files changed, 43 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 3d55405d3151..212b4997dd5e 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2322,7 +2322,7 @@ tdsendsignal(struct proc *p, struct thread *td, int sig, ksiginfo_t *ksi) thread_unsuspend(p); PROC_SUNLOCK(p); sigqueue_delete(sigqueue, sig); - goto out; + goto out_cont; } if (action == SIG_CATCH) { /* @@ -2337,7 +2337,7 @@ tdsendsignal(struct proc *p, struct thread *td, int sig, ksiginfo_t *ksi) */ thread_unsuspend(p); PROC_SUNLOCK(p); - goto out; + goto out_cont; } if (prop & SIGPROP_STOP) { @@ -2422,6 +2422,8 @@ runfast: PROC_SLOCK(p); thread_unsuspend(p); PROC_SUNLOCK(p); +out_cont: + itimer_proc_continue(p); out: /* If we jump here, proc slock should not be owned. */ PROC_SLOCK_ASSERT(p, MA_NOTOWNED); diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 44f6b4ad07f2..3010ee326105 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -881,6 +881,33 @@ kern_setitimer(struct thread *td, u_int which, struct itimerval *aitv, return (0); } +static void +realitexpire_reset_callout(struct proc *p, sbintime_t *isbtp) +{ + sbintime_t prec; + + prec = isbtp == NULL ? tvtosbt(p->p_realtimer.it_interval) : *isbtp; + callout_reset_sbt(&p->p_itcallout, tvtosbt(p->p_realtimer.it_value), + prec >> tc_precexp, realitexpire, p, C_ABSOLUTE); +} + +void +itimer_proc_continue(struct proc *p) +{ + struct timeval ctv; + + PROC_LOCK_ASSERT(p, MA_OWNED); + + if ((p->p_flag2 & P2_ITSTOPPED) != 0) { + p->p_flag2 &= ~P2_ITSTOPPED; + microuptime(&ctv); + if (timevalcmp(&p->p_realtimer.it_value, &ctv, >=)) + realitexpire(p); + else + realitexpire_reset_callout(p, NULL); + } +} + /* * Real interval timer expired: * send process whose timer expired an alarm signal. @@ -908,6 +935,7 @@ realitexpire(void *arg) wakeup(&p->p_itcallout); return; } + isbt = tvtosbt(p->p_realtimer.it_interval); if (isbt >= sbt_timethreshold) getmicrouptime(&ctv); @@ -917,8 +945,14 @@ realitexpire(void *arg) timevaladd(&p->p_realtimer.it_value, &p->p_realtimer.it_interval); } while (timevalcmp(&p->p_realtimer.it_value, &ctv, <=)); - callout_reset_sbt(&p->p_itcallout, tvtosbt(p->p_realtimer.it_value), - isbt >> tc_precexp, realitexpire, p, C_ABSOLUTE); + + if (P_SHOULDSTOP(p) || P_KILLED(p)) { + p->p_flag2 |= P2_ITSTOPPED; + return; + } + + p->p_flag2 &= ~P2_ITSTOPPED; + realitexpire_reset_callout(p, &isbt); } /* diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 3a184f1d678f..8c0f743aef8a 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -1094,6 +1094,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) p->p_flag &= ~(P_STOPPED_TRACE | P_STOPPED_SIG | P_WAITED); thread_unsuspend(p); PROC_SUNLOCK(p); + itimer_proc_continue(p); break; case PT_WRITE_I: diff --git a/sys/sys/proc.h b/sys/sys/proc.h index d51ad1093833..8d41b9b20f10 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -825,6 +825,7 @@ struct proc { MAP_STACK */ #define P2_STKGAP_DISABLE_EXEC 0x00001000 /* Stack gap disabled after exec */ +#define P2_ITSTOPPED 0x00002000 /* Flags protected by proctree_lock, kept in p_treeflags. */ #define P_TREE_ORPHANED 0x00000001 /* Reparented, on orphan list */ @@ -1091,6 +1092,7 @@ void fork_exit(void (*)(void *, struct trapframe *), void *, struct trapframe *); void fork_return(struct thread *, struct trapframe *); int inferior(struct proc *p); +void itimer_proc_continue(struct proc *p); void kern_proc_vmmap_resident(struct vm_map *map, struct vm_map_entry *entry, int *resident_count, bool *super); void kern_yield(int); From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:44:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D5615BC391; Fri, 9 Apr 2021 20:44: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 4FH99G1pzlz4bTh; Fri, 9 Apr 2021 20:44:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2B2342474B; Fri, 9 Apr 2021 20:44: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 139KiYZJ071003; Fri, 9 Apr 2021 20:44:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139KiYiD071002; Fri, 9 Apr 2021 20:44:34 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:44:34 GMT Message-Id: <202104092044.139KiYiD071002@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: 4d27d8d2f3b8 - main - Stop arming realtime posix process timers on suspend or terminate 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: 4d27d8d2f3b8ae4ef3efc86b220c7ff2dbdbac5a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:44:34 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4d27d8d2f3b8ae4ef3efc86b220c7ff2dbdbac5a commit 4d27d8d2f3b8ae4ef3efc86b220c7ff2dbdbac5a Author: Konstantin Belousov AuthorDate: 2021-03-11 08:16:51 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:42:51 +0000 Stop arming realtime posix process timers on suspend or terminate Reported and reviewed by: markj Tested by: markj, pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29106 --- sys/kern/kern_time.c | 48 +++++++++++++++++++++++++++++++++++++++--------- sys/sys/timers.h | 1 + 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 3010ee326105..d3b19111b0f3 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -895,6 +895,8 @@ void itimer_proc_continue(struct proc *p) { struct timeval ctv; + struct itimer *it; + int id; PROC_LOCK_ASSERT(p, MA_OWNED); @@ -906,6 +908,23 @@ itimer_proc_continue(struct proc *p) else realitexpire_reset_callout(p, NULL); } + + if (p->p_itimers != NULL) { + for (id = 3; id < TIMER_MAX; id++) { + it = p->p_itimers->its_timers[id]; + if (it == NULL) + continue; + if ((it->it_flags & ITF_PSTOPPED) != 0) { + ITIMER_LOCK(it); + if ((it->it_flags & ITF_PSTOPPED) != 0) { + it->it_flags &= ~ITF_PSTOPPED; + if ((it->it_flags & ITF_DELETING) == 0) + realtimer_expire(it); + } + ITIMER_UNLOCK(it); + } + } + } } /* @@ -1651,6 +1670,7 @@ realtimer_expire(void *arg) struct timespec cts, ts; struct timeval tv; struct itimer *it; + struct proc *p; uint64_t interval, now, overruns, value; it = (struct itimer *)arg; @@ -1689,10 +1709,15 @@ realtimer_expire(void *arg) timespecclear(&it->it_time.it_value); } if (timespecisset(&it->it_time.it_value)) { - timespecsub(&it->it_time.it_value, &cts, &ts); - TIMESPEC_TO_TIMEVAL(&tv, &ts); - callout_reset(&it->it_callout, tvtohz(&tv), - realtimer_expire, it); + p = it->it_proc; + if (P_SHOULDSTOP(p) || P_KILLED(p)) { + it->it_flags |= ITF_PSTOPPED; + } else { + timespecsub(&it->it_time.it_value, &cts, &ts); + TIMESPEC_TO_TIMEVAL(&tv, &ts); + callout_reset(&it->it_callout, tvtohz(&tv), + realtimer_expire, it); + } } itimer_enter(it); ITIMER_UNLOCK(it); @@ -1700,11 +1725,16 @@ realtimer_expire(void *arg) ITIMER_LOCK(it); itimer_leave(it); } else if (timespecisset(&it->it_time.it_value)) { - ts = it->it_time.it_value; - timespecsub(&ts, &cts, &ts); - TIMESPEC_TO_TIMEVAL(&tv, &ts); - callout_reset(&it->it_callout, tvtohz(&tv), realtimer_expire, - it); + p = it->it_proc; + if (P_SHOULDSTOP(p) || P_KILLED(p)) { + it->it_flags |= ITF_PSTOPPED; + } else { + ts = it->it_time.it_value; + timespecsub(&ts, &cts, &ts); + TIMESPEC_TO_TIMEVAL(&tv, &ts); + callout_reset(&it->it_callout, tvtohz(&tv), + realtimer_expire, it); + } } } diff --git a/sys/sys/timers.h b/sys/sys/timers.h index aa1912149452..5d6f0c95afa2 100644 --- a/sys/sys/timers.h +++ b/sys/sys/timers.h @@ -82,6 +82,7 @@ struct itimer { #define ITF_DELETING 0x01 #define ITF_WANTED 0x02 +#define ITF_PSTOPPED 0x04 #define ITCF_ONWORKLIST 0x01 From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:44:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B3FF5BC14F; Fri, 9 Apr 2021 20:44: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 4FH99J3h9xz4bHQ; Fri, 9 Apr 2021 20:44: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 6CAE0248FF; Fri, 9 Apr 2021 20:44: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 139Kia6e071047; Fri, 9 Apr 2021 20:44:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139Kia6o071046; Fri, 9 Apr 2021 20:44:36 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:44:36 GMT Message-Id: <202104092044.139Kia6o071046@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: 2fd1ffefaa4d - main - Stop arming kqueue timers on knote owner suspend or terminate 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: 2fd1ffefaa4d2cd99a19f866a949cb2cd58ef998 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:44:36 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2fd1ffefaa4d2cd99a19f866a949cb2cd58ef998 commit 2fd1ffefaa4d2cd99a19f866a949cb2cd58ef998 Author: Konstantin Belousov AuthorDate: 2021-03-05 23:29:08 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:43:51 +0000 Stop arming kqueue timers on knote owner suspend or terminate This way, even if the process specified very tight reschedule intervals, it should be stoppable/killable. Reported and reviewed by: markj Tested by: markj, pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29106 --- sys/kern/init_main.c | 1 + sys/kern/kern_event.c | 60 ++++++++++++++++++++++++++++++++++++++++++++------ sys/kern/kern_fork.c | 1 + sys/kern/kern_sig.c | 1 + sys/kern/sys_process.c | 1 + sys/sys/proc.h | 4 ++++ 6 files changed, 61 insertions(+), 7 deletions(-) diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 2d6a4f636240..86cc2494272f 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -524,6 +524,7 @@ proc0_init(void *dummy __unused) callout_init_mtx(&p->p_itcallout, &p->p_mtx, 0); callout_init_mtx(&p->p_limco, &p->p_mtx, 0); callout_init(&td->td_slpcallout, 1); + TAILQ_INIT(&p->p_kqtim_stop); /* Create credentials. */ newcred = crget(); diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 5e9f1fc35dfe..31b091e20984 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -676,8 +676,10 @@ timer2sbintime(int64_t data, int flags) struct kq_timer_cb_data { struct callout c; + struct proc *p; struct knote *kn; int cpuid; + TAILQ_ENTRY(kq_timer_cb_data) link; sbintime_t next; /* next timer event fires at */ sbintime_t to; /* precalculated timer period, 0 for abs */ }; @@ -689,22 +691,65 @@ kqtimer_sched_callout(struct kq_timer_cb_data *kc) kc->cpuid, C_ABSOLUTE); } +void +kqtimer_proc_continue(struct proc *p) +{ + struct kq_timer_cb_data *kc, *kc1; + struct bintime bt; + sbintime_t now; + + PROC_LOCK_ASSERT(p, MA_OWNED); + + getboottimebin(&bt); + now = bttosbt(bt); + + TAILQ_FOREACH_SAFE(kc, &p->p_kqtim_stop, link, kc1) { + TAILQ_REMOVE(&p->p_kqtim_stop, kc, link); + if (kc->next <= now) + filt_timerexpire(kc->kn); + else + kqtimer_sched_callout(kc); + } +} + static void filt_timerexpire(void *knx) { struct knote *kn; struct kq_timer_cb_data *kc; + struct proc *p; + sbintime_t now; kn = knx; - kn->kn_data++; - KNOTE_ACTIVATE(kn, 0); /* XXX - handle locking */ - - if ((kn->kn_flags & EV_ONESHOT) != 0) - return; kc = kn->kn_ptr.p_v; - if (kc->to == 0) + + if ((kn->kn_flags & EV_ONESHOT) != 0 || kc->to == 0) { + kn->kn_data++; + KNOTE_ACTIVATE(kn, 0); return; - kc->next += kc->to; + } + + for (now = sbinuptime(); kc->next <= now; kc->next += kc->to) + kn->kn_data++; + KNOTE_ACTIVATE(kn, 0); /* XXX - handle locking */ + + /* + * Initial check for stopped kc->p is racy. It is fine to + * miss the set of the stop flags, at worst we would schedule + * one more callout. On the other hand, it is not fine to not + * schedule when we we missed clearing of the flags, we + * recheck them under the lock and observe consistent state. + */ + p = kc->p; + if (P_SHOULDSTOP(p) || P_KILLED(p)) { + PROC_LOCK(p); + if (P_SHOULDSTOP(p) || P_KILLED(p)) { + TAILQ_INSERT_TAIL(&p->p_kqtim_stop, kc, link); + PROC_UNLOCK(p); + return; + } + PROC_UNLOCK(p); + } kqtimer_sched_callout(kc); } @@ -762,6 +807,7 @@ filt_timerattach(struct knote *kn) kn->kn_status &= ~KN_DETACHED; /* knlist_add clears it */ kn->kn_ptr.p_v = kc = malloc(sizeof(*kc), M_KQUEUE, M_WAITOK); kc->kn = kn; + kc->p = curproc; kc->cpuid = PCPU_GET(cpuid); callout_init(&kc->c, 1); filt_timerstart(kn, to); diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 3da8205d8ab0..2a092b192878 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -606,6 +606,7 @@ do_fork(struct thread *td, struct fork_req *fr, struct proc *p2, struct thread * LIST_INIT(&p2->p_orphans); callout_init_mtx(&p2->p_itcallout, &p2->p_mtx, 0); + TAILQ_INIT(&p2->p_kqtim_stop); /* * This begins the section where we must prevent the parent diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 212b4997dd5e..46b520030dcd 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -2424,6 +2424,7 @@ runfast: PROC_SUNLOCK(p); out_cont: itimer_proc_continue(p); + kqtimer_proc_continue(p); out: /* If we jump here, proc slock should not be owned. */ PROC_SLOCK_ASSERT(p, MA_NOTOWNED); diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 8c0f743aef8a..51c7bd662600 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -1095,6 +1095,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) thread_unsuspend(p); PROC_SUNLOCK(p); itimer_proc_continue(p); + kqtimer_proc_continue(p); break; case PT_WRITE_I: diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 8d41b9b20f10..b82de183aa44 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -183,6 +183,7 @@ struct kaudit_record; struct kcov_info; struct kdtrace_proc; struct kdtrace_thread; +struct kq_timer_cb_data; struct mqueue_notifier; struct p_sched; struct proc; @@ -727,6 +728,8 @@ struct proc { */ LIST_ENTRY(proc) p_orphan; /* (e) List of orphan processes. */ LIST_HEAD(, proc) p_orphans; /* (e) Pointer to list of orphans. */ + + TAILQ_HEAD(, kq_timer_cb_data) p_kqtim_stop; /* (c) */ }; #define p_session p_pgrp->pg_session @@ -1093,6 +1096,7 @@ void fork_exit(void (*)(void *, struct trapframe *), void *, void fork_return(struct thread *, struct trapframe *); int inferior(struct proc *p); void itimer_proc_continue(struct proc *p); +void kqtimer_proc_continue(struct proc *p); void kern_proc_vmmap_resident(struct vm_map *map, struct vm_map_entry *entry, int *resident_count, bool *super); void kern_yield(int); From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:44:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 065185BC21A; Fri, 9 Apr 2021 20:44: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 4FH99H2zcLz4bHF; Fri, 9 Apr 2021 20: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 51FAA24679; Fri, 9 Apr 2021 20: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 139KiZla071026; Fri, 9 Apr 2021 20: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 139KiZPY071025; Fri, 9 Apr 2021 20:44:35 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:44:35 GMT Message-Id: <202104092044.139KiZPY071025@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: 533e5057ed25 - main - Add helper for kqueue timers callout scheduling 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: 533e5057ed2503013643bf8450588e4aa58c2b7e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:44:36 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=533e5057ed2503013643bf8450588e4aa58c2b7e commit 533e5057ed2503013643bf8450588e4aa58c2b7e Author: Konstantin Belousov AuthorDate: 2021-03-05 23:31:20 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:42:56 +0000 Add helper for kqueue timers callout scheduling Reviewed by: markj Tested by: markj, pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D29106 --- sys/kern/kern_event.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c index 5185723b8d10..5e9f1fc35dfe 100644 --- a/sys/kern/kern_event.c +++ b/sys/kern/kern_event.c @@ -676,10 +676,19 @@ timer2sbintime(int64_t data, int flags) struct kq_timer_cb_data { struct callout c; + struct knote *kn; + int cpuid; sbintime_t next; /* next timer event fires at */ sbintime_t to; /* precalculated timer period, 0 for abs */ }; +static void +kqtimer_sched_callout(struct kq_timer_cb_data *kc) +{ + callout_reset_sbt_on(&kc->c, kc->next, 0, filt_timerexpire, kc->kn, + kc->cpuid, C_ABSOLUTE); +} + static void filt_timerexpire(void *knx) { @@ -696,8 +705,7 @@ filt_timerexpire(void *knx) if (kc->to == 0) return; kc->next += kc->to; - callout_reset_sbt_on(&kc->c, kc->next, 0, filt_timerexpire, kn, - PCPU_GET(cpuid), C_ABSOLUTE); + kqtimer_sched_callout(kc); } /* @@ -753,6 +761,8 @@ filt_timerattach(struct knote *kn) kn->kn_flags |= EV_CLEAR; /* automatically set */ kn->kn_status &= ~KN_DETACHED; /* knlist_add clears it */ kn->kn_ptr.p_v = kc = malloc(sizeof(*kc), M_KQUEUE, M_WAITOK); + kc->kn = kn; + kc->cpuid = PCPU_GET(cpuid); callout_init(&kc->c, 1); filt_timerstart(kn, to); @@ -772,8 +782,7 @@ filt_timerstart(struct knote *kn, sbintime_t to) kc->next = to + sbinuptime(); kc->to = to; } - callout_reset_sbt_on(&kc->c, kc->next, 0, filt_timerexpire, kn, - PCPU_GET(cpuid), C_ABSOLUTE); + kqtimer_sched_callout(kc); } static void From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:47:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 249875BC60A; Fri, 9 Apr 2021 20:47: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 4FH9D90brPz4bJP; Fri, 9 Apr 2021 20:47: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 0775124B81; Fri, 9 Apr 2021 20:47: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 139Kl4ps071415; Fri, 9 Apr 2021 20:47:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139Kl41F071414; Fri, 9 Apr 2021 20:47:04 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:47:04 GMT Message-Id: <202104092047.139Kl41F071414@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: 38e0610df7d5 - main - rtld_lock.h: remove tautological extern's 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: 38e0610df7d5cd5ddd43a477c139ec6ce342c5c2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:05 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=38e0610df7d5cd5ddd43a477c139ec6ce342c5c2 commit 38e0610df7d5cd5ddd43a477c139ec6ce342c5c2 Author: Konstantin Belousov AuthorDate: 2021-04-05 04:11:49 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:46:23 +0000 rtld_lock.h: remove tautological extern's Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623 --- libexec/rtld-elf/rtld_lock.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libexec/rtld-elf/rtld_lock.h b/libexec/rtld-elf/rtld_lock.h index 339028c568dc..cc1fd83169f8 100644 --- a/libexec/rtld-elf/rtld_lock.h +++ b/libexec/rtld-elf/rtld_lock.h @@ -46,9 +46,9 @@ struct RtldLockInfo void (*at_fork)(void); }; -extern void _rtld_thread_init(struct RtldLockInfo *) __exported; -extern void _rtld_atfork_pre(int *) __exported; -extern void _rtld_atfork_post(int *) __exported; +void _rtld_thread_init(struct RtldLockInfo *) __exported; +void _rtld_atfork_pre(int *) __exported; +void _rtld_atfork_post(int *) __exported; #ifdef IN_RTLD From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:47:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 465B15BC3E1; Fri, 9 Apr 2021 20:47: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 4FH9DB1bqzz4bcT; Fri, 9 Apr 2021 20:47: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 2A1E524B82; Fri, 9 Apr 2021 20:47: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 139Kl6Yg071439; Fri, 9 Apr 2021 20:47:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139Kl66K071438; Fri, 9 Apr 2021 20:47:06 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:47:06 GMT Message-Id: <202104092047.139Kl66K071438@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: f61ecf60cfce - main - rtld/x86/reloc.c: style 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: f61ecf60cfce6172df803a9e5e099aab2d4aedcd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:06 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=f61ecf60cfce6172df803a9e5e099aab2d4aedcd commit f61ecf60cfce6172df803a9e5e099aab2d4aedcd Author: Konstantin Belousov AuthorDate: 2021-04-07 06:12:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:46:23 +0000 rtld/x86/reloc.c: style Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623 --- libexec/rtld-elf/amd64/reloc.c | 3 ++- libexec/rtld-elf/i386/reloc.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libexec/rtld-elf/amd64/reloc.c b/libexec/rtld-elf/amd64/reloc.c index 00e538d4b647..309e105d8b5e 100644 --- a/libexec/rtld-elf/amd64/reloc.c +++ b/libexec/rtld-elf/amd64/reloc.c @@ -538,7 +538,8 @@ allocate_initial_tls(Obj_Entry *objs) sysarch(AMD64_SET_FSBASE, &addr); } -void *__tls_get_addr(tls_index *ti) +void * +__tls_get_addr(tls_index *ti) { Elf_Addr** segbase; diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c index 7f8ecfa40f8f..5ed3abf65b31 100644 --- a/libexec/rtld-elf/i386/reloc.c +++ b/libexec/rtld-elf/i386/reloc.c @@ -519,7 +519,8 @@ allocate_initial_tls(Obj_Entry *objs) /* GNU ABI */ __attribute__((__regparm__(1))) -void *___tls_get_addr(tls_index *ti) +void * +___tls_get_addr(tls_index *ti) { Elf_Addr** segbase; @@ -529,7 +530,8 @@ void *___tls_get_addr(tls_index *ti) } /* Sun ABI */ -void *__tls_get_addr(tls_index *ti) +void * +__tls_get_addr(tls_index *ti) { Elf_Addr** segbase; From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:47:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 737DA5BC4C4; Fri, 9 Apr 2021 20:47: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 4FH9DC2QgJz4bJS; Fri, 9 Apr 2021 20:47: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 40AB324A9D; Fri, 9 Apr 2021 20:47: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 139Kl7b8071460; Fri, 9 Apr 2021 20:47:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139Kl7bh071459; Fri, 9 Apr 2021 20:47:07 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:47:07 GMT Message-Id: <202104092047.139Kl7bh071459@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: 34ca6025ddfe - main - rtld_lock.h: Expand scope for IN_RTLD to avoid some conflicts with libc 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: 34ca6025ddfea9899024eb6e7617091c5bc5149a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:07 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=34ca6025ddfea9899024eb6e7617091c5bc5149a commit 34ca6025ddfea9899024eb6e7617091c5bc5149a Author: Konstantin Belousov AuthorDate: 2021-04-05 04:12:22 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:46:23 +0000 rtld_lock.h: Expand scope for IN_RTLD to avoid some conflicts with libc Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623 --- libexec/rtld-elf/rtld_lock.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libexec/rtld-elf/rtld_lock.h b/libexec/rtld-elf/rtld_lock.h index cc1fd83169f8..9aa769b1f7e6 100644 --- a/libexec/rtld-elf/rtld_lock.h +++ b/libexec/rtld-elf/rtld_lock.h @@ -46,10 +46,14 @@ struct RtldLockInfo void (*at_fork)(void); }; +#if defined(IN_RTLD) || defined(PTHREAD_KERNEL) + void _rtld_thread_init(struct RtldLockInfo *) __exported; void _rtld_atfork_pre(int *) __exported; void _rtld_atfork_post(int *) __exported; +#endif /* IN_RTLD || PTHREAD_KERNEL */ + #ifdef IN_RTLD struct rtld_lock; From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:47:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 975ED5BC60D; Fri, 9 Apr 2021 20:47: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 4FH9DD3gqpz4bXb; Fri, 9 Apr 2021 20:47: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 65AD8246FC; Fri, 9 Apr 2021 20:47: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 139Kl8Jl071481; Fri, 9 Apr 2021 20:47:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139Kl8CQ071480; Fri, 9 Apr 2021 20:47:08 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:47:08 GMT Message-Id: <202104092047.139Kl8CQ071480@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: 93c14c55ec0d - main - libc: constify dummy error message string for dlfcn 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: 93c14c55ec0da311dc09c1c8c1c7ecd5f2fae51a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:09 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=93c14c55ec0da311dc09c1c8c1c7ecd5f2fae51a commit 93c14c55ec0da311dc09c1c8c1c7ecd5f2fae51a Author: Konstantin Belousov AuthorDate: 2021-04-05 04:14:39 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:46:23 +0000 libc: constify dummy error message string for dlfcn Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623 --- lib/libc/gen/dlfcn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libc/gen/dlfcn.c b/lib/libc/gen/dlfcn.c index 395a6d9402e8..6047f7ddd4d7 100644 --- a/lib/libc/gen/dlfcn.c +++ b/lib/libc/gen/dlfcn.c @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" #include "reentrant.h" -static char sorry[] = "Service unavailable"; +static const char sorry[] = "Service unavailable"; void _rtld_thread_init(void *); void _rtld_atfork_pre(int *); @@ -91,7 +91,7 @@ char * dlerror(void) { - return (sorry); + return (__DECONST(char *, sorry)); } #pragma weak dllockinit From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:47:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 13B3C5BC6A9; Fri, 9 Apr 2021 20:47: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 4FH9DG6TlTz4bjK; Fri, 9 Apr 2021 20:47: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 A9426243F0; Fri, 9 Apr 2021 20:47: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 139KlAt4071523; Fri, 9 Apr 2021 20:47:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139KlAYE071522; Fri, 9 Apr 2021 20:47:10 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:47:10 GMT Message-Id: <202104092047.139KlAYE071522@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: 99c2ce7ef12f - main - rtld: define TLS_DTV_OFFSET on all architectures 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: 99c2ce7ef12f0852f25155d1d6718beccafbae0e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:11 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=99c2ce7ef12f0852f25155d1d6718beccafbae0e commit 99c2ce7ef12f0852f25155d1d6718beccafbae0e Author: Konstantin Belousov AuthorDate: 2021-04-07 06:25:34 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:46:24 +0000 rtld: define TLS_DTV_OFFSET on all architectures Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623 --- libexec/rtld-elf/aarch64/rtld_machdep.h | 2 ++ libexec/rtld-elf/amd64/rtld_machdep.h | 2 ++ libexec/rtld-elf/arm/rtld_machdep.h | 2 ++ libexec/rtld-elf/i386/rtld_machdep.h | 2 ++ libexec/rtld-elf/mips/rtld_machdep.h | 2 ++ 5 files changed, 10 insertions(+) diff --git a/libexec/rtld-elf/aarch64/rtld_machdep.h b/libexec/rtld-elf/aarch64/rtld_machdep.h index 0824219c00c2..bdd5620867ba 100644 --- a/libexec/rtld-elf/aarch64/rtld_machdep.h +++ b/libexec/rtld-elf/aarch64/rtld_machdep.h @@ -93,4 +93,6 @@ extern void *__tls_get_addr(tls_index *ti); #define md_abi_variant_hook(x) +#define TLS_DTV_OFFSET 0 + #endif diff --git a/libexec/rtld-elf/amd64/rtld_machdep.h b/libexec/rtld-elf/amd64/rtld_machdep.h index 86027a04788f..30c82dcb0625 100644 --- a/libexec/rtld-elf/amd64/rtld_machdep.h +++ b/libexec/rtld-elf/amd64/rtld_machdep.h @@ -73,6 +73,8 @@ void *__tls_get_addr(tls_index *ti) __exported; #define md_abi_variant_hook(x) +#define TLS_DTV_OFFSET 0 + size_t calculate_first_tls_offset(size_t size, size_t align, size_t offset); size_t calculate_tls_offset(size_t prev_offset, size_t prev_size, size_t size, size_t align, size_t offset); diff --git a/libexec/rtld-elf/arm/rtld_machdep.h b/libexec/rtld-elf/arm/rtld_machdep.h index 57420c65593f..b333b1f153eb 100644 --- a/libexec/rtld-elf/arm/rtld_machdep.h +++ b/libexec/rtld-elf/arm/rtld_machdep.h @@ -86,4 +86,6 @@ extern void arm_abi_variant_hook(Elf_Auxinfo **); #define md_abi_variant_hook(x) #endif +#define TLS_DTV_OFFSET 0 + #endif diff --git a/libexec/rtld-elf/i386/rtld_machdep.h b/libexec/rtld-elf/i386/rtld_machdep.h index 5116f9707337..78154a1992d4 100644 --- a/libexec/rtld-elf/i386/rtld_machdep.h +++ b/libexec/rtld-elf/i386/rtld_machdep.h @@ -74,6 +74,8 @@ void *__tls_get_addr(tls_index *ti) __exported; #define md_abi_variant_hook(x) +#define TLS_DTV_OFFSET 0 + size_t calculate_first_tls_offset(size_t size, size_t align, size_t offset); size_t calculate_tls_offset(size_t prev_offset, size_t prev_size, size_t size, size_t align, size_t offset); diff --git a/libexec/rtld-elf/mips/rtld_machdep.h b/libexec/rtld-elf/mips/rtld_machdep.h index b1556c93c3d6..d2498dbb9aa4 100644 --- a/libexec/rtld-elf/mips/rtld_machdep.h +++ b/libexec/rtld-elf/mips/rtld_machdep.h @@ -80,4 +80,6 @@ extern void *__tls_get_addr(tls_index *ti); #define md_abi_variant_hook(x) +#define TLS_DTV_OFFSET 0 + #endif From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:47:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91A6E5BC714; Fri, 9 Apr 2021 20:47: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 4FH9DH6jCQz4bJd; Fri, 9 Apr 2021 20:47: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 BCA112474C; Fri, 9 Apr 2021 20:47: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 139KlB0T071550; Fri, 9 Apr 2021 20:47:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139KlBo3071549; Fri, 9 Apr 2021 20:47:11 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:47:11 GMT Message-Id: <202104092047.139KlBo3071549@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: 06d8a116bd6b - main - libc: add _get_tp() private function 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: 06d8a116bd6b6f70b8aedc6a6a2c4085c53f63ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:12 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=06d8a116bd6b6f70b8aedc6a6a2c4085c53f63ac commit 06d8a116bd6b6f70b8aedc6a6a2c4085c53f63ac Author: Konstantin Belousov AuthorDate: 2021-04-05 03:30:35 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:46:24 +0000 libc: add _get_tp() private function which returns pointer to tcb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623 --- lib/libc/aarch64/gen/Makefile.inc | 1 + lib/libc/aarch64/gen/_get_tp.c | 45 +++++++++++++++ lib/libc/amd64/gen/Makefile.inc | 2 +- lib/libc/amd64/gen/_get_tp.c | 46 ++++++++++++++++ lib/libc/arm/gen/Makefile.inc | 1 + lib/libc/arm/gen/_get_tp.c | 46 ++++++++++++++++ lib/libc/i386/gen/Makefile.inc | 2 +- lib/libc/i386/gen/_get_tp.c | 45 +++++++++++++++ lib/libc/include/libc_private.h | 3 +- lib/libc/mips/gen/Makefile.inc | 2 +- lib/libc/mips/gen/_get_tp.c | 103 +++++++++++++++++++++++++++++++++++ lib/libc/powerpc/gen/Makefile.common | 4 +- lib/libc/powerpc/gen/_get_tp.c | 47 ++++++++++++++++ lib/libc/powerpc64/gen/Makefile.inc | 3 +- lib/libc/powerpc64/gen/_get_tp.c | 47 ++++++++++++++++ lib/libc/riscv/gen/Makefile.inc | 3 + lib/libc/riscv/gen/_get_tp.c | 47 ++++++++++++++++ 17 files changed, 441 insertions(+), 6 deletions(-) diff --git a/lib/libc/aarch64/gen/Makefile.inc b/lib/libc/aarch64/gen/Makefile.inc index fe39136f5b41..7c530b93b4e4 100644 --- a/lib/libc/aarch64/gen/Makefile.inc +++ b/lib/libc/aarch64/gen/Makefile.inc @@ -7,6 +7,7 @@ SRCS+= _ctx_start.S \ flt_rounds.c \ fpgetmask.c \ fpsetmask.c \ + _get_tp.c \ infinity.c \ ldexp.c \ makecontext.c \ diff --git a/lib/libc/aarch64/gen/_get_tp.c b/lib/libc/aarch64/gen/_get_tp.c new file mode 100644 index 000000000000..ce51b400b542 --- /dev/null +++ b/lib/libc/aarch64/gen/_get_tp.c @@ -0,0 +1,45 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Foundation + * + * This software were developed by Konstantin Belousov + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include "libc_private.h" + +void * +_get_tp(void) +{ + void *res; + + __asm __volatile("mrs %0, tpidr_el0" : "=r" (res)); + return (res); +} diff --git a/lib/libc/amd64/gen/Makefile.inc b/lib/libc/amd64/gen/Makefile.inc index 30fb05f89cb7..4df3c044493e 100644 --- a/lib/libc/amd64/gen/Makefile.inc +++ b/lib/libc/amd64/gen/Makefile.inc @@ -1,7 +1,7 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 # $FreeBSD$ -SRCS+= _setjmp.S _set_tp.c rfork_thread.S setjmp.S sigsetjmp.S \ +SRCS+= _setjmp.S _get_tp.c _set_tp.c rfork_thread.S setjmp.S sigsetjmp.S \ fabs.S \ infinity.c ldexp.c makecontext.c signalcontext.c \ flt_rounds.c fpgetmask.c fpsetmask.c fpgetprec.c fpsetprec.c \ diff --git a/lib/libc/amd64/gen/_get_tp.c b/lib/libc/amd64/gen/_get_tp.c new file mode 100644 index 000000000000..3c74b9e769c1 --- /dev/null +++ b/lib/libc/amd64/gen/_get_tp.c @@ -0,0 +1,46 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Foundation + * + * This software were developed by Konstantin Belousov + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include "libc_private.h" + +void * +_get_tp(void) +{ + void **res; + + /* This function is used by rtld, avoid ifuncs. */ + __asm __volatile("movq %%fs:0, %0" : "=r" (res)); + return (&res[1]); +} diff --git a/lib/libc/arm/gen/Makefile.inc b/lib/libc/arm/gen/Makefile.inc index 6cc9b69d2b0e..35aa465e4904 100644 --- a/lib/libc/arm/gen/Makefile.inc +++ b/lib/libc/arm/gen/Makefile.inc @@ -4,6 +4,7 @@ SRCS+= \ __aeabi_read_tp.S \ _ctx_start.S \ + _get_tp.c \ _set_tp.c \ _setjmp.S \ alloca.S \ diff --git a/lib/libc/arm/gen/_get_tp.c b/lib/libc/arm/gen/_get_tp.c new file mode 100644 index 000000000000..495fa982dd6f --- /dev/null +++ b/lib/libc/arm/gen/_get_tp.c @@ -0,0 +1,46 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Foundation + * + * This software were developed by Konstantin Belousov + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include "libc_private.h" + +void * +_get_tp(void) +{ + void *res; + + __asm __volatile("mrc p15, 0, %0, c13, c0, 3" : "=r" (res)); + return (res); +} diff --git a/lib/libc/i386/gen/Makefile.inc b/lib/libc/i386/gen/Makefile.inc index 45e69cad1d0f..bad73852f6eb 100644 --- a/lib/libc/i386/gen/Makefile.inc +++ b/lib/libc/i386/gen/Makefile.inc @@ -1,6 +1,6 @@ # @(#)Makefile.inc 8.1 (Berkeley) 6/4/93 # $FreeBSD$ -SRCS+= _ctx_start.S _setjmp.S _set_tp.c fabs.S \ +SRCS+= _ctx_start.S _setjmp.S _set_tp.c _get_tp.c fabs.S \ flt_rounds.c infinity.c ldexp.c makecontext.c \ rfork_thread.S setjmp.S signalcontext.c sigsetjmp.S diff --git a/lib/libc/i386/gen/_get_tp.c b/lib/libc/i386/gen/_get_tp.c new file mode 100644 index 000000000000..f96695247928 --- /dev/null +++ b/lib/libc/i386/gen/_get_tp.c @@ -0,0 +1,45 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Foundation + * + * This software were developed by Konstantin Belousov + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include "libc_private.h" + +void * +_get_tp(void) +{ + void **res; + + __asm __volatile("movl %%gs:0, %0" : "=r" (res)); + return (&res[1]); +} diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h index 363e1057986b..5a524c0211d1 100644 --- a/lib/libc/include/libc_private.h +++ b/lib/libc/include/libc_private.h @@ -261,8 +261,9 @@ void _init_tls(void); int _once(pthread_once_t *, void (*)(void)); /* - * Set the TLS thread pointer + * Get/set the TLS thread pointer */ +void *_get_tp(void); void _set_tp(void *tp); /* diff --git a/lib/libc/mips/gen/Makefile.inc b/lib/libc/mips/gen/Makefile.inc index 56fa380f7777..d2dc9b5f4bdb 100644 --- a/lib/libc/mips/gen/Makefile.inc +++ b/lib/libc/mips/gen/Makefile.inc @@ -6,6 +6,6 @@ SRCS+= infinity.c fabs.c ldexp.c flt_rounds.c # SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \ # fpsetround.c fpsetsticky.c -SRCS+= _ctx_start.S _set_tp.c _setjmp.S makecontext.c \ +SRCS+= _ctx_start.S _get_tp.c _set_tp.c _setjmp.S makecontext.c \ setjmp.S signalcontext.c sigsetjmp.S \ trivial-getcontextx.c diff --git a/lib/libc/mips/gen/_get_tp.c b/lib/libc/mips/gen/_get_tp.c new file mode 100644 index 000000000000..45c5f8f35d42 --- /dev/null +++ b/lib/libc/mips/gen/_get_tp.c @@ -0,0 +1,103 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Foundation + * + * This software were developed by Konstantin Belousov + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include "libc_private.h" + +#ifdef __mips_n64 +static void * +_mips_get_tls(void) +{ + uint64_t _rv; + + __asm__ __volatile__ ( + ".set\tpush\n\t" + ".set\tmips64r2\n\t" + "rdhwr\t%0, $29\n\t" + ".set\tpop" + : "=r" (_rv)); + /* + * XXXSS See 'git show c6be4f4d2d1b71c04de5d3bbb6933ce2dbcdb317' + * + * Remove the offset since this really a request to get the TLS + * pointer via sysarch() (in theory). Of course, this may go away + * once the TLS code is rewritten. + */ + _rv = _rv - TLS_TP_OFFSET - TLS_TCB_SIZE; + + return (void *)_rv; +} + +#else /* mips 32 */ + +static void * +_mips_get_tls(void) +{ + uint32_t _rv; + + __asm__ __volatile__ ( + ".set\tpush\n\t" + ".set\tmips32r2\n\t" + "rdhwr\t%0, $29\n\t" + ".set\tpop" + : "=r" (_rv)); + /* + * XXXSS See 'git show c6be4f4d2d1b71c04de5d3bbb6933ce2dbcdb317' + * + * Remove the offset since this really a request to get the TLS + * pointer via sysarch() (in theory). Of course, this may go away + * once the TLS code is rewritten. + */ + _rv = _rv - TLS_TP_OFFSET - TLS_TCB_SIZE; + + return (void *)_rv; +} +#endif /* ! __mips_n64 */ + +void * +_get_tp(void) +{ + void *res; + +#ifdef TLS_USE_SYSARCH + sysarch(MIPS_GET_TLS, &res); +#else + res = _mips_get_tls(); +#endif + return (res); +} diff --git a/lib/libc/powerpc/gen/Makefile.common b/lib/libc/powerpc/gen/Makefile.common index 4ba72799a5cf..b2f898c9faae 100644 --- a/lib/libc/powerpc/gen/Makefile.common +++ b/lib/libc/powerpc/gen/Makefile.common @@ -3,4 +3,6 @@ .PATH: ${LIBC_SRCTOP}/powerpc/gen SRCS += _ctx_start.S eabi.S infinity.c ldexp.c makecontext.c \ - signalcontext.c syncicache.c _set_tp.c trivial-getcontextx.c + signalcontext.c syncicache.c _get_tp.c _set_tp.c trivial-getcontextx.c + +CFLAGS._get_tp.c+= ${RTLD_HDRS} diff --git a/lib/libc/powerpc/gen/_get_tp.c b/lib/libc/powerpc/gen/_get_tp.c new file mode 100644 index 000000000000..0d08b707ff1a --- /dev/null +++ b/lib/libc/powerpc/gen/_get_tp.c @@ -0,0 +1,47 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Foundation + * + * This software were developed by Konstantin Belousov + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include "libc_private.h" +#include "rtld.h" + +void * +_get_tp(void) +{ + Elf_Addr tp; + + __asm __volatile("mr %0,2" : "=r" (tp)); + return ((void *)(tp - TLS_TP_OFFSET - TLS_TCB_SIZE)); +} diff --git a/lib/libc/powerpc64/gen/Makefile.inc b/lib/libc/powerpc64/gen/Makefile.inc index 864fb9ede4f4..0e40aee2d11f 100644 --- a/lib/libc/powerpc64/gen/Makefile.inc +++ b/lib/libc/powerpc64/gen/Makefile.inc @@ -1,10 +1,11 @@ # $FreeBSD$ SRCS += _ctx_start.S fabs.S flt_rounds.c fpgetmask.c fpgetround.c \ - fpgetsticky.c fpsetmask.c fpsetround.c \ + fpgetsticky.c fpsetmask.c fpsetround.c _get_tp.c \ infinity.c ldexp.c makecontext.c _setjmp.S \ setjmp.S sigsetjmp.S signalcontext.c syncicache.c \ _set_tp.c \ trivial-getcontextx.c +CFLAGS._get_tp.c+= ${RTLD_HDRS} diff --git a/lib/libc/powerpc64/gen/_get_tp.c b/lib/libc/powerpc64/gen/_get_tp.c new file mode 100644 index 000000000000..16f5c952276e --- /dev/null +++ b/lib/libc/powerpc64/gen/_get_tp.c @@ -0,0 +1,47 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Foundation + * + * This software were developed by Konstantin Belousov + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include "libc_private.h" +#include "rtld.h" + +void * +_get_tp(void) +{ + Elf_Addr tp; + + __asm __volatile("mr %0,13" : "=r" (tp)); + return ((void *)(tp - TLS_TP_OFFSET - TLS_TCB_SIZE)); +} diff --git a/lib/libc/riscv/gen/Makefile.inc b/lib/libc/riscv/gen/Makefile.inc index f13800829d7f..1c1a90bda730 100644 --- a/lib/libc/riscv/gen/Makefile.inc +++ b/lib/libc/riscv/gen/Makefile.inc @@ -5,6 +5,7 @@ SRCS+= _ctx_start.S \ flt_rounds.c \ fpgetmask.c \ fpsetmask.c \ + _get_tp.c \ infinity.c \ ldexp.c \ makecontext.c \ @@ -13,3 +14,5 @@ SRCS+= _ctx_start.S \ setjmp.S \ sigsetjmp.S \ trivial-getcontextx.c + +CFLAGS._get_tp.c+= ${RTLD_HDRS} diff --git a/lib/libc/riscv/gen/_get_tp.c b/lib/libc/riscv/gen/_get_tp.c new file mode 100644 index 000000000000..0477e3ab8ca9 --- /dev/null +++ b/lib/libc/riscv/gen/_get_tp.c @@ -0,0 +1,47 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 The FreeBSD Foundation + * + * This software were developed by Konstantin Belousov + * 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include "libc_private.h" +#include "rtld.h" + +void * +_get_tp(void) +{ + Elf_Addr tp; + + __asm __volatile("mv %0, tp" : "=r" (tp)); + return ((void *)(tp - TLS_TP_OFFSET - TLS_TCB_SIZE)); +} From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:47:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03CA25BC3EB; Fri, 9 Apr 2021 20:47:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FH9DF4nZ5z4bNy; Fri, 9 Apr 2021 20:47: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 7EB8F24912; Fri, 9 Apr 2021 20:47: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 139Kl9Bx071502; Fri, 9 Apr 2021 20:47:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139Kl9i4071501; Fri, 9 Apr 2021 20:47:09 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:47:09 GMT Message-Id: <202104092047.139Kl9i4071501@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: 7f7489eba391 - main - libc: include rtld.h into static implementations of rtld interface 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: 7f7489eba391a858b3930a34e7749d642b374c5c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:10 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7f7489eba391a858b3930a34e7749d642b374c5c commit 7f7489eba391a858b3930a34e7749d642b374c5c Author: Konstantin Belousov AuthorDate: 2021-04-05 03:41:46 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:46:24 +0000 libc: include rtld.h into static implementations of rtld interface and resolve naming conficts Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623 --- lib/libc/Makefile | 8 +++++ lib/libc/gen/Makefile.inc | 3 ++ lib/libc/gen/dlfcn.c | 1 + lib/libc/gen/tls.c | 76 ++++++++++++++++++++++++----------------------- lib/libdl/Makefile | 7 +++++ 5 files changed, 58 insertions(+), 37 deletions(-) diff --git a/lib/libc/Makefile b/lib/libc/Makefile index d93091530721..958270e6ddf5 100644 --- a/lib/libc/Makefile +++ b/lib/libc/Makefile @@ -68,6 +68,14 @@ LIBADD+= ssp_nonshared # Extras that live in either libc.a or libc_nonshared.a LIBC_NONSHARED_SRCS= +RTLD_ELF_DIR=${SRCTOP}/libexec/rtld-elf +.if exists(${RTLD_ELF_DIR}/${MACHINE_ARCH:S/powerpc64le/powerpc64/}) +RTLD_ARCH= ${MACHINE_ARCH:S/powerpc64le/powerpc64/} +.else +RTLD_ARCH= ${MACHINE_CPUARCH} +.endif +RTLD_HDRS= -I${RTLD_ELF_DIR}/${RTLD_ARCH} -I${RTLD_ELF_DIR} + # Define (empty) variables so that make doesn't give substitution # errors if the included makefiles don't change these: MDSRCS= diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index 0ab717600e56..aa9a4c0cbf67 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -172,6 +172,9 @@ SRCS+= __getosreldate.c \ CFLAGS.arc4random.c= -I${SRCTOP}/sys -I${SRCTOP}/sys/crypto/chacha20 +CFLAGS.dlfcn.c= ${RTLD_HDRS} +CFLAGS.tls.c= ${RTLD_HDRS} + .PATH: ${SRCTOP}/contrib/libc-pwcache SRCS+= pwcache.c pwcache.h diff --git a/lib/libc/gen/dlfcn.c b/lib/libc/gen/dlfcn.c index 6047f7ddd4d7..16afdb6bf5d1 100644 --- a/lib/libc/gen/dlfcn.c +++ b/lib/libc/gen/dlfcn.c @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include "namespace.h" #include #include "un-namespace.h" +#include "rtld.h" #include "libc_private.h" #include "reentrant.h" diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index 719391130827..2a64b5266f4a 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -41,6 +41,7 @@ #include #include +#include "rtld.h" #include "libc_private.h" #define tls_assert(cond) ((cond) ? (void) 0 : \ @@ -96,10 +97,10 @@ void __libc_free_tls(void *tls, size_t tcbsize, size_t tcbalign); #ifndef PIC -static size_t tls_static_space; -static size_t tls_init_size; -static size_t tls_init_align; -static void *tls_init; +static size_t libc_tls_static_space; +static size_t libc_tls_init_size; +static size_t libc_tls_init_align; +static void *libc_tls_init; #endif #ifdef __i386__ @@ -124,7 +125,7 @@ __libc_tls_get_addr(void *ti __unused) #ifndef PIC static void * -malloc_aligned(size_t size, size_t align) +libc_malloc_aligned(size_t size, size_t align) { void *mem, *res; @@ -138,7 +139,7 @@ malloc_aligned(size_t size, size_t align) } static void -free_aligned(void *ptr) +libc_free_aligned(void *ptr) { void *mem; uintptr_t x; @@ -188,8 +189,6 @@ free_aligned(void *ptr) * [5] I'm not able to validate "values are biased" assertions. */ -#define TLS_TCB_SIZE (2 * sizeof(void *)) - /* * Return pointer to allocated TLS block */ @@ -201,12 +200,13 @@ get_tls_block_ptr(void *tcb, size_t tcbsize) /* Compute fragments sizes. */ extra_size = tcbsize - TLS_TCB_SIZE; #if defined(__aarch64__) || defined(__arm__) - post_size = roundup2(TLS_TCB_SIZE, tls_init_align) - TLS_TCB_SIZE; + post_size = roundup2(TLS_TCB_SIZE, libc_tls_init_align) - TLS_TCB_SIZE; #else post_size = 0; #endif tls_block_size = tcbsize + post_size; - pre_size = roundup2(tls_block_size, tls_init_align) - tls_block_size; + pre_size = roundup2(tls_block_size, libc_tls_init_align) - + tls_block_size; return ((char *)tcb - pre_size - extra_size); } @@ -225,7 +225,7 @@ __libc_free_tls(void *tcb, size_t tcbsize, size_t tcbalign __unused) tls = (Elf_Addr **)tcb; dtv = tls[0]; __je_bootstrap_free(dtv); - free_aligned(get_tls_block_ptr(tcb, tcbsize)); + libc_free_aligned(get_tls_block_ptr(tcb, tcbsize)); } /* @@ -259,21 +259,22 @@ __libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign) return (oldtcb); tls_assert(tcbalign >= TLS_TCB_ALIGN); - maxalign = MAX(tcbalign, tls_init_align); + maxalign = MAX(tcbalign, libc_tls_init_align); /* Compute fragmets sizes. */ extra_size = tcbsize - TLS_TCB_SIZE; #if defined(__aarch64__) || defined(__arm__) - post_size = roundup2(TLS_TCB_SIZE, tls_init_align) - TLS_TCB_SIZE; + post_size = roundup2(TLS_TCB_SIZE, libc_tls_init_align) - TLS_TCB_SIZE; #else post_size = 0; #endif tls_block_size = tcbsize + post_size; - pre_size = roundup2(tls_block_size, tls_init_align) - tls_block_size; - tls_block_size += pre_size + tls_static_space; + pre_size = roundup2(tls_block_size, libc_tls_init_align) - + tls_block_size; + tls_block_size += pre_size + libc_tls_static_space; /* Allocate whole TLS block */ - tls_block = malloc_aligned(tls_block_size, maxalign); + tls_block = libc_malloc_aligned(tls_block_size, maxalign); if (tls_block == NULL) { tls_msg("__libc_allocate_tls: Out of memory.\n"); abort(); @@ -285,7 +286,7 @@ __libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign) if (oldtcb != NULL) { memcpy(tls_block, get_tls_block_ptr(oldtcb, tcbsize), tls_block_size); - free_aligned(oldtcb); + libc_free_aligned(oldtcb); /* Adjust the DTV. */ dtv = tcb[0]; @@ -302,8 +303,8 @@ __libc_allocate_tls(void *oldtcb, size_t tcbsize, size_t tcbalign) dtv[1] = 1; /* Segments count. */ dtv[2] = (Elf_Addr)(tls + DTV_OFFSET); - if (tls_init_size > 0) - memcpy(tls, tls_init, tls_init_size); + if (libc_tls_init_size > 0) + memcpy(tls, libc_tls_init, libc_tls_init_size); } return (tcb); @@ -329,13 +330,13 @@ __libc_free_tls(void *tcb, size_t tcbsize __unused, size_t tcbalign) * Figure out the size of the initial TLS block so that we can * find stuff which ___tls_get_addr() allocated dynamically. */ - tcbalign = MAX(tcbalign, tls_init_align); - size = roundup2(tls_static_space, tcbalign); + tcbalign = MAX(tcbalign, libc_tls_init_align); + size = roundup2(libc_tls_static_space, tcbalign); dtv = ((Elf_Addr**)tcb)[1]; tlsend = (Elf_Addr) tcb; tlsstart = tlsend - size; - free_aligned((void*)tlsstart); + libc_free_aligned((void*)tlsstart); __je_bootstrap_free(dtv); } @@ -350,12 +351,12 @@ __libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign) Elf_Addr *dtv; Elf_Addr segbase, oldsegbase; - tcbalign = MAX(tcbalign, tls_init_align); - size = roundup2(tls_static_space, tcbalign); + tcbalign = MAX(tcbalign, libc_tls_init_align); + size = roundup2(libc_tls_static_space, tcbalign); if (tcbsize < 2 * sizeof(Elf_Addr)) tcbsize = 2 * sizeof(Elf_Addr); - tls = malloc_aligned(size + tcbsize, tcbalign); + tls = libc_malloc_aligned(size + tcbsize, tcbalign); if (tls == NULL) { tls_msg("__libc_allocate_tls: Out of memory.\n"); abort(); @@ -373,16 +374,16 @@ __libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign) dtv[0] = 1; dtv[1] = 1; - dtv[2] = segbase - tls_static_space; + dtv[2] = segbase - libc_tls_static_space; if (oldtls) { /* * Copy the static TLS block over whole. */ oldsegbase = (Elf_Addr) oldtls; - memcpy((void *)(segbase - tls_static_space), - (const void *)(oldsegbase - tls_static_space), - tls_static_space); + memcpy((void *)(segbase - libc_tls_static_space), + (const void *)(oldsegbase - libc_tls_static_space), + libc_tls_static_space); /* * We assume that this block was the one we created with @@ -390,10 +391,11 @@ __libc_allocate_tls(void *oldtls, size_t tcbsize, size_t tcbalign) */ _rtld_free_tls(oldtls, 2*sizeof(Elf_Addr), sizeof(Elf_Addr)); } else { - memcpy((void *)(segbase - tls_static_space), - tls_init, tls_init_size); - memset((void *)(segbase - tls_static_space + tls_init_size), - 0, tls_static_space - tls_init_size); + memcpy((void *)(segbase - libc_tls_static_space), + libc_tls_init, libc_tls_init_size); + memset((void *)(segbase - libc_tls_static_space + + libc_tls_init_size), 0, + libc_tls_static_space - libc_tls_init_size); } return (void*) segbase; @@ -457,11 +459,11 @@ _init_tls(void) for (i = 0; (unsigned) i < phnum; i++) { if (phdr[i].p_type == PT_TLS) { - tls_static_space = roundup2(phdr[i].p_memsz, + libc_tls_static_space = roundup2(phdr[i].p_memsz, phdr[i].p_align); - tls_init_size = phdr[i].p_filesz; - tls_init_align = phdr[i].p_align; - tls_init = (void*) phdr[i].p_vaddr; + libc_tls_init_size = phdr[i].p_filesz; + libc_tls_init_align = phdr[i].p_align; + libc_tls_init = (void *)phdr[i].p_vaddr; break; } } diff --git a/lib/libdl/Makefile b/lib/libdl/Makefile index d91547352de4..c37449691e0b 100644 --- a/lib/libdl/Makefile +++ b/lib/libdl/Makefile @@ -6,6 +6,13 @@ SHLIB_MAJOR=1 .PATH: ${SRCTOP}/lib/libc/gen CFLAGS+=-I${SRCTOP}/lib/libc/include +RTLD_ELF_DIR=${SRCTOP}/libexec/rtld-elf +.if exists(${RTLD_ELF_DIR}/${MACHINE_ARCH:S/powerpc64le/powerpc64/}) +RTLD_ARCH= ${MACHINE_ARCH:S/powerpc64le/powerpc64/} +.else +RTLD_ARCH= ${MACHINE_CPUARCH} +.endif +CFLAGS+= -I${RTLD_ELF_DIR}/${RTLD_ARCH} -I${RTLD_ELF_DIR} CFLAGS+=-DIN_LIBDL LDFLAGS+=-Wl,-F,libc.so.7 VERSION_DEF=${SRCTOP}/lib/libc/Versions.def From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:47:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDDBF5BC635; Fri, 9 Apr 2021 20:47: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 4FH9DJ6bm3z4bg2; Fri, 9 Apr 2021 20:47: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 CD40E243F1; Fri, 9 Apr 2021 20:47: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 139KlCOW071571; Fri, 9 Apr 2021 20:47:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139KlCSq071570; Fri, 9 Apr 2021 20:47:12 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:47:12 GMT Message-Id: <202104092047.139KlCSq071570@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: ca46b5698e8a - main - libc: implement __tls_get_addr() for static binaries 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: ca46b5698e8ac38ab45d781d592700be59e7de97 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:14 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ca46b5698e8ac38ab45d781d592700be59e7de97 commit ca46b5698e8ac38ab45d781d592700be59e7de97 Author: Konstantin Belousov AuthorDate: 2021-04-05 03:29:47 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:46:24 +0000 libc: implement __tls_get_addr() for static binaries Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623 --- lib/libc/gen/tls.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/libc/gen/tls.c b/lib/libc/gen/tls.c index 2a64b5266f4a..69b87aea52bf 100644 --- a/lib/libc/gen/tls.c +++ b/lib/libc/gen/tls.c @@ -103,25 +103,32 @@ static size_t libc_tls_init_align; static void *libc_tls_init; #endif +void * +__libc_tls_get_addr(void *vti) +{ + Elf_Addr **dtvp, *dtv; + tls_index *ti; + + dtvp = _get_tp(); + dtv = *dtvp; + ti = vti; + return ((char *)(dtv[ti->ti_module + 1] + ti->ti_offset) + + TLS_DTV_OFFSET); +} + #ifdef __i386__ /* GNU ABI */ __attribute__((__regparm__(1))) void * -___libc_tls_get_addr(void *ti __unused) +___libc_tls_get_addr(void *vti) { - return (0); + return (__libc_tls_get_addr(vti)); } #endif -void * -__libc_tls_get_addr(void *ti __unused) -{ - return (0); -} - #ifndef PIC static void * From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:47:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F4485BC4DB; Fri, 9 Apr 2021 20:47: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 4FH9DL0y3Qz4bJl; Fri, 9 Apr 2021 20:47: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 F188C24B83; Fri, 9 Apr 2021 20:47: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 139KlDDO071592; Fri, 9 Apr 2021 20:47:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139KlDqI071591; Fri, 9 Apr 2021 20:47:13 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:47:13 GMT Message-Id: <202104092047.139KlDqI071591@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: dbd2053026a6 - main - libc dl_iterate_phdr(): dlpi_tls_data is wrong 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: dbd2053026a6af28adb1aa32e27603ae0d4efea6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:15 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=dbd2053026a6af28adb1aa32e27603ae0d4efea6 commit dbd2053026a6af28adb1aa32e27603ae0d4efea6 Author: Konstantin Belousov AuthorDate: 2021-04-05 03:38:07 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:46:24 +0000 libc dl_iterate_phdr(): dlpi_tls_data is wrong This is the same change as d36d681615170590, but for libc static implementaion of dl_iterate_phdr(). Reported by: emacsray@gmail.com PR: 254774 Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623 --- lib/libc/gen/dlfcn.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/libc/gen/dlfcn.c b/lib/libc/gen/dlfcn.c index 16afdb6bf5d1..337ad48fd691 100644 --- a/lib/libc/gen/dlfcn.c +++ b/lib/libc/gen/dlfcn.c @@ -196,8 +196,6 @@ dl_init_phdr_info(void) for (i = 0; i < phdr_info.dlpi_phnum; i++) { if (phdr_info.dlpi_phdr[i].p_type == PT_TLS) { phdr_info.dlpi_tls_modid = 1; - phdr_info.dlpi_tls_data = - (void*)phdr_info.dlpi_phdr[i].p_vaddr; } } phdr_info.dlpi_adds = 1; @@ -210,13 +208,17 @@ dl_iterate_phdr(int (*callback)(struct dl_phdr_info *, size_t, void *) __unused, void *data __unused) { #ifndef IN_LIBDL + tls_index ti; int ret; __init_elf_aux_vector(); if (__elf_aux_vector == NULL) return (1); _once(&dl_phdr_info_once, dl_init_phdr_info); + ti.ti_module = 1; + ti.ti_offset = 0; mutex_lock(&dl_phdr_info_lock); + phdr_info.dlpi_tls_data = __tls_get_addr(&ti); ret = callback(&phdr_info, sizeof(phdr_info), data); mutex_unlock(&dl_phdr_info_lock); return (ret); From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:47:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 937905BC4F4; Fri, 9 Apr 2021 20:47: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 4FH9DN2kF0z4bp1; Fri, 9 Apr 2021 20:47: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 366272474D; Fri, 9 Apr 2021 20:47: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 139KlGAe071634; Fri, 9 Apr 2021 20:47:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139KlGML071633; Fri, 9 Apr 2021 20:47:16 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:47:16 GMT Message-Id: <202104092047.139KlGML071633@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: 895080484248 - main - rtld: allow to use tls_get_addr_slow() from context where rtld_bind_lock is locked 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: 89508048424837ffdb32c8444dab02261711f77d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:16 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=89508048424837ffdb32c8444dab02261711f77d commit 89508048424837ffdb32c8444dab02261711f77d Author: Konstantin Belousov AuthorDate: 2021-04-06 18:56:58 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:46:24 +0000 rtld: allow to use tls_get_addr_slow() from context where rtld_bind_lock is locked Explicit locked parameter is added Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623 --- libexec/rtld-elf/rtld.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 8b03616993d2..8c8271abc93e 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -166,6 +166,7 @@ static int symlook_list(SymLook *, const Objlist *, DoneList *); static int symlook_needed(SymLook *, const Needed_Entry *, DoneList *); static int symlook_obj1_sysv(SymLook *, const Obj_Entry *); static int symlook_obj1_gnu(SymLook *, const Obj_Entry *); +static void *tls_get_addr_slow(Elf_Addr **, int, size_t, bool) __noinline; static void trace_loaded_objects(Obj_Entry *); static void unlink_object(Obj_Entry *); static void unload_object(Obj_Entry *, RtldLockState *lockstate); @@ -4871,9 +4872,8 @@ unref_dag(Obj_Entry *root) /* * Common code for MD __tls_get_addr(). */ -static void *tls_get_addr_slow(Elf_Addr **, int, size_t) __noinline; static void * -tls_get_addr_slow(Elf_Addr **dtvp, int index, size_t offset) +tls_get_addr_slow(Elf_Addr **dtvp, int index, size_t offset, bool locked) { Elf_Addr *newdtv, *dtv; RtldLockState lockstate; @@ -4882,7 +4882,8 @@ tls_get_addr_slow(Elf_Addr **dtvp, int index, size_t offset) dtv = *dtvp; /* Check dtv generation in case new modules have arrived */ if (dtv[0] != tls_dtv_generation) { - wlock_acquire(rtld_bind_lock, &lockstate); + if (!locked) + wlock_acquire(rtld_bind_lock, &lockstate); newdtv = xcalloc(tls_max_index + 2, sizeof(Elf_Addr)); to_copy = dtv[1]; if (to_copy > tls_max_index) @@ -4891,17 +4892,20 @@ tls_get_addr_slow(Elf_Addr **dtvp, int index, size_t offset) newdtv[0] = tls_dtv_generation; newdtv[1] = tls_max_index; free(dtv); - lock_release(rtld_bind_lock, &lockstate); + if (!locked) + lock_release(rtld_bind_lock, &lockstate); dtv = *dtvp = newdtv; } /* Dynamically allocate module TLS if necessary */ if (dtv[index + 1] == 0) { /* Signal safe, wlock will block out signals. */ - wlock_acquire(rtld_bind_lock, &lockstate); + if (!locked) + wlock_acquire(rtld_bind_lock, &lockstate); if (!dtv[index + 1]) dtv[index + 1] = (Elf_Addr)allocate_module_tls(index); - lock_release(rtld_bind_lock, &lockstate); + if (!locked) + lock_release(rtld_bind_lock, &lockstate); } return ((void *)(dtv[index + 1] + offset)); } @@ -4916,7 +4920,7 @@ tls_get_addr_common(Elf_Addr **dtvp, int index, size_t offset) if (__predict_true(dtv[0] == tls_dtv_generation && dtv[index + 1] != 0)) return ((void *)(dtv[index + 1] + offset)); - return (tls_get_addr_slow(dtvp, index, offset)); + return (tls_get_addr_slow(dtvp, index, offset, false)); } #if defined(__aarch64__) || defined(__arm__) || defined(__mips__) || \ From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:47:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A378A5BC6C7; Fri, 9 Apr 2021 20:47: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 4FH9DP75czz4bdK; Fri, 9 Apr 2021 20:47: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 6622624B0B; Fri, 9 Apr 2021 20:47: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 139KlHJQ071661; Fri, 9 Apr 2021 20:47:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139KlHQj071660; Fri, 9 Apr 2021 20:47:17 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:47:17 GMT Message-Id: <202104092047.139KlHQj071660@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: 7cb32a0d0343 - main - rtld: avoid recursing on rtld_bind_lock for write 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: 7cb32a0d03437f881169b1c55cce89cf70ed43dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:18 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7cb32a0d03437f881169b1c55cce89cf70ed43dd commit 7cb32a0d03437f881169b1c55cce89cf70ed43dd Author: Konstantin Belousov AuthorDate: 2021-04-06 19:02:23 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:46:24 +0000 rtld: avoid recursing on rtld_bind_lock for write This fixes a regression in d36d6816151705907393889, where the call to __tls_get_address() was performed under rtld_bind_lock write-locked. Instead use tls_get_addr_slow() directly, with locked = true. Reported by: jkim, many others Tested by: jkim, bdragon (powerpc), mhorne (riscv) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623 --- libexec/rtld-elf/rtld-libc/Makefile.inc | 2 ++ libexec/rtld-elf/rtld.c | 8 ++++---- libexec/rtld-elf/rtld.h | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libexec/rtld-elf/rtld-libc/Makefile.inc b/libexec/rtld-elf/rtld-libc/Makefile.inc index d5f5993e3f16..7ffcb6e41ec7 100644 --- a/libexec/rtld-elf/rtld-libc/Makefile.inc +++ b/libexec/rtld-elf/rtld-libc/Makefile.inc @@ -67,6 +67,8 @@ _libc_other_objects+=syncicache abs _libc_other_objects+=syncicache .endif +_libc_other_objects+=_get_tp + # Extract all the .o files from libc_nossp_pic.a. This ensures that # we don't accidentally pull in the interposing table or similar by linking # directly against libc_nossp_pic.a diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 8c8271abc93e..29ab4e93d4da 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -3910,16 +3910,16 @@ dlinfo(void *handle, int request, void *p) static void rtld_fill_dl_phdr_info(const Obj_Entry *obj, struct dl_phdr_info *phdr_info) { - tls_index ti; + Elf_Addr **dtvp; phdr_info->dlpi_addr = (Elf_Addr)obj->relocbase; phdr_info->dlpi_name = obj->path; phdr_info->dlpi_phdr = obj->phdr; phdr_info->dlpi_phnum = obj->phsize / sizeof(obj->phdr[0]); phdr_info->dlpi_tls_modid = obj->tlsindex; - ti.ti_module = obj->tlsindex; - ti.ti_offset = 0; - phdr_info->dlpi_tls_data = __tls_get_addr(&ti); + dtvp = _get_tp(); + phdr_info->dlpi_tls_data = (char *)tls_get_addr_slow(dtvp, + obj->tlsindex, 0, true) + TLS_DTV_OFFSET; phdr_info->dlpi_adds = obj_loads; phdr_info->dlpi_subs = obj_loads - obj_count; } diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index 85472826a4ec..6a2f62fc6189 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -401,6 +401,7 @@ bool allocate_tls_offset(Obj_Entry *obj); void free_tls_offset(Obj_Entry *obj); const Ver_Entry *fetch_ventry(const Obj_Entry *obj, unsigned long); int convert_prot(int elfflags); +void *_get_tp(void); /* libc implementation */ /* * MD function declarations. From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:47:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 292D75BC72B; Fri, 9 Apr 2021 20:47: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 4FH9DM24TWz4bbj; Fri, 9 Apr 2021 20:47: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 127FA246FD; Fri, 9 Apr 2021 20:47: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 139KlEc4071613; Fri, 9 Apr 2021 20:47:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139KlEx9071612; Fri, 9 Apr 2021 20:47:14 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:47:14 GMT Message-Id: <202104092047.139KlEx9071612@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: 85d846b369f4 - main - rtld: style tls_get_addr_slow 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: 85d846b369f4d8c0033993d3d1307779d3b9aa62 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:16 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=85d846b369f4d8c0033993d3d1307779d3b9aa62 commit 85d846b369f4d8c0033993d3d1307779d3b9aa62 Author: Konstantin Belousov AuthorDate: 2021-04-06 18:55:10 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:46:24 +0000 rtld: style tls_get_addr_slow Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623 --- libexec/rtld-elf/rtld.c | 54 ++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 19027518d3c2..8b03616993d2 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -4875,35 +4875,35 @@ static void *tls_get_addr_slow(Elf_Addr **, int, size_t) __noinline; static void * tls_get_addr_slow(Elf_Addr **dtvp, int index, size_t offset) { - Elf_Addr *newdtv, *dtv; - RtldLockState lockstate; - int to_copy; + Elf_Addr *newdtv, *dtv; + RtldLockState lockstate; + int to_copy; - dtv = *dtvp; - /* Check dtv generation in case new modules have arrived */ - if (dtv[0] != tls_dtv_generation) { - wlock_acquire(rtld_bind_lock, &lockstate); - newdtv = xcalloc(tls_max_index + 2, sizeof(Elf_Addr)); - to_copy = dtv[1]; - if (to_copy > tls_max_index) - to_copy = tls_max_index; - memcpy(&newdtv[2], &dtv[2], to_copy * sizeof(Elf_Addr)); - newdtv[0] = tls_dtv_generation; - newdtv[1] = tls_max_index; - free(dtv); - lock_release(rtld_bind_lock, &lockstate); - dtv = *dtvp = newdtv; - } + dtv = *dtvp; + /* Check dtv generation in case new modules have arrived */ + if (dtv[0] != tls_dtv_generation) { + wlock_acquire(rtld_bind_lock, &lockstate); + newdtv = xcalloc(tls_max_index + 2, sizeof(Elf_Addr)); + to_copy = dtv[1]; + if (to_copy > tls_max_index) + to_copy = tls_max_index; + memcpy(&newdtv[2], &dtv[2], to_copy * sizeof(Elf_Addr)); + newdtv[0] = tls_dtv_generation; + newdtv[1] = tls_max_index; + free(dtv); + lock_release(rtld_bind_lock, &lockstate); + dtv = *dtvp = newdtv; + } - /* Dynamically allocate module TLS if necessary */ - if (dtv[index + 1] == 0) { - /* Signal safe, wlock will block out signals. */ - wlock_acquire(rtld_bind_lock, &lockstate); - if (!dtv[index + 1]) - dtv[index + 1] = (Elf_Addr)allocate_module_tls(index); - lock_release(rtld_bind_lock, &lockstate); - } - return ((void *)(dtv[index + 1] + offset)); + /* Dynamically allocate module TLS if necessary */ + if (dtv[index + 1] == 0) { + /* Signal safe, wlock will block out signals. */ + wlock_acquire(rtld_bind_lock, &lockstate); + if (!dtv[index + 1]) + dtv[index + 1] = (Elf_Addr)allocate_module_tls(index); + lock_release(rtld_bind_lock, &lockstate); + } + return ((void *)(dtv[index + 1] + offset)); } void * From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:47:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E5E45BC79F; Fri, 9 Apr 2021 20:47: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 4FH9DQ6vnzz4bYC; Fri, 9 Apr 2021 20:47: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 8015824B0C; Fri, 9 Apr 2021 20:47: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 139KlIo3071682; Fri, 9 Apr 2021 20:47:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139KlIsV071681; Fri, 9 Apr 2021 20:47:18 GMT (envelope-from git) Date: Fri, 9 Apr 2021 20:47:18 GMT Message-Id: <202104092047.139KlIsV071681@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: e8b9c508b7ae - main - rtld: use _get_tp() in __tls_get_addr() 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: e8b9c508b7ae5be618ada089103468c400e465cd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:20 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=e8b9c508b7ae5be618ada089103468c400e465cd commit e8b9c508b7ae5be618ada089103468c400e465cd Author: Konstantin Belousov AuthorDate: 2021-04-07 03:49:28 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-09 20:46:24 +0000 rtld: use _get_tp() in __tls_get_addr() This eliminates some non-trivial amount of code duplication, where done. Only x86 and mips are handled right now. Tested by: bdragon (powerpc), mhorne (riscv) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29623 --- libexec/rtld-elf/amd64/reloc.c | 7 ++-- libexec/rtld-elf/i386/reloc.c | 14 ++++---- libexec/rtld-elf/mips/reloc.c | 62 +++--------------------------------- libexec/rtld-elf/mips/rtld_machdep.h | 2 -- 4 files changed, 13 insertions(+), 72 deletions(-) diff --git a/libexec/rtld-elf/amd64/reloc.c b/libexec/rtld-elf/amd64/reloc.c index 309e105d8b5e..689b0d8635d4 100644 --- a/libexec/rtld-elf/amd64/reloc.c +++ b/libexec/rtld-elf/amd64/reloc.c @@ -541,11 +541,10 @@ allocate_initial_tls(Obj_Entry *objs) void * __tls_get_addr(tls_index *ti) { - Elf_Addr** segbase; + Elf_Addr **dtvp; - __asm __volatile("movq %%fs:0, %0" : "=r" (segbase)); - - return tls_get_addr_common(&segbase[1], ti->ti_module, ti->ti_offset); + dtvp = _get_tp(); + return (tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset)); } size_t diff --git a/libexec/rtld-elf/i386/reloc.c b/libexec/rtld-elf/i386/reloc.c index 5ed3abf65b31..cab163b35e6a 100644 --- a/libexec/rtld-elf/i386/reloc.c +++ b/libexec/rtld-elf/i386/reloc.c @@ -522,22 +522,20 @@ __attribute__((__regparm__(1))) void * ___tls_get_addr(tls_index *ti) { - Elf_Addr** segbase; + Elf_Addr **dtvp; - __asm __volatile("movl %%gs:0, %0" : "=r" (segbase)); - - return tls_get_addr_common(&segbase[1], ti->ti_module, ti->ti_offset); + dtvp = _get_tp(); + return (tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset)); } /* Sun ABI */ void * __tls_get_addr(tls_index *ti) { - Elf_Addr** segbase; - - __asm __volatile("movl %%gs:0, %0" : "=r" (segbase)); + Elf_Addr **dtvp; - return tls_get_addr_common(&segbase[1], ti->ti_module, ti->ti_offset); + dtvp = _get_tp(); + return (tls_get_addr_common(dtvp, ti->ti_module, ti->ti_offset)); } size_t diff --git a/libexec/rtld-elf/mips/reloc.c b/libexec/rtld-elf/mips/reloc.c index 163f9a170872..44ecbd66a707 100644 --- a/libexec/rtld-elf/mips/reloc.c +++ b/libexec/rtld-elf/mips/reloc.c @@ -776,69 +776,15 @@ allocate_initial_tls(Obj_Entry *objs) sysarch(MIPS_SET_TLS, tls); } -#ifdef __mips_n64 -void * -_mips_get_tls(void) -{ - uint64_t _rv; - - __asm__ __volatile__ ( - ".set\tpush\n\t" - ".set\tmips64r2\n\t" - "rdhwr\t%0, $29\n\t" - ".set\tpop" - : "=r" (_rv)); - /* - * XXXSS See 'git show c6be4f4d2d1b71c04de5d3bbb6933ce2dbcdb317' - * - * Remove the offset since this really a request to get the TLS - * pointer via sysarch() (in theory). Of course, this may go away - * once the TLS code is rewritten. - */ - _rv = _rv - TLS_TP_OFFSET - TLS_TCB_SIZE; - - return (void *)_rv; -} - -#else /* mips 32 */ - -void * -_mips_get_tls(void) -{ - uint32_t _rv; - - __asm__ __volatile__ ( - ".set\tpush\n\t" - ".set\tmips32r2\n\t" - "rdhwr\t%0, $29\n\t" - ".set\tpop" - : "=r" (_rv)); - /* - * XXXSS See 'git show c6be4f4d2d1b71c04de5d3bbb6933ce2dbcdb317' - * - * Remove the offset since this really a request to get the TLS - * pointer via sysarch() (in theory). Of course, this may go away - * once the TLS code is rewritten. - */ - _rv = _rv - TLS_TP_OFFSET - TLS_TCB_SIZE; - - return (void *)_rv; -} -#endif /* ! __mips_n64 */ - void * __tls_get_addr(tls_index* ti) { - Elf_Addr** tls; + Elf_Addr **tls; char *p; -#ifdef TLS_USE_SYSARCH - sysarch(MIPS_GET_TLS, &tls); -#else - tls = _mips_get_tls(); -#endif - - p = tls_get_addr_common(tls, ti->ti_module, ti->ti_offset + TLS_DTP_OFFSET); + tls = _get_tp(); + p = tls_get_addr_common(tls, ti->ti_module, ti->ti_offset + + TLS_DTP_OFFSET); return (p); } diff --git a/libexec/rtld-elf/mips/rtld_machdep.h b/libexec/rtld-elf/mips/rtld_machdep.h index d2498dbb9aa4..041a5d05f9a7 100644 --- a/libexec/rtld-elf/mips/rtld_machdep.h +++ b/libexec/rtld-elf/mips/rtld_machdep.h @@ -44,8 +44,6 @@ Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target, const struct Struct_Obj_Entry *defobj, const struct Struct_Obj_Entry *obj, const Elf_Rel *rel); Elf_Addr _mips_rtld_bind(struct Struct_Obj_Entry *obj, Elf_Size reloff); -void *_mips_get_tls(void); - #define make_function_pointer(def, defobj) \ ((defobj)->relocbase + (def)->st_value) From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:57:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D51F5BD20B for ; Fri, 9 Apr 2021 20:57:12 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FH9Rr13ppz4cHs for ; Fri, 9 Apr 2021 20:57:11 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f50.google.com with SMTP id j20-20020a05600c1914b029010f31e15a7fso5400348wmq.1 for ; Fri, 09 Apr 2021 13:57:11 -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=4+7X1I7UjRRgCSAL0gbSTi0PgNdDdyaAjZu7X2TSalQ=; b=GdOzxtWrPungZxeQLjoy2kprbc+27DbD8ooVyaCjZ/G+BwrwoZk5lsD7092Rdune3w bFTRwf/eqeAt0k8cbq/nPkQHbc7IouuxqDIKYUeuRmFQ/2EymlxeiuHujBmHgMN+KO8I Yqs2N3dPGPwLdRqg2m7dbgmkjDdui7vCxh1prOsBUx8HEa9Ywsyjs/or0AZpfQc4i++a 1L3noHKR9KfPLgN2Ez5cTsaeL6DNW+WPqHjq1/K0fxPE9dMR6VPx56xY1kXPBLDUHd3a ZPJ8rCO7B1+9/i76TlzllnwY3Decy8iHGUaZVCxJk49X+k/zOJXn0FaPOKQPma1hnEpt wp+Q== X-Gm-Message-State: AOAM530HUwKqnowv56e/AoBodeIdT7wV99Tf312gUFq2ebuW8ByntJFM wlRpZ9ZUNCZP6Z1MVpUpwbM81Q== X-Google-Smtp-Source: ABdhPJxYHiwIXK8kU8uIIKwI4sU2BR6w/i1q2Pxu2UpqwZH5Iw9wHfak8sXgNgthRJG1r6Pw2NHkqg== X-Received: by 2002:a1c:6a13:: with SMTP id f19mr12565663wmc.145.1618001830517; Fri, 09 Apr 2021 13:57:10 -0700 (PDT) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id h2sm5939983wmc.24.2021.04.09.13.57.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Apr 2021 13:57:09 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: ca46b5698e8a - main - libc: implement __tls_get_addr() for static binaries From: Jessica Clarke In-Reply-To: <202104092047.139KlCSq071570@gitrepo.freebsd.org> Date: Fri, 9 Apr 2021 21:57:09 +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: <202104092047.139KlCSq071570@gitrepo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4FH9Rr13ppz4cHs 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:57:12 -0000 On 9 Apr 2021, at 21:47, Konstantin Belousov wrote: >=20 > The branch main has been updated by kib: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3Dca46b5698e8ac38ab45d781d592700be= 59e7de97 >=20 > commit ca46b5698e8ac38ab45d781d592700be59e7de97 > Author: Konstantin Belousov > AuthorDate: 2021-04-05 03:29:47 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-04-09 20:46:24 +0000 >=20 > libc: implement __tls_get_addr() for static binaries I=E2=80=99ve uttered rude words in the past about the stub = implementation being extremely unhelpful so thanks for this! Jess From owner-dev-commits-src-all@freebsd.org Fri Apr 9 20:57:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70BF35BD1B9 for ; Fri, 9 Apr 2021 20:57:57 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 4FH9Sj2XQxz4cSt for ; Fri, 9 Apr 2021 20:57:57 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f47.google.com with SMTP id x7so6838167wrw.10 for ; Fri, 09 Apr 2021 13:57:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=1aDzDssqkziorV+eGjbWdSfG1hzgfPCqT4LJx6+DVYY=; b=ltnN1cq7bPv2t15P0hgmhpEBe6u0ilbfmtdYKw7gc5Oo0RvIW8cOnK7eBbTHP3jjpc WljiWkOt4Z37trP4HwfKVRgW77VbO7wmbPqnkOKzSStc90+qOngIS5zyrdhIcOh32fBw UECaL5UCcuGpxkaFcAKK5p8VDUFdbEBfYThHHpiQk1QLl880/55IDEtF2kPw/MUNquEE wPD4LV8T0gvxaHlxws/74aGVTHpuuV23wJ5vhOOVPyaRApqW2LoYescIigi5lkxBv5GH Ynq7qLDRWJUq/dAW10jNZh8lR/+fAd8xAchPmax6xPgMBpSHBr8bmTVtQ8Clt7Tg0bqO tzHg== X-Gm-Message-State: AOAM530a2CbMZs4X6g5SCRq1THXAvQWUO5LexIuuGX5EOnwBt/GWfPcn lOm0yyz4it0DIHOPWcoJqb6+Cg== X-Google-Smtp-Source: ABdhPJzCyT3fNJnxrzQxQsOnVi7Vq2x8XIS+FrBt1aTuRzazSqznIbEz8mDf8d5kQladOuZAzGnfBA== X-Received: by 2002:a5d:6b50:: with SMTP id x16mr19049661wrw.379.1618001875961; Fri, 09 Apr 2021 13:57:55 -0700 (PDT) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id h2sm5939983wmc.24.2021.04.09.13.57.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Apr 2021 13:57:55 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 06d8a116bd6b - main - libc: add _get_tp() private function From: Jessica Clarke In-Reply-To: <202104092047.139KlBo3071549@gitrepo.freebsd.org> Date: Fri, 9 Apr 2021 21:57:55 +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: <4BDA2D21-D5D0-4EC2-B6F7-B99260D046E0@freebsd.org> References: <202104092047.139KlBo3071549@gitrepo.freebsd.org> To: Konstantin Belousov X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4FH9Sj2XQxz4cSt 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:57:57 -0000 On 9 Apr 2021, at 21:47, Konstantin Belousov wrote: >=20 > The branch main has been updated by kib: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D06d8a116bd6b6f70b8aedc6a6a2c4085= c53f63ac >=20 > commit 06d8a116bd6b6f70b8aedc6a6a2c4085c53f63ac > Author: Konstantin Belousov > AuthorDate: 2021-04-05 03:30:35 +0000 > Commit: Konstantin Belousov > CommitDate: 2021-04-09 20:46:24 +0000 >=20 > libc: add _get_tp() private function >=20 > which returns pointer to tcb This feels like it should be static inline in a header. Also we already = have _tcb_get in pthread_md.h that should be entirely equivalent, and _libc_get_static_tls_base that=E2=80=99s basically the same again but = with an optional offset. Can we do something to unify all the inline asm into one place = per architecture rather than growing yet more copies of the same thing? Jess From owner-dev-commits-src-all@freebsd.org Fri Apr 9 21:21:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56C265BDE61; Fri, 9 Apr 2021 21:21: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 4FH9zQ1vlSz4dZB; Fri, 9 Apr 2021 21:21: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 33C9924978; Fri, 9 Apr 2021 21:21: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 139LL6fj021647; Fri, 9 Apr 2021 21:21:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139LL6eb021646; Fri, 9 Apr 2021 21:21:06 GMT (envelope-from git) Date: Fri, 9 Apr 2021 21:21:06 GMT Message-Id: <202104092121.139LL6eb021646@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 0c25bf7e7c18 - main - tcp_hostcache: implement tcp_hc_updatemtu() via tcp_hc_update. Locking changes are planned here, and without this change too much copy-and-paste would be between these two functions. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c25bf7e7c1877c88788f63005de525f2847b1d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 21:21:06 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=0c25bf7e7c1877c88788f63005de525f2847b1d8 commit 0c25bf7e7c1877c88788f63005de525f2847b1d8 Author: Gleb Smirnoff AuthorDate: 2021-04-08 21:15:42 +0000 Commit: Gleb Smirnoff CommitDate: 2021-04-09 21:06:44 +0000 tcp_hostcache: implement tcp_hc_updatemtu() via tcp_hc_update. Locking changes are planned here, and without this change too much copy-and-paste would be between these two functions. Reviewed by: rscheff --- sys/netinet/tcp_hostcache.c | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 7bc79b781a30..130b08425096 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -559,37 +559,9 @@ tcp_hc_getmtu(struct in_conninfo *inc) void tcp_hc_updatemtu(struct in_conninfo *inc, uint32_t mtu) { - struct hc_metrics *hc_entry; - - if (!V_tcp_use_hostcache) - return; - - /* - * Find the right bucket. - */ - hc_entry = tcp_hc_lookup(inc, true); - - /* - * If we don't have an existing object, try to insert a new one. - */ - if (hc_entry == NULL) { - hc_entry = tcp_hc_insert(inc); - if (hc_entry == NULL) - return; - } - - hc_entry->rmx_mtu = mtu; - - /* - * Put it upfront so we find it faster next time. - */ - TAILQ_REMOVE(&hc_entry->rmx_head->hch_bucket, hc_entry, rmx_q); - TAILQ_INSERT_HEAD(&hc_entry->rmx_head->hch_bucket, hc_entry, rmx_q); + struct hc_metrics_lite hcml = { .rmx_mtu = mtu }; - /* - * Unlock bucket row. - */ - THC_UNLOCK(&hc_entry->rmx_head->hch_mtx); + return (tcp_hc_update(inc, &hcml)); } /* @@ -611,6 +583,9 @@ tcp_hc_update(struct in_conninfo *inc, struct hc_metrics_lite *hcml) return; } + if (hcml->rmx_mtu != 0) { + hc_entry->rmx_mtu = hcml->rmx_mtu; + } if (hcml->rmx_rtt != 0) { if (hc_entry->rmx_rtt == 0) hc_entry->rmx_rtt = hcml->rmx_rtt; From owner-dev-commits-src-all@freebsd.org Fri Apr 9 21:21:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B16065BDA77; Fri, 9 Apr 2021 21:21: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 4FH9zR3YzTz4dk4; Fri, 9 Apr 2021 21:21: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 4FAC124E7B; Fri, 9 Apr 2021 21:21: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 139LL7WW021668; Fri, 9 Apr 2021 21:21:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139LL7sO021667; Fri, 9 Apr 2021 21:21:07 GMT (envelope-from git) Date: Fri, 9 Apr 2021 21:21:07 GMT Message-Id: <202104092121.139LL7sO021667@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 7c71f3bd6ace - main - tcp_hostcache: remove extraneous check. All paths leading here already checked this setting. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7c71f3bd6acea654b3fc6fdb44f30e8ea601b422 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 21:21:07 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=7c71f3bd6acea654b3fc6fdb44f30e8ea601b422 commit 7c71f3bd6acea654b3fc6fdb44f30e8ea601b422 Author: Gleb Smirnoff AuthorDate: 2021-04-08 21:17:39 +0000 Commit: Gleb Smirnoff CommitDate: 2021-04-09 21:07:19 +0000 tcp_hostcache: remove extraneous check. All paths leading here already checked this setting. Reviewed by: rscheff --- sys/netinet/tcp_hostcache.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 130b08425096..300cbafe4bcd 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -325,9 +325,6 @@ tcp_hc_lookup(struct in_conninfo *inc, bool update) struct hc_head *hc_head; struct hc_metrics *hc_entry; - if (!V_tcp_use_hostcache) - return NULL; - KASSERT(inc != NULL, ("tcp_hc_lookup with NULL in_conninfo pointer")); /* @@ -395,9 +392,6 @@ tcp_hc_insert(struct in_conninfo *inc) struct hc_head *hc_head; struct hc_metrics *hc_entry; - if (!V_tcp_use_hostcache) - return NULL; - KASSERT(inc != NULL, ("tcp_hc_insert with NULL in_conninfo pointer")); /* From owner-dev-commits-src-all@freebsd.org Fri Apr 9 21:21:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD19A5BDC6E; Fri, 9 Apr 2021 21:21: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 4FH9zS4Hwkz4dKh; Fri, 9 Apr 2021 21:21: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 7F812251A1; Fri, 9 Apr 2021 21:21: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 139LL8vp021689; Fri, 9 Apr 2021 21:21:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139LL8UY021688; Fri, 9 Apr 2021 21:21:08 GMT (envelope-from git) Date: Fri, 9 Apr 2021 21:21:08 GMT Message-Id: <202104092121.139LL8UY021688@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 4f49e3382f11 - main - tcp_hostcache: style(9) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4f49e3382f11f34d1ddd3da79b58ec6eb233cd7e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 21:21:09 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=4f49e3382f11f34d1ddd3da79b58ec6eb233cd7e commit 4f49e3382f11f34d1ddd3da79b58ec6eb233cd7e Author: Gleb Smirnoff AuthorDate: 2021-04-08 21:23:23 +0000 Commit: Gleb Smirnoff CommitDate: 2021-04-09 21:07:27 +0000 tcp_hostcache: style(9) Reviewed by: rscheff --- sys/netinet/tcp_hostcache.c | 53 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 300cbafe4bcd..49e9b0822592 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -180,7 +180,7 @@ SYSCTL_UINT(_net_inet_tcp_hostcache, OID_AUTO, bucketlimit, "Per-bucket hash limit for hostcache"); SYSCTL_UINT(_net_inet_tcp_hostcache, OID_AUTO, count, CTLFLAG_VNET | CTLFLAG_RD, - &VNET_NAME(tcp_hostcache.cache_count), 0, + &VNET_NAME(tcp_hostcache.cache_count), 0, "Current number of entries in hostcache"); SYSCTL_INT(_net_inet_tcp_hostcache, OID_AUTO, expire, CTLFLAG_VNET | CTLFLAG_RW, @@ -325,7 +325,7 @@ tcp_hc_lookup(struct in_conninfo *inc, bool update) struct hc_head *hc_head; struct hc_metrics *hc_entry; - KASSERT(inc != NULL, ("tcp_hc_lookup with NULL in_conninfo pointer")); + KASSERT(inc != NULL, ("%s: NULL in_conninfo", __func__)); /* * Hash the foreign ip address. @@ -392,7 +392,7 @@ tcp_hc_insert(struct in_conninfo *inc) struct hc_head *hc_head; struct hc_metrics *hc_entry; - KASSERT(inc != NULL, ("tcp_hc_insert with NULL in_conninfo pointer")); + KASSERT(inc != NULL, ("%s: NULL in_conninfo", __func__)); /* * Hash the foreign ip address. @@ -428,14 +428,14 @@ tcp_hc_insert(struct in_conninfo *inc) */ if (hc_entry == NULL) { THC_UNLOCK(&hc_head->hch_mtx); - return NULL; + return (NULL); } TAILQ_REMOVE(&hc_head->hch_bucket, hc_entry, rmx_q); KASSERT(V_tcp_hostcache.hashbase[hash].hch_length > 0 && - V_tcp_hostcache.hashbase[hash].hch_length <= - V_tcp_hostcache.bucket_limit, - ("tcp_hostcache: bucket length range violated at %u: %u", - hash, V_tcp_hostcache.hashbase[hash].hch_length)); + V_tcp_hostcache.hashbase[hash].hch_length <= + V_tcp_hostcache.bucket_limit, + ("tcp_hostcache: bucket length range violated at %u: %u", + hash, V_tcp_hostcache.hashbase[hash].hch_length)); V_tcp_hostcache.hashbase[hash].hch_length--; atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); TCPSTAT_INC(tcps_hc_bucketoverflow); @@ -449,7 +449,7 @@ tcp_hc_insert(struct in_conninfo *inc) hc_entry = uma_zalloc(V_tcp_hostcache.zone, M_NOWAIT); if (hc_entry == NULL) { THC_UNLOCK(&hc_head->hch_mtx); - return NULL; + return (NULL); } } @@ -471,13 +471,13 @@ tcp_hc_insert(struct in_conninfo *inc) TAILQ_INSERT_HEAD(&hc_head->hch_bucket, hc_entry, rmx_q); V_tcp_hostcache.hashbase[hash].hch_length++; KASSERT(V_tcp_hostcache.hashbase[hash].hch_length < - V_tcp_hostcache.bucket_limit, - ("tcp_hostcache: bucket length too high at %u: %u", - hash, V_tcp_hostcache.hashbase[hash].hch_length)); + V_tcp_hostcache.bucket_limit, + ("tcp_hostcache: bucket length too high at %u: %u", + hash, V_tcp_hostcache.hashbase[hash].hch_length)); atomic_add_int(&V_tcp_hostcache.cache_count, 1); TCPSTAT_INC(tcps_hc_added); - return hc_entry; + return (hc_entry); } /* @@ -534,16 +534,16 @@ tcp_hc_getmtu(struct in_conninfo *inc) uint32_t mtu; if (!V_tcp_use_hostcache) - return 0; + return (0); hc_entry = tcp_hc_lookup(inc, false); if (hc_entry == NULL) { - return 0; + return (0); } mtu = hc_entry->rmx_mtu; THC_UNLOCK(&hc_entry->rmx_head->hch_mtx); - return mtu; + return (mtu); } /* @@ -589,7 +589,7 @@ tcp_hc_update(struct in_conninfo *inc, struct hc_metrics_lite *hcml) TCPSTAT_INC(tcps_cachedrtt); } if (hcml->rmx_rttvar != 0) { - if (hc_entry->rmx_rttvar == 0) + if (hc_entry->rmx_rttvar == 0) hc_entry->rmx_rttvar = hcml->rmx_rttvar; else hc_entry->rmx_rttvar = ((uint64_t)hc_entry->rmx_rttvar + @@ -684,7 +684,7 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) for (i = 0; i < V_tcp_hostcache.hashsize; i++) { THC_LOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); TAILQ_FOREACH(hc_entry, &V_tcp_hostcache.hashbase[i].hch_bucket, - rmx_q) { + rmx_q) { sbuf_printf(&sb, "%-15s %5u %8u %6lums %6lums %8u %8u %8u " #ifdef TCP_HC_COUNTERS @@ -746,8 +746,8 @@ sysctl_tcp_hc_histo(SYSCTL_HANDLER_ARGS) for (i = 0; i < V_tcp_hostcache.hashsize; i++) { hch_length = V_tcp_hostcache.hashbase[i].hch_length; KASSERT(hch_length <= V_tcp_hostcache.bucket_limit, - ("tcp_hostcache: bucket limit exceeded at %u: %u", - i, hch_length)); + ("tcp_hostcache: bucket limit exceeded at %u: %u", + i, hch_length)); histo[hch_length]++; } @@ -778,13 +778,14 @@ tcp_hc_purge_internal(int all) TAILQ_FOREACH_SAFE(hc_entry, &V_tcp_hostcache.hashbase[i].hch_bucket, rmx_q, hc_next) { KASSERT(V_tcp_hostcache.hashbase[i].hch_length > 0 && - V_tcp_hostcache.hashbase[i].hch_length <= - V_tcp_hostcache.bucket_limit, - ("tcp_hostcache: bucket length out of range at %u: %u", - i, V_tcp_hostcache.hashbase[i].hch_length)); + V_tcp_hostcache.hashbase[i].hch_length <= + V_tcp_hostcache.bucket_limit, ("tcp_hostcache: " + "bucket length out of range at %u: %u", + i, V_tcp_hostcache.hashbase[i].hch_length)); if (all || hc_entry->rmx_expire <= 0) { - TAILQ_REMOVE(&V_tcp_hostcache.hashbase[i].hch_bucket, - hc_entry, rmx_q); + TAILQ_REMOVE( + &V_tcp_hostcache.hashbase[i].hch_bucket, + hc_entry, rmx_q); uma_zfree(V_tcp_hostcache.zone, hc_entry); V_tcp_hostcache.hashbase[i].hch_length--; atomic_subtract_int(&V_tcp_hostcache.cache_count, 1); From owner-dev-commits-src-all@freebsd.org Fri Apr 9 21:21:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59FE35BE103; Fri, 9 Apr 2021 21:21:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FH9zT67jxz4dhD; Fri, 9 Apr 2021 21:21: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 99A2024E7D; Fri, 9 Apr 2021 21:21: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 139LL92u021710; Fri, 9 Apr 2021 21:21:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139LL9OP021709; Fri, 9 Apr 2021 21:21:09 GMT (envelope-from git) Date: Fri, 9 Apr 2021 21:21:09 GMT Message-Id: <202104092121.139LL9OP021709@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 1a7fe55ab8ca - main - tcp_hostcache: make THC_LOCK/UNLOCK macros to work with hash head pointer. Not a functional change. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a7fe55ab8ca1e9c74a508c0c21ad0878d649a3f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 21:21:10 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=1a7fe55ab8ca1e9c74a508c0c21ad0878d649a3f commit 1a7fe55ab8ca1e9c74a508c0c21ad0878d649a3f Author: Gleb Smirnoff AuthorDate: 2021-04-09 15:39:40 +0000 Commit: Gleb Smirnoff CommitDate: 2021-04-09 21:07:35 +0000 tcp_hostcache: make THC_LOCK/UNLOCK macros to work with hash head pointer. Not a functional change. --- sys/netinet/tcp_hostcache.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 49e9b0822592..25190697bdee 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -222,8 +222,8 @@ static MALLOC_DEFINE(M_HOSTCACHE, "hostcache", "TCP hostcache"); V_tcp_hostcache.hashsalt) & \ V_tcp_hostcache.hashmask) -#define THC_LOCK(lp) mtx_lock(lp) -#define THC_UNLOCK(lp) mtx_unlock(lp) +#define THC_LOCK(h) mtx_lock(&(h)->hch_mtx) +#define THC_UNLOCK(h) mtx_unlock(&(h)->hch_mtx) void tcp_hc_init(void) @@ -342,7 +342,7 @@ tcp_hc_lookup(struct in_conninfo *inc, bool update) * find an entry, otherwise the caller has to unlock after he is * done. */ - THC_LOCK(&hc_head->hch_mtx); + THC_LOCK(hc_head); /* * Iterate through entries in bucket row looking for a match. @@ -363,7 +363,7 @@ tcp_hc_lookup(struct in_conninfo *inc, bool update) /* * We were unsuccessful and didn't find anything. */ - THC_UNLOCK(&hc_head->hch_mtx); + THC_UNLOCK(hc_head); return (NULL); found: @@ -409,7 +409,7 @@ tcp_hc_insert(struct in_conninfo *inc) * find an entry, otherwise the caller has to unlock after he is * done. */ - THC_LOCK(&hc_head->hch_mtx); + THC_LOCK(hc_head); /* * If the bucket limit is reached, reuse the least-used element. @@ -427,7 +427,7 @@ tcp_hc_insert(struct in_conninfo *inc) * anything to replace. */ if (hc_entry == NULL) { - THC_UNLOCK(&hc_head->hch_mtx); + THC_UNLOCK(hc_head); return (NULL); } TAILQ_REMOVE(&hc_head->hch_bucket, hc_entry, rmx_q); @@ -448,7 +448,7 @@ tcp_hc_insert(struct in_conninfo *inc) */ hc_entry = uma_zalloc(V_tcp_hostcache.zone, M_NOWAIT); if (hc_entry == NULL) { - THC_UNLOCK(&hc_head->hch_mtx); + THC_UNLOCK(hc_head); return (NULL); } } @@ -519,7 +519,7 @@ tcp_hc_get(struct in_conninfo *inc, struct hc_metrics_lite *hc_metrics_lite) /* * Unlock bucket row. */ - THC_UNLOCK(&hc_entry->rmx_head->hch_mtx); + THC_UNLOCK(hc_entry->rmx_head); } /* @@ -542,7 +542,7 @@ tcp_hc_getmtu(struct in_conninfo *inc) } mtu = hc_entry->rmx_mtu; - THC_UNLOCK(&hc_entry->rmx_head->hch_mtx); + THC_UNLOCK(hc_entry->rmx_head); return (mtu); } @@ -633,7 +633,7 @@ tcp_hc_update(struct in_conninfo *inc, struct hc_metrics_lite *hcml) TAILQ_REMOVE(&hc_entry->rmx_head->hch_bucket, hc_entry, rmx_q); TAILQ_INSERT_HEAD(&hc_entry->rmx_head->hch_bucket, hc_entry, rmx_q); - THC_UNLOCK(&hc_entry->rmx_head->hch_mtx); + THC_UNLOCK(hc_entry->rmx_head); } /* @@ -682,7 +682,7 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) #define msec(u) (((u) + 500) / 1000) for (i = 0; i < V_tcp_hostcache.hashsize; i++) { - THC_LOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); + THC_LOCK(&V_tcp_hostcache.hashbase[i]); TAILQ_FOREACH(hc_entry, &V_tcp_hostcache.hashbase[i].hch_bucket, rmx_q) { sbuf_printf(&sb, @@ -713,7 +713,7 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS) #endif hc_entry->rmx_expire); } - THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); + THC_UNLOCK(&V_tcp_hostcache.hashbase[i]); sbuf_drain(&sb); } #undef msec @@ -774,7 +774,7 @@ tcp_hc_purge_internal(int all) int i; for (i = 0; i < V_tcp_hostcache.hashsize; i++) { - THC_LOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); + THC_LOCK(&V_tcp_hostcache.hashbase[i]); TAILQ_FOREACH_SAFE(hc_entry, &V_tcp_hostcache.hashbase[i].hch_bucket, rmx_q, hc_next) { KASSERT(V_tcp_hostcache.hashbase[i].hch_length > 0 && @@ -792,7 +792,7 @@ tcp_hc_purge_internal(int all) } else hc_entry->rmx_expire -= V_tcp_hostcache.prune; } - THC_UNLOCK(&V_tcp_hostcache.hashbase[i].hch_mtx); + THC_UNLOCK(&V_tcp_hostcache.hashbase[i]); } } From owner-dev-commits-src-all@freebsd.org Fri Apr 9 22:38:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E6FB5C0D54; Fri, 9 Apr 2021 22:38: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 4FHCht6wSCz4jjj; Fri, 9 Apr 2021 22:38: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 DC47425EFA; Fri, 9 Apr 2021 22:38: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 139MccCM019427; Fri, 9 Apr 2021 22:38:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139Mcc1m019426; Fri, 9 Apr 2021 22:38:38 GMT (envelope-from git) Date: Fri, 9 Apr 2021 22:38:38 GMT Message-Id: <202104092238.139Mcc1m019426@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: 3c0dcbfc8501 - main - efivar: Add --quiet to not report errors 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: 3c0dcbfc8501155af2c5461de10fd01c615524a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 22:38:39 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3c0dcbfc8501155af2c5461de10fd01c615524a0 commit 3c0dcbfc8501155af2c5461de10fd01c615524a0 Author: Warner Losh AuthorDate: 2021-04-09 22:35:08 +0000 Commit: Warner Losh CommitDate: 2021-04-09 22:36:20 +0000 efivar: Add --quiet to not report errors Add -q/--quiet flag to the command line. With it, errors are not reported at all. Instead nothing is printed and the exit code is non-zero. Reviewed by: markj Sponsored by: Netflix, Inc Differential Revision: https://reviews.freebsd.org/D29619 --- usr.sbin/efivar/efivar.8 | 10 +++++--- usr.sbin/efivar/efivar.c | 62 +++++++++++++++++++++++++++++++++++++----------- 2 files changed, 55 insertions(+), 17 deletions(-) diff --git a/usr.sbin/efivar/efivar.8 b/usr.sbin/efivar/efivar.8 index e6f34501dfde..ac359737915f 100644 --- a/usr.sbin/efivar/efivar.8 +++ b/usr.sbin/efivar/efivar.8 @@ -1,5 +1,5 @@ .\" -.\" Copyright (c) 2017-2019 Netflix, Inc. +.\" Copyright (c) 2017-2021 Netflix, Inc. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 18, 2020 +.Dd April 7, 2021 .Dt EFIVAR 8 .Os .Sh NAME @@ -32,7 +32,7 @@ .Nd UEFI environment variable interaction .Sh SYNOPSIS .Nm -.Op Fl abdDHlLNpRtuw +.Op Fl abdDHlLNpqRtuw .Op Fl n Ar name .Op Fl f Ar file .Op Fl -append @@ -51,6 +51,7 @@ .Op Fl -no-name .Op Fl -print .Op Fl -print-decimal +.Op Fl -quiet .Op Fl -raw-guid .Op Fl -utf8 .Op Fl -write @@ -155,6 +156,9 @@ Decode the variable as if it were a UEFI Boot Option, including information abou Do not display the variable name. .It Fl p Fl -print Print the value of the variable. +.It Fl q Fl -quiet +When an error occurs, exit with a non-zero value without outputting any error messages. +Otherwise, produce the normal output and exit with a zero status. .It Fl R Fl -raw-guid Do not substitute well known names for GUID numeric values in output. .It Fl u Fl -utf8 diff --git a/usr.sbin/efivar/efivar.c b/usr.sbin/efivar/efivar.c index c1d36b9bb0ba..cbf4050a787d 100644 --- a/usr.sbin/efivar/efivar.c +++ b/usr.sbin/efivar/efivar.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Netflix, Inc. + * Copyright (c) 2016-2021 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -60,6 +62,7 @@ static struct option longopts[] = { { "no-name", no_argument, NULL, 'N' }, { "print", no_argument, NULL, 'p' }, // { "print-decimal", no_argument, NULL, 'd' }, /* unimplemnted clash with linux version */ + { "quiet", no_argument, NULL, 'q' }, { "raw-guid", no_argument, NULL, 'R' }, { "utf8", no_argument, NULL, 'u' }, { "write", no_argument, NULL, 'w' }, @@ -69,6 +72,7 @@ static struct option longopts[] = { static int aflag, Aflag, bflag, dflag, Dflag, gflag, Hflag, Nflag, lflag, Lflag, Rflag, wflag, pflag, uflag, load_opt_flag; +static bool quiet; static char *varname; static char *fromfile; static u_long attrib = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS; @@ -77,13 +81,40 @@ static void usage(void) { - errx(1, "efivar [-abdDHlLNpRtuw] [-n name] [-f file] [--append] [--ascii]\n" + errx(1, "efivar [-abdDHlLNpqRtuw] [-n name] [-f file] [--append] [--ascii]\n" "\t[--attributes] [--binary] [--delete] [--fromfile file] [--hex]\n" "\t[--list-guids] [--list] [--load-option] [--name name] [--no-name]\n" "\t[--print] [--print-decimal] [--raw-guid] [--utf8] [--write]\n" + "\t[--quiet]\n" "\tname[=value]"); } +static void +rep_err(int eval, const char *fmt, ...) +{ + va_list ap; + + if (quiet) + exit(eval); + + va_start(ap, fmt); + verr(eval, fmt, ap); + va_end(ap); +} + +static void +rep_errx(int eval, const char *fmt, ...) +{ + va_list ap; + + if (quiet) + exit(eval); + + va_start(ap, fmt); + verrx(eval, fmt, ap); + va_end(ap); +} + static void breakdown_name(char *name, efi_guid_t *guid, char **vname) { @@ -91,11 +122,11 @@ breakdown_name(char *name, efi_guid_t *guid, char **vname) cp = strrchr(name, '-'); if (cp == NULL) - errx(1, "Invalid name: %s", name); + rep_errx(1, "Invalid name: %s", name); *vname = cp + 1; *cp = '\0'; if (efi_name_to_guid(name, guid) < 0) - errx(1, "Invalid guid %s", name); + rep_errx(1, "Invalid guid %s", name); } static uint8_t * @@ -124,7 +155,7 @@ append_variable(char *name, char *val) breakdown_name(name, &guid, &vname); data = get_value(val, &datalen); if (efi_append_variable(guid, vname, data, datalen, attrib) < 0) - err(1, "efi_append_variable"); + rep_err(1, "efi_append_variable"); } static void @@ -135,7 +166,7 @@ delete_variable(char *name) breakdown_name(name, &guid, &vname); if (efi_del_variable(guid, vname) < 0) - err(1, "efi_del_variable"); + rep_err(1, "efi_del_variable"); } static void @@ -149,7 +180,7 @@ write_variable(char *name, char *val) breakdown_name(name, &guid, &vname); data = get_value(val, &datalen); if (efi_set_variable(guid, vname, data, datalen, attrib) < 0) - err(1, "efi_set_variable"); + rep_err(1, "efi_set_variable"); } static void @@ -195,18 +226,18 @@ print_var(efi_guid_t *guid, char *name) fd = open(fromfile, O_RDONLY); if (fd < 0) - err(1, "open %s", fromfile); + rep_err(1, "open %s", fromfile); data = malloc(64 * 1024); if (data == NULL) - err(1, "malloc"); + rep_err(1, "malloc"); datalen = read(fd, data, 64 * 1024); if (datalen <= 0) - err(1, "read"); + rep_err(1, "read"); close(fd); } else { rv = efi_get_variable(*guid, name, &data, &datalen, &att); if (rv < 0) - err(1, "fetching %s-%s", gname, name); + rep_err(1, "fetching %s-%s", gname, name); } @@ -253,7 +284,7 @@ print_variables(void) print_var(guid, name); if (rv < 0) - err(1, "Error listing names"); + rep_err(1, "Error listing names"); } static void @@ -272,7 +303,7 @@ parse_args(int argc, char **argv) { int ch, i; - while ((ch = getopt_long(argc, argv, "aAbdDf:gHlLNn:OpRt:uw", + while ((ch = getopt_long(argc, argv, "aAbdDf:gHlLNn:OpqRt:uw", longopts, NULL)) != -1) { switch (ch) { case 'a': @@ -314,6 +345,9 @@ parse_args(int argc, char **argv) case 'p': pflag++; break; + case 'q': + quiet = true; + break; case 'R': Rflag++; break; @@ -331,7 +365,7 @@ parse_args(int argc, char **argv) fromfile = strdup(optarg); break; case 0: - errx(1, "unknown or unimplemented option\n"); + rep_errx(1, "unknown or unimplemented option\n"); break; default: usage(); From owner-dev-commits-src-all@freebsd.org Fri Apr 9 22:38:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 354DC5C0D55; Fri, 9 Apr 2021 22:38: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 4FHChw0QYsz4jmB; Fri, 9 Apr 2021 22:38: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 F423025EFB; Fri, 9 Apr 2021 22:38: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 139McdDU019448; Fri, 9 Apr 2021 22:38:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139McdWs019447; Fri, 9 Apr 2021 22:38:39 GMT (envelope-from git) Date: Fri, 9 Apr 2021 22:38:39 GMT Message-Id: <202104092238.139McdWs019447@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: 0292a5c95f14 - main - efivar: Attempt to fix setting/printing/deleting EFI vars with '-' in their name 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: 0292a5c95f14b1ad3df39ee71c51cc830864a3aa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 22:38:40 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0292a5c95f14b1ad3df39ee71c51cc830864a3aa commit 0292a5c95f14b1ad3df39ee71c51cc830864a3aa Author: Warner Losh AuthorDate: 2021-04-09 22:35:17 +0000 Commit: Warner Losh CommitDate: 2021-04-09 22:36:40 +0000 efivar: Attempt to fix setting/printing/deleting EFI vars with '-' in their name Due to how we're parsing UUIDs, we were disallowing setting, printing or deleting any UEFI variable with a '-' in it when you attempted to do that operation with the exact name (wildcard reporting was unaffected). Fix the parser to loop over all the dashes in the name and only give up when all possible matches are exhausted. Reviewed by: markj@ Sponsored by: Netflix, Inc Differential Revision: https://reviews.freebsd.org/D29620 --- usr.sbin/efivar/efivar.c | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/usr.sbin/efivar/efivar.c b/usr.sbin/efivar/efivar.c index cbf4050a787d..2fdf0e4d09b8 100644 --- a/usr.sbin/efivar/efivar.c +++ b/usr.sbin/efivar/efivar.c @@ -118,15 +118,24 @@ rep_errx(int eval, const char *fmt, ...) static void breakdown_name(char *name, efi_guid_t *guid, char **vname) { - char *cp; - - cp = strrchr(name, '-'); - if (cp == NULL) - rep_errx(1, "Invalid name: %s", name); - *vname = cp + 1; - *cp = '\0'; - if (efi_name_to_guid(name, guid) < 0) - rep_errx(1, "Invalid guid %s", name); + char *cp, *ocp; + + ocp = NULL; + while (true) { + cp = strrchr(name, '-'); + if (cp == NULL) { + if (ocp != NULL) + *ocp = '-'; + rep_errx(1, "Invalid guid in: %s", name); + } + if (ocp != NULL) + *ocp = '-'; + *vname = cp + 1; + *cp = '\0'; + ocp = cp; + if (efi_name_to_guid(name, guid) >= 0) + break; + } } static uint8_t * From owner-dev-commits-src-all@freebsd.org Fri Apr 9 22:38:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6591F5C0F76; Fri, 9 Apr 2021 22:38: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 4FHChx13Jcz4jmM; Fri, 9 Apr 2021 22:38: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 1525F261B9; Fri, 9 Apr 2021 22:38: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 139McfXo019475; Fri, 9 Apr 2021 22:38:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139McfSr019474; Fri, 9 Apr 2021 22:38:41 GMT (envelope-from git) Date: Fri, 9 Apr 2021 22:38:41 GMT Message-Id: <202104092238.139McfSr019474@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: 066b096d13a1 - main - efivar: use bool for booleans 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: 066b096d13a150e802c7142602d821c0b494487b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 22:38:41 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=066b096d13a150e802c7142602d821c0b494487b commit 066b096d13a150e802c7142602d821c0b494487b Author: Warner Losh AuthorDate: 2021-04-09 22:35:50 +0000 Commit: Warner Losh CommitDate: 2021-04-09 22:36:44 +0000 efivar: use bool for booleans Rather than int flags we ++, use booleans for all command line args. No functional change intended. Reviewed by: markj@ Sponsored by: Netflix, Inc Differential Revision: https://reviews.freebsd.org/D29621 --- usr.sbin/efivar/efivar.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/usr.sbin/efivar/efivar.c b/usr.sbin/efivar/efivar.c index 2fdf0e4d09b8..eb9a6e0257c8 100644 --- a/usr.sbin/efivar/efivar.c +++ b/usr.sbin/efivar/efivar.c @@ -70,9 +70,8 @@ static struct option longopts[] = { }; -static int aflag, Aflag, bflag, dflag, Dflag, gflag, Hflag, Nflag, - lflag, Lflag, Rflag, wflag, pflag, uflag, load_opt_flag; -static bool quiet; +static bool aflag, Aflag, bflag, dflag, Dflag, gflag, Hflag, Nflag, + lflag, Lflag, Rflag, wflag, pflag, uflag, load_opt_flag, quiet; static char *varname; static char *fromfile; static u_long attrib = EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS; @@ -316,58 +315,58 @@ parse_args(int argc, char **argv) longopts, NULL)) != -1) { switch (ch) { case 'a': - aflag++; + aflag = true; break; case 'A': - Aflag++; + Aflag = true; break; case 'b': - bflag++; + bflag = true; break; case 'd': - dflag++; + dflag = true; break; case 'D': - Dflag++; + Dflag = true; break; case 'g': - gflag++; + gflag = true; break; case 'H': - Hflag++; + Hflag = true; break; case 'l': - lflag++; + lflag = true; break; case 'L': - Lflag++; + Lflag = true; break; case 'n': varname = optarg; break; case 'N': - Nflag++; + Nflag = true; break; case 'O': - load_opt_flag++; + load_opt_flag = true; break; case 'p': - pflag++; + pflag = true; break; case 'q': quiet = true; break; case 'R': - Rflag++; + Rflag = true; break; case 't': attrib = strtoul(optarg, NULL, 16); break; case 'u': - uflag++; + uflag = true; break; case 'w': - wflag++; + wflag = true; break; case 'f': free(fromfile); @@ -386,13 +385,13 @@ parse_args(int argc, char **argv) if (argc == 1) varname = argv[0]; - if (aflag + Dflag + wflag > 1) { + if ((int)aflag + (int)Dflag + (int)wflag > 1) { warnx("Can only use one of -a (--append), " "-D (--delete) and -w (--write)"); usage(); } - if (aflag + Dflag + wflag > 0 && varname == NULL) { + if ((int)aflag + (int)Dflag + (int)wflag > 0 && varname == NULL) { warnx("Must specify a variable for -a (--append), " "-D (--delete) or -w (--write)"); usage(); @@ -407,13 +406,13 @@ parse_args(int argc, char **argv) else if (Lflag) print_known_guid(); else if (fromfile) { - Nflag = 1; + Nflag = true; print_var(NULL, NULL); } else if (varname) { - pflag++; + pflag = true; print_variable(varname); } else if (argc > 0) { - pflag++; + pflag = true; for (i = 0; i < argc; i++) print_variable(argv[i]); } else From owner-dev-commits-src-all@freebsd.org Fri Apr 9 23:11:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 331205C24DE; Fri, 9 Apr 2021 23:11: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 4FHDQw11TKz4lSP; Fri, 9 Apr 2021 23:11: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 15BF92675E; Fri, 9 Apr 2021 23:11: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 139NBaKd071106; Fri, 9 Apr 2021 23:11:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139NBacZ071105; Fri, 9 Apr 2021 23:11:36 GMT (envelope-from git) Date: Fri, 9 Apr 2021 23:11:36 GMT Message-Id: <202104092311.139NBacZ071105@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: 6a06b00a0d1f - main - nlmrsa: Remove this deprecated driver. 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: 6a06b00a0d1fe4c426a1778734529e536f1ff99a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 23:11:36 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=6a06b00a0d1fe4c426a1778734529e536f1ff99a commit 6a06b00a0d1fe4c426a1778734529e536f1ff99a Author: John Baldwin AuthorDate: 2021-03-16 21:48:02 +0000 Commit: John Baldwin CommitDate: 2021-04-09 23:10:31 +0000 nlmrsa: Remove this deprecated driver. Relnotes: yes Sponsored by: Chelsio Communications --- sys/mips/conf/std.XLP | 1 - sys/mips/nlm/dev/sec/nlmrsa.c | 485 --------------------------------------- sys/mips/nlm/dev/sec/nlmrsalib.h | 64 ------ sys/mips/nlm/files.xlp | 1 - 4 files changed, 551 deletions(-) diff --git a/sys/mips/conf/std.XLP b/sys/mips/conf/std.XLP index 8d8cfb693a70..ea6216dfcc6c 100644 --- a/sys/mips/conf/std.XLP +++ b/sys/mips/conf/std.XLP @@ -102,7 +102,6 @@ device ds13rtc # RTC on XLP boards device crypto device cryptodev device nlmsec -device nlmrsa # Options that use crypto options IPSEC diff --git a/sys/mips/nlm/dev/sec/nlmrsa.c b/sys/mips/nlm/dev/sec/nlmrsa.c deleted file mode 100644 index 42b904d22a64..000000000000 --- a/sys/mips/nlm/dev/sec/nlmrsa.c +++ /dev/null @@ -1,485 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003-2012 Broadcom Corporation - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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 BROADCOM ``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 BROADCOM OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "cryptodev_if.h" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef NLM_RSA_DEBUG -static void print_krp_params(struct cryptkop *krp); -#endif - -static int xlp_rsa_init(struct xlp_rsa_softc *sc, int node); -static int xlp_rsa_kprocess(device_t , struct cryptkop *, int); -static int xlp_get_rsa_opsize(struct xlp_rsa_command *cmd, unsigned int bits); -static void xlp_free_cmd_params(struct xlp_rsa_command *cmd); -static int xlp_rsa_inp2hwformat(uint8_t *src, uint8_t *dst, - uint32_t paramsize, uint8_t result); - -static int xlp_rsa_probe(device_t); -static int xlp_rsa_attach(device_t); -static int xlp_rsa_detach(device_t); - -static device_method_t xlp_rsa_methods[] = { - /* device interface */ - DEVMETHOD(device_probe, xlp_rsa_probe), - DEVMETHOD(device_attach, xlp_rsa_attach), - DEVMETHOD(device_detach, xlp_rsa_detach), - - /* bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_driver_added, bus_generic_driver_added), - - /* crypto device methods */ - DEVMETHOD(cryptodev_kprocess, xlp_rsa_kprocess), - - DEVMETHOD_END -}; - -static driver_t xlp_rsa_driver = { - "nlmrsa", - xlp_rsa_methods, - sizeof(struct xlp_rsa_softc) -}; -static devclass_t xlp_rsa_devclass; - -DRIVER_MODULE(nlmrsa, pci, xlp_rsa_driver, xlp_rsa_devclass, 0, 0); -MODULE_DEPEND(nlmrsa, crypto, 1, 1, 1); - -#ifdef NLM_RSA_DEBUG -static void -print_krp_params(struct cryptkop *krp) -{ - int i; - - printf("krp->krp_op :%d\n", krp->krp_op); - printf("krp->krp_status :%d\n", krp->krp_status); - printf("krp->krp_iparams:%d\n", krp->krp_iparams); - printf("krp->krp_oparams:%d\n", krp->krp_oparams); - for (i = 0; i < krp->krp_iparams + krp->krp_oparams; i++) { - printf("krp->krp_param[%d].crp_p :0x%llx\n", i, - (unsigned long long)krp->krp_param[i].crp_p); - printf("krp->krp_param[%d].crp_nbits :%d\n", i, - krp->krp_param[i].crp_nbits); - printf("krp->krp_param[%d].crp_nbytes :%d\n", i, - howmany(krp->krp_param[i].crp_nbits, 8)); - } -} -#endif - -static int -xlp_rsa_init(struct xlp_rsa_softc *sc, int node) -{ - struct xlp_rsa_command *cmd = NULL; - uint32_t fbvc, dstvc, endsel, regval; - struct nlm_fmn_msg m; - int err, ret, i; - uint64_t base; - - /* Register interrupt handler for the RSA/ECC CMS messages */ - if (register_msgring_handler(sc->rsaecc_vc_start, - sc->rsaecc_vc_end, nlm_xlprsaecc_msgring_handler, sc) != 0) { - err = -1; - printf("Couldn't register rsa/ecc msgring handler\n"); - goto errout; - } - fbvc = nlm_cpuid() * 4 + XLPGE_FB_VC; - /* Do the CMS credit initialization */ - /* Currently it is configured by default to 50 when kernel comes up */ - -#if BYTE_ORDER == LITTLE_ENDIAN - for (i = 0; i < nitems(nlm_rsa_ucode_data); i++) - nlm_rsa_ucode_data[i] = htobe64(nlm_rsa_ucode_data[i]); -#endif - for (dstvc = sc->rsaecc_vc_start; dstvc <= sc->rsaecc_vc_end; dstvc++) { - cmd = malloc(sizeof(struct xlp_rsa_command), M_DEVBUF, - M_NOWAIT | M_ZERO); - KASSERT(cmd != NULL, ("%s:cmd is NULL\n", __func__)); - cmd->rsasrc = contigmalloc(sizeof(nlm_rsa_ucode_data), - M_DEVBUF, - (M_WAITOK | M_ZERO), - 0UL /* low address */, -1UL /* high address */, - XLP_L2L3_CACHELINE_SIZE /* alignment */, - 0UL /* boundary */); - KASSERT(cmd->rsasrc != NULL, - ("%s:cmd->rsasrc is NULL\n", __func__)); - memcpy(cmd->rsasrc, nlm_rsa_ucode_data, - sizeof(nlm_rsa_ucode_data)); - m.msg[0] = nlm_crypto_form_rsa_ecc_fmn_entry0(1, 0x70, 0, - vtophys(cmd->rsasrc)); - m.msg[1] = nlm_crypto_form_rsa_ecc_fmn_entry1(0, 1, fbvc, - vtophys(cmd->rsasrc)); - /* Software scratch pad */ - m.msg[2] = (uintptr_t)cmd; - m.msg[3] = 0; - - ret = nlm_fmn_msgsend(dstvc, 3, FMN_SWCODE_RSA, &m); - if (ret != 0) { - err = -1; - printf("%s: msgsnd failed (%x)\n", __func__, ret); - goto errout; - } - } - /* Configure so that all VCs send request to all RSA pipes */ - base = nlm_get_rsa_regbase(node); - if (nlm_is_xlp3xx()) { - endsel = 1; - regval = 0xFFFF; - } else { - endsel = 3; - regval = 0x07FFFFFF; - } - for (i = 0; i < endsel; i++) - nlm_write_rsa_reg(base, RSA_ENG_SEL_0 + i, regval); - return (0); -errout: - xlp_free_cmd_params(cmd); - return (err); -} - -/* This function is called from an interrupt handler */ -void -nlm_xlprsaecc_msgring_handler(int vc, int size, int code, int src_id, - struct nlm_fmn_msg *msg, void *data) -{ - struct xlp_rsa_command *cmd; - struct xlp_rsa_softc *sc; - struct crparam *outparam; - int ostart; - - KASSERT(code == FMN_SWCODE_RSA, - ("%s: bad code = %d, expected code = %d\n", __func__, code, - FMN_SWCODE_RSA)); - - sc = data; - KASSERT(src_id >= sc->rsaecc_vc_start && src_id <= sc->rsaecc_vc_end, - ("%s: bad src_id = %d, expect %d - %d\n", __func__, - src_id, sc->rsaecc_vc_start, sc->rsaecc_vc_end)); - - cmd = (struct xlp_rsa_command *)(uintptr_t)msg->msg[1]; - KASSERT(cmd != NULL, ("%s:cmd not received properly\n", __func__)); - - if (RSA_ERROR(msg->msg[0]) != 0) { - printf("%s: Message rcv msg0 %llx msg1 %llx err %x \n", - __func__, (unsigned long long)msg->msg[0], - (unsigned long long)msg->msg[1], - (int)RSA_ERROR(msg->msg[0])); - cmd->krp->krp_status = EBADMSG; - } - - if (cmd->krp != NULL) { - ostart = cmd->krp->krp_iparams; - outparam = &cmd->krp->krp_param[ostart]; - xlp_rsa_inp2hwformat(cmd->rsasrc + cmd->rsaopsize * ostart, - outparam->crp_p, - howmany(outparam->crp_nbits, 8), - 1); - crypto_kdone(cmd->krp); - } - - xlp_free_cmd_params(cmd); -} - -static int -xlp_rsa_probe(device_t dev) -{ - struct xlp_rsa_softc *sc; - - if (pci_get_vendor(dev) == PCI_VENDOR_NETLOGIC && - pci_get_device(dev) == PCI_DEVICE_ID_NLM_RSA) { - sc = device_get_softc(dev); - return (BUS_PROBE_DEFAULT); - } - return (ENXIO); -} - -/* - * Attach an interface that successfully probed. - */ -static int -xlp_rsa_attach(device_t dev) -{ - struct xlp_rsa_softc *sc = device_get_softc(dev); - uint64_t base; - int qstart, qnum; - int freq, node; - - sc->sc_dev = dev; - - node = nlm_get_device_node(pci_get_slot(dev)); - freq = nlm_set_device_frequency(node, DFS_DEVICE_RSA, 250); - if (bootverbose) - device_printf(dev, "RSA Freq: %dMHz\n", freq); - if (pci_get_device(dev) == PCI_DEVICE_ID_NLM_RSA) { - device_set_desc(dev, "XLP RSA/ECC Accelerator"); - sc->sc_cid = crypto_get_driverid(dev, - sizeof(struct xlp_rsa_session), CRYPTOCAP_F_HARDWARE); - if (sc->sc_cid < 0) { - printf("xlp_rsaecc-err:couldn't get the driver id\n"); - goto error_exit; - } - if (crypto_kregister(sc->sc_cid, CRK_MOD_EXP, 0) != 0) - goto error_exit; - - base = nlm_get_rsa_pcibase(node); - qstart = nlm_qidstart(base); - qnum = nlm_qnum(base); - sc->rsaecc_vc_start = qstart; - sc->rsaecc_vc_end = qstart + qnum - 1; - } - if (xlp_rsa_init(sc, node) != 0) - goto error_exit; - device_printf(dev, "RSA Initialization complete!\n"); - gone_in_dev(dev, 14, "Asymmetric crypto"); - return (0); - -error_exit: - return (ENXIO); -} - -/* - * Detach an interface that successfully probed. - */ -static int -xlp_rsa_detach(device_t dev) -{ - return (0); -} - -/* - * XXX freesession should run a zero'd mac/encrypt key into context ram. - * XXX to blow away any keys already stored there. - */ - -static void -xlp_free_cmd_params(struct xlp_rsa_command *cmd) -{ - - if (cmd == NULL) - return; - if (cmd->rsasrc != NULL) { - if (cmd->krp == NULL) /* Micro code load */ - contigfree(cmd->rsasrc, sizeof(nlm_rsa_ucode_data), - M_DEVBUF); - else - free(cmd->rsasrc, M_DEVBUF); - } - free(cmd, M_DEVBUF); -} - -static int -xlp_get_rsa_opsize(struct xlp_rsa_command *cmd, unsigned int bits) -{ - - if (bits == 0 || bits > 8192) - return (-1); - /* XLP hardware expects always a fixed size with unused bytes - * zeroed out in the input data */ - if (bits <= 512) { - cmd->rsatype = 0x40; - cmd->rsaopsize = 64; - } else if (bits <= 1024) { - cmd->rsatype = 0x41; - cmd->rsaopsize = 128; - } else if (bits <= 2048) { - cmd->rsatype = 0x42; - cmd->rsaopsize = 256; - } else if (bits <= 4096) { - cmd->rsatype = 0x43; - cmd->rsaopsize = 512; - } else if (bits <= 8192) { - cmd->rsatype = 0x44; - cmd->rsaopsize = 1024; - } - return (0); -} - -static int -xlp_rsa_inp2hwformat(uint8_t *src, uint8_t *dst, uint32_t paramsize, - uint8_t result) -{ - uint32_t pdwords, pbytes; - int i, j, k; - - pdwords = paramsize / 8; - pbytes = paramsize % 8; - - for (i = 0, k = 0; i < pdwords; i++) { - /* copy dwords of inp/hw to hw/out format */ - for (j = 7; j >= 0; j--, k++) - dst[i * 8 + j] = src[k]; - } - if (pbytes) { - if (result == 0) { - /* copy rem bytes of input data to hw format */ - for (j = 7; k < paramsize; j--, k++) - dst[i * 8 + j] = src[k]; - } else { - /* copy rem bytes of hw data to exp output format */ - for (j = 7; k < paramsize; j--, k++) - dst[k] = src[i * 8 + j]; - } - } - - return (0); -} - -static int -nlm_crypto_complete_rsa_request(struct xlp_rsa_softc *sc, - struct xlp_rsa_command *cmd) -{ - unsigned int fbvc; - struct nlm_fmn_msg m; - int ret; - - fbvc = nlm_cpuid() * 4 + XLPGE_FB_VC; - - m.msg[0] = nlm_crypto_form_rsa_ecc_fmn_entry0(1, cmd->rsatype, - cmd->rsafn, vtophys(cmd->rsasrc)); - m.msg[1] = nlm_crypto_form_rsa_ecc_fmn_entry1(0, 1, fbvc, - vtophys(cmd->rsasrc + cmd->rsaopsize * cmd->krp->krp_iparams)); - /* Software scratch pad */ - m.msg[2] = (uintptr_t)cmd; - m.msg[3] = 0; - - /* Send the message to rsa engine vc */ - ret = nlm_fmn_msgsend(sc->rsaecc_vc_start, 3, FMN_SWCODE_RSA, &m); - if (ret != 0) { -#ifdef NLM_SEC_DEBUG - printf("%s: msgsnd failed (%x)\n", __func__, ret); -#endif - return (ERESTART); - } - return (0); -} - -static int -xlp_rsa_kprocess(device_t dev, struct cryptkop *krp, int hint) -{ - struct xlp_rsa_softc *sc = device_get_softc(dev); - struct xlp_rsa_command *cmd; - struct crparam *kp; - int err, i; - - if (krp == NULL || krp->krp_callback == NULL) - return (EINVAL); - - cmd = malloc(sizeof(struct xlp_rsa_command), M_DEVBUF, - M_NOWAIT | M_ZERO); - KASSERT(cmd != NULL, ("%s:cmd is NULL\n", __func__)); - cmd->krp = krp; - -#ifdef NLM_RSA_DEBUG - print_krp_params(krp); -#endif - err = EOPNOTSUPP; - switch (krp->krp_op) { - case CRK_MOD_EXP: - if (krp->krp_iparams == 3 && krp->krp_oparams == 1) - break; - goto errout; - default: - device_printf(dev, "Op:%d not yet supported\n", krp->krp_op); - goto errout; - } - - err = xlp_get_rsa_opsize(cmd, - krp->krp_param[krp->krp_iparams - 1].crp_nbits); - if (err != 0) { - err = EINVAL; - goto errout; - } - cmd->rsafn = 0; /* Mod Exp */ - cmd->rsasrc = malloc( - cmd->rsaopsize * (krp->krp_iparams + krp->krp_oparams), - M_DEVBUF, - M_NOWAIT | M_ZERO); - if (cmd->rsasrc == NULL) { - err = ENOMEM; - goto errout; - } - - for (i = 0, kp = krp->krp_param; i < krp->krp_iparams; i++, kp++) { - KASSERT(kp->crp_nbits != 0, - ("%s: parameter[%d]'s length is zero\n", __func__, i)); - xlp_rsa_inp2hwformat(kp->crp_p, - cmd->rsasrc + i * cmd->rsaopsize, - howmany(kp->crp_nbits, 8), 0); - } - err = nlm_crypto_complete_rsa_request(sc, cmd); - if (err != 0) - goto errout; - - return (0); -errout: - xlp_free_cmd_params(cmd); - krp->krp_status = err; - crypto_kdone(krp); - return (err); -} diff --git a/sys/mips/nlm/dev/sec/nlmrsalib.h b/sys/mips/nlm/dev/sec/nlmrsalib.h deleted file mode 100644 index 8166f0f0ded4..000000000000 --- a/sys/mips/nlm/dev/sec/nlmrsalib.h +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2003-2012 Broadcom Corporation - * All Rights Reserved - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, 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 BROADCOM ``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 BROADCOM 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 _NLMRSALIB_H_ -#define _NLMRSALIB_H_ - -#define RSA_ERROR(msg0) (((msg0) >> 53) & 0x1f) - -struct xlp_rsa_session { -}; - -struct xlp_rsa_command { - struct xlp_rsa_session *ses; - struct cryptkop *krp; - uint8_t *rsasrc; - uint32_t rsaopsize; - uint32_t rsatype; - uint32_t rsafn; -}; - -/* - * Holds data specific to nlm security accelerators - */ -struct xlp_rsa_softc { - device_t sc_dev; /* device backpointer */ - uint64_t rsa_base; - int sc_cid; - int rsaecc_vc_start; - int rsaecc_vc_end; -}; - -void -nlm_xlprsaecc_msgring_handler(int vc, int size, int code, int src_id, - struct nlm_fmn_msg *msg, void *data); - -#endif /* _NLMRSALIB_H_ */ diff --git a/sys/mips/nlm/files.xlp b/sys/mips/nlm/files.xlp index db6c4eba6754..ecb2477bab06 100644 --- a/sys/mips/nlm/files.xlp +++ b/sys/mips/nlm/files.xlp @@ -36,4 +36,3 @@ ucore_app_bin.h optional xlpge \ # mips/nlm/dev/sec/nlmsec.c optional nlmsec mips/nlm/dev/sec/nlmseclib.c optional nlmsec -mips/nlm/dev/sec/nlmrsa.c optional nlmrsa From owner-dev-commits-src-all@freebsd.org Fri Apr 9 23:11:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D1D45C20E3; Fri, 9 Apr 2021 23:11: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 4FHDQx2VHJz4lVl; Fri, 9 Apr 2021 23:11: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 37B51265C5; Fri, 9 Apr 2021 23:11: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 139NBbcl071131; Fri, 9 Apr 2021 23:11:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139NBb1a071130; Fri, 9 Apr 2021 23:11:37 GMT (envelope-from git) Date: Fri, 9 Apr 2021 23:11:37 GMT Message-Id: <202104092311.139NBb1a071130@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: 86e352c934e5 - main - Fix a typo in a comment: frame -> framework. 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: 86e352c934e5af49866d13a79ddb7c6fbf090cb9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 23:11:37 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=86e352c934e5af49866d13a79ddb7c6fbf090cb9 commit 86e352c934e5af49866d13a79ddb7c6fbf090cb9 Author: John Baldwin AuthorDate: 2021-03-16 22:33:20 +0000 Commit: John Baldwin CommitDate: 2021-04-09 23:10:55 +0000 Fix a typo in a comment: frame -> framework. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/opencrypto/cryptodev_if.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/opencrypto/cryptodev_if.m b/sys/opencrypto/cryptodev_if.m index 1d767be3f4e4..ceb2564b8af5 100644 --- a/sys/opencrypto/cryptodev_if.m +++ b/sys/opencrypto/cryptodev_if.m @@ -100,7 +100,7 @@ METHOD int newsession { * @brief Destroy a crypto session object * * The crypto framework invokes this method when tearing down a crypto - * session. After this callback returns, the frame will explicitly + * session. After this callback returns, the framework will explicitly * zero and free the drvier's per-session memory object. If the * driver requires additional actions to destroy a session, it should * perform those in this method. If the driver does not require From owner-dev-commits-src-all@freebsd.org Fri Apr 9 23:37:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62A9B5C331A; Fri, 9 Apr 2021 23:37: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 4FHF0K2HzXz4mfw; Fri, 9 Apr 2021 23:37: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 410BA26F88; Fri, 9 Apr 2021 23:37: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 139Nb5Ju098116; Fri, 9 Apr 2021 23:37:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 139Nb5Ik098115; Fri, 9 Apr 2021 23:37:05 GMT (envelope-from git) Date: Fri, 9 Apr 2021 23:37:05 GMT Message-Id: <202104092337.139Nb5Ik098115@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Peter Jeremy Subject: git: 292bcaa4ba28 - stable/13 - arm64: Add support for the RK805/RK808 RTC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: peterj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 292bcaa4ba2843da2757368094241c50c7cc0474 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 23:37:05 -0000 The branch stable/13 has been updated by peterj: URL: https://cgit.FreeBSD.org/src/commit/?id=292bcaa4ba2843da2757368094241c50c7cc0474 commit 292bcaa4ba2843da2757368094241c50c7cc0474 Author: Peter Jeremy AuthorDate: 2021-03-12 22:06:04 +0000 Commit: Peter Jeremy CommitDate: 2021-04-09 23:34:03 +0000 arm64: Add support for the RK805/RK808 RTC MFC 07564e1762010ba7e8ef5a7574bf9ceee811e95c Implement a driver for the RTC embedded in the RK805/RK808 power management system used for RK3328 and RK3399 SoCs. Based on experiments on my RK808, setting the time doesn't alter the internal/inaccessible sub-second counter, therefore there's no point in calling clock_schedule(). Based on an earlier revision by andrew. Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D22692 Sponsored by: Google MFC after: 1 week (cherry picked from commit 07564e1762010ba7e8ef5a7574bf9ceee811e95c) --- sys/arm64/rockchip/rk805.c | 123 ++++++++++++++++++++++++++++++++++++++++-- sys/arm64/rockchip/rk805reg.h | 25 +++++++++ 2 files changed, 144 insertions(+), 4 deletions(-) diff --git a/sys/arm64/rockchip/rk805.c b/sys/arm64/rockchip/rk805.c index 19397627a8b0..d3e04081aeb2 100644 --- a/sys/arm64/rockchip/rk805.c +++ b/sys/arm64/rockchip/rk805.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -46,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include +#include "clock_if.h" #include "regdev_if.h" MALLOC_DEFINE(M_RK805_REG, "RK805 regulator", "RK805 power regulator"); @@ -356,10 +358,10 @@ rk805_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size) } static int -rk805_write(device_t dev, uint8_t reg, uint8_t data) +rk805_write(device_t dev, uint8_t reg, uint8_t *data, uint8_t size) { - return (iicdev_writeto(dev, reg, &data, 1, IIC_INTRWAIT)); + return (iicdev_writeto(dev, reg, data, size, IIC_INTRWAIT)); } static int @@ -415,7 +417,7 @@ rk805_regnode_enable(struct regnode *regnode, bool enable, int *udelay) val |= sc->def->enable_mask; else val &= ~sc->def->enable_mask; - rk805_write(sc->base_dev, sc->def->enable_reg, val); + rk805_write(sc->base_dev, sc->def->enable_reg, &val, 1); *udelay = 0; @@ -491,7 +493,7 @@ rk805_regnode_set_voltage(struct regnode *regnode, int min_uvolt, if (rk805_regnode_voltage_to_reg(sc, min_uvolt, max_uvolt, &val) != 0) return (ERANGE); - rk805_write(sc->base_dev, sc->def->voltage_reg, val); + rk805_write(sc->base_dev, sc->def->voltage_reg, &val, 1); rk805_read(sc->base_dev, sc->def->voltage_reg, &val, 1); @@ -624,9 +626,117 @@ rk805_start(void *pdev) device_printf(dev, "Chip Version: %x\n", data[1] & 0xf); } + /* Register this as a 1Hz clock */ + clock_register(dev, 1000000); + config_intrhook_disestablish(&sc->intr_hook); } +static int +rk805_gettime(device_t dev, struct timespec *ts) +{ + struct bcd_clocktime bct; + uint8_t data[7]; + uint8_t ctrl; + int error; + + /* Latch the RTC value into the shadow registers and set 24hr mode */ + error = rk805_read(dev, RK805_RTC_CTRL, &ctrl, 1); + if (error != 0) + return (error); + + ctrl |= RK805_RTC_READSEL; + ctrl &= ~(RK805_RTC_AMPM_MODE | RK805_RTC_GET_TIME); + error = rk805_write(dev, RK805_RTC_CTRL, &ctrl, 1); + if (error != 0) + return (error); + ctrl |= RK805_RTC_GET_TIME; + error = rk805_write(dev, RK805_RTC_CTRL, &ctrl, 1); + if (error != 0) + return (error); + ctrl &= ~RK805_RTC_GET_TIME; + error = rk805_write(dev, RK805_RTC_CTRL, &ctrl, 1); + if (error != 0) + return (error); + + /* This works as long as RK805_RTC_SECS = 0 */ + error = rk805_read(dev, RK805_RTC_SECS, data, 7); + if (error != 0) + return (error); + + /* + * If the reported year is earlier than 2019, assume the clock is unset. + * This is both later than the reset value for the RK805 and RK808 as + * well as being prior to the current time. + */ + if (data[RK805_RTC_YEARS] < 0x19) + return (EINVAL); + + memset(&bct, 0, sizeof(bct)); + bct.year = data[RK805_RTC_YEARS]; + bct.mon = data[RK805_RTC_MONTHS] & RK805_RTC_MONTHS_MASK; + bct.day = data[RK805_RTC_DAYS] & RK805_RTC_DAYS_MASK; + bct.hour = data[RK805_RTC_HOURS] & RK805_RTC_HOURS_MASK; + bct.min = data[RK805_RTC_MINUTES] & RK805_RTC_MINUTES_MASK; + bct.sec = data[RK805_RTC_SECS] & RK805_RTC_SECS_MASK; + bct.dow = data[RK805_RTC_WEEKS] & RK805_RTC_WEEKS_MASK; + /* The day of week is reported as 1-7 with 1 = Monday */ + if (bct.dow == 7) + bct.dow = 0; + bct.ispm = 0; + + if (bootverbose) + device_printf(dev, "Read RTC: %02x-%02x-%02x %02x:%02x:%02x\n", + bct.year, bct.mon, bct.day, bct.hour, bct.min, bct.sec); + + return (clock_bcd_to_ts(&bct, ts, false)); +} + +static int +rk805_settime(device_t dev, struct timespec *ts) +{ + struct bcd_clocktime bct; + uint8_t data[7]; + int error; + uint8_t ctrl; + + clock_ts_to_bcd(ts, &bct, false); + + /* This works as long as RK805_RTC_SECS = 0 */ + data[RK805_RTC_YEARS] = bct.year; + data[RK805_RTC_MONTHS] = bct.mon; + data[RK805_RTC_DAYS] = bct.day; + data[RK805_RTC_HOURS] = bct.hour; + data[RK805_RTC_MINUTES] = bct.min; + data[RK805_RTC_SECS] = bct.sec; + data[RK805_RTC_WEEKS] = bct.dow; + /* The day of week is reported as 1-7 with 1 = Monday */ + if (data[RK805_RTC_WEEKS] == 0) + data[RK805_RTC_WEEKS] = 7; + + error = rk805_read(dev, RK805_RTC_CTRL, &ctrl, 1); + if (error != 0) + return (error); + + ctrl |= RK805_RTC_CTRL_STOP; + ctrl &= ~RK805_RTC_AMPM_MODE; + error = rk805_write(dev, RK805_RTC_CTRL, &ctrl, 1); + if (error != 0) + return (error); + + error = rk805_write(dev, RK805_RTC_SECS, data, 7); + ctrl &= ~RK805_RTC_CTRL_STOP; + rk805_write(dev, RK805_RTC_CTRL, &ctrl, 1); + + if (bootverbose) + device_printf(dev, + "Set RTC at %04x-%02x-%02x %02x:%02x:%02x[.%09ld]\n", + bct.year, bct.mon, bct.day, bct.hour, bct.min, bct.sec, + bct.nsec); + + return (error); +} + static int rk805_attach(device_t dev) { @@ -724,6 +834,11 @@ static device_method_t rk805_methods[] = { /* regdev interface */ DEVMETHOD(regdev_map, rk805_map), + + /* Clock interface */ + DEVMETHOD(clock_gettime, rk805_gettime), + DEVMETHOD(clock_settime, rk805_settime), + DEVMETHOD_END }; diff --git a/sys/arm64/rockchip/rk805reg.h b/sys/arm64/rockchip/rk805reg.h index db489d77c26e..b1f4481a5b68 100644 --- a/sys/arm64/rockchip/rk805reg.h +++ b/sys/arm64/rockchip/rk805reg.h @@ -30,6 +30,31 @@ #ifndef _RK805REG_H_ #define _RK805REG_H_ +/* + * The RTC registers are the same in both RK805 and RK808. + * Note that the code assumes that RK805_RTC_SECS is 0 + */ +#define RK805_RTC_SECS 0x00 +#define RK805_RTC_SECS_MASK 0x7f +#define RK805_RTC_MINUTES 0x01 +#define RK805_RTC_MINUTES_MASK 0x7f +#define RK805_RTC_HOURS 0x02 +#define RK805_RTC_HOURS_MASK 0x3f +#define RK805_RTC_HOURS_PM 0x80 +#define RK805_RTC_DAYS 0x03 +#define RK805_RTC_DAYS_MASK 0x3f +#define RK805_RTC_MONTHS 0x04 +#define RK805_RTC_MONTHS_MASK 0x1f +#define RK805_RTC_YEARS 0x05 +#define RK805_RTC_WEEKS 0x06 /* day of week */ +#define RK805_RTC_WEEKS_MASK 0x07 + +#define RK805_RTC_CTRL 0x10 +#define RK805_RTC_CTRL_STOP (1 << 0) +#define RK805_RTC_AMPM_MODE (1 << 3) +#define RK805_RTC_GET_TIME (1 << 6) +#define RK805_RTC_READSEL (1 << 7) + #define RK805_CHIP_NAME 0x17 #define RK805_CHIP_VER 0x18 #define RK805_OTP_VER 0x19 From owner-dev-commits-src-all@freebsd.org Sat Apr 10 01:25:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 202EB5C64BF; Sat, 10 Apr 2021 01:25: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 4FHHP30Q8vz4rLk; Sat, 10 Apr 2021 01:25: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 01364467; Sat, 10 Apr 2021 01:25: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 13A1PAGi043256; Sat, 10 Apr 2021 01:25:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A1PAOV043255; Sat, 10 Apr 2021 01:25:10 GMT (envelope-from git) Date: Sat, 10 Apr 2021 01:25:10 GMT Message-Id: <202104100125.13A1PAOV043255@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: a8b75a57c9b2 - main - x86: add x86_clear_dbregs() helper 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: a8b75a57c9b2cb3388746f097a55086a0f8c5d38 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 01:25:11 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a8b75a57c9b2cb3388746f097a55086a0f8c5d38 commit a8b75a57c9b2cb3388746f097a55086a0f8c5d38 Author: Konstantin Belousov AuthorDate: 2021-04-09 23:19:23 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-10 01:25:01 +0000 x86: add x86_clear_dbregs() helper Move the code from exec_setregs() to reset debug registers state on exec, to the x86_clear_dbregs() helper Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29687 --- sys/amd64/amd64/machdep.c | 50 +++++++++++++++++++++++++++-------------------- sys/i386/i386/machdep.c | 50 +++++++++++++++++++++++++++-------------------- sys/x86/include/x86_var.h | 1 + 3 files changed, 59 insertions(+), 42 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 5c8a3ae6bb4e..362ea6eea825 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -581,6 +581,34 @@ freebsd4_sigreturn(struct thread *td, struct freebsd4_sigreturn_args *uap) } #endif +/* + * Reset the hardware debug registers if they were in use. + * They won't have any meaning for the newly exec'd process. + */ +void +x86_clear_dbregs(struct pcb *pcb) +{ + if ((pcb->pcb_flags & PCB_DBREGS) == 0) + return; + + pcb->pcb_dr0 = 0; + pcb->pcb_dr1 = 0; + pcb->pcb_dr2 = 0; + pcb->pcb_dr3 = 0; + pcb->pcb_dr6 = 0; + pcb->pcb_dr7 = 0; + + if (pcb == curpcb) { + /* + * Clear the debug registers on the running CPU, + * otherwise they will end up affecting the next + * process we switch to. + */ + reset_dbregs(); + } + clear_pcb_flags(pcb, PCB_DBREGS); +} + /* * Reset registers to default values on exec. */ @@ -617,27 +645,7 @@ exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) regs->tf_gs = _ugssel; regs->tf_flags = TF_HASSEGS; - /* - * Reset the hardware debug registers if they were in use. - * They won't have any meaning for the newly exec'd process. - */ - if (pcb->pcb_flags & PCB_DBREGS) { - pcb->pcb_dr0 = 0; - pcb->pcb_dr1 = 0; - pcb->pcb_dr2 = 0; - pcb->pcb_dr3 = 0; - pcb->pcb_dr6 = 0; - pcb->pcb_dr7 = 0; - if (pcb == curpcb) { - /* - * Clear the debug registers on the running - * CPU, otherwise they will end up affecting - * the next process we switch to. - */ - reset_dbregs(); - } - clear_pcb_flags(pcb, PCB_DBREGS); - } + x86_clear_dbregs(pcb); /* * Drop the FP state if we hold it, so that the process gets a diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index a9749d331f89..5fec2e448c53 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -1121,6 +1121,34 @@ setup_priv_lcall_gate(struct proc *p) } #endif +/* + * Reset the hardware debug registers if they were in use. + * They won't have any meaning for the newly exec'd process. + */ +void +x86_clear_dbregs(struct pcb *pcb) +{ + if ((pcb->pcb_flags & PCB_DBREGS) == 0) + return; + + pcb->pcb_dr0 = 0; + pcb->pcb_dr1 = 0; + pcb->pcb_dr2 = 0; + pcb->pcb_dr3 = 0; + pcb->pcb_dr6 = 0; + pcb->pcb_dr7 = 0; + + if (pcb == curpcb) { + /* + * Clear the debug registers on the running CPU, + * otherwise they will end up affecting the next + * process we switch to. + */ + reset_dbregs(); + } + pcb->pcb_flags &= ~PCB_DBREGS; +} + /* * Reset registers to default values on exec. */ @@ -1174,27 +1202,7 @@ exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) /* PS_STRINGS value for BSD/OS binaries. It is 0 for non-BSD/OS. */ regs->tf_ebx = (register_t)imgp->ps_strings; - /* - * Reset the hardware debug registers if they were in use. - * They won't have any meaning for the newly exec'd process. - */ - if (pcb->pcb_flags & PCB_DBREGS) { - pcb->pcb_dr0 = 0; - pcb->pcb_dr1 = 0; - pcb->pcb_dr2 = 0; - pcb->pcb_dr3 = 0; - pcb->pcb_dr6 = 0; - pcb->pcb_dr7 = 0; - if (pcb == curpcb) { - /* - * Clear the debug registers on the running - * CPU, otherwise they will end up affecting - * the next process we switch to. - */ - reset_dbregs(); - } - pcb->pcb_flags &= ~PCB_DBREGS; - } + x86_clear_dbregs(pcb); pcb->pcb_initial_npxcw = __INITIAL_NPXCW__; diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h index 3e5aa847304e..983c353327fd 100644 --- a/sys/x86/include/x86_var.h +++ b/sys/x86/include/x86_var.h @@ -123,6 +123,7 @@ void cpu_setregs(void); int dbreg_set_watchpoint(vm_offset_t addr, vm_size_t size, int access); int dbreg_clr_watchpoint(vm_offset_t addr, vm_size_t size); void dbreg_list_watchpoints(void); +void x86_clear_dbregs(struct pcb *pcb); bool disable_wp(void); void restore_wp(bool old_wp); void finishidentcpu(void); From owner-dev-commits-src-all@freebsd.org Sat Apr 10 01:25:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4AC285C64C2; Sat, 10 Apr 2021 01:25: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 4FHHP41N6sz4rpB; Sat, 10 Apr 2021 01:25: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 20AE3468; Sat, 10 Apr 2021 01:25: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 13A1PC39043277; Sat, 10 Apr 2021 01:25:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A1PCii043276; Sat, 10 Apr 2021 01:25:12 GMT (envelope-from git) Date: Sat, 10 Apr 2021 01:25:12 GMT Message-Id: <202104100125.13A1PCii043276@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: 290b0d123ae2 - main - x86: use x86_clear_dbregs() on fork 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: 290b0d123ae2136ad84b268cd1884b1624d1d37f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 01:25:12 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=290b0d123ae2136ad84b268cd1884b1624d1d37f commit 290b0d123ae2136ad84b268cd1884b1624d1d37f Author: Konstantin Belousov AuthorDate: 2021-04-09 23:20:55 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-10 01:25:02 +0000 x86: use x86_clear_dbregs() on fork instead of manual zeroing of the debug registers file in pcb. This centralizes the cleaning code, but the practical difference is that PCB_DBREGS flag is cleared, saving some operations on context switching. Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29687 --- sys/amd64/amd64/vm_machdep.c | 7 +------ sys/i386/i386/vm_machdep.c | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 98d212dc8771..1acc5dc55c85 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -230,12 +230,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) copy_thread(td1, td2); /* Reset debug registers in the new process */ - pcb2->pcb_dr0 = 0; - pcb2->pcb_dr1 = 0; - pcb2->pcb_dr2 = 0; - pcb2->pcb_dr3 = 0; - pcb2->pcb_dr6 = 0; - pcb2->pcb_dr7 = 0; + x86_clear_dbregs(pcb2); /* Point mdproc and then copy over p1's contents */ mdp2 = &p2->p_md; diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index ed40ebe5d1c8..57377575b9bf 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -242,12 +242,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) copy_thread(td1, td2); /* Reset debug registers in the new process */ - pcb2->pcb_dr0 = 0; - pcb2->pcb_dr1 = 0; - pcb2->pcb_dr2 = 0; - pcb2->pcb_dr3 = 0; - pcb2->pcb_dr6 = 0; - pcb2->pcb_dr7 = 0; + x86_clear_dbregs(pcb2); /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; From owner-dev-commits-src-all@freebsd.org Sat Apr 10 01:25:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 843375C661B; Sat, 10 Apr 2021 01:25: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 4FHHP52rpPz4rpH; Sat, 10 Apr 2021 01:25: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 49FD4469; Sat, 10 Apr 2021 01:25: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 13A1PD9f043302; Sat, 10 Apr 2021 01:25:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A1PDFK043301; Sat, 10 Apr 2021 01:25:13 GMT (envelope-from git) Date: Sat, 10 Apr 2021 01:25:13 GMT Message-Id: <202104100125.13A1PDFK043301@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: 2f1588474768 - main - amd64 linux64: use x86_clear_dbregs() 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: 2f1588474768f61f3a983af207e753bd0340a9e7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 01:25:13 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2f1588474768f61f3a983af207e753bd0340a9e7 commit 2f1588474768f61f3a983af207e753bd0340a9e7 Author: Konstantin Belousov AuthorDate: 2021-04-09 23:22:48 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-10 01:25:02 +0000 amd64 linux64: use x86_clear_dbregs() instead of manually inlining it Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29687 --- sys/amd64/linux/linux_sysvec.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/sys/amd64/linux/linux_sysvec.c b/sys/amd64/linux/linux_sysvec.c index abc750c63682..252579a4809e 100644 --- a/sys/amd64/linux/linux_sysvec.c +++ b/sys/amd64/linux/linux_sysvec.c @@ -477,27 +477,7 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp, regs->tf_gs = _ugssel; regs->tf_flags = TF_HASSEGS; - /* - * Reset the hardware debug registers if they were in use. - * They won't have any meaning for the newly exec'd process. - */ - if (pcb->pcb_flags & PCB_DBREGS) { - pcb->pcb_dr0 = 0; - pcb->pcb_dr1 = 0; - pcb->pcb_dr2 = 0; - pcb->pcb_dr3 = 0; - pcb->pcb_dr6 = 0; - pcb->pcb_dr7 = 0; - if (pcb == curpcb) { - /* - * Clear the debug registers on the running - * CPU, otherwise they will end up affecting - * the next process we switch to. - */ - reset_dbregs(); - } - clear_pcb_flags(pcb, PCB_DBREGS); - } + x86_clear_dbregs(pcb); /* * Drop the FP state if we hold it, so that the process gets a From owner-dev-commits-src-all@freebsd.org Sat Apr 10 01:25:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F42065C6551; Sat, 10 Apr 2021 01:25: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 4FHHP63vF0z4rcM; Sat, 10 Apr 2021 01:25: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 68D1F3BD; Sat, 10 Apr 2021 01:25: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 13A1PEPO043326; Sat, 10 Apr 2021 01:25:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A1PEfD043325; Sat, 10 Apr 2021 01:25:14 GMT (envelope-from git) Date: Sat, 10 Apr 2021 01:25:14 GMT Message-Id: <202104100125.13A1PEfD043325@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: d50adfec9ee7 - main - amd64: clear debug registers on execing 32bit native binary 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: d50adfec9ee73e88e8d365525f1acef2c1db798a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 01:25:15 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=d50adfec9ee73e88e8d365525f1acef2c1db798a commit d50adfec9ee73e88e8d365525f1acef2c1db798a Author: Konstantin Belousov AuthorDate: 2021-04-09 23:23:54 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-10 01:25:02 +0000 amd64: clear debug registers on execing 32bit native binary Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29687 --- sys/amd64/ia32/ia32_signal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c index 51dd1f38090f..c114cf1d240a 100644 --- a/sys/amd64/ia32/ia32_signal.c +++ b/sys/amd64/ia32/ia32_signal.c @@ -968,6 +968,8 @@ ia32_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) regs->tf_gs = _ugssel; regs->tf_flags = TF_HASSEGS; + x86_clear_dbregs(pcb); + fpstate_drop(td); /* Return via doreti so that we can change to a different %cs */ From owner-dev-commits-src-all@freebsd.org Sat Apr 10 01:25:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7C825C6451; Sat, 10 Apr 2021 01:25: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 4FHHP74RG7z4rrr; Sat, 10 Apr 2021 01:25: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 895F154C; Sat, 10 Apr 2021 01:25: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 13A1PFd0043347; Sat, 10 Apr 2021 01:25:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A1PF9x043346; Sat, 10 Apr 2021 01:25:15 GMT (envelope-from git) Date: Sat, 10 Apr 2021 01:25:15 GMT Message-Id: <202104100125.13A1PF9x043346@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: 94172affa43a - main - amd64: clear debug registers on execing 32bit Linux binary 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: 94172affa43af15fe3b50293a96c292eca30c386 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 01:25:15 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=94172affa43af15fe3b50293a96c292eca30c386 commit 94172affa43af15fe3b50293a96c292eca30c386 Author: Konstantin Belousov AuthorDate: 2021-04-09 23:25:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-10 01:25:02 +0000 amd64: clear debug registers on execing 32bit Linux binary Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29687 --- sys/amd64/linux32/linux32_sysvec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/amd64/linux32/linux32_sysvec.c b/sys/amd64/linux32/linux32_sysvec.c index bb86baefaec4..3790d0fcb69c 100644 --- a/sys/amd64/linux32/linux32_sysvec.c +++ b/sys/amd64/linux32/linux32_sysvec.c @@ -722,6 +722,8 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp, regs->tf_cs = _ucode32sel; regs->tf_rbx = (register_t)imgp->ps_strings; + x86_clear_dbregs(pcb); + fpstate_drop(td); /* Do full restore on return so that we can change to a different %cs */ From owner-dev-commits-src-all@freebsd.org Sat Apr 10 01:26:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C9695C6930; Sat, 10 Apr 2021 01:26: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 4FHHQk3fMbz4rwJ; Sat, 10 Apr 2021 01:26: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 7030246C; Sat, 10 Apr 2021 01:26: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 13A1QcSk043619; Sat, 10 Apr 2021 01:26:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A1QcuF043618; Sat, 10 Apr 2021 01:26:38 GMT (envelope-from git) Date: Sat, 10 Apr 2021 01:26:38 GMT Message-Id: <202104100126.13A1QcuF043618@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 484cec486ddc - stable/13 - ffsinfo: Update example to avoid to-be-deprecated vinum 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 484cec486ddcde8c4c009f786f57e3609c1c25db Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 01:26:38 -0000 The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=484cec486ddcde8c4c009f786f57e3609c1c25db commit 484cec486ddcde8c4c009f786f57e3609c1c25db Author: Ed Maste AuthorDate: 2021-03-29 00:04:29 +0000 Commit: Ed Maste CommitDate: 2021-04-10 01:26:23 +0000 ffsinfo: Update example to avoid to-be-deprecated vinum Reviewed by: mckusick Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29478 (cherry picked from commit a64096aa63ea1303ae8d20d4147b3b097071072f) --- sbin/ffsinfo/ffsinfo.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/ffsinfo/ffsinfo.8 b/sbin/ffsinfo/ffsinfo.8 index 4bf5cdd1cb18..90580f5767d5 100644 --- a/sbin/ffsinfo/ffsinfo.8 +++ b/sbin/ffsinfo/ffsinfo.8 @@ -113,10 +113,10 @@ If is provided, output will be sent to stdout. .El .Sh EXAMPLES -.Dl ffsinfo -o /var/tmp/ffsinfo -l 1023 /dev/vinum/testvol +.Dl ffsinfo -o /var/tmp/ffsinfo -l 1023 /dev/md0 .Pp will dump -.Pa /dev/vinum/testvol +.Pa /dev/md0 to .Pa /var/tmp/ffsinfo with all available information. From owner-dev-commits-src-all@freebsd.org Sat Apr 10 01:27:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BAEBD5C6842; Sat, 10 Apr 2021 01:27: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 4FHHRZ4xQhz4s02; Sat, 10 Apr 2021 01:27: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 9C61D3BF; Sat, 10 Apr 2021 01:27: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 13A1RMk4043779; Sat, 10 Apr 2021 01:27:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A1RM3c043778; Sat, 10 Apr 2021 01:27:22 GMT (envelope-from git) Date: Sat, 10 Apr 2021 01:27:22 GMT Message-Id: <202104100127.13A1RM3c043778@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 3c00d2008f01 - stable/12 - ffsinfo: Update example to avoid to-be-deprecated vinum 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 3c00d2008f01ad15d6b1a2e93041030f46e65bcd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 01:27:22 -0000 The branch stable/12 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=3c00d2008f01ad15d6b1a2e93041030f46e65bcd commit 3c00d2008f01ad15d6b1a2e93041030f46e65bcd Author: Ed Maste AuthorDate: 2021-03-29 00:04:29 +0000 Commit: Ed Maste CommitDate: 2021-04-10 01:27:13 +0000 ffsinfo: Update example to avoid to-be-deprecated vinum Reviewed by: mckusick Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29478 (cherry picked from commit a64096aa63ea1303ae8d20d4147b3b097071072f) --- sbin/ffsinfo/ffsinfo.8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/ffsinfo/ffsinfo.8 b/sbin/ffsinfo/ffsinfo.8 index 4bf5cdd1cb18..90580f5767d5 100644 --- a/sbin/ffsinfo/ffsinfo.8 +++ b/sbin/ffsinfo/ffsinfo.8 @@ -113,10 +113,10 @@ If is provided, output will be sent to stdout. .El .Sh EXAMPLES -.Dl ffsinfo -o /var/tmp/ffsinfo -l 1023 /dev/vinum/testvol +.Dl ffsinfo -o /var/tmp/ffsinfo -l 1023 /dev/md0 .Pp will dump -.Pa /dev/vinum/testvol +.Pa /dev/md0 to .Pa /var/tmp/ffsinfo with all available information. From owner-dev-commits-src-all@freebsd.org Sat Apr 10 01:33:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8F6715C6A43; Sat, 10 Apr 2021 01:33:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 4FHHb31Vztz4sRp; Sat, 10 Apr 2021 01:33:50 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 13A1Xbjc070960 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 10 Apr 2021 04:33:40 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 13A1Xbjc070960 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 13A1Xbgq070959; Sat, 10 Apr 2021 04:33:37 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 10 Apr 2021 04:33:37 +0300 From: Konstantin Belousov To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 06d8a116bd6b - main - libc: add _get_tp() private function Message-ID: References: <202104092047.139KlBo3071549@gitrepo.freebsd.org> <4BDA2D21-D5D0-4EC2-B6F7-B99260D046E0@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4BDA2D21-D5D0-4EC2-B6F7-B99260D046E0@freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4FHHb31Vztz4sRp 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 01:33:51 -0000 On Fri, Apr 09, 2021 at 09:57:55PM +0100, Jessica Clarke wrote: > On 9 Apr 2021, at 21:47, Konstantin Belousov wrote: > > > > The branch main has been updated by kib: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=06d8a116bd6b6f70b8aedc6a6a2c4085c53f63ac > > > > commit 06d8a116bd6b6f70b8aedc6a6a2c4085c53f63ac > > Author: Konstantin Belousov > > AuthorDate: 2021-04-05 03:30:35 +0000 > > Commit: Konstantin Belousov > > CommitDate: 2021-04-09 20:46:24 +0000 > > > > libc: add _get_tp() private function > > > > which returns pointer to tcb > > This feels like it should be static inline in a header. Also we already have > _tcb_get in pthread_md.h that should be entirely equivalent, and > _libc_get_static_tls_base that’s basically the same again but with an optional > offset. Can we do something to unify all the inline asm into one place per > architecture rather than growing yet more copies of the same thing? Yes, this should happens, eventually. From owner-dev-commits-src-all@freebsd.org Sat Apr 10 02:24:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F8575C77F3; Sat, 10 Apr 2021 02:24: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 4FHJjm2F7Mz4v6k; Sat, 10 Apr 2021 02:24: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 3E77BFBC; Sat, 10 Apr 2021 02:24: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 13A2OisT022941; Sat, 10 Apr 2021 02:24:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A2OiJh022940; Sat, 10 Apr 2021 02:24:44 GMT (envelope-from git) Date: Sat, 10 Apr 2021 02:24:44 GMT Message-Id: <202104100224.13A2OiJh022940@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: 9d178c925fb9 - main - Drop 'Set to' from most src.conf(5) knobs 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: 9d178c925fb9acd88d2e5c5145d639b30b398c12 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 02:24:44 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=9d178c925fb9acd88d2e5c5145d639b30b398c12 commit 9d178c925fb9acd88d2e5c5145d639b30b398c12 Author: Ed Maste AuthorDate: 2021-04-10 02:23:03 +0000 Commit: Ed Maste CommitDate: 2021-04-10 02:23:03 +0000 Drop 'Set to' from most src.conf(5) knobs The description is clearly what effect the knob has when set, so the additional text was unnecessary. Reviewed by: jhb, se Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29583 --- tools/build/options/WITHOUT_ACCT | 2 +- tools/build/options/WITHOUT_ACPI | 2 +- tools/build/options/WITHOUT_APM | 2 +- tools/build/options/WITHOUT_ASSERT_DEBUG | 2 +- tools/build/options/WITHOUT_AT | 2 +- tools/build/options/WITHOUT_ATM | 2 +- tools/build/options/WITHOUT_AUDIT | 2 +- tools/build/options/WITHOUT_AUTHPF | 2 +- tools/build/options/WITHOUT_AUTOFS | 2 +- tools/build/options/WITHOUT_BHYVE | 2 +- tools/build/options/WITHOUT_BLACKLIST_SUPPORT | 2 +- tools/build/options/WITHOUT_BLUETOOTH | 2 +- tools/build/options/WITHOUT_BOOT | 2 +- tools/build/options/WITHOUT_BOOTPARAMD | 2 +- tools/build/options/WITHOUT_BOOTPD | 2 +- tools/build/options/WITHOUT_BSDINSTALL | 2 +- tools/build/options/WITHOUT_BSD_CPIO | 2 +- tools/build/options/WITHOUT_BSNMP | 2 +- tools/build/options/WITHOUT_BZIP2 | 2 +- tools/build/options/WITHOUT_BZIP2_SUPPORT | 2 +- tools/build/options/WITHOUT_CALENDAR | 2 +- tools/build/options/WITHOUT_CAPSICUM | 2 +- tools/build/options/WITHOUT_CAROOT | 2 +- tools/build/options/WITHOUT_CASPER | 2 +- tools/build/options/WITHOUT_CCD | 2 +- tools/build/options/WITHOUT_CDDL | 2 +- tools/build/options/WITHOUT_CLANG | 2 +- tools/build/options/WITHOUT_CLANG_BOOTSTRAP | 2 +- tools/build/options/WITHOUT_CLANG_FULL | 2 +- tools/build/options/WITHOUT_CPP | 2 +- tools/build/options/WITHOUT_CROSS_COMPILER | 2 +- tools/build/options/WITHOUT_CRYPT | 2 +- tools/build/options/WITHOUT_CUSE | 2 +- tools/build/options/WITHOUT_CXGBETOOL | 2 +- tools/build/options/WITHOUT_CXX | 2 +- tools/build/options/WITHOUT_DEBUG_FILES | 2 +- tools/build/options/WITHOUT_DIALOG | 2 +- tools/build/options/WITHOUT_DICT | 2 +- tools/build/options/WITHOUT_DMAGENT | 2 +- tools/build/options/WITHOUT_DOCCOMPRESS | 2 +- tools/build/options/WITHOUT_EE | 2 +- tools/build/options/WITHOUT_ELFTOOLCHAIN_BOOTSTRAP | 2 +- tools/build/options/WITHOUT_EXAMPLES | 2 +- tools/build/options/WITHOUT_FDT | 2 +- tools/build/options/WITHOUT_FILE | 2 +- tools/build/options/WITHOUT_FINGER | 2 +- tools/build/options/WITHOUT_FLOPPY | 2 +- tools/build/options/WITHOUT_FORMAT_EXTENSIONS | 2 +- tools/build/options/WITHOUT_FORTH | 2 +- tools/build/options/WITHOUT_FP_LIBC | 2 +- tools/build/options/WITHOUT_FREEBSD_UPDATE | 2 +- tools/build/options/WITHOUT_FTP | 2 +- tools/build/options/WITHOUT_GAMES | 2 +- tools/build/options/WITHOUT_GCC | 2 +- tools/build/options/WITHOUT_GCC_BOOTSTRAP | 2 +- tools/build/options/WITHOUT_GCOV | 2 +- tools/build/options/WITHOUT_GDB | 2 +- tools/build/options/WITHOUT_GH_BC | 4 ++-- tools/build/options/WITHOUT_GNU_DIFF | 2 +- tools/build/options/WITHOUT_GOOGLETEST | 2 +- tools/build/options/WITHOUT_GPIO | 2 +- tools/build/options/WITHOUT_GSSAPI | 2 +- tools/build/options/WITHOUT_HAST | 2 +- tools/build/options/WITHOUT_HTML | 2 +- tools/build/options/WITHOUT_HYPERV | 2 +- tools/build/options/WITHOUT_ICONV | 2 +- tools/build/options/WITHOUT_INCLUDES | 2 +- tools/build/options/WITHOUT_INET | 2 +- tools/build/options/WITHOUT_INET6 | 2 +- tools/build/options/WITHOUT_INET6_SUPPORT | 2 +- tools/build/options/WITHOUT_INETD | 2 +- tools/build/options/WITHOUT_INET_SUPPORT | 2 +- tools/build/options/WITHOUT_INFO | 2 +- tools/build/options/WITHOUT_IPFILTER | 2 +- tools/build/options/WITHOUT_IPFW | 2 +- tools/build/options/WITHOUT_IPSEC_SUPPORT | 2 +- tools/build/options/WITHOUT_ISCSI | 2 +- tools/build/options/WITHOUT_JAIL | 2 +- tools/build/options/WITHOUT_KDUMP | 2 +- tools/build/options/WITHOUT_KERBEROS_SUPPORT | 2 +- tools/build/options/WITHOUT_KERNEL_RETPOLINE | 2 +- tools/build/options/WITHOUT_KERNEL_SYMBOLS | 2 +- tools/build/options/WITHOUT_KVM | 2 +- tools/build/options/WITHOUT_KVM_SUPPORT | 2 +- tools/build/options/WITHOUT_LEGACY_CONSOLE | 2 +- tools/build/options/WITHOUT_LIB32 | 2 +- tools/build/options/WITHOUT_LLD | 2 +- tools/build/options/WITHOUT_LLDB | 2 +- tools/build/options/WITHOUT_LLD_BOOTSTRAP | 2 +- tools/build/options/WITHOUT_LLVM_ASSERTIONS | 2 +- tools/build/options/WITHOUT_LLVM_COV | 2 +- tools/build/options/WITHOUT_LLVM_TARGET_AARCH64 | 2 +- tools/build/options/WITHOUT_LLVM_TARGET_ALL | 2 +- tools/build/options/WITHOUT_LLVM_TARGET_ARM | 2 +- tools/build/options/WITHOUT_LLVM_TARGET_MIPS | 2 +- tools/build/options/WITHOUT_LLVM_TARGET_POWERPC | 2 +- tools/build/options/WITHOUT_LLVM_TARGET_RISCV | 2 +- tools/build/options/WITHOUT_LLVM_TARGET_SPARC | 2 +- tools/build/options/WITHOUT_LLVM_TARGET_X86 | 2 +- tools/build/options/WITHOUT_LOADER_LUA | 2 +- tools/build/options/WITHOUT_LOADER_ZFS | 2 +- tools/build/options/WITHOUT_LOCALES | 2 +- tools/build/options/WITHOUT_LOCATE | 2 +- tools/build/options/WITHOUT_LPR | 2 +- tools/build/options/WITHOUT_LS_COLORS | 2 +- tools/build/options/WITHOUT_LZMA_SUPPORT | 2 +- tools/build/options/WITHOUT_MAIL | 2 +- tools/build/options/WITHOUT_MAILWRAPPER | 2 +- tools/build/options/WITHOUT_MAKE | 2 +- tools/build/options/WITHOUT_MAKE_CHECK_USE_SANDBOX | 2 +- tools/build/options/WITHOUT_MALLOC_PRODUCTION | 2 +- tools/build/options/WITHOUT_MAN | 2 +- tools/build/options/WITHOUT_MANCOMPRESS | 2 +- tools/build/options/WITHOUT_MAN_UTILS | 2 +- tools/build/options/WITHOUT_MLX5TOOL | 2 +- tools/build/options/WITHOUT_NAND | 2 +- tools/build/options/WITHOUT_NCP | 2 +- tools/build/options/WITHOUT_NETCAT | 2 +- tools/build/options/WITHOUT_NETGRAPH | 2 +- tools/build/options/WITHOUT_NETGRAPH_SUPPORT | 2 +- tools/build/options/WITHOUT_NIS | 2 +- tools/build/options/WITHOUT_NLS | 2 +- tools/build/options/WITHOUT_NLS_CATALOGS | 2 +- tools/build/options/WITHOUT_NS_CACHING | 2 +- tools/build/options/WITHOUT_NTP | 2 +- tools/build/options/WITHOUT_NVME | 2 +- tools/build/options/WITHOUT_OFED | 2 +- tools/build/options/WITHOUT_OPENMP | 2 +- tools/build/options/WITHOUT_OPENSSH | 2 +- tools/build/options/WITHOUT_OPENSSL | 2 +- tools/build/options/WITHOUT_OPENSSL_KTLS | 2 +- tools/build/options/WITHOUT_PAM | 2 +- tools/build/options/WITHOUT_PAM_SUPPORT | 2 +- tools/build/options/WITHOUT_PF | 2 +- tools/build/options/WITHOUT_PKGBOOTSTRAP | 2 +- tools/build/options/WITHOUT_PMC | 2 +- tools/build/options/WITHOUT_PORTSNAP | 2 +- tools/build/options/WITHOUT_PPP | 2 +- tools/build/options/WITHOUT_PROFILE | 2 +- tools/build/options/WITHOUT_QUOTAS | 2 +- tools/build/options/WITHOUT_RADIUS_SUPPORT | 2 +- tools/build/options/WITHOUT_RBOOTD | 2 +- tools/build/options/WITHOUT_REPRODUCIBLE_BUILD | 2 +- tools/build/options/WITHOUT_RESCUE | 2 +- tools/build/options/WITHOUT_ROUTED | 2 +- tools/build/options/WITHOUT_SENDMAIL | 2 +- tools/build/options/WITHOUT_SERVICESDB | 2 +- tools/build/options/WITHOUT_SHAREDOCS | 2 +- tools/build/options/WITHOUT_SHARED_TOOLCHAIN | 2 +- tools/build/options/WITHOUT_SOURCELESS | 2 +- tools/build/options/WITHOUT_SOURCELESS_HOST | 2 +- tools/build/options/WITHOUT_SOURCELESS_UCODE | 2 +- tools/build/options/WITHOUT_SSP | 2 +- tools/build/options/WITHOUT_STATS | 2 +- tools/build/options/WITHOUT_SVNLITE | 2 +- tools/build/options/WITHOUT_SYSCONS | 2 +- tools/build/options/WITHOUT_SYSTEM_COMPILER | 2 +- tools/build/options/WITHOUT_SYSTEM_LINKER | 2 +- tools/build/options/WITHOUT_TALK | 2 +- tools/build/options/WITHOUT_TCP_WRAPPERS | 2 +- tools/build/options/WITHOUT_TCSH | 2 +- tools/build/options/WITHOUT_TELNET | 2 +- tools/build/options/WITHOUT_TESTS | 2 +- tools/build/options/WITHOUT_TESTS_SUPPORT | 2 +- tools/build/options/WITHOUT_TEXTPROC | 2 +- tools/build/options/WITHOUT_TFTP | 2 +- tools/build/options/WITHOUT_TOOLCHAIN | 2 +- tools/build/options/WITHOUT_UNBOUND | 2 +- tools/build/options/WITHOUT_UNIFIED_OBJDIR | 2 +- tools/build/options/WITHOUT_USB | 2 +- tools/build/options/WITHOUT_USB_GADGET_EXAMPLES | 2 +- tools/build/options/WITHOUT_UTMPX | 2 +- tools/build/options/WITHOUT_VI | 2 +- tools/build/options/WITHOUT_VT | 2 +- tools/build/options/WITHOUT_WIRELESS | 2 +- tools/build/options/WITHOUT_WIRELESS_SUPPORT | 2 +- tools/build/options/WITHOUT_ZFS | 2 +- tools/build/options/WITHOUT_ZONEINFO | 2 +- tools/build/options/WITH_BHYVE_SNAPSHOT | 2 +- tools/build/options/WITH_CCACHE_BUILD | 2 +- tools/build/options/WITH_CLANG | 2 +- tools/build/options/WITH_CLANG_BOOTSTRAP | 2 +- tools/build/options/WITH_CLANG_EXTRAS | 2 +- tools/build/options/WITH_CLANG_FORMAT | 2 +- tools/build/options/WITH_CLANG_FULL | 2 +- tools/build/options/WITH_CTF | 2 +- tools/build/options/WITH_CXGBETOOL | 2 +- tools/build/options/WITH_CXX | 2 +- tools/build/options/WITH_DEBUG_FILES | 2 +- tools/build/options/WITH_DTRACE_TESTS | 2 +- tools/build/options/WITH_EFI | 2 +- tools/build/options/WITH_EXPERIMENTAL | 2 +- tools/build/options/WITH_EXTRA_TCP_STACKS | 2 +- tools/build/options/WITH_FDT | 2 +- tools/build/options/WITH_GCC | 2 +- tools/build/options/WITH_GCC_BOOTSTRAP | 2 +- tools/build/options/WITH_GDB | 2 +- tools/build/options/WITH_GH_BC | 2 +- tools/build/options/WITH_GOOGLETEST | 2 +- tools/build/options/WITH_HESIOD | 2 +- tools/build/options/WITH_HYPERV | 2 +- tools/build/options/WITH_INIT_ALL_PATTERN | 2 +- tools/build/options/WITH_INIT_ALL_ZERO | 2 +- tools/build/options/WITH_INSTALL_AS_USER | 2 +- tools/build/options/WITH_KERNEL_RETPOLINE | 2 +- tools/build/options/WITH_LIBSOFT | 2 +- tools/build/options/WITH_LLD | 2 +- tools/build/options/WITH_LLDB | 2 +- tools/build/options/WITH_LLD_BOOTSTRAP | 2 +- tools/build/options/WITH_LLD_IS_LD | 2 +- tools/build/options/WITH_LLVM_ASSERTIONS | 2 +- tools/build/options/WITH_LLVM_COV | 2 +- tools/build/options/WITH_LLVM_TARGET_AARCH64 | 2 +- tools/build/options/WITH_LLVM_TARGET_ALL | 2 +- tools/build/options/WITH_LLVM_TARGET_ARM | 2 +- tools/build/options/WITH_LLVM_TARGET_BPF | 2 +- tools/build/options/WITH_LLVM_TARGET_MIPS | 2 +- tools/build/options/WITH_LLVM_TARGET_POWERPC | 2 +- tools/build/options/WITH_LLVM_TARGET_RISCV | 2 +- tools/build/options/WITH_LLVM_TARGET_SPARC | 2 +- tools/build/options/WITH_LLVM_TARGET_X86 | 2 +- tools/build/options/WITH_LOADER_GELI | 2 +- tools/build/options/WITH_LOADER_LUA | 2 +- tools/build/options/WITH_LOADER_OFW | 2 +- tools/build/options/WITH_LOADER_UBOOT | 2 +- tools/build/options/WITH_LOADER_VERBOSE | 2 +- tools/build/options/WITH_MALLOC_PRODUCTION | 2 +- tools/build/options/WITH_MANSPLITPKG | 2 +- tools/build/options/WITH_MLX5TOOL | 2 +- tools/build/options/WITH_NAND | 2 +- tools/build/options/WITH_NVME | 2 +- tools/build/options/WITH_OFED_EXTRA | 2 +- tools/build/options/WITH_OPENMP | 2 +- tools/build/options/WITH_OPENSSL_KTLS | 2 +- tools/build/options/WITH_PROFILE | 2 +- tools/build/options/WITH_RATELIMIT | 2 +- tools/build/options/WITH_REPRODUCIBLE_BUILD | 2 +- tools/build/options/WITH_RETPOLINE | 2 +- tools/build/options/WITH_RPCBIND_WARMSTART_SUPPORT | 2 +- tools/build/options/WITH_SHARED_TOOLCHAIN | 2 +- tools/build/options/WITH_SORT_THREADS | 2 +- tools/build/options/WITH_SSP | 2 +- tools/build/options/WITH_STATS | 2 +- tools/build/options/WITH_SVN | 2 +- tools/build/options/WITH_SYSTEM_COMPILER | 2 +- tools/build/options/WITH_SYSTEM_LINKER | 2 +- tools/build/options/WITH_UNIFIED_OBJDIR | 2 +- tools/build/options/WITH_USB_GADGET_EXAMPLES | 2 +- tools/build/options/WITH_ZONEINFO_LEAPSECONDS_SUPPORT | 2 +- tools/build/options/WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT | 2 +- 250 files changed, 251 insertions(+), 251 deletions(-) diff --git a/tools/build/options/WITHOUT_ACCT b/tools/build/options/WITHOUT_ACCT index a0e0f545265e..b885bc113692 100644 --- a/tools/build/options/WITHOUT_ACCT +++ b/tools/build/options/WITHOUT_ACCT @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build process accounting tools such as +Do not build process accounting tools such as .Xr accton 8 and .Xr sa 8 . diff --git a/tools/build/options/WITHOUT_ACPI b/tools/build/options/WITHOUT_ACPI index b046a1775e74..76c304a1b1a8 100644 --- a/tools/build/options/WITHOUT_ACPI +++ b/tools/build/options/WITHOUT_ACPI @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr acpiconf 8 , .Xr acpidump 8 and related programs. diff --git a/tools/build/options/WITHOUT_APM b/tools/build/options/WITHOUT_APM index 6ed47d073756..cb1334e1e654 100644 --- a/tools/build/options/WITHOUT_APM +++ b/tools/build/options/WITHOUT_APM @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr apm 8 , .Xr apmd 8 and related programs. diff --git a/tools/build/options/WITHOUT_ASSERT_DEBUG b/tools/build/options/WITHOUT_ASSERT_DEBUG index 2bc179cc8136..66103683229a 100644 --- a/tools/build/options/WITHOUT_ASSERT_DEBUG +++ b/tools/build/options/WITHOUT_ASSERT_DEBUG @@ -1,4 +1,4 @@ .\" $FreeBSD$ -Set to compile programs and libraries without the +Compile programs and libraries without the .Xr assert 3 checks. diff --git a/tools/build/options/WITHOUT_AT b/tools/build/options/WITHOUT_AT index 45e552fcc9b1..849f6b1e5468 100644 --- a/tools/build/options/WITHOUT_AT +++ b/tools/build/options/WITHOUT_AT @@ -1,4 +1,4 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr at 1 and related utilities. diff --git a/tools/build/options/WITHOUT_ATM b/tools/build/options/WITHOUT_ATM index 6e362d3fdcb7..345663fb3ccd 100644 --- a/tools/build/options/WITHOUT_ATM +++ b/tools/build/options/WITHOUT_ATM @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build +Do not build programs and libraries related to ATM networking. diff --git a/tools/build/options/WITHOUT_AUDIT b/tools/build/options/WITHOUT_AUDIT index 8dfe0fc887d8..479bf77655e1 100644 --- a/tools/build/options/WITHOUT_AUDIT +++ b/tools/build/options/WITHOUT_AUDIT @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build audit support into system programs. +Do not build audit support into system programs. diff --git a/tools/build/options/WITHOUT_AUTHPF b/tools/build/options/WITHOUT_AUTHPF index 1e50a4fda445..55e6a726b4ff 100644 --- a/tools/build/options/WITHOUT_AUTHPF +++ b/tools/build/options/WITHOUT_AUTHPF @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr authpf 8 . diff --git a/tools/build/options/WITHOUT_AUTOFS b/tools/build/options/WITHOUT_AUTOFS index e8a9799eba35..0d8f2450cccc 100644 --- a/tools/build/options/WITHOUT_AUTOFS +++ b/tools/build/options/WITHOUT_AUTOFS @@ -1,4 +1,4 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr autofs 5 related programs, libraries, and kernel modules. diff --git a/tools/build/options/WITHOUT_BHYVE b/tools/build/options/WITHOUT_BHYVE index b80a72697a26..52cef5d142e3 100644 --- a/tools/build/options/WITHOUT_BHYVE +++ b/tools/build/options/WITHOUT_BHYVE @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build or install +Do not build or install .Xr bhyve 8 , associated utilities, and examples. .Pp diff --git a/tools/build/options/WITHOUT_BLACKLIST_SUPPORT b/tools/build/options/WITHOUT_BLACKLIST_SUPPORT index 8423c7276067..2bb7542699e9 100644 --- a/tools/build/options/WITHOUT_BLACKLIST_SUPPORT +++ b/tools/build/options/WITHOUT_BLACKLIST_SUPPORT @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to build some programs without +Build some programs without .Xr libblacklist 3 support, like .Xr fingerd 8 , diff --git a/tools/build/options/WITHOUT_BLUETOOTH b/tools/build/options/WITHOUT_BLUETOOTH index d0c6863fcb4a..0b8b2b5aa74c 100644 --- a/tools/build/options/WITHOUT_BLUETOOTH +++ b/tools/build/options/WITHOUT_BLUETOOTH @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build Bluetooth related kernel modules, programs and libraries. +Do not build Bluetooth related kernel modules, programs and libraries. diff --git a/tools/build/options/WITHOUT_BOOT b/tools/build/options/WITHOUT_BOOT index 0ba78e2fffc3..dae312bf45b1 100644 --- a/tools/build/options/WITHOUT_BOOT +++ b/tools/build/options/WITHOUT_BOOT @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build the boot blocks and loader. +Do not build the boot blocks and loader. diff --git a/tools/build/options/WITHOUT_BOOTPARAMD b/tools/build/options/WITHOUT_BOOTPARAMD index f9960830fd24..3363479d2018 100644 --- a/tools/build/options/WITHOUT_BOOTPARAMD +++ b/tools/build/options/WITHOUT_BOOTPARAMD @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build or install +Do not build or install .Xr bootparamd 8 . diff --git a/tools/build/options/WITHOUT_BOOTPD b/tools/build/options/WITHOUT_BOOTPD index 6733d5a7b839..cc4ef91da9ee 100644 --- a/tools/build/options/WITHOUT_BOOTPD +++ b/tools/build/options/WITHOUT_BOOTPD @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build or install +Do not build or install .Xr bootpd 8 . diff --git a/tools/build/options/WITHOUT_BSDINSTALL b/tools/build/options/WITHOUT_BSDINSTALL index 8aaf2a6544ed..77d82a9749bc 100644 --- a/tools/build/options/WITHOUT_BSDINSTALL +++ b/tools/build/options/WITHOUT_BSDINSTALL @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr bsdinstall 8 , .Xr sade 8 , and related programs. diff --git a/tools/build/options/WITHOUT_BSD_CPIO b/tools/build/options/WITHOUT_BSD_CPIO index 9c722ee01851..207b7f898b2e 100644 --- a/tools/build/options/WITHOUT_BSD_CPIO +++ b/tools/build/options/WITHOUT_BSD_CPIO @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build the BSD licensed version of cpio based on +Do not build the BSD licensed version of cpio based on .Xr libarchive 3 . diff --git a/tools/build/options/WITHOUT_BSNMP b/tools/build/options/WITHOUT_BSNMP index 61dbb27d4f10..2836cc58bff1 100644 --- a/tools/build/options/WITHOUT_BSNMP +++ b/tools/build/options/WITHOUT_BSNMP @@ -1,4 +1,4 @@ .\" $FreeBSD$ -Set to not build or install +Do not build or install .Xr bsnmpd 1 and related libraries and data files. diff --git a/tools/build/options/WITHOUT_BZIP2 b/tools/build/options/WITHOUT_BZIP2 index 20f025b7b905..6f7c29f8e00f 100644 --- a/tools/build/options/WITHOUT_BZIP2 +++ b/tools/build/options/WITHOUT_BZIP2 @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build contributed bzip2 software as a part of the base system. +Do not build contributed bzip2 software as a part of the base system. .Bf -symbolic The option has no effect yet. .Ef diff --git a/tools/build/options/WITHOUT_BZIP2_SUPPORT b/tools/build/options/WITHOUT_BZIP2_SUPPORT index 12b1c7b132f8..ca0e80d44e29 100644 --- a/tools/build/options/WITHOUT_BZIP2_SUPPORT +++ b/tools/build/options/WITHOUT_BZIP2_SUPPORT @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to build some programs without optional bzip2 support. +Build some programs without optional bzip2 support. diff --git a/tools/build/options/WITHOUT_CALENDAR b/tools/build/options/WITHOUT_CALENDAR index 6944e3fb6705..aa87b2fa1c09 100644 --- a/tools/build/options/WITHOUT_CALENDAR +++ b/tools/build/options/WITHOUT_CALENDAR @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr calendar 1 . diff --git a/tools/build/options/WITHOUT_CAPSICUM b/tools/build/options/WITHOUT_CAPSICUM index 8d719e96dcb2..9d0eb89e491d 100644 --- a/tools/build/options/WITHOUT_CAPSICUM +++ b/tools/build/options/WITHOUT_CAPSICUM @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build Capsicum support into system programs. +Do not build Capsicum support into system programs. diff --git a/tools/build/options/WITHOUT_CAROOT b/tools/build/options/WITHOUT_CAROOT index 6d6293acffa4..07394ae5a7a5 100644 --- a/tools/build/options/WITHOUT_CAROOT +++ b/tools/build/options/WITHOUT_CAROOT @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not add the trusted certificates from the Mozilla NSS bundle to +Do not add the trusted certificates from the Mozilla NSS bundle to base. diff --git a/tools/build/options/WITHOUT_CASPER b/tools/build/options/WITHOUT_CASPER index d364305caebb..32bfa960d7d5 100644 --- a/tools/build/options/WITHOUT_CASPER +++ b/tools/build/options/WITHOUT_CASPER @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build Casper program and related libraries. +Do not build Casper program and related libraries. diff --git a/tools/build/options/WITHOUT_CCD b/tools/build/options/WITHOUT_CCD index b4d044ecaaa9..c6c47e61c1e6 100644 --- a/tools/build/options/WITHOUT_CCD +++ b/tools/build/options/WITHOUT_CCD @@ -1,4 +1,4 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr geom_ccd 4 and related utilities. diff --git a/tools/build/options/WITHOUT_CDDL b/tools/build/options/WITHOUT_CDDL index 909c52ba7166..a2210308ab67 100644 --- a/tools/build/options/WITHOUT_CDDL +++ b/tools/build/options/WITHOUT_CDDL @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build code licensed under Sun's CDDL. +Do not build code licensed under Sun's CDDL. diff --git a/tools/build/options/WITHOUT_CLANG b/tools/build/options/WITHOUT_CLANG index 51c9c514e68b..27bfc4da5a53 100644 --- a/tools/build/options/WITHOUT_CLANG +++ b/tools/build/options/WITHOUT_CLANG @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build the Clang C/C++ compiler during the regular phase of the build. +Do not build the Clang C/C++ compiler during the regular phase of the build. diff --git a/tools/build/options/WITHOUT_CLANG_BOOTSTRAP b/tools/build/options/WITHOUT_CLANG_BOOTSTRAP index e56706faad89..ca65c02133cc 100644 --- a/tools/build/options/WITHOUT_CLANG_BOOTSTRAP +++ b/tools/build/options/WITHOUT_CLANG_BOOTSTRAP @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build the Clang C/C++ compiler during the bootstrap phase of +Do not build the Clang C/C++ compiler during the bootstrap phase of the build. To be able to build the system, either gcc or clang bootstrap must be enabled unless an alternate compiler is provided via XCC. diff --git a/tools/build/options/WITHOUT_CLANG_FULL b/tools/build/options/WITHOUT_CLANG_FULL index 418b7d657f67..d519983e9c91 100644 --- a/tools/build/options/WITHOUT_CLANG_FULL +++ b/tools/build/options/WITHOUT_CLANG_FULL @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to avoid building the ARCMigrate, Rewriter and StaticAnalyzer components of +Avoid building the ARCMigrate, Rewriter and StaticAnalyzer components of the Clang C/C++ compiler. diff --git a/tools/build/options/WITHOUT_CPP b/tools/build/options/WITHOUT_CPP index 78094191f694..8b9d064d2889 100644 --- a/tools/build/options/WITHOUT_CPP +++ b/tools/build/options/WITHOUT_CPP @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr cpp 1 . diff --git a/tools/build/options/WITHOUT_CROSS_COMPILER b/tools/build/options/WITHOUT_CROSS_COMPILER index fc5233c50bae..6c690d6cf96b 100644 --- a/tools/build/options/WITHOUT_CROSS_COMPILER +++ b/tools/build/options/WITHOUT_CROSS_COMPILER @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build any cross compiler in the cross-tools stage of buildworld. +Do not build any cross compiler in the cross-tools stage of buildworld. When compiling a different version of .Fx than what is installed on the system, provide an alternate diff --git a/tools/build/options/WITHOUT_CRYPT b/tools/build/options/WITHOUT_CRYPT index 044055d88441..9b0e2a5dfe0e 100644 --- a/tools/build/options/WITHOUT_CRYPT +++ b/tools/build/options/WITHOUT_CRYPT @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build any crypto code. +Do not build any crypto code. diff --git a/tools/build/options/WITHOUT_CUSE b/tools/build/options/WITHOUT_CUSE index bdf064fe25ac..2e498797fe52 100644 --- a/tools/build/options/WITHOUT_CUSE +++ b/tools/build/options/WITHOUT_CUSE @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build CUSE-related programs and libraries. +Do not build CUSE-related programs and libraries. diff --git a/tools/build/options/WITHOUT_CXGBETOOL b/tools/build/options/WITHOUT_CXGBETOOL index d7aef386344b..75142882d5b3 100644 --- a/tools/build/options/WITHOUT_CXGBETOOL +++ b/tools/build/options/WITHOUT_CXGBETOOL @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr cxgbetool 8 diff --git a/tools/build/options/WITHOUT_CXX b/tools/build/options/WITHOUT_CXX index ab9346afbf04..6847ba0fc83f 100644 --- a/tools/build/options/WITHOUT_CXX +++ b/tools/build/options/WITHOUT_CXX @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr c++ 1 and related libraries. It will also prevent building of diff --git a/tools/build/options/WITHOUT_DEBUG_FILES b/tools/build/options/WITHOUT_DEBUG_FILES index 2938f3008e9a..f9169afccf2a 100644 --- a/tools/build/options/WITHOUT_DEBUG_FILES +++ b/tools/build/options/WITHOUT_DEBUG_FILES @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to avoid building or installing standalone debug files for each +Avoid building or installing standalone debug files for each executable binary and shared library. diff --git a/tools/build/options/WITHOUT_DIALOG b/tools/build/options/WITHOUT_DIALOG index 9a13dcf305ff..792b2bede32a 100644 --- a/tools/build/options/WITHOUT_DIALOG +++ b/tools/build/options/WITHOUT_DIALOG @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr dialog 1 , .Xr dialog 3 , .Xr dpv 1 , diff --git a/tools/build/options/WITHOUT_DICT b/tools/build/options/WITHOUT_DICT index dc3d28167109..86a8523122e8 100644 --- a/tools/build/options/WITHOUT_DICT +++ b/tools/build/options/WITHOUT_DICT @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build the Webster dictionary files. +Do not build the Webster dictionary files. diff --git a/tools/build/options/WITHOUT_DMAGENT b/tools/build/options/WITHOUT_DMAGENT index d5e62093ee26..3195ce07ecc3 100644 --- a/tools/build/options/WITHOUT_DMAGENT +++ b/tools/build/options/WITHOUT_DMAGENT @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build dma Mail Transport Agent. +Do not build dma Mail Transport Agent. diff --git a/tools/build/options/WITHOUT_DOCCOMPRESS b/tools/build/options/WITHOUT_DOCCOMPRESS index ec4de74e146d..c1db65c598c2 100644 --- a/tools/build/options/WITHOUT_DOCCOMPRESS +++ b/tools/build/options/WITHOUT_DOCCOMPRESS @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not install compressed system documentation. +Do not install compressed system documentation. Only the uncompressed version will be installed. diff --git a/tools/build/options/WITHOUT_EE b/tools/build/options/WITHOUT_EE index 721ddaab9df8..4295cd6ddbc2 100644 --- a/tools/build/options/WITHOUT_EE +++ b/tools/build/options/WITHOUT_EE @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build and install +Do not build and install .Xr edit 1 , .Xr ee 1 , and related programs. diff --git a/tools/build/options/WITHOUT_ELFTOOLCHAIN_BOOTSTRAP b/tools/build/options/WITHOUT_ELFTOOLCHAIN_BOOTSTRAP index 85fa01eabd76..45c92aea4b90 100644 --- a/tools/build/options/WITHOUT_ELFTOOLCHAIN_BOOTSTRAP +++ b/tools/build/options/WITHOUT_ELFTOOLCHAIN_BOOTSTRAP @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build ELF Tool Chain tools +Do not build ELF Tool Chain tools (addr2line, nm, size, strings and strip) as part of the bootstrap process. .Bf -symbolic diff --git a/tools/build/options/WITHOUT_EXAMPLES b/tools/build/options/WITHOUT_EXAMPLES index 5e60b73bb532..88fb243eafac 100644 --- a/tools/build/options/WITHOUT_EXAMPLES +++ b/tools/build/options/WITHOUT_EXAMPLES @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to avoid installing examples to +Avoid installing examples to .Pa /usr/share/examples/ . diff --git a/tools/build/options/WITHOUT_FDT b/tools/build/options/WITHOUT_FDT index d3ade054c42a..bf22c5012413 100644 --- a/tools/build/options/WITHOUT_FDT +++ b/tools/build/options/WITHOUT_FDT @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build Flattened Device Tree support as part of the base system. +Do not build Flattened Device Tree support as part of the base system. This includes the device tree compiler (dtc) and libfdt support library. diff --git a/tools/build/options/WITHOUT_FILE b/tools/build/options/WITHOUT_FILE index 636d00a7fab2..67859bd6ded1 100644 --- a/tools/build/options/WITHOUT_FILE +++ b/tools/build/options/WITHOUT_FILE @@ -1,4 +1,4 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr file 1 and related programs. diff --git a/tools/build/options/WITHOUT_FINGER b/tools/build/options/WITHOUT_FINGER index 7f654083a3c4..d42161245478 100644 --- a/tools/build/options/WITHOUT_FINGER +++ b/tools/build/options/WITHOUT_FINGER @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build or install +Do not build or install .Xr finger 1 and .Xr fingerd 8 . diff --git a/tools/build/options/WITHOUT_FLOPPY b/tools/build/options/WITHOUT_FLOPPY index ea78d28c8e4b..324081f993f1 100644 --- a/tools/build/options/WITHOUT_FLOPPY +++ b/tools/build/options/WITHOUT_FLOPPY @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build or install programs +Do not build or install programs for operating floppy disk driver. diff --git a/tools/build/options/WITHOUT_FORMAT_EXTENSIONS b/tools/build/options/WITHOUT_FORMAT_EXTENSIONS index 7ae02e1bf86c..05ae981f7b9c 100644 --- a/tools/build/options/WITHOUT_FORMAT_EXTENSIONS +++ b/tools/build/options/WITHOUT_FORMAT_EXTENSIONS @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not enable +Do not enable .Fl fformat-extensions when compiling the kernel. Also disables all format checking. diff --git a/tools/build/options/WITHOUT_FORTH b/tools/build/options/WITHOUT_FORTH index db409964f34e..dd3de7d18e91 100644 --- a/tools/build/options/WITHOUT_FORTH +++ b/tools/build/options/WITHOUT_FORTH @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to build bootloaders without Forth support. +Build bootloaders without Forth support. diff --git a/tools/build/options/WITHOUT_FP_LIBC b/tools/build/options/WITHOUT_FP_LIBC index 5d591b515031..a2975088c6cf 100644 --- a/tools/build/options/WITHOUT_FP_LIBC +++ b/tools/build/options/WITHOUT_FP_LIBC @@ -1,4 +1,4 @@ .\" $FreeBSD$ -Set to build +Build .Nm libc without floating-point support. diff --git a/tools/build/options/WITHOUT_FREEBSD_UPDATE b/tools/build/options/WITHOUT_FREEBSD_UPDATE index 72157543f27a..61638b7f35ac 100644 --- a/tools/build/options/WITHOUT_FREEBSD_UPDATE +++ b/tools/build/options/WITHOUT_FREEBSD_UPDATE @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr freebsd-update 8 . diff --git a/tools/build/options/WITHOUT_FTP b/tools/build/options/WITHOUT_FTP index 5e0fc8eedc19..e037640b59f0 100644 --- a/tools/build/options/WITHOUT_FTP +++ b/tools/build/options/WITHOUT_FTP @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build or install +Do not build or install .Xr ftp 1 and .Xr ftpd 8 . diff --git a/tools/build/options/WITHOUT_GAMES b/tools/build/options/WITHOUT_GAMES index 13067bf05a8b..7102c377e07c 100644 --- a/tools/build/options/WITHOUT_GAMES +++ b/tools/build/options/WITHOUT_GAMES @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build games. +Do not build games. diff --git a/tools/build/options/WITHOUT_GCC b/tools/build/options/WITHOUT_GCC index c746d16dc076..927765bfdc69 100644 --- a/tools/build/options/WITHOUT_GCC +++ b/tools/build/options/WITHOUT_GCC @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build and install gcc and g++ as part of the normal build process. +Do not build and install gcc and g++ as part of the normal build process. diff --git a/tools/build/options/WITHOUT_GCC_BOOTSTRAP b/tools/build/options/WITHOUT_GCC_BOOTSTRAP index 03868c5cc5f7..88820cf67e05 100644 --- a/tools/build/options/WITHOUT_GCC_BOOTSTRAP +++ b/tools/build/options/WITHOUT_GCC_BOOTSTRAP @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build gcc and g++ as part of the bootstrap process. +Do not build gcc and g++ as part of the bootstrap process. diff --git a/tools/build/options/WITHOUT_GCOV b/tools/build/options/WITHOUT_GCOV index 1872e1479b55..0857788db2ff 100644 --- a/tools/build/options/WITHOUT_GCOV +++ b/tools/build/options/WITHOUT_GCOV @@ -1,4 +1,4 @@ .\" $FreeBSD$ -Set to not build the +Do not build the .Xr gcov 1 tool. diff --git a/tools/build/options/WITHOUT_GDB b/tools/build/options/WITHOUT_GDB index 68f4801a3997..1d99903fb3fc 100644 --- a/tools/build/options/WITHOUT_GDB +++ b/tools/build/options/WITHOUT_GDB @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr gdb 1 . diff --git a/tools/build/options/WITHOUT_GH_BC b/tools/build/options/WITHOUT_GH_BC index 80e43bb7cde0..a1f2c070831e 100644 --- a/tools/build/options/WITHOUT_GH_BC +++ b/tools/build/options/WITHOUT_GH_BC @@ -1,6 +1,6 @@ .\" $FreeBSD$ -Set to not build and install the enhanced +Install the traditional FreeBSD .Xr bc 1 and .Xr dc 1 -programs instead of the traditional FreeBSD versions. +programs instead of the enhanced versions. diff --git a/tools/build/options/WITHOUT_GNU_DIFF b/tools/build/options/WITHOUT_GNU_DIFF index 48d7361ff8ca..a929b9686da9 100644 --- a/tools/build/options/WITHOUT_GNU_DIFF +++ b/tools/build/options/WITHOUT_GNU_DIFF @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build GNU +Do not build GNU .Xr diff3 1 . diff --git a/tools/build/options/WITHOUT_GOOGLETEST b/tools/build/options/WITHOUT_GOOGLETEST index a76112e07fa4..fca54e882561 100644 --- a/tools/build/options/WITHOUT_GOOGLETEST +++ b/tools/build/options/WITHOUT_GOOGLETEST @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to neither build nor install +Neither build nor install .Lb libgmock , .Lb libgtest , and dependent tests. diff --git a/tools/build/options/WITHOUT_GPIO b/tools/build/options/WITHOUT_GPIO index 0b1d091470d0..70b3673bb5db 100644 --- a/tools/build/options/WITHOUT_GPIO +++ b/tools/build/options/WITHOUT_GPIO @@ -1,4 +1,4 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr gpioctl 8 as part of the base system. diff --git a/tools/build/options/WITHOUT_GSSAPI b/tools/build/options/WITHOUT_GSSAPI index 0f31dd98ed5a..1f325a64d249 100644 --- a/tools/build/options/WITHOUT_GSSAPI +++ b/tools/build/options/WITHOUT_GSSAPI @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build libgssapi. +Do not build libgssapi. diff --git a/tools/build/options/WITHOUT_HAST b/tools/build/options/WITHOUT_HAST index 0c31b8c3d0ca..975f56331ab1 100644 --- a/tools/build/options/WITHOUT_HAST +++ b/tools/build/options/WITHOUT_HAST @@ -1,4 +1,4 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr hastd 8 and related utilities. diff --git a/tools/build/options/WITHOUT_HTML b/tools/build/options/WITHOUT_HTML index 03cbdc4a2a99..04c1174f136f 100644 --- a/tools/build/options/WITHOUT_HTML +++ b/tools/build/options/WITHOUT_HTML @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build HTML docs. +Do not build HTML docs. diff --git a/tools/build/options/WITHOUT_HYPERV b/tools/build/options/WITHOUT_HYPERV index ef63f70ea80e..c717a4e943f8 100644 --- a/tools/build/options/WITHOUT_HYPERV +++ b/tools/build/options/WITHOUT_HYPERV @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build or install HyperV utilities. +Do not build or install HyperV utilities. diff --git a/tools/build/options/WITHOUT_ICONV b/tools/build/options/WITHOUT_ICONV index a43dd3a16919..3c887a415153 100644 --- a/tools/build/options/WITHOUT_ICONV +++ b/tools/build/options/WITHOUT_ICONV @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build iconv as part of libc. +Do not build iconv as part of libc. diff --git a/tools/build/options/WITHOUT_INCLUDES b/tools/build/options/WITHOUT_INCLUDES index 40f8ff5b1be9..da210a4f76f3 100644 --- a/tools/build/options/WITHOUT_INCLUDES +++ b/tools/build/options/WITHOUT_INCLUDES @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not install header files. +Do not install header files. This option used to be spelled .Va NO_INCS . .Bf -symbolic diff --git a/tools/build/options/WITHOUT_INET b/tools/build/options/WITHOUT_INET index 98e1c560e0fc..79e493258017 100644 --- a/tools/build/options/WITHOUT_INET +++ b/tools/build/options/WITHOUT_INET @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build programs and libraries related to IPv4 networking. +Do not build programs and libraries related to IPv4 networking. diff --git a/tools/build/options/WITHOUT_INET6 b/tools/build/options/WITHOUT_INET6 index 32c657b9476a..a28a85691090 100644 --- a/tools/build/options/WITHOUT_INET6 +++ b/tools/build/options/WITHOUT_INET6 @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build +Do not build programs and libraries related to IPv6 networking. diff --git a/tools/build/options/WITHOUT_INET6_SUPPORT b/tools/build/options/WITHOUT_INET6_SUPPORT index 1e36fed1f545..e41e3d5baf1c 100644 --- a/tools/build/options/WITHOUT_INET6_SUPPORT +++ b/tools/build/options/WITHOUT_INET6_SUPPORT @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to build libraries, programs, and kernel modules without IPv6 support. +Build libraries, programs, and kernel modules without IPv6 support. diff --git a/tools/build/options/WITHOUT_INETD b/tools/build/options/WITHOUT_INETD index b4fe5dce7b30..4d47f6e17c7a 100644 --- a/tools/build/options/WITHOUT_INETD +++ b/tools/build/options/WITHOUT_INETD @@ -1,3 +1,3 @@ .\" $FreeBSD$ -Set to not build +Do not build .Xr inetd 8 . diff --git a/tools/build/options/WITHOUT_INET_SUPPORT b/tools/build/options/WITHOUT_INET_SUPPORT index 725744099adb..e5c0ded7d56b 100644 --- a/tools/build/options/WITHOUT_INET_SUPPORT +++ b/tools/build/options/WITHOUT_INET_SUPPORT @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to build libraries, programs, and kernel modules without IPv4 support. +Build libraries, programs, and kernel modules without IPv4 support. diff --git a/tools/build/options/WITHOUT_INFO b/tools/build/options/WITHOUT_INFO index de46159d101a..6900ca9cb315 100644 --- a/tools/build/options/WITHOUT_INFO +++ b/tools/build/options/WITHOUT_INFO @@ -1,4 +1,4 @@ .\" $FreeBSD$ -Set to not make or install +Do not make or install .Xr info 5 files. diff --git a/tools/build/options/WITHOUT_IPFILTER b/tools/build/options/WITHOUT_IPFILTER index 9d02c0358438..4bdb201944fc 100644 --- a/tools/build/options/WITHOUT_IPFILTER +++ b/tools/build/options/WITHOUT_IPFILTER @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build IP Filter package. +Do not build IP Filter package. diff --git a/tools/build/options/WITHOUT_IPFW b/tools/build/options/WITHOUT_IPFW index b6a06b23dfdb..591973e57e12 100644 --- a/tools/build/options/WITHOUT_IPFW +++ b/tools/build/options/WITHOUT_IPFW @@ -1,2 +1,2 @@ .\" $FreeBSD$ -Set to not build IPFW tools. +Do not build IPFW tools. diff --git a/tools/build/options/WITHOUT_IPSEC_SUPPORT b/tools/build/options/WITHOUT_IPSEC_SUPPORT index 73d71ccc8a3b..03ab11bda522 100644 --- a/tools/build/options/WITHOUT_IPSEC_SUPPORT +++ b/tools/build/options/WITHOUT_IPSEC_SUPPORT @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build the kernel with +Do not build the kernel with .Xr ipsec 4 support. This option is needed for diff --git a/tools/build/options/WITHOUT_ISCSI b/tools/build/options/WITHOUT_ISCSI index 02e80c7feff2..6d6e76b53891 100644 --- a/tools/build/options/WITHOUT_ISCSI +++ b/tools/build/options/WITHOUT_ISCSI *** 1658 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Apr 10 02:24:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 80A4B5C7C24; Sat, 10 Apr 2021 02:24: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 4FHJjn37rGz4v9H; Sat, 10 Apr 2021 02:24: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 5D7BBE6D; Sat, 10 Apr 2021 02:24: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 13A2Ojnw022962; Sat, 10 Apr 2021 02:24:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A2OjY2022961; Sat, 10 Apr 2021 02:24:45 GMT (envelope-from git) Date: Sat, 10 Apr 2021 02:24:45 GMT Message-Id: <202104100224.13A2OjY2022961@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: 041c50494242 - main - Regen src.conf.5 after 9d178c925fb9 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: 041c5049424224f1c9d803d6735cdf669c1ef7ba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 02:24:45 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=041c5049424224f1c9d803d6735cdf669c1ef7ba commit 041c5049424224f1c9d803d6735cdf669c1ef7ba Author: Ed Maste AuthorDate: 2021-04-10 02:22:05 +0000 Commit: Ed Maste CommitDate: 2021-04-10 02:24:08 +0000 Regen src.conf.5 after 9d178c925fb9 --- share/man/man5/src.conf.5 | 420 +++++++++++++++++++++++----------------------- 1 file changed, 210 insertions(+), 210 deletions(-) diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 98fcc427d608..fede8aea2ba8 100644 --- a/share/man/man5/src.conf.5 +++ b/share/man/man5/src.conf.5 @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd March 16, 2021 +.Dd April 9, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -92,38 +92,38 @@ This list provides a name and short description for variables that can be used for source builds. .Bl -tag -width indent .It Va WITHOUT_ACCT -Set to not build process accounting tools such as +Do not build process accounting tools such as .Xr accton 8 and .Xr sa 8 . .It Va WITHOUT_ACPI -Set to not build +Do not build .Xr acpiconf 8 , .Xr acpidump 8 and related programs. .It Va WITHOUT_APM -Set to not build +Do not build .Xr apm 8 , .Xr apmd 8 and related programs. .It Va WITHOUT_ASSERT_DEBUG -Set to compile programs and libraries without the +Compile programs and libraries without the .Xr assert 3 checks. .It Va WITHOUT_AT -Set to not build +Do not build .Xr at 1 and related utilities. .It Va WITHOUT_ATM -Set to not build +Do not build programs and libraries related to ATM networking. .It Va WITHOUT_AUDIT -Set to not build audit support into system programs. +Do not build audit support into system programs. .It Va WITHOUT_AUTHPF -Set to not build +Do not build .Xr authpf 8 . .It Va WITHOUT_AUTOFS -Set to not build +Do not build .Xr autofs 5 related programs, libraries, and kernel modules. .It Va WITHOUT_AUTO_OBJ @@ -166,13 +166,13 @@ is set explicitly) is set explicitly) .El .It Va WITHOUT_BHYVE -Set to not build or install +Do not build or install .Xr bhyve 8 , associated utilities, and examples. .Pp This option only affects amd64/amd64. .It Va WITH_BHYVE_SNAPSHOT -Set to include support for save and restore (snapshots) in +Include support for save and restore (snapshots) in .Xr bhyve 8 and .Xr bhyvectl 8 . @@ -197,7 +197,7 @@ When set, these options are also in effect: is set explicitly) .El .It Va WITHOUT_BLACKLIST_SUPPORT -Set to build some programs without +Build some programs without .Xr libblacklist 3 support, like .Xr fingerd 8 , @@ -205,29 +205,29 @@ support, like and .Xr sshd 8 . .It Va WITHOUT_BLUETOOTH -Set to not build Bluetooth related kernel modules, programs and libraries. +Do not build Bluetooth related kernel modules, programs and libraries. .It Va WITHOUT_BOOT -Set to not build the boot blocks and loader. +Do not build the boot blocks and loader. .It Va WITHOUT_BOOTPARAMD -Set to not build or install +Do not build or install .Xr bootparamd 8 . .It Va WITHOUT_BOOTPD -Set to not build or install +Do not build or install .Xr bootpd 8 . .It Va WITHOUT_BSDINSTALL -Set to not build +Do not build .Xr bsdinstall 8 , .Xr sade 8 , and related programs. .It Va WITHOUT_BSD_CPIO -Set to not build the BSD licensed version of cpio based on +Do not build the BSD licensed version of cpio based on .Xr libarchive 3 . .It Va WITHOUT_BSNMP -Set to not build or install +Do not build or install .Xr bsnmpd 1 and related libraries and data files. .It Va WITHOUT_BZIP2 -Set to not build contributed bzip2 software as a part of the base system. +Do not build contributed bzip2 software as a part of the base system. .Bf -symbolic The option has no effect yet. .Ef @@ -240,12 +240,12 @@ When set, these options are also in effect: is set explicitly) .El .It Va WITHOUT_BZIP2_SUPPORT -Set to build some programs without optional bzip2 support. +Build some programs without optional bzip2 support. .It Va WITHOUT_CALENDAR -Set to not build +Do not build .Xr calendar 1 . .It Va WITHOUT_CAPSICUM -Set to not build Capsicum support into system programs. +Do not build Capsicum support into system programs. When set, it enforces these options: .Pp .Bl -item -compact @@ -253,12 +253,12 @@ When set, it enforces these options: .Va WITHOUT_CASPER .El .It Va WITHOUT_CAROOT -Set to not add the trusted certificates from the Mozilla NSS bundle to +Do not add the trusted certificates from the Mozilla NSS bundle to base. .It Va WITHOUT_CASPER -Set to not build Casper program and related libraries. +Do not build Casper program and related libraries. .It Va WITH_CCACHE_BUILD -Set to use +Use .Xr ccache 1 for the build. No configuration is required except to install the @@ -297,11 +297,11 @@ See .Xr ccache 1 for more configuration options. .It Va WITHOUT_CCD -Set to not build +Do not build .Xr geom_ccd 4 and related utilities. .It Va WITHOUT_CDDL -Set to not build code licensed under Sun's CDDL. +Do not build code licensed under Sun's CDDL. When set, it enforces these options: .Pp .Bl -item -compact @@ -313,7 +313,7 @@ When set, it enforces these options: .Va WITHOUT_ZFS .El .It Va WITHOUT_CLANG -Set to not build the Clang C/C++ compiler during the regular phase of the build. +Do not build the Clang C/C++ compiler during the regular phase of the build. When set, it enforces these options: .Pp .Bl -item -compact @@ -327,17 +327,17 @@ When set, it enforces these options: .Va WITHOUT_LLVM_COV .El .It Va WITHOUT_CLANG_BOOTSTRAP -Set to not build the Clang C/C++ compiler during the bootstrap phase of +Do not build the Clang C/C++ compiler during the bootstrap phase of the build. To be able to build the system, either gcc or clang bootstrap must be enabled unless an alternate compiler is provided via XCC. .It Va WITH_CLANG_EXTRAS -Set to build additional clang and llvm tools, such as bugpoint and +Build additional clang and llvm tools, such as bugpoint and clang-format. .It Va WITH_CLANG_FORMAT -Set to build clang-format. +Build clang-format. .It Va WITHOUT_CLANG_FULL -Set to avoid building the ARCMigrate, Rewriter and StaticAnalyzer components of +Avoid building the ARCMigrate, Rewriter and StaticAnalyzer components of the Clang C/C++ compiler. .It Va WITHOUT_CLANG_IS_CC Do not install links to the Clang C/C++ compiler as @@ -348,10 +348,10 @@ and .It Va WITHOUT_CLEAN Do not clean before building world and/or kernel. .It Va WITHOUT_CPP -Set to not build +Do not build .Xr cpp 1 . .It Va WITHOUT_CROSS_COMPILER -Set to not build any cross compiler in the cross-tools stage of buildworld. +Do not build any cross compiler in the cross-tools stage of buildworld. When compiling a different version of .Fx than what is installed on the system, provide an alternate @@ -374,7 +374,7 @@ When set, it enforces these options: .Va WITHOUT_LLD_BOOTSTRAP .El .It Va WITHOUT_CRYPT -Set to not build any crypto code. +Do not build any crypto code. When set, it enforces these options: .Pp .Bl -item -compact @@ -413,25 +413,25 @@ When set, these options are also in effect: is set explicitly) .El .It Va WITH_CTF -Set to compile with CTF (Compact C Type Format) data. +Compile with CTF (Compact C Type Format) data. CTF data encapsulates a reduced form of debugging information similar to DWARF and the venerable stabs and is required for DTrace. .It Va WITHOUT_CUSE -Set to not build CUSE-related programs and libraries. +Do not build CUSE-related programs and libraries. .It Va WITHOUT_CXGBETOOL -Set to not build +Do not build .Xr cxgbetool 8 .Pp This is a default setting on arm/armv6, arm/armv7, mips/mips, mips/mips64, powerpc/powerpc, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_CXGBETOOL -Set to build +Build .Xr cxgbetool 8 .Pp This is a default setting on amd64/amd64, arm64/aarch64, i386/i386 and powerpc/powerpc64. .It Va WITHOUT_CXX -Set to not build +Do not build .Xr c++ 1 and related libraries. It will also prevent building of @@ -459,10 +459,10 @@ When set, it enforces these options: .Va WITHOUT_TESTS .El .It Va WITHOUT_DEBUG_FILES -Set to avoid building or installing standalone debug files for each +Avoid building or installing standalone debug files for each executable binary and shared library. .It Va WITHOUT_DIALOG -Set to not build +Do not build .Xr dialog 1 , .Xr dialog 3 , .Xr dpv 1 , @@ -475,7 +475,7 @@ When set, it enforces these options: .Va WITHOUT_BSDINSTALL .El .It Va WITHOUT_DICT -Set to not build the Webster dictionary files. +Do not build the Webster dictionary files. .It Va WITH_DIRDEPS_BUILD This is an experimental build system. For details see @@ -559,12 +559,12 @@ This must be set in the environment, make command line, or not .Pa /etc/src.conf . .It Va WITHOUT_DMAGENT -Set to not build dma Mail Transport Agent. +Do not build dma Mail Transport Agent. .It Va WITHOUT_DOCCOMPRESS -Set to not install compressed system documentation. +Do not install compressed system documentation. Only the uncompressed version will be installed. .It Va WITH_DTRACE_TESTS -Set to build and install the DTrace test suite in +Build and install the DTrace test suite in .Pa /usr/tests/cddl/usr.sbin/dtrace . This test suite is considered experimental on architectures other than amd64/amd64 and running it may cause system instability. @@ -575,7 +575,7 @@ and .Pa /sbin dynamically. .It Va WITHOUT_EE -Set to not build and install +Do not build and install .Xr edit 1 , .Xr ee 1 , and related programs. @@ -588,7 +588,7 @@ and This is a default setting on mips/mips, mips/mips64, powerpc/powerpc and powerpc/powerpc64. .It Va WITH_EFI -Set to build +Build .Xr efivar 3 and .Xr efivar 8 . @@ -596,24 +596,24 @@ and This is a default setting on amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64 and riscv/riscv64sf. .It Va WITHOUT_ELFTOOLCHAIN_BOOTSTRAP -Set to not build ELF Tool Chain tools +Do not build ELF Tool Chain tools (addr2line, nm, size, strings and strip) as part of the bootstrap process. .Bf -symbolic An alternate bootstrap tool chain must be provided. .Ef .It Va WITHOUT_EXAMPLES -Set to avoid installing examples to +Avoid installing examples to .Pa /usr/share/examples/ . .It Va WITH_EXPERIMENTAL -Set to include experimental features in the build. +Include experimental features in the build. .It Va WITH_EXTRA_TCP_STACKS -Set to build extra TCP stack modules. +Build extra TCP stack modules. .It Va WITHOUT_FDT -Set to not build Flattened Device Tree support as part of the base system. +Do not build Flattened Device Tree support as part of the base system. This includes the device tree compiler (dtc) and libfdt support library. .It Va WITHOUT_FILE -Set to not build +Do not build .Xr file 1 and related programs. When set, it enforces these options: @@ -623,45 +623,45 @@ When set, it enforces these options: .Va WITHOUT_SVNLITE .El .It Va WITHOUT_FINGER -Set to not build or install +Do not build or install .Xr finger 1 and .Xr fingerd 8 . .It Va WITHOUT_FLOPPY -Set to not build or install programs +Do not build or install programs for operating floppy disk driver. .It Va WITHOUT_FORMAT_EXTENSIONS -Set to not enable +Do not enable .Fl fformat-extensions when compiling the kernel. Also disables all format checking. .It Va WITHOUT_FORTH -Set to build bootloaders without Forth support. +Build bootloaders without Forth support. .It Va WITHOUT_FP_LIBC -Set to build +Build .Nm libc without floating-point support. .It Va WITHOUT_FREEBSD_UPDATE -Set to not build +Do not build .Xr freebsd-update 8 . .It Va WITHOUT_FTP -Set to not build or install +Do not build or install .Xr ftp 1 and .Xr ftpd 8 . .It Va WITHOUT_GAMES -Set to not build games. +Do not build games. .It Va WITHOUT_GH_BC -Set to not build and install the enhanced +Install the traditional FreeBSD .Xr bc 1 and .Xr dc 1 -programs instead of the traditional FreeBSD versions. +programs instead of the enhanced versions. .It Va WITHOUT_GNU_DIFF -Set to not build GNU +Do not build GNU .Xr diff3 1 . .It Va WITHOUT_GOOGLETEST -Set to neither build nor install +Neither build nor install .Lb libgmock , .Lb libgtest , and dependent tests. @@ -669,7 +669,7 @@ and dependent tests. This is a default setting on mips/mips and mips/mips64. .It Va WITH_GOOGLETEST -Set to build and install +Build and install .Lb libgmock , .Lb libgtest , and dependent tests. @@ -677,40 +677,40 @@ and dependent tests. This is a default setting on amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64, riscv/riscv64 and riscv/riscv64sf. .It Va WITHOUT_GPIO -Set to not build +Do not build .Xr gpioctl 8 as part of the base system. .It Va WITHOUT_GSSAPI -Set to not build libgssapi. +Do not build libgssapi. .It Va WITHOUT_HAST -Set to not build +Do not build .Xr hastd 8 and related utilities. .It Va WITH_HESIOD -Set to build Hesiod support. +Build Hesiod support. .It Va WITHOUT_HTML -Set to not build HTML docs. +Do not build HTML docs. .It Va WITHOUT_HYPERV -Set to not build or install HyperV utilities. +Do not build or install HyperV utilities. .Pp This is a default setting on arm/armv6, arm/armv7, arm64/aarch64, mips/mips, mips/mips64, powerpc/powerpc, powerpc/powerpc64, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_HYPERV -Set to build or install HyperV utilities. +Build or install HyperV utilities. .Pp This is a default setting on amd64/amd64 and i386/i386. .It Va WITHOUT_ICONV -Set to not build iconv as part of libc. +Do not build iconv as part of libc. .It Va WITHOUT_INCLUDES -Set to not install header files. +Do not install header files. This option used to be spelled .Va NO_INCS . .Bf -symbolic The option does not work for build targets. .Ef .It Va WITHOUT_INET -Set to not build programs and libraries related to IPv4 networking. +Do not build programs and libraries related to IPv4 networking. When set, it enforces these options: .Pp .Bl -item -compact @@ -718,7 +718,7 @@ When set, it enforces these options: .Va WITHOUT_INET_SUPPORT .El .It Va WITHOUT_INET6 -Set to not build +Do not build programs and libraries related to IPv6 networking. When set, it enforces these options: .Pp @@ -727,19 +727,19 @@ When set, it enforces these options: .Va WITHOUT_INET6_SUPPORT .El .It Va WITHOUT_INET6_SUPPORT -Set to build libraries, programs, and kernel modules without IPv6 support. +Build libraries, programs, and kernel modules without IPv6 support. .It Va WITHOUT_INETD -Set to not build +Do not build .Xr inetd 8 . .It Va WITHOUT_INET_SUPPORT -Set to build libraries, programs, and kernel modules without IPv4 support. +Build libraries, programs, and kernel modules without IPv4 support. .It Va WITH_INIT_ALL_PATTERN -Set to build the base system or kernel with stack variables initialized to +Build the base system or kernel with stack variables initialized to .Pq compiler defined debugging patterns on function entry. This option requires the clang compiler. .It Va WITH_INIT_ALL_ZERO -Set to build the base system or kernel with stack variables initialized +Build the base system or kernel with stack variables initialized to zero on function entry. This option requires that the clang compiler be used. .It Va WITHOUT_INSTALLLIB @@ -751,7 +751,7 @@ image. The option does not work for build targets. .Ef .It Va WITH_INSTALL_AS_USER -Set to make install targets succeed for non-root users by installing +Make install targets succeed for non-root users by installing files with owner and group attributes set to that of the user running the .Xr make 1 @@ -760,11 +760,11 @@ The user still must set the .Va DESTDIR variable to point to a directory where the user has write permissions. .It Va WITHOUT_IPFILTER -Set to not build IP Filter package. +Do not build IP Filter package. .It Va WITHOUT_IPFW -Set to not build IPFW tools. +Do not build IPFW tools. .It Va WITHOUT_IPSEC_SUPPORT -Set to not build the kernel with +Do not build the kernel with .Xr ipsec 4 support. This option is needed for @@ -772,14 +772,14 @@ This option is needed for and .Xr tcpmd5 4 . .It Va WITHOUT_ISCSI -Set to not build +Do not build .Xr iscsid 8 and related utilities. .It Va WITHOUT_JAIL -Set to not build tools for the support of jails; e.g., +Do not build tools for the support of jails; e.g., .Xr jail 8 . .It Va WITHOUT_KDUMP -Set to not build +Do not build .Xr kdump 1 and .Xr truss 1 . @@ -798,22 +798,22 @@ is set explicitly) is set explicitly) .El .It Va WITHOUT_KERBEROS_SUPPORT -Set to build some programs without Kerberos support, like +Build some programs without Kerberos support, like .Xr ssh 1 , .Xr telnet 1 , .Xr sshd 8 , and .Xr telnetd 8 . .It Va WITH_KERNEL_RETPOLINE -Set to enable the "retpoline" mitigation for CVE-2017-5715 in the kernel +Enable the "retpoline" mitigation for CVE-2017-5715 in the kernel build. .It Va WITHOUT_KERNEL_SYMBOLS -Set to not install kernel symbol files. +Do not install kernel symbol files. .Bf -symbolic This option is recommended for those people who have small root partitions. .Ef .It Va WITHOUT_KVM -Set to not build the +Do not build the .Nm libkvm library as a part of the base system. .Bf -symbolic @@ -828,7 +828,7 @@ When set, these options are also in effect: is set explicitly) .El .It Va WITHOUT_KVM_SUPPORT -Set to build some programs without optional +Build some programs without optional .Nm libkvm support. .It Va WITHOUT_LDNS @@ -847,34 +847,34 @@ Setting this variable will prevent building the LDNS utilities and .Xr host 1 . .It Va WITHOUT_LEGACY_CONSOLE -Set to not build programs that support a legacy PC console; e.g., +Do not build programs that support a legacy PC console; e.g., .Xr kbdcontrol 1 and .Xr vidcontrol 1 . .It Va WITHOUT_LIB32 -On 64-bit platforms, set to not build 32-bit library set and a +On 64-bit platforms, do not build 32-bit library set and a .Nm ld-elf32.so.1 runtime linker. .Pp This is a default setting on arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mips, powerpc/powerpc, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_LIBSOFT -On armv6 only, set to enable soft float ABI compatibility libraries. +On armv6 only, enable soft float ABI compatibility libraries. This option is for transitioning to the new hard float ABI. .It Va WITHOUT_LLD -Set to not build LLVM's lld linker. +Do not build LLVM's lld linker. .It Va WITHOUT_LLDB -Set to not build the LLDB debugger. +Do not build the LLDB debugger. .Pp This is a default setting on arm/armv6, arm/armv7, mips/mips, mips/mips64, powerpc/powerpc, powerpc/powerpc64, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_LLDB -Set to build the LLDB debugger. +Build the LLDB debugger. .Pp This is a default setting on amd64/amd64, arm64/aarch64 and i386/i386. .It Va WITHOUT_LLD_BOOTSTRAP -Set to not build the LLD linker during the bootstrap phase of +Do not build the LLD linker during the bootstrap phase of the build. To be able to build the system an alternate linker must be provided via XLD. .It Va WITHOUT_LLD_IS_LD @@ -885,20 +885,20 @@ to The system will not have a usable tool chain unless a linker is provided some other way. .It Va WITHOUT_LLVM_ASSERTIONS -Set to disable debugging assertions in LLVM. +Disable debugging assertions in LLVM. .It Va WITHOUT_LLVM_COV -Set to not build the +Do not build the .Xr llvm-cov 1 tool. .It Va WITHOUT_LLVM_CXXFILT Install ELF Tool Chain's cxxfilt as c++filt, instead of LLVM's llvm-cxxfilt. .It Va WITHOUT_LLVM_TARGET_AARCH64 -Set to not build LLVM target support for AArch64. +Do not build LLVM target support for AArch64. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .It Va WITHOUT_LLVM_TARGET_ALL -Set to only build the required LLVM target support. +Only build the required LLVM target support. This option is preferred to specific target support options. When set, these options are also in effect: .Pp @@ -925,32 +925,32 @@ is set explicitly) is set explicitly) .El .It Va WITHOUT_LLVM_TARGET_ARM -Set to not build LLVM target support for ARM. +Do not build LLVM target support for ARM. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .It Va WITH_LLVM_TARGET_BPF -Set to build LLVM target support for BPF. +Build LLVM target support for BPF. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .It Va WITHOUT_LLVM_TARGET_MIPS -Set to not build LLVM target support for MIPS. +Do not build LLVM target support for MIPS. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .It Va WITHOUT_LLVM_TARGET_POWERPC -Set to not build LLVM target support for PowerPC. +Do not build LLVM target support for PowerPC. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .It Va WITHOUT_LLVM_TARGET_RISCV -Set to not build LLVM target support for RISC-V. +Do not build LLVM target support for RISC-V. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. .It Va WITHOUT_LLVM_TARGET_X86 -Set to not build LLVM target support for X86. +Do not build LLVM target support for X86. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. @@ -968,17 +968,17 @@ Disable inclusion of GELI crypto support in the boot chain binaries. This is a default setting on powerpc/powerpc and powerpc/powerpc64. .It Va WITH_LOADER_GELI -Set to build GELI bootloader support. +Build GELI bootloader support. .Pp This is a default setting on amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mips, mips/mips64, riscv/riscv64 and riscv/riscv64sf. .It Va WITHOUT_LOADER_LUA -Set to not build LUA bindings for the boot loader. +Do not build LUA bindings for the boot loader. .Pp This is a default setting on powerpc/powerpc and powerpc/powerpc64. .It Va WITH_LOADER_LUA -Set to build LUA bindings for the boot loader. +Build LUA bindings for the boot loader. .Pp This is a default setting on amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mips, mips/mips64, riscv/riscv64 and riscv/riscv64sf. @@ -988,7 +988,7 @@ Disable building of openfirmware bootloader components. This is a default setting on amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mips, mips/mips64, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_LOADER_OFW -Set to build openfirmware bootloader components. +Build openfirmware bootloader components. .Pp This is a default setting on powerpc/powerpc and powerpc/powerpc64. @@ -998,12 +998,12 @@ Disable building of ubldr. This is a default setting on amd64/amd64, arm64/aarch64, i386/i386, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_LOADER_UBOOT -Set to build ubldr. +Build ubldr. .Pp This is a default setting on arm/armv6, arm/armv7, mips/mips, mips/mips64, powerpc/powerpc and powerpc/powerpc64. .It Va WITH_LOADER_VERBOSE -Set to build with extra verbose debugging in the loader. +Build with extra verbose debugging in the loader. May explode already nearly too large loader over the limit. Use with care. .It Va WITH_LOADER_VERIEXEC @@ -1034,26 +1034,26 @@ The kernel has to be built with a module to parse the manifest. Depends on .Va WITH_LOADER_VERIEXEC . .It Va WITHOUT_LOADER_ZFS -Set to not build ZFS file system boot loader support. +Do not build ZFS file system boot loader support. .It Va WITHOUT_LOCALES -Set to not build localization files; see +Do not build localization files; see .Xr locale 1 . .It Va WITHOUT_LOCATE -Set to not build +Do not build .Xr locate 1 and related programs. .It Va WITHOUT_LPR -Set to not build +Do not build .Xr lpr 1 and related programs. .It Va WITHOUT_LS_COLORS -Set to build +Build .Xr ls 1 without support for colors to distinguish file types. .It Va WITHOUT_LZMA_SUPPORT -Set to build some programs without optional lzma compression support. +Build some programs without optional lzma compression support. .It Va WITHOUT_MAIL -Set to not build any mail support (MUA or MTA). +Do not build any mail support (MUA or MTA). When set, it enforces these options: .Pp .Bl -item -compact @@ -1065,15 +1065,15 @@ When set, it enforces these options: .Va WITHOUT_SENDMAIL .El .It Va WITHOUT_MAILWRAPPER -Set to not build the +Do not build the .Xr mailwrapper 8 MTA selector. .It Va WITHOUT_MAKE -Set to not install +Do not install .Xr make 1 and related support files. .It Va WITHOUT_MAKE_CHECK_USE_SANDBOX -Set to not execute +Do not execute .Dq Li "make check" in limited sandbox mode. This option should be paired with @@ -1083,11 +1083,11 @@ See .Xr tests 7 for more details. .It Va WITH_MALLOC_PRODUCTION -Set to disable assertions and statistics gathering in +Disable assertions and statistics gathering in .Xr malloc 3 . It also defaults the A and J runtime options to off. .It Va WITHOUT_MAN -Set to not build manual pages. +Do not build manual pages. When set, these options are also in effect: .Pp .Bl -inset -compact @@ -1097,12 +1097,12 @@ When set, these options are also in effect: is set explicitly) .El .It Va WITHOUT_MANCOMPRESS -Set to not to install compressed man pages. +Do not install compressed man pages. Only the uncompressed versions will be installed. .It Va WITH_MANSPLITPKG -Set to split man pages into their own packages during make package. +Split man pages into their own packages during make package. .It Va WITHOUT_MAN_UTILS -Set to not build utilities for manual pages, +Do not build utilities for manual pages, .Xr apropos 1 , .Xr makewhatis 1 , .Xr man 1 , @@ -1166,23 +1166,23 @@ This must be set in the environment, make command line, or not .Pa /etc/src.conf . .It Va WITHOUT_MLX5TOOL -Set to not build +Do not build .Xr mlx5tool 8 .Pp This is a default setting on arm/armv6, arm/armv7, mips/mips, mips/mips64, powerpc/powerpc, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_MLX5TOOL -Set to build +Build .Xr mlx5tool 8 .Pp This is a default setting on amd64/amd64, arm64/aarch64, i386/i386 and powerpc/powerpc64. .It Va WITHOUT_NETCAT -Set to not build +Do not build .Xr nc 1 utility. .It Va WITHOUT_NETGRAPH -Set to not build applications to support +Do not build applications to support .Xr netgraph 4 . When set, it enforces these options: .Pp @@ -1202,9 +1202,9 @@ When set, these options are also in effect: is set explicitly) .El .It Va WITHOUT_NETGRAPH_SUPPORT -Set to build libraries, programs, and kernel modules without netgraph support. +Build libraries, programs, and kernel modules without netgraph support. .It Va WITHOUT_NIS -Set to not build +Do not build .Xr NIS 8 support and related programs. If set, you might need to adopt your @@ -1213,7 +1213,7 @@ and remove .Sq nis entries. .It Va WITHOUT_NLS -Set to not build NLS catalogs. +Do not build NLS catalogs. When set, it enforces these options: .Pp .Bl -item -compact @@ -1221,31 +1221,31 @@ When set, it enforces these options: .Va WITHOUT_NLS_CATALOGS .El .It Va WITHOUT_NLS_CATALOGS -Set to not build NLS catalog support for +Do not build NLS catalog support for .Xr csh 1 . .It Va WITHOUT_NS_CACHING -Set to disable name caching in the +Disable name caching in the .Pa nsswitch subsystem. The generic caching daemon, .Xr nscd 8 , will not be built either if this option is set. .It Va WITHOUT_NTP -Set to not build +Do not build .Xr ntpd 8 and related programs. .It Va WITHOUT_NVME -Set to not build nvme related tools and kernel modules. +Do not build nvme related tools and kernel modules. .Pp This is a default setting on arm/armv6, arm/armv7, mips/mips, mips/mips64, powerpc/powerpc, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_NVME -Set to build nvme related tools and kernel modules. +Build nvme related tools and kernel modules. .Pp This is a default setting on amd64/amd64, arm64/aarch64, i386/i386 and powerpc/powerpc64. .It Va WITHOUT_OFED -Set to disable the build of the +Disable the build of the .Dq "OpenFabrics Enterprise Distribution" Infiniband software stack, including kernel modules and userspace libraries. .Pp @@ -1258,25 +1258,25 @@ When set, it enforces these options: .Va WITHOUT_OFED_EXTRA .El .It Va WITH_OFED_EXTRA -Set to build the non-essential components of the +Build the non-essential components of the .Dq "OpenFabrics Enterprise Distribution" Infiniband software stack, mostly examples. .It Va WITH_OPENLDAP Enable building LDAP support for kerberos using an openldap client from ports. .It Va WITHOUT_OPENMP -Set to not build LLVM's OpenMP runtime. +Do not build LLVM's OpenMP runtime. .Pp This is a default setting on arm/armv6, arm/armv7, mips/mips, mips/mips64, powerpc/powerpc, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_OPENMP -Set to build LLVM's OpenMP runtime. +Build LLVM's OpenMP runtime. .Pp This is a default setting on amd64/amd64, arm64/aarch64, i386/i386 and powerpc/powerpc64. .It Va WITHOUT_OPENSSH -Set to not build OpenSSH. +Do not build OpenSSH. .It Va WITHOUT_OPENSSL -Set to not build OpenSSL. +Do not build OpenSSL. When set, it enforces these options: .Pp .Bl -item -compact @@ -1313,17 +1313,17 @@ When set, these options are also in effect: is set explicitly) .El .It Va WITHOUT_OPENSSL_KTLS -Set to not include kernel TLS support in OpenSSL. +Do not include kernel TLS support in OpenSSL. .Pp This is a default setting on arm/armv6, arm/armv7, i386/i386, mips/mips, mips/mips64, powerpc/powerpc, powerpc/powerpc64, riscv/riscv64 and riscv/riscv64sf. .It Va WITH_OPENSSL_KTLS -Set to include kernel TLS support in OpenSSL. +Include kernel TLS support in OpenSSL. .Pp This is a default setting on amd64/amd64 and arm64/aarch64. .It Va WITHOUT_PAM -Set to not build PAM library and modules. +Do not build PAM library and modules. .Bf -symbolic This option is deprecated and does nothing. .Ef @@ -1336,12 +1336,12 @@ When set, these options are also in effect: is set explicitly) .El .It Va WITHOUT_PAM_SUPPORT -Set to build some programs without PAM support, particularly +Build some programs without PAM support, particularly .Xr ftpd 8 and .Xr ppp 8 . .It Va WITHOUT_PF -Set to not build PF firewall package. +Do not build PF firewall package. When set, it enforces these options: .Pp .Bl -item -compact @@ -1352,44 +1352,44 @@ When set, it enforces these options: Do not build dynamically linked binaries as Position-Independent Executable (PIE). .It Va WITHOUT_PKGBOOTSTRAP -Set to not build +Do not build .Xr pkg 7 bootstrap tool. .It Va WITHOUT_PMC -Set to not build +Do not build .Xr pmccontrol 8 and related programs. .It Va WITHOUT_PORTSNAP *** 308 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Apr 10 06:02:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E6D05CF65A; Sat, 10 Apr 2021 06:02: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 4FHPXW1TNTz4RFR; Sat, 10 Apr 2021 06:02: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 137003A8B; Sat, 10 Apr 2021 06:02: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 13A62222015136; Sat, 10 Apr 2021 06:02:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A622HI015135; Sat, 10 Apr 2021 06:02:02 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:02:02 GMT Message-Id: <202104100602.13A622HI015135@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 378d492b2ed4 - stable/13 - cache: remove the largely obsolete general description 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 378d492b2ed420d09344fb32f52ea75b1e35ac1e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:02:03 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=378d492b2ed420d09344fb32f52ea75b1e35ac1e commit 378d492b2ed420d09344fb32f52ea75b1e35ac1e Author: Mateusz Guzik AuthorDate: 2021-02-05 23:16:55 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 05:57:55 +0000 cache: remove the largely obsolete general description Examples of inconsistencies with the current state: - references LRU of all entries, removed years ago - references a non-existent lock (neglist) - claims negative entries have a NULL target It will be replaced with a more accurate and more informative description. In the meantime take it out so it stops misleading. (cherry picked from commit 2f8a844635312b0f25028a87459fdd2d2a1cbfd6) --- sys/kern/vfs_cache.c | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 50ec6face6ac..21eb436681fc 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -276,52 +276,6 @@ cache_ncp_invalidate(struct namecache *ncp) __predict_true((_nc_flag & (NCF_INVALID | NCF_WIP | NCF_WHITE)) == 0); \ }) -/* - * Name caching works as follows: - * - * Names found by directory scans are retained in a cache - * for future reference. It is managed LRU, so frequently - * used names will hang around. Cache is indexed by hash value - * obtained from (dvp, name) where dvp refers to the directory - * containing name. - * - * If it is a "negative" entry, (i.e. for a name that is known NOT to - * exist) the vnode pointer will be NULL. - * - * Upon reaching the last segment of a path, if the reference - * is for DELETE, or NOCACHE is set (rewrite), and the - * name is located in the cache, it will be dropped. - * - * These locks are used (in the order in which they can be taken): - * NAME TYPE ROLE - * vnodelock mtx vnode lists and v_cache_dd field protection - * bucketlock mtx for access to given set of hash buckets - * neglist mtx negative entry LRU management - * - * It is legal to take multiple vnodelock and bucketlock locks. The locking - * order is lower address first. Both are recursive. - * - * "." lookups are lockless. - * - * ".." and vnode -> name lookups require vnodelock. - * - * name -> vnode lookup requires the relevant bucketlock to be held for reading. - * - * Insertions and removals of entries require involved vnodes and bucketlocks - * to be locked to provide safe operation against other threads modifying the - * cache. - * - * Some lookups result in removal of the found entry (e.g. getting rid of a - * negative entry with the intent to create a positive one), which poses a - * problem when multiple threads reach the state. Similarly, two different - * threads can purge two different vnodes and try to remove the same name. - * - * If the already held vnode lock is lower than the second required lock, we - * can just take the other lock. However, in the opposite case, this could - * deadlock. As such, this is resolved by trylocking and if that fails unlocking - * the first node, locking everything in order and revalidating the state. - */ - VFS_SMR_DECLARE; static SYSCTL_NODE(_vfs_cache, OID_AUTO, param, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, From owner-dev-commits-src-all@freebsd.org Sat Apr 10 06:02:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 013AC5CFAAE; Sat, 10 Apr 2021 06:02: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 4FHPXh4wBgz4RCn; Sat, 10 Apr 2021 06:02: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 2585E3FA0; Sat, 10 Apr 2021 06:02: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 13A62CB4015311; Sat, 10 Apr 2021 06:02:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A62Cjv015310; Sat, 10 Apr 2021 06:02:12 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:02:12 GMT Message-Id: <202104100602.13A62Cjv015310@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: d8aa5ff4f606 - stable/13 - cache: add high level overview 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d8aa5ff4f606788fdbbfd032ebbe2966c1fb4399 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:02:13 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=d8aa5ff4f606788fdbbfd032ebbe2966c1fb4399 commit d8aa5ff4f606788fdbbfd032ebbe2966c1fb4399 Author: Mateusz Guzik AuthorDate: 2021-02-11 15:39:28 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 05:57:56 +0000 cache: add high level overview Differential Revision: https://reviews.freebsd.org/D28675 (cherry picked from commit f79bd71def7a03b3a1b043cae7b908b36a05f41c) --- sys/kern/vfs_cache.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index ad91fb1686a4..a3af949597af 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -82,6 +82,131 @@ __FBSDID("$FreeBSD$"); #include +/* + * High level overview of name caching in the VFS layer. + * + * Originally caching was implemented as part of UFS, later extracted to allow + * use by other filesystems. A decision was made to make it optional and + * completely detached from the rest of the kernel, which comes with limitations + * outlined near the end of this comment block. + * + * This fundamental choice needs to be revisited. In the meantime, the current + * state is described below. Significance of all notable routines is explained + * in comments placed above their implementation. Scattered thoroughout the + * file are TODO comments indicating shortcomings which can be fixed without + * reworking everything (most of the fixes will likely be reusable). Various + * details are omitted from this explanation to not clutter the overview, they + * have to be checked by reading the code and associated commentary. + * + * Keep in mind that it's individual path components which are cached, not full + * paths. That is, for a fully cached path "foo/bar/baz" there are 3 entries, + * one for each name. + * + * I. Data organization + * + * Entries are described by "struct namecache" objects and stored in a hash + * table. See cache_get_hash for more information. + * + * "struct vnode" contains pointers to source entries (names which can be found + * when traversing through said vnode), destination entries (names of that + * vnode (see "Limitations" for a breakdown on the subject) and a pointer to + * the parent vnode. + * + * The (directory vnode; name) tuple reliably determines the target entry if + * it exists. + * + * Since there are no small locks at this time (all are 32 bytes in size on + * LP64), the code works around the problem by introducing lock arrays to + * protect hash buckets and vnode lists. + * + * II. Filesystem integration + * + * Filesystems participating in name caching do the following: + * - set vop_lookup routine to vfs_cache_lookup + * - set vop_cachedlookup to whatever can perform the lookup if the above fails + * - if they support lockless lookup (see below), vop_fplookup_vexec and + * vop_fplookup_symlink are set along with the MNTK_FPLOOKUP flag on the + * mount point + * - call cache_purge or cache_vop_* routines to eliminate stale entries as + * applicable + * - call cache_enter to add entries depending on the MAKEENTRY flag + * + * With the above in mind, there are 2 entry points when doing lookups: + * - ... -> namei -> cache_fplookup -- this is the default + * - ... -> VOP_LOOKUP -> vfs_cache_lookup -- normally only called by namei + * should the above fail + * + * Example code flow how an entry is added: + * ... -> namei -> cache_fplookup -> cache_fplookup_noentry -> VOP_LOOKUP -> + * vfs_cache_lookup -> VOP_CACHEDLOOKUP -> ufs_lookup_ino -> cache_enter + * + * III. Performance considerations + * + * For lockless case forward lookup avoids any writes to shared areas apart + * from the terminal path component. In other words non-modifying lookups of + * different files don't suffer any scalability problems in the namecache. + * Looking up the same file is limited by VFS and goes beyond the scope of this + * file. + * + * At least on amd64 the single-threaded bottleneck for long paths is hashing + * (see cache_get_hash). There are cases where the code issues acquire fence + * multiple times, they can be combined on architectures which suffer from it. + * + * For locked case each encountered vnode has to be referenced and locked in + * order to be handed out to the caller (normally that's namei). This + * introduces significant hit single-threaded and serialization multi-threaded. + * + * Reverse lookup (e.g., "getcwd") fully scales provided it is fully cached -- + * avoids any writes to shared areas to any components. + * + * Unrelated insertions are partially serialized on updating the global entry + * counter and possibly serialized on colliding bucket or vnode locks. + * + * IV. Observability + * + * Note not everything has an explicit dtrace probe nor it should have, thus + * some of the one-liners below depend on implementation details. + * + * Examples: + * + * # Check what lookups failed to be handled in a lockless manner. Column 1 is + * # line number, column 2 is status code (see cache_fpl_status) + * dtrace -n 'vfs:fplookup:lookup:done { @[arg1, arg2] = count(); }' + * + * # Lengths of names added by binary name + * dtrace -n 'fbt::cache_enter_time:entry { @[execname] = quantize(args[2]->cn_namelen); }' + * + * # Same as above but only those which exceed 64 characters + * dtrace -n 'fbt::cache_enter_time:entry /args[2]->cn_namelen > 64/ { @[execname] = quantize(args[2]->cn_namelen); }' + * + * # Who is performing lookups with spurious slashes (e.g., "foo//bar") and what + * # path is it + * dtrace -n 'fbt::cache_fplookup_skip_slashes:entry { @[execname, stringof(args[0]->cnp->cn_pnbuf)] = count(); }' + * + * V. Limitations and implementation defects + * + * - since it is possible there is no entry for an open file, tools like + * "procstat" may fail to resolve fd -> vnode -> path to anything + * - even if a filesystem adds an entry, it may get purged (e.g., due to memory + * shortage) in which case the above problem applies + * - hardlinks are not tracked, thus if a vnode is reachable in more than one + * way, resolving a name may return a different path than the one used to + * open it (even if said path is still valid) + * - by default entries are not added for newly created files + * - adding an entry may need to evict negative entry first, which happens in 2 + * distinct places (evicting on lookup, adding in a later VOP) making it + * impossible to simply reuse it + * - there is a simple scheme to evict negative entries as the cache is approaching + * its capacity, but it is very unclear if doing so is a good idea to begin with + * - vnodes are subject to being recycled even if target inode is left in memory, + * which loses the name cache entries when it perhaps should not. in case of tmpfs + * names get duplicated -- kept by filesystem itself and namecache separately + * - struct namecache has a fixed size and comes in 2 variants, often wasting space. + * now hard to replace with malloc due to dependence on SMR. + * - lack of better integration with the kernel also turns nullfs into a layered + * filesystem instead of something which can take advantage of caching + */ + static SYSCTL_NODE(_vfs, OID_AUTO, cache, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, "Name cache"); From owner-dev-commits-src-all@freebsd.org Sat Apr 10 06:01:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4AED5CF99C; Sat, 10 Apr 2021 06: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 4FHPXR59wYz4RFK; Sat, 10 Apr 2021 06: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 A269440A0; Sat, 10 Apr 2021 06: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 13A61xhA015073; Sat, 10 Apr 2021 06: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 13A61xb0015072; Sat, 10 Apr 2021 06:01:59 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:01:59 GMT Message-Id: <202104100601.13A61xb0015072@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: e201fa7c98db - stable/13 - cache: comment on FNV 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e201fa7c98db30b6a3c7c66387df68161b71c1ef Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:01:59 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e201fa7c98db30b6a3c7c66387df68161b71c1ef commit e201fa7c98db30b6a3c7c66387df68161b71c1ef Author: Mateusz Guzik AuthorDate: 2021-02-03 20:44:54 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 05:57:54 +0000 cache: comment on FNV (cherry picked from commit b54ed778fe45d482bd1e2009df802fda26f94495) --- sys/kern/vfs_cache.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index db482ea4eba3..47abe0feb152 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -704,9 +704,31 @@ out: SDT_PROBE1(vfs, namecache, purge, batch, i); } +/* + * Hashing. + * + * The code was made to use FNV in 2001 and this choice needs to be revisited. + * + * Short summary of the difficulty: + * The longest name which can be inserted is NAME_MAX characters in length (or + * 255 at the time of writing this comment), while majority of names used in + * practice are significantly shorter (mostly below 10). More importantly + * majority of lookups performed find names are even shorter than that. + * + * This poses a problem where hashes which do better than FNV past word size + * (or so) tend to come with additional overhead when finalizing the result, + * making them noticeably slower for the most commonly used range. + * + * Consider a path like: /usr/obj/usr/src/sys/amd64/GENERIC/vnode_if.c + * + * When looking it up the most time consuming part by a large margin (at least + * on amd64) is hashing. Replacing FNV with something which pessimizes short + * input would make the slowest part stand out even more. + */ + /* * TODO: With the value stored we can do better than computing the hash based - * on the address. The choice of FNV should also be revisited. + * on the address. */ static void cache_prehash(struct vnode *vp) From owner-dev-commits-src-all@freebsd.org Sat Apr 10 06:02:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F3325CF9A8; Sat, 10 Apr 2021 06:02: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 4FHPXX2085z4QnY; Sat, 10 Apr 2021 06:02: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 2BA4E4229; Sat, 10 Apr 2021 06:02: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 13A624kN015157; Sat, 10 Apr 2021 06:02:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A624N0015156; Sat, 10 Apr 2021 06:02:04 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:02:04 GMT Message-Id: <202104100602.13A624N0015156@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: ca718f503168 - stable/13 - libkern: use compiler builtins for strcpy, strcmp and strlen 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/stable/13 X-Git-Reftype: branch X-Git-Commit: ca718f503168291d3f764e32f7642501c5283efd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:02:04 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=ca718f503168291d3f764e32f7642501c5283efd commit ca718f503168291d3f764e32f7642501c5283efd Author: Mateusz Guzik AuthorDate: 2021-02-07 19:50:25 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 05:57:55 +0000 libkern: use compiler builtins for strcpy, strcmp and strlen (cherry picked from commit 81e074d57dfcd86f152e2848dc44b77087ee7a2d) --- sys/sys/libkern.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index 3874ef9ec4bd..3f8827de06c5 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -199,6 +199,10 @@ size_t kcsan_strlen(const char *); #define strcpy(d, s) kcsan_strcpy((d), (s)) #define strcmp(s1, s2) kcsan_strcmp((s1), (s2)) #define strlen(s) kcsan_strlen((s)) +#else +#define strcpy(d, s) __builtin_strcpy((d), (s)) +#define strcmp(s1, s2) __builtin_strcmp((s1), (s2)) +#define strlen(s) __builtin_strlen((s)) #endif static __inline char * From owner-dev-commits-src-all@freebsd.org Sat Apr 10 06:02:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 047B55CF9BB; Sat, 10 Apr 2021 06:02: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 4FHPXZ4Bsgz4R4g; Sat, 10 Apr 2021 06:02: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 5CCEE3F9E; Sat, 10 Apr 2021 06:02: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 13A6262K015205; Sat, 10 Apr 2021 06:02:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A6264L015204; Sat, 10 Apr 2021 06:02:06 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:02:06 GMT Message-Id: <202104100602.13A6264L015204@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 4cb1b49b3c98 - stable/13 - cache: assorted comment fixups 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4cb1b49b3c985e97933a6194646bab47ece82400 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:02:07 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=4cb1b49b3c985e97933a6194646bab47ece82400 commit 4cb1b49b3c985e97933a6194646bab47ece82400 Author: Mateusz Guzik AuthorDate: 2021-02-09 16:06:27 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 05:57:55 +0000 cache: assorted comment fixups (cherry picked from commit 39e0c3f686387605591f8f646ceec53613619525) --- sys/kern/vfs_cache.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 21eb436681fc..fef1e31d197b 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -5268,6 +5268,10 @@ cache_fplookup_parse(struct cache_fpl *fpl) cache_fpl_pathlen_sub(fpl, cnp->cn_namelen); #ifdef INVARIANTS + /* + * cache_get_hash only accepts lengths up to NAME_MAX. This is fine since + * we are going to fail this lookup with ENAMETOOLONG (see below). + */ if (cnp->cn_namelen <= NAME_MAX) { if (fpl->hash != cache_get_hash(cnp->cn_nameptr, cnp->cn_namelen, dvp)) { panic("%s: mismatched hash for [%s] len %ld", __func__, @@ -5359,7 +5363,7 @@ cache_fplookup_skip_slashes(struct cache_fpl *fpl) * manner relying on an invariant that a non-directory vnode will get a miss. * In this case cn_nameptr[0] == '\0' and cn_namelen == 0. * - * Thus for a path like "foo/bar/" the code unwinds the state back to 'bar/' + * Thus for a path like "foo/bar/" the code unwinds the state back to "bar/" * and denotes this is the last path component, which avoids looping back. * * Only plain lookups are supported for now to restrict corner cases to handle. @@ -5454,14 +5458,14 @@ cache_fplookup_trailingslash(struct cache_fpl *fpl) #endif /* - * The previous directory is this one. + * If this was a "./" lookup the parent directory is already correct. */ if (cnp->cn_nameptr[0] == '.' && cnp->cn_namelen == 1) { return (0); } /* - * The previous directory is something else. + * Otherwise we need to look it up. */ tvp = fpl->tvp; ncp = atomic_load_consume_ptr(&tvp->v_cache_dd); @@ -5495,10 +5499,11 @@ cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error) dvp_seqc = fpl->dvp_seqc; /* - * TODO: Due to ignoring slashes lookup will perform a permission check - * on the last dir when it should not have. If it fails, we get here. - * It is possible possible to fix it up fully without resorting to - * regular lookup, but for now just abort. + * TODO: Due to ignoring trailing slashes lookup will perform a + * permission check on the last dir when it should not be doing it. It + * may fail, but said failure should be ignored. It is possible to fix + * it up fully without resorting to regular lookup, but for now just + * abort. */ if (cache_fpl_istrailingslash(fpl)) { return (cache_fpl_aborted(fpl)); From owner-dev-commits-src-all@freebsd.org Sat Apr 10 06:02:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C2135CF669; Sat, 10 Apr 2021 06:02: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 4FHPXg0g0Sz4RJ3; Sat, 10 Apr 2021 06:02: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 0368B3F67; Sat, 10 Apr 2021 06:02: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 13A62AfB015290; Sat, 10 Apr 2021 06:02:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A62AB5015289; Sat, 10 Apr 2021 06:02:10 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:02:10 GMT Message-Id: <202104100602.13A62AB5015289@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 5dd2f40ab47c - stable/13 - cache: fix resizing in face of lockless lookup 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5dd2f40ab47c02906a0fd86af45794b0e3869483 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:02:11 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=5dd2f40ab47c02906a0fd86af45794b0e3869483 commit 5dd2f40ab47c02906a0fd86af45794b0e3869483 Author: Mateusz Guzik AuthorDate: 2021-03-29 19:17:57 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 05:57:56 +0000 cache: fix resizing in face of lockless lookup Reported by: pho Tested by: pho (cherry picked from commit dc532884d582db6da833d598e4bb37ad1880947c) --- sys/kern/vfs_cache.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 106 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index fef1e31d197b..ad91fb1686a4 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -455,6 +455,9 @@ static long cache_lock_vnodes_cel_3_failures; DEBUGNODE_ULONG(vnodes_cel_3_failures, cache_lock_vnodes_cel_3_failures, "Number of times 3-way vnode locking failed"); +static void cache_fplookup_lockout(void); +static void cache_fplookup_restore(void); + static void cache_zap_locked(struct namecache *ncp); static int vn_fullpath_hardlink(struct nameidata *ndp, char **retbuf, char **freebuf, size_t *buflen); @@ -2544,11 +2547,76 @@ cache_vnode_init(struct vnode *vp) cache_prehash(vp); } +/* + * Induce transient cache misses for lockless operation in cache_lookup() by + * using a temporary hash table. + * + * This will force a fs lookup. + * + * Synchronisation is done in 2 steps, calling vfs_smr_quiesce each time + * to observe all CPUs not performing the lookup. + */ +static void +cache_changesize_set_temp(struct nchashhead *temptbl, u_long temphash) +{ + + MPASS(temphash < nchash); + /* + * Change the size. The new size is smaller and can safely be used + * against the existing table. All lookups which now hash wrong will + * result in a cache miss, which all callers are supposed to know how + * to handle. + */ + atomic_store_long(&nchash, temphash); + atomic_thread_fence_rel(); + vfs_smr_quiesce(); + /* + * At this point everyone sees the updated hash value, but they still + * see the old table. + */ + atomic_store_ptr(&nchashtbl, temptbl); + atomic_thread_fence_rel(); + vfs_smr_quiesce(); + /* + * At this point everyone sees the updated table pointer and size pair. + */ +} + +/* + * Set the new hash table. + * + * Similarly to cache_changesize_set_temp(), this has to synchronize against + * lockless operation in cache_lookup(). + */ +static void +cache_changesize_set_new(struct nchashhead *new_tbl, u_long new_hash) +{ + + MPASS(nchash < new_hash); + /* + * Change the pointer first. This wont result in out of bounds access + * since the temporary table is guaranteed to be smaller. + */ + atomic_store_ptr(&nchashtbl, new_tbl); + atomic_thread_fence_rel(); + vfs_smr_quiesce(); + /* + * At this point everyone sees the updated pointer value, but they + * still see the old size. + */ + atomic_store_long(&nchash, new_hash); + atomic_thread_fence_rel(); + vfs_smr_quiesce(); + /* + * At this point everyone sees the updated table pointer and size pair. + */ +} + void cache_changesize(u_long newmaxvnodes) { - struct nchashhead *new_nchashtbl, *old_nchashtbl; - u_long new_nchash, old_nchash; + struct nchashhead *new_nchashtbl, *old_nchashtbl, *temptbl; + u_long new_nchash, old_nchash, temphash; struct namecache *ncp; uint32_t hash; u_long newncsize; @@ -2565,30 +2633,36 @@ cache_changesize(u_long newmaxvnodes) ncfreetbl(new_nchashtbl); return; } + + temptbl = nchinittbl(1, &temphash); + /* * Move everything from the old hash table to the new table. * None of the namecache entries in the table can be removed * because to do so, they have to be removed from the hash table. */ + cache_fplookup_lockout(); cache_lock_all_vnodes(); cache_lock_all_buckets(); old_nchashtbl = nchashtbl; old_nchash = nchash; - nchashtbl = new_nchashtbl; - nchash = new_nchash; + cache_changesize_set_temp(temptbl, temphash); for (i = 0; i <= old_nchash; i++) { while ((ncp = CK_SLIST_FIRST(&old_nchashtbl[i])) != NULL) { hash = cache_get_hash(ncp->nc_name, ncp->nc_nlen, ncp->nc_dvp); CK_SLIST_REMOVE(&old_nchashtbl[i], ncp, namecache, nc_hash); - CK_SLIST_INSERT_HEAD(NCHHASH(hash), ncp, nc_hash); + CK_SLIST_INSERT_HEAD(&new_nchashtbl[hash & new_nchash], ncp, nc_hash); } } ncsize = newncsize; cache_recalc_neg_min(ncnegminpct); + cache_changesize_set_new(new_nchashtbl, new_nchash); cache_unlock_all_buckets(); cache_unlock_all_vnodes(); + cache_fplookup_restore(); ncfreetbl(old_nchashtbl); + ncfreetbl(temptbl); } /* @@ -3661,6 +3735,33 @@ syscal_vfs_cache_fast_lookup(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_vfs, OID_AUTO, cache_fast_lookup, CTLTYPE_INT|CTLFLAG_RW|CTLFLAG_MPSAFE, &cache_fast_lookup, 0, syscal_vfs_cache_fast_lookup, "IU", ""); +/* + * Disable lockless lookup and observe all CPUs not executing it. + * + * Used when resizing the hash table. + * + * TODO: no provisions are made to handle tweaking of the knob at the same time + */ +static void +cache_fplookup_lockout(void) +{ + bool on; + + on = atomic_load_char(&cache_fast_lookup_enabled); + if (on) { + atomic_store_char(&cache_fast_lookup_enabled, false); + atomic_thread_fence_rel(); + vfs_smr_quiesce(); + } +} + +static void +cache_fplookup_restore(void) +{ + + cache_fast_lookup_enabled_recalc(); +} + /* * Components of nameidata (or objects it can point to) which may * need restoring in case fast path lookup fails. From owner-dev-commits-src-all@freebsd.org Sat Apr 10 06:02:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E235E5CF9D2; Sat, 10 Apr 2021 06:02: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 4FHPXk46gyz4R52; Sat, 10 Apr 2021 06:02: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 6B4F440A3; Sat, 10 Apr 2021 06:02: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 13A62Eia015353; Sat, 10 Apr 2021 06:02:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A62Ef3015352; Sat, 10 Apr 2021 06:02:14 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:02:14 GMT Message-Id: <202104100602.13A62Ef3015352@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: e9fc871b0dec - stable/13 - vfs: replace vfs_smr_quiesce with vfs_smr_synchronize 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/stable/13 X-Git-Reftype: branch X-Git-Commit: e9fc871b0dec47b943dd2d09688aa9fe867bfc9b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:02:15 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e9fc871b0dec47b943dd2d09688aa9fe867bfc9b commit e9fc871b0dec47b943dd2d09688aa9fe867bfc9b Author: Mateusz Guzik AuthorDate: 2021-04-08 07:08:41 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 05:57:56 +0000 vfs: replace vfs_smr_quiesce with vfs_smr_synchronize This ends up using a smr specific method. Suggested by: markj Tested by: pho (cherry picked from commit 72b3b5a941927f7a79611131f144eeb2dc9143c9) --- sys/kern/vfs_cache.c | 12 ++++++------ sys/sys/vnode.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index ddeb87e269d7..b5fa21eea887 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -2678,7 +2678,7 @@ cache_vnode_init(struct vnode *vp) * * This will force a fs lookup. * - * Synchronisation is done in 2 steps, calling vfs_smr_quiesce each time + * Synchronisation is done in 2 steps, calling vfs_smr_synchronize each time * to observe all CPUs not performing the lookup. */ static void @@ -2694,14 +2694,14 @@ cache_changesize_set_temp(struct nchashhead *temptbl, u_long temphash) */ atomic_store_long(&nchash, temphash); atomic_thread_fence_rel(); - vfs_smr_quiesce(); + vfs_smr_synchronize(); /* * At this point everyone sees the updated hash value, but they still * see the old table. */ atomic_store_ptr(&nchashtbl, temptbl); atomic_thread_fence_rel(); - vfs_smr_quiesce(); + vfs_smr_synchronize(); /* * At this point everyone sees the updated table pointer and size pair. */ @@ -2724,14 +2724,14 @@ cache_changesize_set_new(struct nchashhead *new_tbl, u_long new_hash) */ atomic_store_ptr(&nchashtbl, new_tbl); atomic_thread_fence_rel(); - vfs_smr_quiesce(); + vfs_smr_synchronize(); /* * At this point everyone sees the updated pointer value, but they * still see the old size. */ atomic_store_long(&nchash, new_hash); atomic_thread_fence_rel(); - vfs_smr_quiesce(); + vfs_smr_synchronize(); /* * At this point everyone sees the updated table pointer and size pair. */ @@ -3876,7 +3876,7 @@ cache_fplookup_lockout(void) if (on) { atomic_store_char(&cache_fast_lookup_enabled, false); atomic_thread_fence_rel(); - vfs_smr_quiesce(); + vfs_smr_synchronize(); } } diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index e37302aeb379..d26c8aa70d8e 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1109,7 +1109,7 @@ int vn_dir_check_exec(struct vnode *vp, struct componentname *cnp); #define VFS_SMR() vfs_smr #define vfs_smr_enter() smr_enter(VFS_SMR()) #define vfs_smr_exit() smr_exit(VFS_SMR()) -#define vfs_smr_quiesce() quiesce_all_critical() +#define vfs_smr_synchronize() smr_synchronize(VFS_SMR()) #define vfs_smr_entered_load(ptr) smr_entered_load((ptr), VFS_SMR()) #define VFS_SMR_ASSERT_ENTERED() SMR_ASSERT_ENTERED(VFS_SMR()) #define VFS_SMR_ASSERT_NOT_ENTERED() SMR_ASSERT_NOT_ENTERED(VFS_SMR()) From owner-dev-commits-src-all@freebsd.org Sat Apr 10 06:02:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC27A5CF9A0; Sat, 10 Apr 2021 06:02: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 4FHPXS5mT8z4R4R; Sat, 10 Apr 2021 06:02: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 B6E59412F; Sat, 10 Apr 2021 06:02: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 13A620bQ015094; Sat, 10 Apr 2021 06:02:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A620oC015093; Sat, 10 Apr 2021 06:02:00 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:02:00 GMT Message-Id: <202104100602.13A620oC015093@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 7815eb006223 - stable/13 - cache: drop spurious arg from panic in cache_validate 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 7815eb006223c7020c1322c0fdf949fb18d28a07 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:02:01 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=7815eb006223c7020c1322c0fdf949fb18d28a07 commit 7815eb006223c7020c1322c0fdf949fb18d28a07 Author: Mateusz Guzik AuthorDate: 2021-02-05 22:49:59 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 05:57:54 +0000 cache: drop spurious arg from panic in cache_validate vp is already reported when noting mismatch (cherry picked from commit 2e96132a7d8bbb2347a3b4776806324f984aa49f) --- sys/kern/vfs_cache.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 47abe0feb152..5cfc23779c42 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -2824,9 +2824,8 @@ cache_validate(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen && !bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen)) { if (ncp->nc_vp != vp) - panic("%s: mismatch (%p != %p); ncp %p [%s] dvp %p vp %p\n", - __func__, vp, ncp->nc_vp, ncp, ncp->nc_name, ncp->nc_dvp, - ncp->nc_vp); + panic("%s: mismatch (%p != %p); ncp %p [%s] dvp %p\n", + __func__, vp, ncp->nc_vp, ncp, ncp->nc_name, ncp->nc_dvp); } } mtx_unlock(blp); From owner-dev-commits-src-all@freebsd.org Sat Apr 10 06:02:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A94C5CFB24; Sat, 10 Apr 2021 06:02: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 4FHPXc0TYsz4RHx; Sat, 10 Apr 2021 06:02: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 8BFBE422D; Sat, 10 Apr 2021 06:02: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 13A627Yr015226; Sat, 10 Apr 2021 06:02:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A627Uh015225; Sat, 10 Apr 2021 06:02:07 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:02:07 GMT Message-Id: <202104100602.13A627Uh015225@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: fb16013129a1 - stable/13 - vfs: add vfs_ref_from_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/stable/13 X-Git-Reftype: branch X-Git-Commit: fb16013129a10a10be46197a82b814e479ed0905 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:02:08 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=fb16013129a10a10be46197a82b814e479ed0905 commit fb16013129a10a10be46197a82b814e479ed0905 Author: Mateusz Guzik AuthorDate: 2021-02-15 22:08:40 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 05:57:55 +0000 vfs: add vfs_ref_from_vp This generalizes what vop_stdgetwritemount used to be doing. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D28695 (cherry picked from commit a15f787adb4429b83fa911dcb60f69121aaee1ba) --- sys/kern/vfs_default.c | 25 +------------------------ sys/kern/vfs_mount.c | 38 ++++++++++++++++++++++++++++++++++++++ sys/sys/mount.h | 1 + 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 3c428d7b7511..4b9b1b43f1ce 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -680,7 +680,6 @@ vop_stdgetwritemount(ap) } */ *ap; { struct mount *mp; - struct mount_pcpu *mpcpu; struct vnode *vp; /* @@ -693,29 +692,7 @@ vop_stdgetwritemount(ap) * with releasing it. */ vp = ap->a_vp; - mp = vp->v_mount; - if (mp == NULL) { - *(ap->a_mpp) = NULL; - return (0); - } - if (vfs_op_thread_enter(mp, mpcpu)) { - if (mp == vp->v_mount) { - vfs_mp_count_add_pcpu(mpcpu, ref, 1); - vfs_op_thread_exit(mp, mpcpu); - } else { - vfs_op_thread_exit(mp, mpcpu); - mp = NULL; - } - } else { - MNT_ILOCK(mp); - if (mp == vp->v_mount) { - MNT_REF(mp); - MNT_IUNLOCK(mp); - } else { - MNT_IUNLOCK(mp); - mp = NULL; - } - } + mp = vfs_ref_from_vp(vp); *(ap->a_mpp) = mp; return (0); } diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 59000728efcc..7dc6b795eefd 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -449,6 +449,44 @@ sys_nmount(struct thread *td, struct nmount_args *uap) * Various utility functions */ +/* + * Get a reference on a mount point from a vnode. + * + * The vnode is allowed to be passed unlocked and race against dooming. Note in + * such case there are no guarantees the referenced mount point will still be + * associated with it after the function returns. + */ +struct mount * +vfs_ref_from_vp(struct vnode *vp) +{ + struct mount *mp; + struct mount_pcpu *mpcpu; + + mp = atomic_load_ptr(&vp->v_mount); + if (__predict_false(mp == NULL)) { + return (mp); + } + if (vfs_op_thread_enter(mp, mpcpu)) { + if (__predict_true(mp == vp->v_mount)) { + vfs_mp_count_add_pcpu(mpcpu, ref, 1); + vfs_op_thread_exit(mp, mpcpu); + } else { + vfs_op_thread_exit(mp, mpcpu); + mp = NULL; + } + } else { + MNT_ILOCK(mp); + if (mp == vp->v_mount) { + MNT_REF(mp); + MNT_IUNLOCK(mp); + } else { + MNT_IUNLOCK(mp); + mp = NULL; + } + } + return (mp); +} + void vfs_ref(struct mount *mp) { diff --git a/sys/sys/mount.h b/sys/sys/mount.h index 98d50161bed5..e6a74bf1fb60 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -997,6 +997,7 @@ void vfs_mount_error(struct mount *, const char *, ...); void vfs_mountroot(void); /* mount our root filesystem */ void vfs_mountedfrom(struct mount *, const char *from); void vfs_notify_upper(struct vnode *, int); +struct mount *vfs_ref_from_vp(struct vnode *); void vfs_ref(struct mount *); void vfs_rel(struct mount *); struct mount *vfs_mount_alloc(struct vnode *, struct vfsconf *, const char *, From owner-dev-commits-src-all@freebsd.org Sat Apr 10 06:02:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56B585CF877; Sat, 10 Apr 2021 06:02: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 4FHPXT6qzdz4R99; Sat, 10 Apr 2021 06:02: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 DA5914130; Sat, 10 Apr 2021 06:02: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 13A621xE015115; Sat, 10 Apr 2021 06:02:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A621kH015114; Sat, 10 Apr 2021 06:02:01 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:02:01 GMT Message-Id: <202104100602.13A621kH015114@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 565872e3ed7c - stable/13 - cache: fix vfs:namecache:lookup:miss probe call sites 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 565872e3ed7c13a7412a055f9a6fab4453d2f460 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:02:02 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=565872e3ed7c13a7412a055f9a6fab4453d2f460 commit 565872e3ed7c13a7412a055f9a6fab4453d2f460 Author: Mateusz Guzik AuthorDate: 2021-02-05 22:58:27 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 05:57:55 +0000 cache: fix vfs:namecache:lookup:miss probe call sites (cherry picked from commit 0e1594e60e5e0b1fddc33225171f1d1c6a421ed4) --- sys/kern/vfs_cache.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index 5cfc23779c42..50ec6face6ac 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -1767,7 +1767,7 @@ retry: mtx_lock(dvlp); ncp = dvp->v_cache_dd; if (ncp == NULL) { - SDT_PROBE3(vfs, namecache, lookup, miss, dvp, "..", NULL); + SDT_PROBE2(vfs, namecache, lookup, miss, dvp, ".."); mtx_unlock(dvlp); return (0); } @@ -1894,8 +1894,7 @@ retry: if (__predict_false(ncp == NULL)) { mtx_unlock(blp); - SDT_PROBE3(vfs, namecache, lookup, miss, dvp, cnp->cn_nameptr, - NULL); + SDT_PROBE2(vfs, namecache, lookup, miss, dvp, cnp->cn_nameptr); counter_u64_add(nummiss, 1); return (0); } @@ -1990,8 +1989,7 @@ cache_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, if (__predict_false(ncp == NULL)) { vfs_smr_exit(); - SDT_PROBE3(vfs, namecache, lookup, miss, dvp, cnp->cn_nameptr, - NULL); + SDT_PROBE2(vfs, namecache, lookup, miss, dvp, cnp->cn_nameptr); counter_u64_add(nummiss, 1); return (0); } From owner-dev-commits-src-all@freebsd.org Sat Apr 10 06:02:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78EE65CF7F1; Sat, 10 Apr 2021 06:02: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 4FHPXY2sJZz4R4c; Sat, 10 Apr 2021 06:02: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 492F8422A; Sat, 10 Apr 2021 06:02: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 13A625Zv015184; Sat, 10 Apr 2021 06:02:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A625Cj015183; Sat, 10 Apr 2021 06:02:05 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:02:05 GMT Message-Id: <202104100602.13A625Cj015183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: c3437848d868 - stable/13 - devfs: fix use count leak when using TIOCSCTTY 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c3437848d8683f6ad03a15bde201c4ead541378e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:02:05 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=c3437848d8683f6ad03a15bde201c4ead541378e commit c3437848d8683f6ad03a15bde201c4ead541378e Author: Mateusz Guzik AuthorDate: 2021-02-08 22:10:57 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 05:57:55 +0000 devfs: fix use count leak when using TIOCSCTTY by matching devfs_ctty_ref Fixes: 3b44443626603f65 ("devfs: rework si_usecount to track opens") (cherry picked from commit 3bc17248d31794519ba95b2c6b9ff8a0d31dba81) --- sys/fs/devfs/devfs_vnops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 983bfc803999..043cee74fde2 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -974,7 +974,7 @@ devfs_ioctl(struct vop_ioctl_args *ap) /* Get rid of reference to old control tty */ if (vpold) - vrele(vpold); + devfs_ctty_unref(vpold); } return (error); } From owner-dev-commits-src-all@freebsd.org Sat Apr 10 06:02:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0793E5CFB26; Sat, 10 Apr 2021 06:02: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 4FHPXc5jmDz4R9k; Sat, 10 Apr 2021 06:02: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 A82BB422F; Sat, 10 Apr 2021 06:02: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 13A628bW015247; Sat, 10 Apr 2021 06:02:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A6289I015246; Sat, 10 Apr 2021 06:02:08 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:02:08 GMT Message-Id: <202104100602.13A6289I015246@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 4606d441703d - stable/13 - vfs: employ vfs_ref_from_vp in statfs and fstatfs 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4606d441703d695ab74d6e66fadc18703615e4dc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:02:09 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=4606d441703d695ab74d6e66fadc18703615e4dc commit 4606d441703d695ab74d6e66fadc18703615e4dc Author: Mateusz Guzik AuthorDate: 2021-02-15 22:08:20 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 05:57:55 +0000 vfs: employ vfs_ref_from_vp in statfs and fstatfs Avoids locking and unlocking the vnode. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D28695 (cherry picked from commit 81174cd8e24aa2bb27f6a8b41032abf59add479f) --- sys/kern/vfs_syscalls.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 40dd8c069bfb..3db34c3689de 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -331,15 +331,13 @@ kern_statfs(struct thread *td, const char *path, enum uio_seg pathseg, struct nameidata nd; int error; - NDINIT(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | AUDITVNODE1, - pathseg, path, td); + NDINIT(&nd, LOOKUP, FOLLOW | AUDITVNODE1, pathseg, path, td); error = namei(&nd); if (error != 0) return (error); - mp = nd.ni_vp->v_mount; - vfs_ref(mp); + mp = vfs_ref_from_vp(nd.ni_vp); NDFREE_NOTHING(&nd); - vput(nd.ni_vp); + vrele(nd.ni_vp); return (kern_do_statfs(td, mp, buf)); } @@ -379,14 +377,14 @@ kern_fstatfs(struct thread *td, int fd, struct statfs *buf) if (error != 0) return (error); vp = fp->f_vnode; - vn_lock(vp, LK_SHARED | LK_RETRY); #ifdef AUDIT - AUDIT_ARG_VNODE1(vp); + if (AUDITING_TD(td)) { + vn_lock(vp, LK_SHARED | LK_RETRY); + AUDIT_ARG_VNODE1(vp); + VOP_UNLOCK(vp); + } #endif - mp = vp->v_mount; - if (mp != NULL) - vfs_ref(mp); - VOP_UNLOCK(vp); + mp = vfs_ref_from_vp(vp); fdrop(fp, td); return (kern_do_statfs(td, mp, buf)); } From owner-dev-commits-src-all@freebsd.org Sat Apr 10 06:02:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 28EA55CFB31; Sat, 10 Apr 2021 06:02:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FHPXd6P0Nz4RLW; Sat, 10 Apr 2021 06:02: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 CC06840A2; Sat, 10 Apr 2021 06:02: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 13A629VO015268; Sat, 10 Apr 2021 06:02:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A629qt015267; Sat, 10 Apr 2021 06:02:09 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:02:09 GMT Message-Id: <202104100602.13A629qt015267@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 8ef8057ed5f1 - stable/13 - vfs: add vfs_smr_quiesce 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 8ef8057ed5f16dde7a243e2cc557bc6cd4dfcdf9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:02:10 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8ef8057ed5f16dde7a243e2cc557bc6cd4dfcdf9 commit 8ef8057ed5f16dde7a243e2cc557bc6cd4dfcdf9 Author: Mateusz Guzik AuthorDate: 2021-03-30 14:44:10 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 05:57:55 +0000 vfs: add vfs_smr_quiesce This can be used to observe all CPUs not executing while within vfs_smr_enter. (cherry picked from commit 3f56bc79860ec20f0e53de42dab1c117ee68e37b) --- sys/sys/vnode.h | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index bb07cd80e42e..e37302aeb379 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -1109,6 +1109,7 @@ int vn_dir_check_exec(struct vnode *vp, struct componentname *cnp); #define VFS_SMR() vfs_smr #define vfs_smr_enter() smr_enter(VFS_SMR()) #define vfs_smr_exit() smr_exit(VFS_SMR()) +#define vfs_smr_quiesce() quiesce_all_critical() #define vfs_smr_entered_load(ptr) smr_entered_load((ptr), VFS_SMR()) #define VFS_SMR_ASSERT_ENTERED() SMR_ASSERT_ENTERED(VFS_SMR()) #define VFS_SMR_ASSERT_NOT_ENTERED() SMR_ASSERT_NOT_ENTERED(VFS_SMR()) From owner-dev-commits-src-all@freebsd.org Sat Apr 10 06:02:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 752045CFA2B; Sat, 10 Apr 2021 06:02: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 4FHPXj2VHCz4RCs; Sat, 10 Apr 2021 06:02: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 474813C38; Sat, 10 Apr 2021 06:02: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 13A62DsK015332; Sat, 10 Apr 2021 06:02:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A62DiO015331; Sat, 10 Apr 2021 06:02:13 GMT (envelope-from git) Date: Sat, 10 Apr 2021 06:02:13 GMT Message-Id: <202104100602.13A62DiO015331@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: f1727a66974f - stable/13 - cache: update an assert on CACHE_FPL_STATUS_ABORTED 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/stable/13 X-Git-Reftype: branch X-Git-Commit: f1727a66974f07c44ab7f2770a7320c7d5a3800f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 06:02:13 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=f1727a66974f07c44ab7f2770a7320c7d5a3800f commit f1727a66974f07c44ab7f2770a7320c7d5a3800f Author: Mateusz Guzik AuthorDate: 2021-04-06 20:31:48 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 05:57:56 +0000 cache: update an assert on CACHE_FPL_STATUS_ABORTED Since symlink support it can get upgraded to CACHE_FPL_STATUS_DESTROYED. Reported by: bdrewery (cherry picked from commit 13b3862ee874db0b5efae484934de9b20da864e4) --- sys/kern/vfs_cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index a3af949597af..ddeb87e269d7 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -4655,7 +4655,8 @@ cache_fplookup_final_withparent(struct cache_fpl *fpl) error = cache_fplookup_final_child(fpl, tvs); if (__predict_false(error != 0)) { - MPASS(fpl->status == CACHE_FPL_STATUS_ABORTED); + MPASS(fpl->status == CACHE_FPL_STATUS_ABORTED || + fpl->status == CACHE_FPL_STATUS_DESTROYED); if ((cnp->cn_flags & LOCKPARENT) != 0) vput(dvp); else From owner-dev-commits-src-all@freebsd.org Sat Apr 10 08:32:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9E225DD187; Sat, 10 Apr 2021 08:32: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 4FHStN5sCyz4lNd; Sat, 10 Apr 2021 08:32: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 BC1A45D7D; Sat, 10 Apr 2021 08:32: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 13A8Wiuw015127; Sat, 10 Apr 2021 08:32:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A8WiAg015126; Sat, 10 Apr 2021 08:32:44 GMT (envelope-from git) Date: Sat, 10 Apr 2021 08:32:44 GMT Message-Id: <202104100832.13A8WiAg015126@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: 44f3b1aa980e - main - rc: kldxref only needs to depend on rootfs, not FILESYSTEMS 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: 44f3b1aa980e747ce9b72ba4333c80a99d8cd966 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 08:32:44 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=44f3b1aa980e747ce9b72ba4333c80a99d8cd966 commit 44f3b1aa980e747ce9b72ba4333c80a99d8cd966 Author: Edward Tomasz Napierala AuthorDate: 2021-04-10 08:19:25 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-04-10 08:31:12 +0000 rc: kldxref only needs to depend on rootfs, not FILESYSTEMS This makes it run a bit earlier in the startup, which will be useful for the linux rc script later on. Reviewed By: imp (earlier version) Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29589 --- libexec/rc/rc.d/kldxref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/kldxref b/libexec/rc/rc.d/kldxref index 4d232ee0d4cf..4c1fa15f2a35 100755 --- a/libexec/rc/rc.d/kldxref +++ b/libexec/rc/rc.d/kldxref @@ -4,7 +4,7 @@ # # PROVIDE: kldxref -# REQUIRE: FILESYSTEMS +# REQUIRE: root # BEFORE: netif # KEYWORD: nojail From owner-dev-commits-src-all@freebsd.org Sat Apr 10 08:38:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EB425DEECC; Sat, 10 Apr 2021 08:38: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 4FHT0c74TWz4m07; Sat, 10 Apr 2021 08:38: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 E5ECD5D7E; Sat, 10 Apr 2021 08:38: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 13A8c8qa015893; Sat, 10 Apr 2021 08:38:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A8c8Nb015892; Sat, 10 Apr 2021 08:38:08 GMT (envelope-from git) Date: Sat, 10 Apr 2021 08:38:08 GMT Message-Id: <202104100838.13A8c8Nb015892@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Toomas Soome Subject: git: 3056bbfc2cb2 - stable/13 - loader: we should support pools without features MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tsoome X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3056bbfc2cb24ec80ebfd831bf5c2fb3d7596a2f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 08:38:09 -0000 The branch stable/13 has been updated by tsoome: URL: https://cgit.FreeBSD.org/src/commit/?id=3056bbfc2cb24ec80ebfd831bf5c2fb3d7596a2f commit 3056bbfc2cb24ec80ebfd831bf5c2fb3d7596a2f Author: Toomas Soome AuthorDate: 2021-04-02 23:40:51 +0000 Commit: Toomas Soome CommitDate: 2021-04-09 20:09:28 +0000 loader: we should support pools without features nvlist_check_features_for_read() does return error when there are no features for read. Reported by: yuripv (cherry picked from commit d36341f7b8ddc2457a1e9e4a721d27d2e66cb39a) --- stand/libsa/zfs/zfsimpl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/stand/libsa/zfs/zfsimpl.c b/stand/libsa/zfs/zfsimpl.c index bc577f168459..7036b508fa3c 100644 --- a/stand/libsa/zfs/zfsimpl.c +++ b/stand/libsa/zfs/zfsimpl.c @@ -191,8 +191,16 @@ nvlist_check_features_for_read(nvlist_t *nvl) rc = nvlist_find(nvl, ZPOOL_CONFIG_FEATURES_FOR_READ, DATA_TYPE_NVLIST, NULL, &features, NULL); - if (rc != 0) - return (rc); + switch (rc) { + case 0: + break; /* Continue with checks */ + + case ENOENT: + return (0); /* All features are disabled */ + + default: + return (rc); /* Error while reading nvlist */ + } data = (nvs_data_t *)features->nv_data; nvp = &data->nvl_pair; /* first pair in nvlist */ From owner-dev-commits-src-all@freebsd.org Sat Apr 10 09:14:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4AA4F5DFB39; Sat, 10 Apr 2021 09:14: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 4FHTpJ1ZYPz4n0s; Sat, 10 Apr 2021 09:14: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 21B0B6B83; Sat, 10 Apr 2021 09:14: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 13A9EFgp068645; Sat, 10 Apr 2021 09:14:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A9EFP6068644; Sat, 10 Apr 2021 09:14:15 GMT (envelope-from git) Date: Sat, 10 Apr 2021 09:14:15 GMT Message-Id: <202104100914.13A9EFP6068644@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: 28b475b01832 - main - Cross-reference camcontrol(8) and zonectl(8) man pages. 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: 28b475b01832af786f3bbd2aafec9caf121b9ca8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 09:14:16 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=28b475b01832af786f3bbd2aafec9caf121b9ca8 commit 28b475b01832af786f3bbd2aafec9caf121b9ca8 Author: Edward Tomasz Napierala AuthorDate: 2021-04-10 09:13:29 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-04-10 09:13:29 +0000 Cross-reference camcontrol(8) and zonectl(8) man pages. --- sbin/camcontrol/camcontrol.8 | 4 +++- usr.sbin/zonectl/zonectl.8 | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/sbin/camcontrol/camcontrol.8 b/sbin/camcontrol/camcontrol.8 index cf7aec25022d..9c128131d817 100644 --- a/sbin/camcontrol/camcontrol.8 +++ b/sbin/camcontrol/camcontrol.8 @@ -2919,7 +2919,9 @@ that was created using this format string. .Xr cam_cdbparse 3 , .Xr cam 4 , .Xr pass 4 , -.Xr xpt 4 +.Xr xpt 4 , +.Xr trim 8 , +.Xr zonectl 8 .Sh HISTORY The .Nm diff --git a/usr.sbin/zonectl/zonectl.8 b/usr.sbin/zonectl/zonectl.8 index 39b418ceb395..1338bf197eb2 100644 --- a/usr.sbin/zonectl/zonectl.8 +++ b/usr.sbin/zonectl/zonectl.8 @@ -226,5 +226,7 @@ zonectl -d /dev/da5 -c rwp -l 0x2c80000 .Pp Issue the Reset Write Pointer command to disk da5 for the zone that starts at LBA 0x2c80000. +.Sh SEE ALSO +.Xr camcontrol 8 .Sh AUTHORS .An Kenneth Merry Aq ken@FreeBSD.org From owner-dev-commits-src-all@freebsd.org Sat Apr 10 09:16:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E06C5DFFED; Sat, 10 Apr 2021 09:16: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 4FHTrf0kV2z4nc3; Sat, 10 Apr 2021 09:16: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 0B57A6759; Sat, 10 Apr 2021 09:16: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 13A9GHwu068929; Sat, 10 Apr 2021 09:16:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A9GH6G068928; Sat, 10 Apr 2021 09:16:17 GMT (envelope-from git) Date: Sat, 10 Apr 2021 09:16:17 GMT Message-Id: <202104100916.13A9GH6G068928@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: 5c62eded5a11 - main - pf: Introduce nvlist variant of DIOCADDRULE 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: 5c62eded5a11ebdb1d57134d923596e2b04e9466 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 09:16:18 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5c62eded5a11ebdb1d57134d923596e2b04e9466 commit 5c62eded5a11ebdb1d57134d923596e2b04e9466 Author: Kristof Provost AuthorDate: 2021-03-11 15:21:23 +0000 Commit: Kristof Provost CommitDate: 2021-04-10 09:16:00 +0000 pf: Introduce nvlist variant of DIOCADDRULE This will make future extensions of the API much easier. The intent is to remove support for DIOCADDRULE in FreeBSD 14. Reviewed by: markj (previous version), glebius (previous version) MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29557 --- sys/conf/files | 1 + sys/modules/pf/Makefile | 2 +- sys/net/pfvar.h | 1 + sys/netpfil/pf/pf.h | 6 + sys/netpfil/pf/pf_ioctl.c | 647 ++++++++++++++++++++++++++++++++++++---------- sys/netpfil/pf/pf_nv.c | 127 +++++++++ sys/netpfil/pf/pf_nv.h | 53 ++++ 7 files changed, 697 insertions(+), 140 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 4c66b941ba99..909002e807e5 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4525,6 +4525,7 @@ netpfil/pf/pf_if.c optional pf inet netpfil/pf/pf_ioctl.c optional pf inet netpfil/pf/pf_lb.c optional pf inet netpfil/pf/pf_norm.c optional pf inet +netpfil/pf/pf_nv.c optional pf inet netpfil/pf/pf_osfp.c optional pf inet netpfil/pf/pf_ruleset.c optional pf inet netpfil/pf/pf_table.c optional pf inet diff --git a/sys/modules/pf/Makefile b/sys/modules/pf/Makefile index 148b64c02a9f..7293b30cda9d 100644 --- a/sys/modules/pf/Makefile +++ b/sys/modules/pf/Makefile @@ -4,7 +4,7 @@ KMOD= pf SRCS= pf.c pf_if.c pf_lb.c pf_osfp.c pf_ioctl.c pf_norm.c pf_table.c \ - pf_ruleset.c in4_cksum.c \ + pf_ruleset.c pf_nv.c in4_cksum.c \ bus_if.h device_if.h \ opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h opt_sctp.h opt_global.h diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 0e78bcbdf34c..465c1dcccef4 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1230,6 +1230,7 @@ struct pfioc_iface { #define DIOCSTART _IO ('D', 1) #define DIOCSTOP _IO ('D', 2) #define DIOCADDRULE _IOWR('D', 4, struct pfioc_rule) +#define DIOCADDRULENV _IOWR('D', 4, struct pfioc_nv) #define DIOCGETRULES _IOWR('D', 6, struct pfioc_rule) #define DIOCGETRULE _IOWR('D', 7, struct pfioc_rule) /* XXX cut 8 - 17 */ diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index 511c60f5abd1..bc6cd92ae7b8 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -187,6 +187,12 @@ enum { PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, #define PF_TABLE_NAME_SIZE 32 #define PF_QNAME_SIZE 64 +struct pfioc_nv { + void *data; + size_t len; /* The length of the nvlist data. */ + size_t size; /* The total size of the data buffer. */ +}; + struct pf_rule; /* keep synced with pfi_kif, used in RB_FIND */ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 08d9f9530ba9..c0f8a5a2a65d 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -82,6 +83,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef INET6 #include @@ -1622,6 +1624,294 @@ pf_check_rule_addr(const struct pf_rule_addr *addr) 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 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)); + +errout: + return (error); +} + +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)); + PFNV_CHK(pf_nvstring(nvl, "ifname", addr->v.ifname, + sizeof(addr->v.ifname))); + 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 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 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 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; + + rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK | M_ZERO); + + PFNV_CHK(pf_nvuint32(nvl, "nr", &rule->nr)); + + if (! nvlist_exists_nvlist(nvl, "src")) { + error = EINVAL; + goto errout; + } + error = pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "src"), + &rule->src); + if (error != 0) + goto errout; + + if (! nvlist_exists_nvlist(nvl, "dst")) { + error = EINVAL; + goto errout; + } + PFNV_CHK(pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "dst"), + &rule->dst)); + + PFNV_CHK(pf_nvstring(nvl, "label", rule->label, sizeof(rule->label))); + 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")) { + error = EINVAL; + goto errout; + } + 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")) { + error = EINVAL; + goto errout; + } + PFNV_CHK(pf_nvrule_uid_to_rule_uid(nvlist_get_nvlist(nvl, "uid"), + &rule->uid)); + + if (! nvlist_exists_nvlist(nvl, "gid")) { + error = EINVAL; + goto errout; + } + 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")) { + error = EINVAL; + goto errout; + } + 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) { + error = EAFNOSUPPORT; + goto errout; + } +#endif /* INET */ +#ifndef INET6 + if (rule->af == AF_INET6) { + error = EAFNOSUPPORT; + goto errout; + } +#endif /* INET6 */ + + PFNV_CHK(pf_check_rule_addr(&rule->src)); + PFNV_CHK(pf_check_rule_addr(&rule->dst)); + + *prule = rule; + + return (0); + +errout: + pf_krule_free(rule); + *prule = NULL; + + return (error); +} + static int pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) { @@ -1730,6 +2020,163 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) return (0); } +static int +pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, + uint32_t pool_ticket, const char *anchor, const char *anchor_call, + struct thread *td) +{ + struct pf_kruleset *ruleset; + struct pf_krule *tail; + struct pf_kpooladdr *pa; + struct pfi_kkif *kif = NULL; + int rs_num; + int error = 0; + + if ((rule->return_icmp >> 8) > ICMP_MAXTYPE) { + error = EINVAL; + goto errout_unlocked; + } + +#define ERROUT(x) { error = (x); goto errout; } + + if (rule->ifname[0]) + kif = pf_kkif_create(M_WAITOK); + rule->evaluations = counter_u64_alloc(M_WAITOK); + for (int i = 0; i < 2; i++) { + rule->packets[i] = counter_u64_alloc(M_WAITOK); + rule->bytes[i] = counter_u64_alloc(M_WAITOK); + } + rule->states_cur = counter_u64_alloc(M_WAITOK); + rule->states_tot = counter_u64_alloc(M_WAITOK); + rule->src_nodes = counter_u64_alloc(M_WAITOK); + rule->cuid = td->td_ucred->cr_ruid; + rule->cpid = td->td_proc ? td->td_proc->p_pid : 0; + TAILQ_INIT(&rule->rpool.list); + + PF_RULES_WLOCK(); + ruleset = pf_find_kruleset(anchor); + if (ruleset == NULL) + ERROUT(EINVAL); + rs_num = pf_get_ruleset_number(rule->action); + if (rs_num >= PF_RULESET_MAX) + ERROUT(EINVAL); + if (ticket != ruleset->rules[rs_num].inactive.ticket) { + DPFPRINTF(PF_DEBUG_MISC, + ("ticket: %d != [%d]%d\n", ticket, rs_num, + ruleset->rules[rs_num].inactive.ticket)); + ERROUT(EBUSY); + } + if (pool_ticket != V_ticket_pabuf) { + DPFPRINTF(PF_DEBUG_MISC, + ("pool_ticket: %d != %d\n", pool_ticket, + V_ticket_pabuf)); + ERROUT(EBUSY); + } + + tail = TAILQ_LAST(ruleset->rules[rs_num].inactive.ptr, + pf_krulequeue); + if (tail) + rule->nr = tail->nr + 1; + else + rule->nr = 0; + if (rule->ifname[0]) { + rule->kif = pfi_kkif_attach(kif, rule->ifname); + pfi_kkif_ref(rule->kif); + } else + rule->kif = NULL; + + if (rule->rtableid > 0 && rule->rtableid >= rt_numfibs) + error = EBUSY; + +#ifdef ALTQ + /* set queue IDs */ + if (rule->qname[0] != 0) { + if ((rule->qid = pf_qname2qid(rule->qname)) == 0) + error = EBUSY; + else if (rule->pqname[0] != 0) { + if ((rule->pqid = + pf_qname2qid(rule->pqname)) == 0) + error = EBUSY; + } else + rule->pqid = rule->qid; + } +#endif + if (rule->tagname[0]) + if ((rule->tag = pf_tagname2tag(rule->tagname)) == 0) + error = EBUSY; + if (rule->match_tagname[0]) + if ((rule->match_tag = + pf_tagname2tag(rule->match_tagname)) == 0) + error = EBUSY; + if (rule->rt && !rule->direction) + error = EINVAL; + if (!rule->log) + rule->logif = 0; + if (rule->logif >= PFLOGIFS_MAX) + error = EINVAL; + if (pf_addr_setup(ruleset, &rule->src.addr, rule->af)) + error = ENOMEM; + if (pf_addr_setup(ruleset, &rule->dst.addr, rule->af)) + error = ENOMEM; + if (pf_kanchor_setup(rule, ruleset, anchor_call)) + error = EINVAL; + if (rule->scrub_flags & PFSTATE_SETPRIO && + (rule->set_prio[0] > PF_PRIO_MAX || + rule->set_prio[1] > PF_PRIO_MAX)) + error = EINVAL; + TAILQ_FOREACH(pa, &V_pf_pabuf, entries) + if (pa->addr.type == PF_ADDR_TABLE) { + pa->addr.p.tbl = pfr_attach_table(ruleset, + pa->addr.v.tblname); + if (pa->addr.p.tbl == NULL) + error = ENOMEM; + } + + rule->overload_tbl = NULL; + if (rule->overload_tblname[0]) { + if ((rule->overload_tbl = pfr_attach_table(ruleset, + rule->overload_tblname)) == NULL) + error = EINVAL; + else + rule->overload_tbl->pfrkt_flags |= + PFR_TFLAG_ACTIVE; + } + + pf_mv_kpool(&V_pf_pabuf, &rule->rpool.list); + if (((((rule->action == PF_NAT) || (rule->action == PF_RDR) || + (rule->action == PF_BINAT)) && rule->anchor == NULL) || + (rule->rt > PF_NOPFROUTE)) && + (TAILQ_FIRST(&rule->rpool.list) == NULL)) + error = EINVAL; + + if (error) { + pf_free_rule(rule); + rule = NULL; + ERROUT(error); + } + + rule->rpool.cur = TAILQ_FIRST(&rule->rpool.list); + counter_u64_zero(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_zero(rule->packets[i]); + counter_u64_zero(rule->bytes[i]); + } + TAILQ_INSERT_TAIL(ruleset->rules[rs_num].inactive.ptr, + rule, entries); + ruleset->rules[rs_num].inactive.rcount++; + PF_RULES_WUNLOCK(); + + return (0); + +#undef ERROUT +errout: + PF_RULES_WUNLOCK(); +errout_unlocked: + pf_kkif_free(kif); + pf_krule_free(rule); + return (error); +} + static int pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td) { @@ -1880,161 +2327,83 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td } break; - case DIOCADDRULE: { - struct pfioc_rule *pr = (struct pfioc_rule *)addr; - struct pf_kruleset *ruleset; - struct pf_krule *rule, *tail; - struct pf_kpooladdr *pa; - struct pfi_kkif *kif = NULL; - int rs_num; + case DIOCADDRULENV: { + struct pfioc_nv *nv = (struct pfioc_nv *)addr; + nvlist_t *nvl = NULL; + void *nvlpacked = NULL; + struct pf_krule *rule = NULL; + const char *anchor = "", *anchor_call = ""; + uint32_t ticket = 0, pool_ticket = 0; - if (pr->rule.return_icmp >> 8 > ICMP_MAXTYPE) { - error = EINVAL; - break; - } +#define ERROUT(x) do { error = (x); goto DIOCADDRULENV_error; } while (0) - rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK); - error = pf_rule_to_krule(&pr->rule, rule); - if (error != 0) { - free(rule, M_PFRULE); - break; - } + if (nv->len > pf_ioctl_maxcount) + ERROUT(ENOMEM); - if (rule->ifname[0]) - kif = pf_kkif_create(M_WAITOK); - rule->evaluations = counter_u64_alloc(M_WAITOK); - for (int i = 0; i < 2; i++) { - rule->packets[i] = counter_u64_alloc(M_WAITOK); - rule->bytes[i] = counter_u64_alloc(M_WAITOK); - } - rule->states_cur = counter_u64_alloc(M_WAITOK); - rule->states_tot = counter_u64_alloc(M_WAITOK); - rule->src_nodes = counter_u64_alloc(M_WAITOK); - rule->cuid = td->td_ucred->cr_ruid; - rule->cpid = td->td_proc ? td->td_proc->p_pid : 0; - TAILQ_INIT(&rule->rpool.list); -#define ERROUT(x) { error = (x); goto DIOCADDRULE_error; } + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + error = copyin(nv->data, nvlpacked, nv->len); + if (error) + ERROUT(error); - PF_RULES_WLOCK(); - pr->anchor[sizeof(pr->anchor) - 1] = 0; - ruleset = pf_find_kruleset(pr->anchor); - if (ruleset == NULL) + nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) + ERROUT(EBADMSG); + + if (! nvlist_exists_number(nvl, "ticket")) ERROUT(EINVAL); - rs_num = pf_get_ruleset_number(pr->rule.action); - if (rs_num >= PF_RULESET_MAX) + ticket = nvlist_get_number(nvl, "ticket"); + + if (! nvlist_exists_number(nvl, "pool_ticket")) ERROUT(EINVAL); - if (pr->ticket != ruleset->rules[rs_num].inactive.ticket) { - DPFPRINTF(PF_DEBUG_MISC, - ("ticket: %d != [%d]%d\n", pr->ticket, rs_num, - ruleset->rules[rs_num].inactive.ticket)); - ERROUT(EBUSY); - } - if (pr->pool_ticket != V_ticket_pabuf) { - DPFPRINTF(PF_DEBUG_MISC, - ("pool_ticket: %d != %d\n", pr->pool_ticket, - V_ticket_pabuf)); - ERROUT(EBUSY); - } + pool_ticket = nvlist_get_number(nvl, "pool_ticket"); - tail = TAILQ_LAST(ruleset->rules[rs_num].inactive.ptr, - pf_krulequeue); - if (tail) - rule->nr = tail->nr + 1; - else - rule->nr = 0; - if (rule->ifname[0]) { - rule->kif = pfi_kkif_attach(kif, rule->ifname); - pfi_kkif_ref(rule->kif); - } else - rule->kif = NULL; + if (! nvlist_exists_nvlist(nvl, "rule")) + ERROUT(EINVAL); - if (rule->rtableid > 0 && rule->rtableid >= rt_numfibs) - error = EBUSY; + error = pf_nvrule_to_krule(nvlist_get_nvlist(nvl, "rule"), + &rule); + if (error) + ERROUT(error); -#ifdef ALTQ - /* set queue IDs */ - if (rule->qname[0] != 0) { - if ((rule->qid = pf_qname2qid(rule->qname)) == 0) - error = EBUSY; - else if (rule->pqname[0] != 0) { - if ((rule->pqid = - pf_qname2qid(rule->pqname)) == 0) - error = EBUSY; - } else - rule->pqid = rule->qid; - } -#endif - if (rule->tagname[0]) - if ((rule->tag = pf_tagname2tag(rule->tagname)) == 0) - error = EBUSY; - if (rule->match_tagname[0]) - if ((rule->match_tag = - pf_tagname2tag(rule->match_tagname)) == 0) - error = EBUSY; - if (rule->rt && !rule->direction) - error = EINVAL; - if (!rule->log) - rule->logif = 0; - if (rule->logif >= PFLOGIFS_MAX) - error = EINVAL; - if (pf_addr_setup(ruleset, &rule->src.addr, rule->af)) - error = ENOMEM; - if (pf_addr_setup(ruleset, &rule->dst.addr, rule->af)) - error = ENOMEM; - if (pf_kanchor_setup(rule, ruleset, pr->anchor_call)) - error = EINVAL; - if (rule->scrub_flags & PFSTATE_SETPRIO && - (rule->set_prio[0] > PF_PRIO_MAX || - rule->set_prio[1] > PF_PRIO_MAX)) - error = EINVAL; - TAILQ_FOREACH(pa, &V_pf_pabuf, entries) - if (pa->addr.type == PF_ADDR_TABLE) { - pa->addr.p.tbl = pfr_attach_table(ruleset, - pa->addr.v.tblname); - if (pa->addr.p.tbl == NULL) - error = ENOMEM; - } + if (nvlist_exists_string(nvl, "anchor")) + anchor = nvlist_get_string(nvl, "anchor"); + if (nvlist_exists_string(nvl, "anchor_call")) + anchor_call = nvlist_get_string(nvl, "anchor_call"); - rule->overload_tbl = NULL; - if (rule->overload_tblname[0]) { - if ((rule->overload_tbl = pfr_attach_table(ruleset, - rule->overload_tblname)) == NULL) - error = EINVAL; - else - rule->overload_tbl->pfrkt_flags |= - PFR_TFLAG_ACTIVE; - } + if ((error = nvlist_error(nvl))) + ERROUT(error); - pf_mv_kpool(&V_pf_pabuf, &rule->rpool.list); - if (((((rule->action == PF_NAT) || (rule->action == PF_RDR) || - (rule->action == PF_BINAT)) && rule->anchor == NULL) || - (rule->rt > PF_NOPFROUTE)) && - (TAILQ_FIRST(&rule->rpool.list) == NULL)) - error = EINVAL; + /* Frees rule on error */ + error = pf_ioctl_addrule(rule, ticket, pool_ticket, anchor, + anchor_call, td); - if (error) { - pf_free_rule(rule); - PF_RULES_WUNLOCK(); + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + break; +#undef ERROUT +DIOCADDRULENV_error: + pf_krule_free(rule); + nvlist_destroy(nvl); + free(nvlpacked, M_TEMP); + + break; + } + case DIOCADDRULE: { + struct pfioc_rule *pr = (struct pfioc_rule *)addr; + struct pf_krule *rule; + + rule = malloc(sizeof(*rule), M_PFRULE, M_WAITOK); + error = pf_rule_to_krule(&pr->rule, rule); + if (error != 0) { + free(rule, M_PFRULE); break; } - rule->rpool.cur = TAILQ_FIRST(&rule->rpool.list); - counter_u64_zero(rule->evaluations); - for (int i = 0; i < 2; i++) { - counter_u64_zero(rule->packets[i]); - counter_u64_zero(rule->bytes[i]); - } - TAILQ_INSERT_TAIL(ruleset->rules[rs_num].inactive.ptr, - rule, entries); - ruleset->rules[rs_num].inactive.rcount++; - PF_RULES_WUNLOCK(); - break; + pr->anchor[sizeof(pr->anchor) - 1] = 0; -#undef ERROUT -DIOCADDRULE_error: - PF_RULES_WUNLOCK(); - pf_krule_free(rule); - pf_kkif_free(kif); + /* Frees rule on error */ + error = pf_ioctl_addrule(rule, pr->ticket, pr->pool_ticket, + pr->anchor, pr->anchor_call, td); break; } diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c new file mode 100644 index 000000000000..d583844c4086 --- /dev/null +++ b/sys/netpfil/pf/pf_nv.c @@ -0,0 +1,127 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) + * + * 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 + +#define PV_NV_IMPL_UINT(fnname, type, max) \ + int \ + fnname(const nvlist_t *nvl, const char *name, type *val) \ + { \ + uint64_t raw; \ + if (! nvlist_exists_number(nvl, name)) \ + return (EINVAL); \ + raw = nvlist_get_number(nvl, name); \ + if (raw > max) \ + return (ERANGE); \ + *val = (type)raw; \ + return (0); \ + } \ + int \ + fnname ## _array(const nvlist_t *nvl, const char *name, type *array, \ + size_t maxelems, size_t *nelems) \ + { \ + const uint64_t *n; \ + size_t nitems; \ + bzero(array, sizeof(type) * maxelems); \ + if (! nvlist_exists_number_array(nvl, name)) \ + return (EINVAL); \ + n = nvlist_get_number_array(nvl, name, &nitems); \ + if (nitems != maxelems) \ + return (E2BIG); \ + if (nelems != NULL) \ + *nelems = nitems; \ + for (size_t i = 0; i < nitems; i++) { \ + if (n[i] > max) \ + return (ERANGE); \ + array[i] = (type)n[i]; \ + } \ + return (0); \ + } +int +pf_nvbinary(const nvlist_t *nvl, const char *name, void *data, + size_t expected_size) +{ + const uint8_t *nvdata; + size_t len; + + bzero(data, expected_size); + + if (! nvlist_exists_binary(nvl, name)) + return (EINVAL); + + nvdata = (const uint8_t *)nvlist_get_binary(nvl, name, &len); + if (len > expected_size) + return (EINVAL); + + memcpy(data, nvdata, len); + + return (0); +} + +PV_NV_IMPL_UINT(pf_nvuint8, uint8_t, UINT8_MAX) +PV_NV_IMPL_UINT(pf_nvuint16, uint16_t, UINT16_MAX); +PV_NV_IMPL_UINT(pf_nvuint32, uint32_t, UINT32_MAX) + +int +pf_nvint(const nvlist_t *nvl, const char *name, int *val) +{ + int64_t raw; + + if (! nvlist_exists_number(nvl, name)) + return (EINVAL); + + raw = nvlist_get_number(nvl, name); + if (raw > INT_MAX || raw < INT_MIN) + return (ERANGE); + + *val = (int)raw; + + return (0); +} + +int +pf_nvstring(const nvlist_t *nvl, const char *name, char *str, size_t maxlen) +{ + int ret; + + if (! nvlist_exists_string(nvl, name)) + return (EINVAL); + + ret = strlcpy(str, nvlist_get_string(nvl, name), maxlen); + if (ret >= maxlen) + return (EINVAL); + + return (0); +} diff --git a/sys/netpfil/pf/pf_nv.h b/sys/netpfil/pf/pf_nv.h new file mode 100644 index 000000000000..f0db1e880e9e --- /dev/null +++ b/sys/netpfil/pf/pf_nv.h @@ -0,0 +1,53 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2021 Rubicon Communications, LLC (Netgate) + * + * 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. + * + */ +#ifndef _PF_NV_H_ +#define _PF_NV_H_ + +#include +#include + +int pf_nvbinary(const nvlist_t *, const char *, void *, size_t); +int pf_nvint(const nvlist_t *, const char *, int *); +int pf_nvuint8(const nvlist_t *, const char *, uint8_t *); +int pf_nvuint8_array(const nvlist_t *, const char *, uint8_t *, + size_t, size_t *); +int pf_nvuint16(const nvlist_t *, const char *, uint16_t *); +int pf_nvuint16_array(const nvlist_t *, const char *, uint16_t *, + size_t, size_t *); +int pf_nvuint32(const nvlist_t *, const char *, uint32_t *); +int pf_nvuint32_array(const nvlist_t *, const char *, uint32_t *, + size_t, size_t *); +int pf_nvstring(const nvlist_t *, const char *, char *, size_t); + +#define PFNV_CHK(x) do { \ + error = (x); \ + if (error != 0) \ + goto errout; \ + } while (0) + +#endif From owner-dev-commits-src-all@freebsd.org Sat Apr 10 09:16:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5320F5E0295; Sat, 10 Apr 2021 09:16: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 4FHTrg1lQ0z4nc4; Sat, 10 Apr 2021 09:16: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 237E86A8C; Sat, 10 Apr 2021 09:16: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 13A9GJXP068956; Sat, 10 Apr 2021 09:16:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A9GJpP068955; Sat, 10 Apr 2021 09:16:19 GMT (envelope-from git) Date: Sat, 10 Apr 2021 09:16:19 GMT Message-Id: <202104100916.13A9GJpP068955@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: 5c11c5a36558 - main - pfctl: Move to DIOCADDRULENV 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: 5c11c5a3655842a176124ef2334fcdf830422c8a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 09:16:19 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5c11c5a3655842a176124ef2334fcdf830422c8a commit 5c11c5a3655842a176124ef2334fcdf830422c8a Author: Kristof Provost AuthorDate: 2021-03-12 17:03:14 +0000 Commit: Kristof Provost CommitDate: 2021-04-10 09:16:01 +0000 pfctl: Move to DIOCADDRULENV Start using the new nvlist based ioctl to add rules. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29558 --- sbin/pfctl/Makefile | 2 +- sbin/pfctl/pfctl.c | 217 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 207 insertions(+), 12 deletions(-) diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile index 14dc83eb97b0..74cefe6824a4 100644 --- a/sbin/pfctl/Makefile +++ b/sbin/pfctl/Makefile @@ -27,7 +27,7 @@ CFLAGS+= -DWITH_INET YFLAGS= -LIBADD= m md +LIBADD= m md nv HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 4e00bf2462a6..58a87a2b8395 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1422,19 +1423,217 @@ pfctl_load_ruleset(struct pfctl *pf, char *path, struct pf_ruleset *rs, } +static void +pfctl_nv_add_addr(nvlist_t *nvparent, const char *name, + const struct pf_addr *addr) +{ + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_binary(nvl, "addr", addr, sizeof(*addr)); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_addr_wrap(nvlist_t *nvparent, const char *name, + const struct pf_addr_wrap *addr) +{ + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_number(nvl, "type", addr->type); + nvlist_add_number(nvl, "iflags", addr->iflags); + nvlist_add_string(nvl, "ifname", addr->v.ifname); + nvlist_add_string(nvl, "tblname", addr->v.tblname); + pfctl_nv_add_addr(nvl, "addr", &addr->v.a.addr); + pfctl_nv_add_addr(nvl, "mask", &addr->v.a.mask); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_rule_addr(nvlist_t *nvparent, const char *name, + const struct pf_rule_addr *addr) +{ + u_int64_t ports[2]; + nvlist_t *nvl = nvlist_create(0); + + pfctl_nv_add_addr_wrap(nvl, "addr", &addr->addr); + ports[0] = addr->port[0]; + ports[1] = addr->port[1]; + nvlist_add_number_array(nvl, "port", ports, 2); + nvlist_add_number(nvl, "neg", addr->neg); + nvlist_add_number(nvl, "port_op", addr->port_op); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, + const struct pf_pool *pool) +{ + u_int64_t ports[2]; + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_binary(nvl, "key", &pool->key, sizeof(pool->key)); + pfctl_nv_add_addr(nvl, "counter", &pool->counter); + nvlist_add_number(nvl, "tblidx", pool->tblidx); + + ports[0] = pool->proxy_port[0]; + ports[1] = pool->proxy_port[1]; + nvlist_add_number_array(nvl, "proxy_port", ports, 2); + nvlist_add_number(nvl, "opts", pool->opts); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_uid(nvlist_t *nvparent, const char *name, + const struct pf_rule_uid *uid) +{ + u_int64_t uids[2]; + nvlist_t *nvl = nvlist_create(0); + + uids[0] = uid->uid[0]; + uids[1] = uid->uid[1]; + nvlist_add_number_array(nvl, "uid", uids, 2); + nvlist_add_number(nvl, "op", uid->op); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static void +pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, + const struct pf_rule *r) +{ + nvlist_t *nvl = nvlist_create(0); + + pfctl_nv_add_addr(nvl, "addr", &r->divert.addr); + nvlist_add_number(nvl, "port", r->divert.port); + + nvlist_add_nvlist(nvparent, name, nvl); +} + +static int +pfctl_addrule(struct pfctl *pf, const struct pf_rule *r, const char *anchor, + const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket) +{ + struct pfioc_nv nv; + u_int64_t timeouts[PFTM_MAX]; + u_int64_t set_prio[2]; + nvlist_t *nvl, *nvlr; + int ret; + + nvl = nvlist_create(0); + nvlr = nvlist_create(0); + + nvlist_add_number(nvl, "ticket", ticket); + nvlist_add_number(nvl, "pool_ticket", pool_ticket); + nvlist_add_string(nvl, "anchor", anchor); + nvlist_add_string(nvl, "anchor_call", anchor_call); + + nvlist_add_number(nvlr, "nr", r->nr); + pfctl_nv_add_rule_addr(nvlr, "src", &r->src); + pfctl_nv_add_rule_addr(nvlr, "dst", &r->dst); + + nvlist_add_string(nvlr, "label", r->label); + nvlist_add_string(nvlr, "ifname", r->ifname); + nvlist_add_string(nvlr, "qname", r->qname); + nvlist_add_string(nvlr, "pqname", r->pqname); + nvlist_add_string(nvlr, "tagname", r->tagname); + nvlist_add_string(nvlr, "match_tagname", r->match_tagname); + nvlist_add_string(nvlr, "overload_tblname", r->overload_tblname); + + pfctl_nv_add_pool(nvlr, "rpool", &r->rpool); + + nvlist_add_number(nvlr, "os_fingerprint", r->os_fingerprint); + + nvlist_add_number(nvlr, "rtableid", r->rtableid); + for (int i = 0; i < PFTM_MAX; i++) + timeouts[i] = r->timeout[i]; + nvlist_add_number_array(nvlr, "timeout", timeouts, PFTM_MAX); + nvlist_add_number(nvlr, "max_states", r->max_states); + nvlist_add_number(nvlr, "max_src_nodes", r->max_src_nodes); + nvlist_add_number(nvlr, "max_src_states", r->max_src_states); + nvlist_add_number(nvlr, "max_src_conn", r->max_src_conn); + nvlist_add_number(nvlr, "max_src_conn_rate.limit", + r->max_src_conn_rate.limit); + nvlist_add_number(nvlr, "max_src_conn_rate.seconds", + r->max_src_conn_rate.seconds); + nvlist_add_number(nvlr, "prob", r->prob); + nvlist_add_number(nvlr, "cuid", r->cuid); + nvlist_add_number(nvlr, "cpid", r->cpid); + + nvlist_add_number(nvlr, "return_icmp", r->return_icmp); + nvlist_add_number(nvlr, "return_icmp6", r->return_icmp6); + + nvlist_add_number(nvlr, "max_mss", r->max_mss); + nvlist_add_number(nvlr, "scrub_flags", r->scrub_flags); + + pfctl_nv_add_uid(nvlr, "uid", &r->uid); + pfctl_nv_add_uid(nvlr, "gid", (struct pf_rule_uid *)&r->gid); + + nvlist_add_number(nvlr, "rule_flag", r->rule_flag); + nvlist_add_number(nvlr, "action", r->action); + nvlist_add_number(nvlr, "direction", r->direction); + nvlist_add_number(nvlr, "log", r->log); + nvlist_add_number(nvlr, "logif", r->logif); + nvlist_add_number(nvlr, "quick", r->quick); + nvlist_add_number(nvlr, "ifnot", r->ifnot); + nvlist_add_number(nvlr, "match_tag_not", r->match_tag_not); + nvlist_add_number(nvlr, "natpass", r->natpass); + + nvlist_add_number(nvlr, "keep_state", r->keep_state); + nvlist_add_number(nvlr, "af", r->af); + nvlist_add_number(nvlr, "proto", r->proto); + nvlist_add_number(nvlr, "type", r->type); + nvlist_add_number(nvlr, "code", r->code); + nvlist_add_number(nvlr, "flags", r->flags); + nvlist_add_number(nvlr, "flagset", r->flagset); + nvlist_add_number(nvlr, "min_ttl", r->min_ttl); + nvlist_add_number(nvlr, "allow_opts", r->allow_opts); + nvlist_add_number(nvlr, "rt", r->rt); + nvlist_add_number(nvlr, "return_ttl", r->return_ttl); + nvlist_add_number(nvlr, "tos", r->tos); + nvlist_add_number(nvlr, "set_tos", r->set_tos); + nvlist_add_number(nvlr, "anchor_relative", r->anchor_relative); + nvlist_add_number(nvlr, "anchor_wildcard", r->anchor_wildcard); + + nvlist_add_number(nvlr, "flush", r->flush); + + nvlist_add_number(nvlr, "prio", r->prio); + set_prio[0] = r->set_prio[0]; + set_prio[1] = r->set_prio[1]; + nvlist_add_number_array(nvlr, "set_prio", set_prio, 2); + + pfctl_nv_add_divert(nvlr, "divert", r); + + nvlist_add_nvlist(nvl, "rule", nvlr); + + /* Now do the call. */ + nv.data = nvlist_pack(nvl, &nv.len); + nv.size = nv.len; + + ret = ioctl(pf->dev, DIOCADDRULENV, &nv); + + free(nv.data); + nvlist_destroy(nvl); + + return (ret); +} + int pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth) { u_int8_t rs_num = pf_get_ruleset_number(r->action); char *name; - struct pfioc_rule pr; + u_int32_t ticket; + char anchor[PF_ANCHOR_NAME_SIZE]; int len = strlen(path); - bzero(&pr, sizeof(pr)); /* set up anchor before adding to path for anchor_call */ if ((pf->opts & PF_OPT_NOACTION) == 0) - pr.ticket = pfctl_get_ticket(pf->trans, rs_num, path); - if (strlcpy(pr.anchor, path, sizeof(pr.anchor)) >= sizeof(pr.anchor)) + ticket = pfctl_get_ticket(pf->trans, rs_num, path); + if (strlcpy(anchor, path, sizeof(anchor)) >= sizeof(anchor)) errx(1, "pfctl_load_rule: strlcpy"); if (r->anchor) { @@ -1454,13 +1653,9 @@ pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth) if ((pf->opts & PF_OPT_NOACTION) == 0) { if (pfctl_add_pool(pf, &r->rpool, r->af)) return (1); - pr.pool_ticket = pf->paddr.ticket; - memcpy(&pr.rule, r, sizeof(pr.rule)); - if (r->anchor && strlcpy(pr.anchor_call, name, - sizeof(pr.anchor_call)) >= sizeof(pr.anchor_call)) - errx(1, "pfctl_load_rule: strlcpy"); - if (ioctl(pf->dev, DIOCADDRULE, &pr)) - err(1, "DIOCADDRULE"); + if (pfctl_addrule(pf, r, anchor, name, ticket, + pf->paddr.ticket)) + err(1, "DIOCADDRULENV"); } if (pf->opts & PF_OPT_VERBOSE) { From owner-dev-commits-src-all@freebsd.org Sat Apr 10 09:16:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 868105E013B; Sat, 10 Apr 2021 09:16: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 4FHTrh2mRNz4nl3; Sat, 10 Apr 2021 09:16: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 4A75166C8; Sat, 10 Apr 2021 09:16: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 13A9GKHH068978; Sat, 10 Apr 2021 09:16:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A9GK22068977; Sat, 10 Apr 2021 09:16:20 GMT (envelope-from git) Date: Sat, 10 Apr 2021 09:16:20 GMT Message-Id: <202104100916.13A9GK22068977@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: d710367d1159 - main - pf: Implement nvlist variant of DIOCGETRULE 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: d710367d1159423ed4da6628b7ab042d3e44f900 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 09:16:20 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d710367d1159423ed4da6628b7ab042d3e44f900 commit d710367d1159423ed4da6628b7ab042d3e44f900 Author: Kristof Provost AuthorDate: 2021-03-25 09:39:14 +0000 Commit: Kristof Provost CommitDate: 2021-04-10 09:16:01 +0000 pf: Implement nvlist variant of DIOCGETRULE MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29559 --- sys/net/pfvar.h | 4 + sys/netpfil/pf/pf_ioctl.c | 398 ++++++++++++++++++++++++++++++++++++++++++++ sys/netpfil/pf/pf_nv.c | 23 ++- sys/netpfil/pf/pf_nv.h | 7 + sys/netpfil/pf/pf_ruleset.c | 47 ++++++ 5 files changed, 473 insertions(+), 6 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 465c1dcccef4..abce11e8dfd6 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -1233,6 +1234,7 @@ struct pfioc_iface { #define DIOCADDRULENV _IOWR('D', 4, struct pfioc_nv) #define DIOCGETRULES _IOWR('D', 6, struct pfioc_rule) #define DIOCGETRULE _IOWR('D', 7, struct pfioc_rule) +#define DIOCGETRULENV _IOWR('D', 7, struct pfioc_nv) /* XXX cut 8 - 17 */ #define DIOCCLRSTATES _IOWR('D', 18, struct pfioc_state_kill) #define DIOCGETSTATE _IOWR('D', 19, struct pfioc_state) @@ -1636,6 +1638,8 @@ VNET_DECLARE(struct pf_kanchor, pf_main_anchor); void pf_init_kruleset(struct pf_kruleset *); int pf_kanchor_setup(struct pf_krule *, const struct pf_kruleset *, const char *); +int pf_kanchor_nvcopyout(const struct pf_kruleset *, + const struct pf_krule *, nvlist_t *); int pf_kanchor_copyout(const struct pf_kruleset *, const struct pf_krule *, struct pfioc_rule *); void pf_kanchor_remove(struct pf_krule *); diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index c0f8a5a2a65d..0b8570f294bf 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1630,6 +1630,20 @@ 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_nvpool_to_pool(const nvlist_t *nvl, struct pf_kpool *kpool) { @@ -1653,6 +1667,33 @@ 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_add_number(nvl, "tblidx", pool->tblidx); + pf_uint16_array_nv(nvl, "proxy_port", pool->proxy_port, 2); + nvlist_add_number(nvl, "opts", pool->opts); + + 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) { @@ -1693,6 +1734,37 @@ 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); + nvlist_add_string(nvl, "ifname", addr->v.ifname); + 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); + tmp = pf_addr_to_nvaddr(&addr->v.a.mask); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "mask", tmp); + + return (nvl); + +error: + nvlist_destroy(nvl); + return (NULL); +} + static int pf_validate_op(uint8_t op) { @@ -1735,6 +1807,31 @@ 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); + 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) { @@ -1751,6 +1848,21 @@ 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) { @@ -1912,6 +2024,158 @@ errout: 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_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); + tmp = pf_rule_addr_to_nvrule_addr(&rule->dst); + if (tmp == NULL) + goto error; + nvlist_add_nvlist(nvl, "dst", 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); + } + + nvlist_add_string(nvl, "label", rule->label); + 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_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); + 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_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); + + return (nvl); + +error: + nvlist_destroy(nvl); + return (NULL); +} + static int pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) { @@ -2188,6 +2452,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td switch (cmd) { case DIOCGETRULES: case DIOCGETRULE: + case DIOCGETRULENV: case DIOCGETADDRS: case DIOCGETADDR: case DIOCGETSTATE: @@ -2269,6 +2534,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td case DIOCIGETIFACES: case DIOCGIFSPEEDV1: case DIOCGIFSPEEDV0: + case DIOCGETRULENV: break; case DIOCRCLRTABLES: case DIOCRADDTABLES: @@ -2494,6 +2760,138 @@ DIOCADDRULENV_error: break; } + case DIOCGETRULENV: { + struct pfioc_nv *nv = (struct pfioc_nv *)addr; + nvlist_t *nvrule = NULL; + nvlist_t *nvl = NULL; + struct pf_kruleset *ruleset; + struct pf_krule *rule; + void *nvlpacked = NULL; + int rs_num, nr; + bool clear_counter = false; + +#define ERROUT(x) do { error = (x); goto DIOCGETRULENV_error; } while (0) + + if (nv->len > pf_ioctl_maxcount) + ERROUT(ENOMEM); + + /* Copy the request in */ + nvlpacked = malloc(nv->len, M_TEMP, M_WAITOK); + if (nvlpacked == NULL) + ERROUT(ENOMEM); + + error = copyin(nv->data, nvlpacked, nv->len); + if (error) + ERROUT(error); + + nvl = nvlist_unpack(nvlpacked, nv->len, 0); + if (nvl == NULL) + ERROUT(EBADMSG); + + if (! nvlist_exists_string(nvl, "anchor")) + ERROUT(EBADMSG); + if (! nvlist_exists_number(nvl, "ruleset")) + ERROUT(EBADMSG); + if (! nvlist_exists_number(nvl, "ticket")) + ERROUT(EBADMSG); + if (! nvlist_exists_number(nvl, "nr")) + ERROUT(EBADMSG); + + if (nvlist_exists_bool(nvl, "clear_counter")) + clear_counter = nvlist_get_bool(nvl, "clear_counter"); + + if (clear_counter && !(flags & FWRITE)) + ERROUT(EACCES); + + nr = nvlist_get_number(nvl, "nr"); + + PF_RULES_WLOCK(); + ruleset = pf_find_kruleset(nvlist_get_string(nvl, "anchor")); + if (ruleset == NULL) { + PF_RULES_WUNLOCK(); + ERROUT(ENOENT); + } + + rs_num = pf_get_ruleset_number(nvlist_get_number(nvl, "ruleset")); + if (rs_num >= PF_RULESET_MAX) { + PF_RULES_WUNLOCK(); + ERROUT(EINVAL); + } + + if (nvlist_get_number(nvl, "ticket") != + ruleset->rules[rs_num].active.ticket) { + PF_RULES_WUNLOCK(); + ERROUT(EBUSY); + break; + } + + if ((error = nvlist_error(nvl))) { + PF_RULES_WUNLOCK(); + ERROUT(error); + } + + rule = TAILQ_FIRST(ruleset->rules[rs_num].active.ptr); + while ((rule != NULL) && (rule->nr != nr)) + rule = TAILQ_NEXT(rule, entries); + if (rule == NULL) { + PF_RULES_WUNLOCK(); + ERROUT(EBUSY); + break; + } + + nvrule = pf_krule_to_nvrule(rule); + + nvlist_destroy(nvl); + nvl = nvlist_create(0); + if (nvl == NULL) { + PF_RULES_WUNLOCK(); + ERROUT(ENOMEM); + } + nvlist_add_number(nvl, "nr", nr); + nvlist_add_nvlist(nvl, "rule", nvrule); + nvrule = NULL; + if (pf_kanchor_nvcopyout(ruleset, rule, nvl)) { + PF_RULES_WUNLOCK(); + ERROUT(EBUSY); + } + + free(nvlpacked, M_TEMP); + nvlpacked = nvlist_pack(nvl, &nv->len); + if (nvlpacked == NULL) { + PF_RULES_WUNLOCK(); + ERROUT(ENOMEM); + } + + if (nv->size == 0) { + PF_RULES_WUNLOCK(); + ERROUT(0); + } + else if (nv->size < nv->len) { + PF_RULES_WUNLOCK(); + ERROUT(ENOSPC); + } + + error = copyout(nvlpacked, nv->data, nv->len); + + if (clear_counter) { + counter_u64_zero(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_zero(rule->packets[i]); + counter_u64_zero(rule->bytes[i]); + } + counter_u64_zero(rule->states_tot); + } + PF_RULES_WUNLOCK(); + +#undef ERROUT +DIOCGETRULENV_error: + free(nvlpacked, M_TEMP); + nvlist_destroy(nvrule); + nvlist_destroy(nvl); + + break; + } + case DIOCCHANGERULE: { struct pfioc_rule *pcr = (struct pfioc_rule *)addr; struct pf_kruleset *ruleset; diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c index d583844c4086..d88c0b14e435 100644 --- a/sys/netpfil/pf/pf_nv.c +++ b/sys/netpfil/pf/pf_nv.c @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #define PV_NV_IMPL_UINT(fnname, type, max) \ int \ - fnname(const nvlist_t *nvl, const char *name, type *val) \ + pf_nv ## fnname(const nvlist_t *nvl, const char *name, type *val) \ { \ uint64_t raw; \ if (! nvlist_exists_number(nvl, name)) \ @@ -49,8 +49,8 @@ __FBSDID("$FreeBSD$"); return (0); \ } \ int \ - fnname ## _array(const nvlist_t *nvl, const char *name, type *array, \ - size_t maxelems, size_t *nelems) \ + pf_nv ## fnname ## _array(const nvlist_t *nvl, const char *name, \ + type *array, size_t maxelems, size_t *nelems) \ { \ const uint64_t *n; \ size_t nitems; \ @@ -68,7 +68,18 @@ __FBSDID("$FreeBSD$"); array[i] = (type)n[i]; \ } \ return (0); \ + } \ + void \ + pf_ ## fnname ## _array_nv(nvlist_t *nvl, const char *name, \ + const type *numbers, size_t count) \ + { \ + uint64_t tmp; \ + for (size_t i = 0; i < count; i++) { \ + tmp = numbers[i]; \ + nvlist_append_number_array(nvl, name, tmp); \ + } \ } + int pf_nvbinary(const nvlist_t *nvl, const char *name, void *data, size_t expected_size) @@ -90,9 +101,9 @@ pf_nvbinary(const nvlist_t *nvl, const char *name, void *data, return (0); } -PV_NV_IMPL_UINT(pf_nvuint8, uint8_t, UINT8_MAX) -PV_NV_IMPL_UINT(pf_nvuint16, uint16_t, UINT16_MAX); -PV_NV_IMPL_UINT(pf_nvuint32, uint32_t, UINT32_MAX) +PV_NV_IMPL_UINT(uint8, uint8_t, UINT8_MAX) +PV_NV_IMPL_UINT(uint16, uint16_t, UINT16_MAX); +PV_NV_IMPL_UINT(uint32, uint32_t, UINT32_MAX) int pf_nvint(const nvlist_t *nvl, const char *name, int *val) diff --git a/sys/netpfil/pf/pf_nv.h b/sys/netpfil/pf/pf_nv.h index f0db1e880e9e..0a0f9beeef40 100644 --- a/sys/netpfil/pf/pf_nv.h +++ b/sys/netpfil/pf/pf_nv.h @@ -36,12 +36,19 @@ int pf_nvint(const nvlist_t *, const char *, int *); int pf_nvuint8(const nvlist_t *, const char *, uint8_t *); int pf_nvuint8_array(const nvlist_t *, const char *, uint8_t *, size_t, size_t *); +void pf_uint8_array_nv(nvlist_t *, const char *, const uint8_t *, + size_t); int pf_nvuint16(const nvlist_t *, const char *, uint16_t *); int pf_nvuint16_array(const nvlist_t *, const char *, uint16_t *, size_t, size_t *); +void pf_uint16_array_nv(nvlist_t *, const char *, const uint16_t *, + size_t); int pf_nvuint32(const nvlist_t *, const char *, uint32_t *); int pf_nvuint32_array(const nvlist_t *, const char *, uint32_t *, size_t, size_t *); +void pf_uint32_array_nv(nvlist_t *, const char *, const uint32_t *, + size_t); + int pf_nvstring(const nvlist_t *, const char *, char *, size_t); #define PFNV_CHK(x) do { \ diff --git a/sys/netpfil/pf/pf_ruleset.c b/sys/netpfil/pf/pf_ruleset.c index 0cc0c357d59d..ad1b07f69fe6 100644 --- a/sys/netpfil/pf/pf_ruleset.c +++ b/sys/netpfil/pf/pf_ruleset.c @@ -336,6 +336,53 @@ pf_kanchor_setup(struct pf_krule *r, const struct pf_kruleset *s, return (0); } +int +pf_kanchor_nvcopyout(const struct pf_kruleset *rs, const struct pf_krule *r, + nvlist_t *nvl) +{ + char anchor_call[MAXPATHLEN] = { 0 }; + + if (r->anchor == NULL) + goto done; + if (!r->anchor_relative) { + strlcpy(anchor_call, "/", sizeof(anchor_call)); + strlcat(anchor_call, r->anchor->path, + sizeof(anchor_call)); + } else { + char a[MAXPATHLEN]; + char *p; + int i; + if (rs->anchor == NULL) + a[0] = 0; + else + strlcpy(a, rs->anchor->path, MAXPATHLEN); + for (i = 1; i < r->anchor_relative; ++i) { + if ((p = strrchr(a, '/')) == NULL) + p = a; + *p = 0; + strlcat(anchor_call, "../", + sizeof(anchor_call)); + } + if (strncmp(a, r->anchor->path, strlen(a))) { + printf("pf_anchor_copyout: '%s' '%s'\n", a, + r->anchor->path); + return (1); + } + if (strlen(r->anchor->path) > strlen(a)) + strlcat(anchor_call, r->anchor->path + (a[0] ? + strlen(a) + 1 : 0), sizeof(anchor_call)); + + } + if (r->anchor_wildcard) + strlcat(anchor_call, anchor_call[0] ? "/*" : "*", + sizeof(anchor_call)); + +done: + nvlist_add_string(nvl, "anchor_call", anchor_call); + + return (0); +} + int pf_kanchor_copyout(const struct pf_kruleset *rs, const struct pf_krule *r, struct pfioc_rule *pr) From owner-dev-commits-src-all@freebsd.org Sat Apr 10 09:16:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F07825E0141; Sat, 10 Apr 2021 09:16: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 4FHTrj3L5nz4nl7; Sat, 10 Apr 2021 09:16: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 5CD296A21; Sat, 10 Apr 2021 09:16: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 13A9GLV8068999; Sat, 10 Apr 2021 09:16:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A9GLWm068998; Sat, 10 Apr 2021 09:16:21 GMT (envelope-from git) Date: Sat, 10 Apr 2021 09:16:21 GMT Message-Id: <202104100916.13A9GLWm068998@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: 0d6c8174ef2f - main - pfctl: Use the new DIOCGETRULENV ioctl 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: 0d6c8174ef2f3d8d6fb02ec97753a0937796a5c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 09:16:22 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0d6c8174ef2f3d8d6fb02ec97753a0937796a5c6 commit 0d6c8174ef2f3d8d6fb02ec97753a0937796a5c6 Author: Kristof Provost AuthorDate: 2021-03-26 10:22:15 +0000 Commit: Kristof Provost CommitDate: 2021-04-10 09:16:01 +0000 pfctl: Use the new DIOCGETRULENV ioctl Create wrapper functions to handle the parsing of the nvlist and move that code into pfctl_ioctl.c. At some point this should be moved into a libpfctl. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29560 --- sbin/pfctl/Makefile | 2 +- sbin/pfctl/pfctl.c | 12 +- sbin/pfctl/pfctl_ioctl.c | 339 ++++++++++++++++++++++++++++++++++++++++++++ sbin/pfctl/pfctl_ioctl.h | 43 ++++++ sbin/pfctl/pfctl_optimize.c | 7 +- 5 files changed, 396 insertions(+), 7 deletions(-) diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile index 74cefe6824a4..c84d558c989d 100644 --- a/sbin/pfctl/Makefile +++ b/sbin/pfctl/Makefile @@ -9,7 +9,7 @@ MAN= pfctl.8 SRCS = pfctl.c parse.y pfctl_parser.c pf_print_state.c pfctl_altq.c SRCS+= pfctl_osfp.c pfctl_radix.c pfctl_table.c pfctl_qstats.c -SRCS+= pfctl_optimize.c +SRCS+= pfctl_optimize.c pfctl_ioctl.c SRCS+= pf_ruleset.c WARNS?= 2 diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 58a87a2b8395..1aa17065597b 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -63,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "pfctl_ioctl.h" #include "pfctl_parser.h" #include "pfctl.h" @@ -952,8 +953,9 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, for (nr = 0; nr < mnr; ++nr) { pr.nr = nr; - if (ioctl(dev, DIOCGETRULE, &pr)) { - warn("DIOCGETRULE"); + if (pfctl_get_rule(dev, nr, pr.ticket, path, PF_SCRUB, + &pr.rule, pr.anchor_call)) { + warn("DIOCGETRULENV"); goto error; } @@ -984,7 +986,8 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, mnr = pr.nr; for (nr = 0; nr < mnr; ++nr) { pr.nr = nr; - if (ioctl(dev, DIOCGETRULE, &pr)) { + if (pfctl_get_rule(dev, nr, pr.ticket, path, PF_PASS, + &pr.rule, pr.anchor_call)) { warn("DIOCGETRULE"); goto error; } @@ -1074,7 +1077,8 @@ pfctl_show_nat(int dev, int opts, char *anchorname) mnr = pr.nr; for (nr = 0; nr < mnr; ++nr) { pr.nr = nr; - if (ioctl(dev, DIOCGETRULE, &pr)) { + if (pfctl_get_rule(dev, nr, pr.ticket, anchorname, + nattype[i], &pr.rule, pr.anchor_call)) { warn("DIOCGETRULE"); return (-1); } diff --git a/sbin/pfctl/pfctl_ioctl.c b/sbin/pfctl/pfctl_ioctl.c new file mode 100644 index 000000000000..878a57de0fe4 --- /dev/null +++ b/sbin/pfctl/pfctl_ioctl.c @@ -0,0 +1,339 @@ +/*- + * 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: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS 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$ + */ + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include "pfctl_ioctl.h" + +static void +pf_nvuint_8_array(const nvlist_t *nvl, const char *name, size_t maxelems, + u_int8_t *numbers, size_t *nelems) +{ + const uint64_t *tmp; + size_t elems; + + tmp = nvlist_get_number_array(nvl, name, &elems); + assert(elems <= maxelems); + + for (size_t i = 0; i < elems; i++) + numbers[i] = tmp[i]; + + if (nelems) + *nelems = elems; +} + +static void +pf_nvuint_16_array(const nvlist_t *nvl, const char *name, size_t maxelems, + u_int16_t *numbers, size_t *nelems) +{ + const uint64_t *tmp; + size_t elems; + + tmp = nvlist_get_number_array(nvl, name, &elems); + assert(elems <= maxelems); + + for (size_t i = 0; i < elems; i++) + numbers[i] = tmp[i]; + + if (nelems) + *nelems = elems; +} + +static void +pf_nvuint_32_array(const nvlist_t *nvl, const char *name, size_t maxelems, + u_int32_t *numbers, size_t *nelems) +{ + const uint64_t *tmp; + size_t elems; + + tmp = nvlist_get_number_array(nvl, name, &elems); + assert(elems <= maxelems); + + for (size_t i = 0; i < elems; i++) + numbers[i] = tmp[i]; + + if (nelems) + *nelems = elems; +} + +static void +pf_nvuint_64_array(const nvlist_t *nvl, const char *name, size_t maxelems, + u_int64_t *numbers, size_t *nelems) +{ + const uint64_t *tmp; + size_t elems; + + tmp = nvlist_get_number_array(nvl, name, &elems); + assert(elems <= maxelems); + + for (size_t i = 0; i < elems; i++) + numbers[i] = tmp[i]; + + if (nelems) + *nelems = elems; +} + +static void +pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *addr) +{ + size_t len; + const void *data; + + data = nvlist_get_binary(nvl, "addr", &len); + assert(len == sizeof(struct pf_addr)); + memcpy(addr, data, len); +} + +static void +pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) +{ + addr->type = nvlist_get_number(nvl, "type"); + addr->iflags = nvlist_get_number(nvl, "iflags"); + strlcpy(addr->v.ifname, nvlist_get_string(nvl, "ifname"), IFNAMSIZ); + strlcpy(addr->v.tblname, nvlist_get_string(nvl, "tblname"), + PF_TABLE_NAME_SIZE); + + pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "addr"), &addr->v.a.addr); + pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "mask"), &addr->v.a.mask); +} + +static void +pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr) +{ + pf_nvaddr_wrap_to_addr_wrap(nvlist_get_nvlist(nvl, "addr"), &addr->addr); + + pf_nvuint_16_array(nvl, "port", 2, addr->port, NULL); + addr->neg = nvlist_get_number(nvl, "neg"); + addr->port_op = nvlist_get_number(nvl, "port_op"); +} + +static void +pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_pool *pool) +{ + size_t len; + const void *data; + + data = nvlist_get_binary(nvl, "key", &len); + assert(len == sizeof(pool->key)); + memcpy(&pool->key, data, len); + + pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "counter"), &pool->counter); + + pool->tblidx = nvlist_get_number(nvl, "tblidx"); + pf_nvuint_16_array(nvl, "proxy_port", 2, pool->proxy_port, NULL); + pool->opts = nvlist_get_number(nvl, "opts"); +} + +static void +pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) +{ + pf_nvuint_32_array(nvl, "uid", 2, uid->uid, NULL); + uid->op = nvlist_get_number(nvl, "op"); +} + +static void +pf_nvdivert_to_divert(const nvlist_t *nvl, struct pf_rule *rule) +{ + pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "addr"), &rule->divert.addr); + rule->divert.port = nvlist_get_number(nvl, "port"); +} + +static void +pf_nvrule_to_rule(const nvlist_t *nvl, struct pf_rule *rule) +{ + const uint64_t *skip; + size_t skipcount; + + rule->nr = nvlist_get_number(nvl, "nr"); + + pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "src"), &rule->src); + pf_nvrule_addr_to_rule_addr(nvlist_get_nvlist(nvl, "dst"), &rule->dst); + + skip = nvlist_get_number_array(nvl, "skip", &skipcount); + assert(skip); + assert(skipcount == PF_SKIP_COUNT); + for (int i = 0; i < PF_SKIP_COUNT; i++) + rule->skip[i].nr = skip[i]; + + strlcpy(rule->label, nvlist_get_string(nvl, "label"), PF_RULE_LABEL_SIZE); + strlcpy(rule->ifname, nvlist_get_string(nvl, "ifname"), IFNAMSIZ); + strlcpy(rule->qname, nvlist_get_string(nvl, "qname"), PF_QNAME_SIZE); + strlcpy(rule->pqname, nvlist_get_string(nvl, "pqname"), PF_QNAME_SIZE); + strlcpy(rule->tagname, nvlist_get_string(nvl, "tagname"), + PF_TAG_NAME_SIZE); + strlcpy(rule->match_tagname, nvlist_get_string(nvl, "match_tagname"), + PF_TAG_NAME_SIZE); + + strlcpy(rule->overload_tblname, nvlist_get_string(nvl, "overload_tblname"), + PF_TABLE_NAME_SIZE); + + pf_nvpool_to_pool(nvlist_get_nvlist(nvl, "rpool"), &rule->rpool); + + rule->evaluations = nvlist_get_number(nvl, "evaluations"); + pf_nvuint_64_array(nvl, "packets", 2, rule->packets, NULL); + pf_nvuint_64_array(nvl, "bytes", 2, rule->bytes, NULL); + + rule->os_fingerprint = nvlist_get_number(nvl, "os_fingerprint"); + + rule->rtableid = nvlist_get_number(nvl, "rtableid"); + pf_nvuint_32_array(nvl, "timeout", PFTM_MAX, rule->timeout, NULL); + rule->max_states = nvlist_get_number(nvl, "max_states"); + rule->max_src_nodes = nvlist_get_number(nvl, "max_src_nodes"); + rule->max_src_states = nvlist_get_number(nvl, "max_src_states"); + rule->max_src_conn = nvlist_get_number(nvl, "max_src_conn"); + rule->max_src_conn_rate.limit = + nvlist_get_number(nvl, "max_src_conn_rate.limit"); + rule->max_src_conn_rate.seconds = + nvlist_get_number(nvl, "max_src_conn_rate.seconds"); + rule->qid = nvlist_get_number(nvl, "qid"); + rule->pqid = nvlist_get_number(nvl, "pqid"); + rule->prob = nvlist_get_number(nvl, "prob"); + rule->cuid = nvlist_get_number(nvl, "cuid"); + rule->cpid = nvlist_get_number(nvl, "cpid"); + + rule->return_icmp = nvlist_get_number(nvl, "return_icmp"); + rule->return_icmp6 = nvlist_get_number(nvl, "return_icmp6"); + rule->max_mss = nvlist_get_number(nvl, "max_mss"); + rule->scrub_flags = nvlist_get_number(nvl, "scrub_flags"); + + pf_nvrule_uid_to_rule_uid(nvlist_get_nvlist(nvl, "uid"), &rule->uid); + pf_nvrule_uid_to_rule_uid(nvlist_get_nvlist(nvl, "gid"), + (struct pf_rule_uid *)&rule->gid); + + rule->rule_flag = nvlist_get_number(nvl, "rule_flag"); + rule->action = nvlist_get_number(nvl, "action"); + rule->direction = nvlist_get_number(nvl, "direction"); + rule->log = nvlist_get_number(nvl, "log"); + rule->logif = nvlist_get_number(nvl, "logif"); + rule->quick = nvlist_get_number(nvl, "quick"); + rule->ifnot = nvlist_get_number(nvl, "ifnot"); + rule->match_tag_not = nvlist_get_number(nvl, "match_tag_not"); + rule->natpass = nvlist_get_number(nvl, "natpass"); + + rule->keep_state = nvlist_get_number(nvl, "keep_state"); + rule->af = nvlist_get_number(nvl, "af"); + rule->proto = nvlist_get_number(nvl, "proto"); + rule->type = nvlist_get_number(nvl, "type"); + rule->code = nvlist_get_number(nvl, "code"); + rule->flags = nvlist_get_number(nvl, "flags"); + rule->flagset = nvlist_get_number(nvl, "flagset"); + rule->min_ttl = nvlist_get_number(nvl, "min_ttl"); + rule->allow_opts = nvlist_get_number(nvl, "allow_opts"); + rule->rt = nvlist_get_number(nvl, "rt"); + rule->return_ttl = nvlist_get_number(nvl, "return_ttl"); + rule->tos = nvlist_get_number(nvl, "tos"); + rule->set_tos = nvlist_get_number(nvl, "set_tos"); + rule->anchor_relative = nvlist_get_number(nvl, "anchor_relative"); + rule->anchor_wildcard = nvlist_get_number(nvl, "anchor_wildcard"); + + rule->flush = nvlist_get_number(nvl, "flush"); + rule->prio = nvlist_get_number(nvl, "prio"); + pf_nvuint_8_array(nvl, "set_prio", 2, rule->set_prio, NULL); + + pf_nvdivert_to_divert(nvlist_get_nvlist(nvl, "divert"), rule); + + rule->u_states_cur = nvlist_get_number(nvl, "states_cur"); + rule->u_states_tot = nvlist_get_number(nvl, "states_tot"); + rule->u_src_nodes = nvlist_get_number(nvl, "src_nodes"); +} + + +int +pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, + u_int32_t ruleset, struct pf_rule *rule, char *anchor_call) +{ + struct pfioc_nv nv; + nvlist_t *nvl; + void *nvlpacked; + int ret; + + nvl = nvlist_create(0); + if (nvl == 0) + return (ENOMEM); + + nvlist_add_number(nvl, "nr", nr); + nvlist_add_number(nvl, "ticket", ticket); + nvlist_add_string(nvl, "anchor", anchor); + nvlist_add_number(nvl, "ruleset", ruleset); + + nvlpacked = nvlist_pack(nvl, &nv.len); + if (nvlpacked == NULL) { + nvlist_destroy(nvl); + return (ENOMEM); + } + nv.data = malloc(8182); + nv.size = 8192; + assert(nv.len <= nv.size); + memcpy(nv.data, nvlpacked, nv.len); + nvlist_destroy(nvl); + nvl = NULL; + free(nvlpacked); + + ret = ioctl(dev, DIOCGETRULENV, &nv); + if (ret != 0) { + free(nv.data); + return (ret); + } + + nvl = nvlist_unpack(nv.data, nv.len, 0); + if (nvl == NULL) { + free(nv.data); + return (EIO); + } + + pf_nvrule_to_rule(nvlist_get_nvlist(nvl, "rule"), rule); + + if (anchor_call) + strlcpy(anchor_call, nvlist_get_string(nvl, "anchor_call"), + MAXPATHLEN); + + free(nv.data); + nvlist_destroy(nvl); + + return (0); +} diff --git a/sbin/pfctl/pfctl_ioctl.h b/sbin/pfctl/pfctl_ioctl.h new file mode 100644 index 000000000000..41dd0776854a --- /dev/null +++ b/sbin/pfctl/pfctl_ioctl.h @@ -0,0 +1,43 @@ +/*- + * 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: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS 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 _PFCTL_IOCTL_H_ +#define _PFCTL_IOCTL_H_ + +#include + +int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, + const char *anchor, u_int32_t ruleset, struct pf_rule *rule, + char *anchor_call); + +#endif diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c index 599ed2424ebf..d3f0aa1bf3a4 100644 --- a/sbin/pfctl/pfctl_optimize.c +++ b/sbin/pfctl/pfctl_optimize.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include "pfctl_ioctl.h" #include "pfctl_parser.h" #include "pfctl.h" @@ -909,8 +910,10 @@ load_feedback_profile(struct pfctl *pf, struct superblocks *superblocks) return (1); } pr.nr = nr; - if (ioctl(pf->dev, DIOCGETRULE, &pr)) { - warn("DIOCGETRULES"); + + if (pfctl_get_rule(pf->dev, nr, pr.ticket, "", PF_PASS, + &pr.rule, pr.anchor_call)) { + warn("DIOCGETRULENV"); return (1); } memcpy(&por->por_rule, &pr.rule, sizeof(por->por_rule)); From owner-dev-commits-src-all@freebsd.org Sat Apr 10 09:16:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BA1DA5E0381; Sat, 10 Apr 2021 09:16: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 4FHTrk4Zcsz4nlB; Sat, 10 Apr 2021 09:16: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 7FD8E675A; Sat, 10 Apr 2021 09:16: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 13A9GMgT069020; Sat, 10 Apr 2021 09:16:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A9GMOp069019; Sat, 10 Apr 2021 09:16:22 GMT (envelope-from git) Date: Sat, 10 Apr 2021 09:16:22 GMT Message-Id: <202104100916.13A9GMOp069019@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: 0dd13c77432a - main - libnv: Build PIC 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: 0dd13c77432ade1ae94c9661cbad5537e3e6ab1d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 09:16:22 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0dd13c77432ade1ae94c9661cbad5537e3e6ab1d commit 0dd13c77432ade1ae94c9661cbad5537e3e6ab1d Author: Kristof Provost AuthorDate: 2021-04-02 15:06:02 +0000 Commit: Kristof Provost CommitDate: 2021-04-10 09:16:01 +0000 libnv: Build PIC Build libnv as position independent code so we can use it from shared libraries. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29561 --- lib/libnv/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/libnv/Makefile b/lib/libnv/Makefile index b13758931c4e..854cd2c7f3f3 100644 --- a/lib/libnv/Makefile +++ b/lib/libnv/Makefile @@ -10,6 +10,7 @@ SHLIB_MAJOR= 0 .PATH: ${SRCTOP}/sys/contrib/libnv ${SRCTOP}/sys/sys CFLAGS+=-I${.CURDIR} +CFLAGS+=-fPIC SRCS= cnvlist.c SRCS+= dnvlist.c From owner-dev-commits-src-all@freebsd.org Sat Apr 10 09:16:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA1395E0152; Sat, 10 Apr 2021 09:16: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 4FHTrl6jvsz4nXl; Sat, 10 Apr 2021 09:16: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 9B89368C2; Sat, 10 Apr 2021 09:16: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 13A9GNmc069041; Sat, 10 Apr 2021 09:16:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A9GNGO069040; Sat, 10 Apr 2021 09:16:23 GMT (envelope-from git) Date: Sat, 10 Apr 2021 09:16:23 GMT Message-Id: <202104100916.13A9GNGO069040@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: 0d71f9f36e6c - main - pfctl: Move ioctl abstraction functions into libpfctl 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: 0d71f9f36e6c1849fdaf6c1edc1178be07357034 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 09:16:25 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0d71f9f36e6c1849fdaf6c1edc1178be07357034 commit 0d71f9f36e6c1849fdaf6c1edc1178be07357034 Author: Kristof Provost AuthorDate: 2021-03-26 10:38:58 +0000 Commit: Kristof Provost CommitDate: 2021-04-10 09:16:02 +0000 pfctl: Move ioctl abstraction functions into libpfctl Introduce a library to wrap the pf ioctl interface. MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29562 --- lib/Makefile | 1 + lib/libpfctl/Makefile | 12 ++ .../pfctl/pfctl_ioctl.c => lib/libpfctl/libpfctl.c | 199 ++++++++++++++++++- lib/libpfctl/libpfctl.h | 45 +++++ sbin/pfctl/Makefile | 5 +- sbin/pfctl/parse.y | 6 +- sbin/pfctl/pfctl.c | 212 +-------------------- sbin/pfctl/pfctl_ioctl.h | 43 ----- sbin/pfctl/pfctl_optimize.c | 2 +- sbin/pfctl/pfctl_parser.h | 2 +- share/mk/src.libnames.mk | 5 + 11 files changed, 276 insertions(+), 256 deletions(-) diff --git a/lib/Makefile b/lib/Makefile index 80b77f1fd704..26b867ec00e1 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -210,6 +210,7 @@ SUBDIR.${MK_BHYVE}+= libvmmapi SUBDIR.${MK_OPENMP}+= libomp .endif SUBDIR.${MK_OPENSSL}+= libmp +SUBDIR.${MK_PF}+= libpfctl SUBDIR.${MK_PMC}+= libpmc libpmcstat SUBDIR.${MK_RADIUS_SUPPORT}+= libradius SUBDIR.${MK_SENDMAIL}+= libmilter libsm libsmdb libsmutil diff --git a/lib/libpfctl/Makefile b/lib/libpfctl/Makefile new file mode 100644 index 000000000000..d7a00a94b349 --- /dev/null +++ b/lib/libpfctl/Makefile @@ -0,0 +1,12 @@ +# $FreeBSD$ + +PACKAGE= lib${LIB} +LIB= pfctl +INTERNALLIB= true + +SRCS= libpfctl.c +INCS= libpfctl.h + +CFLAGS+= -fPIC + +.include diff --git a/sbin/pfctl/pfctl_ioctl.c b/lib/libpfctl/libpfctl.c similarity index 62% rename from sbin/pfctl/pfctl_ioctl.c rename to lib/libpfctl/libpfctl.c index 878a57de0fe4..e0d429112f5b 100644 --- a/sbin/pfctl/pfctl_ioctl.c +++ b/lib/libpfctl/libpfctl.c @@ -48,7 +48,7 @@ #include #include -#include "pfctl_ioctl.h" +#include "libpfctl.h" static void pf_nvuint_8_array(const nvlist_t *nvl, const char *name, size_t maxelems, @@ -118,6 +118,17 @@ pf_nvuint_64_array(const nvlist_t *nvl, const char *name, size_t maxelems, *nelems = elems; } +static void +pfctl_nv_add_addr(nvlist_t *nvparent, const char *name, + const struct pf_addr *addr) +{ + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_binary(nvl, "addr", addr, sizeof(*addr)); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *addr) { @@ -129,6 +140,22 @@ pf_nvaddr_to_addr(const nvlist_t *nvl, struct pf_addr *addr) memcpy(addr, data, len); } +static void +pfctl_nv_add_addr_wrap(nvlist_t *nvparent, const char *name, + const struct pf_addr_wrap *addr) +{ + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_number(nvl, "type", addr->type); + nvlist_add_number(nvl, "iflags", addr->iflags); + nvlist_add_string(nvl, "ifname", addr->v.ifname); + nvlist_add_string(nvl, "tblname", addr->v.tblname); + pfctl_nv_add_addr(nvl, "addr", &addr->v.a.addr); + pfctl_nv_add_addr(nvl, "mask", &addr->v.a.mask); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) { @@ -142,6 +169,23 @@ pf_nvaddr_wrap_to_addr_wrap(const nvlist_t *nvl, struct pf_addr_wrap *addr) pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "mask"), &addr->v.a.mask); } +static void +pfctl_nv_add_rule_addr(nvlist_t *nvparent, const char *name, + const struct pf_rule_addr *addr) +{ + u_int64_t ports[2]; + nvlist_t *nvl = nvlist_create(0); + + pfctl_nv_add_addr_wrap(nvl, "addr", &addr->addr); + ports[0] = addr->port[0]; + ports[1] = addr->port[1]; + nvlist_add_number_array(nvl, "port", ports, 2); + nvlist_add_number(nvl, "neg", addr->neg); + nvlist_add_number(nvl, "port_op", addr->port_op); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr) { @@ -152,6 +196,25 @@ pf_nvrule_addr_to_rule_addr(const nvlist_t *nvl, struct pf_rule_addr *addr) addr->port_op = nvlist_get_number(nvl, "port_op"); } +static void +pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, + const struct pf_pool *pool) +{ + u_int64_t ports[2]; + nvlist_t *nvl = nvlist_create(0); + + nvlist_add_binary(nvl, "key", &pool->key, sizeof(pool->key)); + pfctl_nv_add_addr(nvl, "counter", &pool->counter); + nvlist_add_number(nvl, "tblidx", pool->tblidx); + + ports[0] = pool->proxy_port[0]; + ports[1] = pool->proxy_port[1]; + nvlist_add_number_array(nvl, "proxy_port", ports, 2); + nvlist_add_number(nvl, "opts", pool->opts); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_pool *pool) { @@ -169,6 +232,21 @@ pf_nvpool_to_pool(const nvlist_t *nvl, struct pf_pool *pool) pool->opts = nvlist_get_number(nvl, "opts"); } +static void +pfctl_nv_add_uid(nvlist_t *nvparent, const char *name, + const struct pf_rule_uid *uid) +{ + u_int64_t uids[2]; + nvlist_t *nvl = nvlist_create(0); + + uids[0] = uid->uid[0]; + uids[1] = uid->uid[1]; + nvlist_add_number_array(nvl, "uid", uids, 2); + nvlist_add_number(nvl, "op", uid->op); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) { @@ -176,6 +254,18 @@ pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) uid->op = nvlist_get_number(nvl, "op"); } +static void +pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, + const struct pf_rule *r) +{ + nvlist_t *nvl = nvlist_create(0); + + pfctl_nv_add_addr(nvl, "addr", &r->divert.addr); + nvlist_add_number(nvl, "port", r->divert.port); + + nvlist_add_nvlist(nvparent, name, nvl); +} + static void pf_nvdivert_to_divert(const nvlist_t *nvl, struct pf_rule *rule) { @@ -282,6 +372,113 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pf_rule *rule) rule->u_src_nodes = nvlist_get_number(nvl, "src_nodes"); } +int +pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, + const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket) +{ + struct pfioc_nv nv; + u_int64_t timeouts[PFTM_MAX]; + u_int64_t set_prio[2]; + nvlist_t *nvl, *nvlr; + int ret; + + nvl = nvlist_create(0); + nvlr = nvlist_create(0); + + nvlist_add_number(nvl, "ticket", ticket); + nvlist_add_number(nvl, "pool_ticket", pool_ticket); + nvlist_add_string(nvl, "anchor", anchor); + nvlist_add_string(nvl, "anchor_call", anchor_call); + + nvlist_add_number(nvlr, "nr", r->nr); + pfctl_nv_add_rule_addr(nvlr, "src", &r->src); + pfctl_nv_add_rule_addr(nvlr, "dst", &r->dst); + + nvlist_add_string(nvlr, "label", r->label); + nvlist_add_string(nvlr, "ifname", r->ifname); + nvlist_add_string(nvlr, "qname", r->qname); + nvlist_add_string(nvlr, "pqname", r->pqname); + nvlist_add_string(nvlr, "tagname", r->tagname); + nvlist_add_string(nvlr, "match_tagname", r->match_tagname); + nvlist_add_string(nvlr, "overload_tblname", r->overload_tblname); + + pfctl_nv_add_pool(nvlr, "rpool", &r->rpool); + + nvlist_add_number(nvlr, "os_fingerprint", r->os_fingerprint); + + nvlist_add_number(nvlr, "rtableid", r->rtableid); + for (int i = 0; i < PFTM_MAX; i++) + timeouts[i] = r->timeout[i]; + nvlist_add_number_array(nvlr, "timeout", timeouts, PFTM_MAX); + nvlist_add_number(nvlr, "max_states", r->max_states); + nvlist_add_number(nvlr, "max_src_nodes", r->max_src_nodes); + nvlist_add_number(nvlr, "max_src_states", r->max_src_states); + nvlist_add_number(nvlr, "max_src_conn", r->max_src_conn); + nvlist_add_number(nvlr, "max_src_conn_rate.limit", + r->max_src_conn_rate.limit); + nvlist_add_number(nvlr, "max_src_conn_rate.seconds", + r->max_src_conn_rate.seconds); + nvlist_add_number(nvlr, "prob", r->prob); + nvlist_add_number(nvlr, "cuid", r->cuid); + nvlist_add_number(nvlr, "cpid", r->cpid); + + nvlist_add_number(nvlr, "return_icmp", r->return_icmp); + nvlist_add_number(nvlr, "return_icmp6", r->return_icmp6); + + nvlist_add_number(nvlr, "max_mss", r->max_mss); + nvlist_add_number(nvlr, "scrub_flags", r->scrub_flags); + + pfctl_nv_add_uid(nvlr, "uid", &r->uid); + pfctl_nv_add_uid(nvlr, "gid", (const struct pf_rule_uid *)&r->gid); + + nvlist_add_number(nvlr, "rule_flag", r->rule_flag); + nvlist_add_number(nvlr, "action", r->action); + nvlist_add_number(nvlr, "direction", r->direction); + nvlist_add_number(nvlr, "log", r->log); + nvlist_add_number(nvlr, "logif", r->logif); + nvlist_add_number(nvlr, "quick", r->quick); + nvlist_add_number(nvlr, "ifnot", r->ifnot); + nvlist_add_number(nvlr, "match_tag_not", r->match_tag_not); + nvlist_add_number(nvlr, "natpass", r->natpass); + + nvlist_add_number(nvlr, "keep_state", r->keep_state); + nvlist_add_number(nvlr, "af", r->af); + nvlist_add_number(nvlr, "proto", r->proto); + nvlist_add_number(nvlr, "type", r->type); + nvlist_add_number(nvlr, "code", r->code); + nvlist_add_number(nvlr, "flags", r->flags); + nvlist_add_number(nvlr, "flagset", r->flagset); + nvlist_add_number(nvlr, "min_ttl", r->min_ttl); + nvlist_add_number(nvlr, "allow_opts", r->allow_opts); + nvlist_add_number(nvlr, "rt", r->rt); + nvlist_add_number(nvlr, "return_ttl", r->return_ttl); + nvlist_add_number(nvlr, "tos", r->tos); + nvlist_add_number(nvlr, "set_tos", r->set_tos); + nvlist_add_number(nvlr, "anchor_relative", r->anchor_relative); + nvlist_add_number(nvlr, "anchor_wildcard", r->anchor_wildcard); + + nvlist_add_number(nvlr, "flush", r->flush); + + nvlist_add_number(nvlr, "prio", r->prio); + set_prio[0] = r->set_prio[0]; + set_prio[1] = r->set_prio[1]; + nvlist_add_number_array(nvlr, "set_prio", set_prio, 2); + + pfctl_nv_add_divert(nvlr, "divert", r); + + nvlist_add_nvlist(nvl, "rule", nvlr); + + /* Now do the call. */ + nv.data = nvlist_pack(nvl, &nv.len); + nv.size = nv.len; + + ret = ioctl(dev, DIOCADDRULENV, &nv); + + free(nv.data); + nvlist_destroy(nvl); + + return (ret); +} int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h new file mode 100644 index 000000000000..65ff2179f23d --- /dev/null +++ b/lib/libpfctl/libpfctl.h @@ -0,0 +1,45 @@ +/*- + * 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: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS 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 _PFCTL_IOCTL_H_ +#define _PFCTL_IOCTL_H_ + +#include + +int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, + const char *anchor, u_int32_t ruleset, struct pf_rule *rule, + char *anchor_call); +int pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, + const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket); + +#endif diff --git a/sbin/pfctl/Makefile b/sbin/pfctl/Makefile index c84d558c989d..49bdfb9e3733 100644 --- a/sbin/pfctl/Makefile +++ b/sbin/pfctl/Makefile @@ -9,13 +9,14 @@ MAN= pfctl.8 SRCS = pfctl.c parse.y pfctl_parser.c pf_print_state.c pfctl_altq.c SRCS+= pfctl_osfp.c pfctl_radix.c pfctl_table.c pfctl_qstats.c -SRCS+= pfctl_optimize.c pfctl_ioctl.c +SRCS+= pfctl_optimize.c SRCS+= pf_ruleset.c WARNS?= 2 CFLAGS+= -Wall -Wmissing-prototypes -Wno-uninitialized CFLAGS+= -Wstrict-prototypes CFLAGS+= -DENABLE_ALTQ -I${.CURDIR} +CFLAGS+= -I${SRCTOP}/lib/libpfctl -I${OBJTOP}/lib/libpfctl # Need to use "WITH_" prefix to not conflict with the l/y INET/INET6 keywords .if ${MK_INET6_SUPPORT} != "no" @@ -27,7 +28,7 @@ CFLAGS+= -DWITH_INET YFLAGS= -LIBADD= m md nv +LIBADD= m md pfctl HAS_TESTS= SUBDIR.${MK_TESTS}+= tests diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 9db85538feaf..89e421e6b5ad 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -1040,7 +1040,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto decide_address_family($6.src.host, &r.af); decide_address_family($6.dst.host, &r.af); - pfctl_add_rule(pf, &r, $2); + pfctl_append_rule(pf, &r, $2); free($2); } ; @@ -4390,7 +4390,7 @@ binatrule : no BINAT natpasslog interface af proto FROM ipspec toipspec tag free($13); } - pfctl_add_rule(pf, &binat, ""); + pfctl_append_rule(pf, &binat, ""); } ; @@ -5407,7 +5407,7 @@ expand_rule(struct pf_rule *r, yyerror("skipping rule due to errors"); else { r->nr = pf->astack[pf->asd]->match++; - pfctl_add_rule(pf, r, anchor_call); + pfctl_append_rule(pf, r, anchor_call); added++; } diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 1aa17065597b..fde9d61260ef 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -63,7 +64,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include "pfctl_ioctl.h" #include "pfctl_parser.h" #include "pfctl.h" @@ -1291,7 +1291,7 @@ pfctl_add_pool(struct pfctl *pf, struct pf_pool *p, sa_family_t af) } int -pfctl_add_rule(struct pfctl *pf, struct pf_rule *r, const char *anchor_call) +pfctl_append_rule(struct pfctl *pf, struct pf_rule *r, const char *anchor_call) { u_int8_t rs_num; struct pf_rule *rule; @@ -1309,22 +1309,22 @@ pfctl_add_rule(struct pfctl *pf, struct pf_rule *r, const char *anchor_call) * Don't make non-brace anchors part of the main anchor pool. */ if ((r->anchor = calloc(1, sizeof(*r->anchor))) == NULL) - err(1, "pfctl_add_rule: calloc"); + err(1, "pfctl_append_rule: calloc"); pf_init_ruleset(&r->anchor->ruleset); r->anchor->ruleset.anchor = r->anchor; if (strlcpy(r->anchor->path, anchor_call, sizeof(rule->anchor->path)) >= sizeof(rule->anchor->path)) - errx(1, "pfctl_add_rule: strlcpy"); + errx(1, "pfctl_append_rule: strlcpy"); if ((p = strrchr(anchor_call, '/')) != NULL) { if (!strlen(p)) - err(1, "pfctl_add_rule: bad anchor name %s", + err(1, "pfctl_append_rule: bad anchor name %s", anchor_call); } else p = (char *)anchor_call; if (strlcpy(r->anchor->name, p, sizeof(rule->anchor->name)) >= sizeof(rule->anchor->name)) - errx(1, "pfctl_add_rule: strlcpy"); + errx(1, "pfctl_append_rule: strlcpy"); } if ((rule = calloc(1, sizeof(*rule))) == NULL) @@ -1427,204 +1427,6 @@ pfctl_load_ruleset(struct pfctl *pf, char *path, struct pf_ruleset *rs, } -static void -pfctl_nv_add_addr(nvlist_t *nvparent, const char *name, - const struct pf_addr *addr) -{ - nvlist_t *nvl = nvlist_create(0); - - nvlist_add_binary(nvl, "addr", addr, sizeof(*addr)); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_addr_wrap(nvlist_t *nvparent, const char *name, - const struct pf_addr_wrap *addr) -{ - nvlist_t *nvl = nvlist_create(0); - - nvlist_add_number(nvl, "type", addr->type); - nvlist_add_number(nvl, "iflags", addr->iflags); - nvlist_add_string(nvl, "ifname", addr->v.ifname); - nvlist_add_string(nvl, "tblname", addr->v.tblname); - pfctl_nv_add_addr(nvl, "addr", &addr->v.a.addr); - pfctl_nv_add_addr(nvl, "mask", &addr->v.a.mask); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_rule_addr(nvlist_t *nvparent, const char *name, - const struct pf_rule_addr *addr) -{ - u_int64_t ports[2]; - nvlist_t *nvl = nvlist_create(0); - - pfctl_nv_add_addr_wrap(nvl, "addr", &addr->addr); - ports[0] = addr->port[0]; - ports[1] = addr->port[1]; - nvlist_add_number_array(nvl, "port", ports, 2); - nvlist_add_number(nvl, "neg", addr->neg); - nvlist_add_number(nvl, "port_op", addr->port_op); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_pool(nvlist_t *nvparent, const char *name, - const struct pf_pool *pool) -{ - u_int64_t ports[2]; - nvlist_t *nvl = nvlist_create(0); - - nvlist_add_binary(nvl, "key", &pool->key, sizeof(pool->key)); - pfctl_nv_add_addr(nvl, "counter", &pool->counter); - nvlist_add_number(nvl, "tblidx", pool->tblidx); - - ports[0] = pool->proxy_port[0]; - ports[1] = pool->proxy_port[1]; - nvlist_add_number_array(nvl, "proxy_port", ports, 2); - nvlist_add_number(nvl, "opts", pool->opts); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_uid(nvlist_t *nvparent, const char *name, - const struct pf_rule_uid *uid) -{ - u_int64_t uids[2]; - nvlist_t *nvl = nvlist_create(0); - - uids[0] = uid->uid[0]; - uids[1] = uid->uid[1]; - nvlist_add_number_array(nvl, "uid", uids, 2); - nvlist_add_number(nvl, "op", uid->op); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static void -pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, - const struct pf_rule *r) -{ - nvlist_t *nvl = nvlist_create(0); - - pfctl_nv_add_addr(nvl, "addr", &r->divert.addr); - nvlist_add_number(nvl, "port", r->divert.port); - - nvlist_add_nvlist(nvparent, name, nvl); -} - -static int -pfctl_addrule(struct pfctl *pf, const struct pf_rule *r, const char *anchor, - const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket) -{ - struct pfioc_nv nv; - u_int64_t timeouts[PFTM_MAX]; - u_int64_t set_prio[2]; - nvlist_t *nvl, *nvlr; - int ret; - - nvl = nvlist_create(0); - nvlr = nvlist_create(0); - - nvlist_add_number(nvl, "ticket", ticket); - nvlist_add_number(nvl, "pool_ticket", pool_ticket); - nvlist_add_string(nvl, "anchor", anchor); - nvlist_add_string(nvl, "anchor_call", anchor_call); - - nvlist_add_number(nvlr, "nr", r->nr); - pfctl_nv_add_rule_addr(nvlr, "src", &r->src); - pfctl_nv_add_rule_addr(nvlr, "dst", &r->dst); - - nvlist_add_string(nvlr, "label", r->label); - nvlist_add_string(nvlr, "ifname", r->ifname); - nvlist_add_string(nvlr, "qname", r->qname); - nvlist_add_string(nvlr, "pqname", r->pqname); - nvlist_add_string(nvlr, "tagname", r->tagname); - nvlist_add_string(nvlr, "match_tagname", r->match_tagname); - nvlist_add_string(nvlr, "overload_tblname", r->overload_tblname); - - pfctl_nv_add_pool(nvlr, "rpool", &r->rpool); - - nvlist_add_number(nvlr, "os_fingerprint", r->os_fingerprint); - - nvlist_add_number(nvlr, "rtableid", r->rtableid); - for (int i = 0; i < PFTM_MAX; i++) - timeouts[i] = r->timeout[i]; - nvlist_add_number_array(nvlr, "timeout", timeouts, PFTM_MAX); - nvlist_add_number(nvlr, "max_states", r->max_states); - nvlist_add_number(nvlr, "max_src_nodes", r->max_src_nodes); - nvlist_add_number(nvlr, "max_src_states", r->max_src_states); - nvlist_add_number(nvlr, "max_src_conn", r->max_src_conn); - nvlist_add_number(nvlr, "max_src_conn_rate.limit", - r->max_src_conn_rate.limit); - nvlist_add_number(nvlr, "max_src_conn_rate.seconds", - r->max_src_conn_rate.seconds); - nvlist_add_number(nvlr, "prob", r->prob); - nvlist_add_number(nvlr, "cuid", r->cuid); - nvlist_add_number(nvlr, "cpid", r->cpid); - - nvlist_add_number(nvlr, "return_icmp", r->return_icmp); - nvlist_add_number(nvlr, "return_icmp6", r->return_icmp6); - - nvlist_add_number(nvlr, "max_mss", r->max_mss); - nvlist_add_number(nvlr, "scrub_flags", r->scrub_flags); - - pfctl_nv_add_uid(nvlr, "uid", &r->uid); - pfctl_nv_add_uid(nvlr, "gid", (struct pf_rule_uid *)&r->gid); - - nvlist_add_number(nvlr, "rule_flag", r->rule_flag); - nvlist_add_number(nvlr, "action", r->action); - nvlist_add_number(nvlr, "direction", r->direction); - nvlist_add_number(nvlr, "log", r->log); - nvlist_add_number(nvlr, "logif", r->logif); - nvlist_add_number(nvlr, "quick", r->quick); - nvlist_add_number(nvlr, "ifnot", r->ifnot); - nvlist_add_number(nvlr, "match_tag_not", r->match_tag_not); - nvlist_add_number(nvlr, "natpass", r->natpass); - - nvlist_add_number(nvlr, "keep_state", r->keep_state); - nvlist_add_number(nvlr, "af", r->af); - nvlist_add_number(nvlr, "proto", r->proto); - nvlist_add_number(nvlr, "type", r->type); - nvlist_add_number(nvlr, "code", r->code); - nvlist_add_number(nvlr, "flags", r->flags); - nvlist_add_number(nvlr, "flagset", r->flagset); - nvlist_add_number(nvlr, "min_ttl", r->min_ttl); - nvlist_add_number(nvlr, "allow_opts", r->allow_opts); - nvlist_add_number(nvlr, "rt", r->rt); - nvlist_add_number(nvlr, "return_ttl", r->return_ttl); - nvlist_add_number(nvlr, "tos", r->tos); - nvlist_add_number(nvlr, "set_tos", r->set_tos); - nvlist_add_number(nvlr, "anchor_relative", r->anchor_relative); - nvlist_add_number(nvlr, "anchor_wildcard", r->anchor_wildcard); - - nvlist_add_number(nvlr, "flush", r->flush); - - nvlist_add_number(nvlr, "prio", r->prio); - set_prio[0] = r->set_prio[0]; - set_prio[1] = r->set_prio[1]; - nvlist_add_number_array(nvlr, "set_prio", set_prio, 2); - - pfctl_nv_add_divert(nvlr, "divert", r); - - nvlist_add_nvlist(nvl, "rule", nvlr); - - /* Now do the call. */ - nv.data = nvlist_pack(nvl, &nv.len); - nv.size = nv.len; - - ret = ioctl(pf->dev, DIOCADDRULENV, &nv); - - free(nv.data); - nvlist_destroy(nvl); - - return (ret); -} - int pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth) { @@ -1657,7 +1459,7 @@ pfctl_load_rule(struct pfctl *pf, char *path, struct pf_rule *r, int depth) if ((pf->opts & PF_OPT_NOACTION) == 0) { if (pfctl_add_pool(pf, &r->rpool, r->af)) return (1); - if (pfctl_addrule(pf, r, anchor, name, ticket, + if (pfctl_add_rule(pf->dev, r, anchor, name, ticket, pf->paddr.ticket)) err(1, "DIOCADDRULENV"); } diff --git a/sbin/pfctl/pfctl_ioctl.h b/sbin/pfctl/pfctl_ioctl.h index 41dd0776854a..e69de29bb2d1 100644 --- a/sbin/pfctl/pfctl_ioctl.h +++ b/sbin/pfctl/pfctl_ioctl.h @@ -1,43 +0,0 @@ -/*- - * 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: - * - * - Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS 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 _PFCTL_IOCTL_H_ -#define _PFCTL_IOCTL_H_ - -#include - -int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, - const char *anchor, u_int32_t ruleset, struct pf_rule *rule, - char *anchor_call); - -#endif diff --git a/sbin/pfctl/pfctl_optimize.c b/sbin/pfctl/pfctl_optimize.c index d3f0aa1bf3a4..821a528932f3 100644 --- a/sbin/pfctl/pfctl_optimize.c +++ b/sbin/pfctl/pfctl_optimize.c @@ -33,12 +33,12 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include -#include "pfctl_ioctl.h" #include "pfctl_parser.h" #include "pfctl.h" diff --git a/sbin/pfctl/pfctl_parser.h b/sbin/pfctl/pfctl_parser.h index aa6d98d7cf91..2547caa1a8ce 100644 --- a/sbin/pfctl/pfctl_parser.h +++ b/sbin/pfctl/pfctl_parser.h @@ -252,7 +252,7 @@ TAILQ_HEAD(pf_opt_queue, pf_opt_rule); int pfctl_rules(int, char *, int, int, char *, struct pfr_buffer *); int pfctl_optimize_ruleset(struct pfctl *, struct pf_ruleset *); -int pfctl_add_rule(struct pfctl *, struct pf_rule *, const char *); +int pfctl_append_rule(struct pfctl *, struct pf_rule *, const char *); int pfctl_add_altq(struct pfctl *, struct pf_altq *); int pfctl_add_pool(struct pfctl *, struct pf_pool *, sa_family_t); void pfctl_move_pool(struct pf_pool *, struct pf_pool *); diff --git a/share/mk/src.libnames.mk b/share/mk/src.libnames.mk index 1d3195f53eb1..259a65a7afd4 100644 --- a/share/mk/src.libnames.mk +++ b/share/mk/src.libnames.mk @@ -57,6 +57,7 @@ _INTERNALLIBS= \ opts \ parse \ pe \ + pfctl \ pmcstat \ sl \ sm \ @@ -387,6 +388,7 @@ _DP_zutil= avl tpool _DP_be= zfs spl nvpair zfsbootenv _DP_netmap= _DP_ifconfig= m +_DP_pfctl= nv # OFED support .if ${MK_OFED} != "no" @@ -564,6 +566,9 @@ LIBOPTS?= ${LIBOPTSDIR}/libopts${PIE_SUFFIX}.a LIBPARSEDIR= ${_LIB_OBJTOP}/usr.sbin/ntp/libparse LIBPARSE?= ${LIBPARSEDIR}/libparse${PIE_SUFFIX}.a +LIBPFCTL= ${_LIB_OBJTOP}/lib/libpfctl +LIBPFCTL?= ${LIBPFCTLDIR}/libpfctl${PIE_SUFFIX}.a + LIBLPRDIR= ${_LIB_OBJTOP}/usr.sbin/lpr/common_source LIBLPR?= ${LIBLPRDIR}/liblpr${PIE_SUFFIX}.a From owner-dev-commits-src-all@freebsd.org Sat Apr 10 09:16:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 157325E025B; Sat, 10 Apr 2021 09:16:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FHTrm651gz4nnj; Sat, 10 Apr 2021 09:16: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 AF75A675B; Sat, 10 Apr 2021 09:16: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 13A9GOvd069065; Sat, 10 Apr 2021 09:16:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A9GOSs069064; Sat, 10 Apr 2021 09:16:24 GMT (envelope-from git) Date: Sat, 10 Apr 2021 09:16:24 GMT Message-Id: <202104100916.13A9GOSs069064@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: 95be9288f01f - main - (t)ftp-proxy: use libpfctl 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: 95be9288f01f30a50440ea56d11468a2c6e18fed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 09:16:25 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=95be9288f01f30a50440ea56d11468a2c6e18fed commit 95be9288f01f30a50440ea56d11468a2c6e18fed Author: Kristof Provost AuthorDate: 2021-03-29 12:03:39 +0000 Commit: Kristof Provost CommitDate: 2021-04-10 09:16:02 +0000 (t)ftp-proxy: use libpfctl Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29641 --- contrib/pf/ftp-proxy/filter.c | 16 +++++++++++----- contrib/pf/tftp-proxy/filter.c | 10 +++++++--- libexec/tftp-proxy/Makefile | 3 +++ usr.sbin/ftp-proxy/Makefile | 3 ++- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/contrib/pf/ftp-proxy/filter.c b/contrib/pf/ftp-proxy/filter.c index f575db1c69cc..db3735565dac 100644 --- a/contrib/pf/ftp-proxy/filter.c +++ b/contrib/pf/ftp-proxy/filter.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -68,7 +69,8 @@ add_filter(u_int32_t id, u_int8_t dir, struct sockaddr *src, return (-1); pfr.rule.direction = dir; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); @@ -97,12 +99,14 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(nat)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (ioctl(dev, DIOCADDADDR, &pfp) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); pfr.rule.rpool.proxy_port[0] = nat_range_low; pfr.rule.rpool.proxy_port[1] = nat_range_high; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); @@ -130,11 +134,13 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(rdr)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (ioctl(dev, DIOCADDADDR, &pfp) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); pfr.rule.rpool.proxy_port[0] = rdr_port; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); diff --git a/contrib/pf/tftp-proxy/filter.c b/contrib/pf/tftp-proxy/filter.c index e5a769a62a54..0b87d568809f 100644 --- a/contrib/pf/tftp-proxy/filter.c +++ b/contrib/pf/tftp-proxy/filter.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -72,7 +73,8 @@ add_filter(u_int32_t id, u_int8_t dir, struct sockaddr *src, return (-1); pfr.rule.direction = dir; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); @@ -106,7 +108,8 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, pfr.rule.rpool.proxy_port[0] = nat_range_low; pfr.rule.rpool.proxy_port[1] = nat_range_high; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); @@ -138,7 +141,8 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, return (-1); pfr.rule.rpool.proxy_port[0] = rdr_port; - if (ioctl(dev, DIOCADDRULE, &pfr) == -1) + if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, + pfr.ticket, pfr.pool_ticket)) return (-1); return (0); diff --git a/libexec/tftp-proxy/Makefile b/libexec/tftp-proxy/Makefile index 596ca26cb61c..353e72007734 100644 --- a/libexec/tftp-proxy/Makefile +++ b/libexec/tftp-proxy/Makefile @@ -6,6 +6,9 @@ PROG= tftp-proxy SRCS= tftp-proxy.c filter.c MAN= tftp-proxy.8 +CFLAGS+= -I${SRCTOP}/lib/libpfctl -I${OBJTOP}/lib/libpfctl +LIBADD= pfctl + WARNS?= 3 .include diff --git a/usr.sbin/ftp-proxy/Makefile b/usr.sbin/ftp-proxy/Makefile index 7d05aa9bf624..768901f99131 100644 --- a/usr.sbin/ftp-proxy/Makefile +++ b/usr.sbin/ftp-proxy/Makefile @@ -8,8 +8,9 @@ MAN= ftp-proxy.8 SRCS= ftp-proxy.c filter.c CFLAGS+=-I${SRCTOP}/contrib/pf/libevent +CFLAGS+= -I${SRCTOP}/lib/libpfctl -I${OBJTOP}/lib/libpfctl -LIBADD= event1 +LIBADD= event1 pfctl WARNS?= 3 From owner-dev-commits-src-all@freebsd.org Sat Apr 10 09:16:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A8BF5E006D; Sat, 10 Apr 2021 09:16: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 4FHTrp1CLgz4ncY; Sat, 10 Apr 2021 09:16: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 E4552675C; Sat, 10 Apr 2021 09:16:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13A9GPM1069089; Sat, 10 Apr 2021 09:16:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A9GPM3069088; Sat, 10 Apr 2021 09:16:25 GMT (envelope-from git) Date: Sat, 10 Apr 2021 09:16:25 GMT Message-Id: <202104100916.13A9GPM3069088@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: 956e7d232549 - main - bsnmp: Use libpfctl 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: 956e7d232549ce4b17f5b1a079e5b51229479dda Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 09:16:27 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=956e7d232549ce4b17f5b1a079e5b51229479dda commit 956e7d232549ce4b17f5b1a079e5b51229479dda Author: Kristof Provost AuthorDate: 2021-03-29 15:43:25 +0000 Commit: Kristof Provost CommitDate: 2021-04-10 09:16:02 +0000 bsnmp: Use libpfctl Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29642 --- usr.sbin/bsnmpd/modules/snmp_pf/Makefile | 3 +++ usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/usr.sbin/bsnmpd/modules/snmp_pf/Makefile b/usr.sbin/bsnmpd/modules/snmp_pf/Makefile index fdf77191f706..3ab6e436aa75 100644 --- a/usr.sbin/bsnmpd/modules/snmp_pf/Makefile +++ b/usr.sbin/bsnmpd/modules/snmp_pf/Makefile @@ -9,4 +9,7 @@ XSYM= begemotPf DEFS= ${MOD}_tree.def BMIBS= BEGEMOT-PF-MIB.txt +CFLAGS+= -I${SRCTOP}/lib/libpfctl -I${OBJTOP}/lib/libpfctl +LIBADD+= pfctl + .include diff --git a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c index a14ab5841dfa..dc55c730bc5f 100644 --- a/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c +++ b/usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -1528,7 +1529,8 @@ pfl_scan_ruleset(const char *path) for (nr = pr.nr, i = 0; i < nr; i++) { pr.nr = i; - if (ioctl(dev, DIOCGETRULE, &pr)) { + if (pfctl_add_rule(dev, &pr.rule, pr.anchor, pr.anchor_call, + pr.ticket, pr.pool_ticket)) { syslog(LOG_ERR, "pfl_scan_ruleset: ioctl(DIOCGETRULE):" " %s", strerror(errno)); goto err; From owner-dev-commits-src-all@freebsd.org Sat Apr 10 09:16:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB2545E0267; Sat, 10 Apr 2021 09:16: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 4FHTrr4C92z4nr4; Sat, 10 Apr 2021 09:16: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 2489E6A23; Sat, 10 Apr 2021 09:16: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 13A9GSf7069131; Sat, 10 Apr 2021 09:16:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A9GSD7069130; Sat, 10 Apr 2021 09:16:28 GMT (envelope-from git) Date: Sat, 10 Apr 2021 09:16:28 GMT Message-Id: <202104100916.13A9GSD7069130@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: e9eb09414a8d - main - libpfctl: Switch to pfctl_rule 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: e9eb09414a8de8f3329f51b48c90a5e5ac8f09cf Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 09:16:29 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e9eb09414a8de8f3329f51b48c90a5e5ac8f09cf commit e9eb09414a8de8f3329f51b48c90a5e5ac8f09cf Author: Kristof Provost AuthorDate: 2021-04-08 08:31:46 +0000 Commit: Kristof Provost CommitDate: 2021-04-10 09:16:02 +0000 libpfctl: Switch to pfctl_rule Stop using the kernel's struct pf_rule, switch to libpfctl's pfctl_rule. Now that we use nvlists to communicate with the kernel these structures can be fully decoupled. Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29644 --- contrib/pf/ftp-proxy/filter.c | 100 +++++++++++---------- contrib/pf/tftp-proxy/filter.c | 90 ++++++++++--------- lib/libpfctl/libpfctl.c | 10 +-- lib/libpfctl/libpfctl.h | 143 +++++++++++++++++++++++++++++- sbin/pfctl/parse.y | 52 +++++------ sbin/pfctl/pf_ruleset.c | 63 ++++++------- sbin/pfctl/pfctl.c | 91 ++++++++++--------- sbin/pfctl/pfctl.h | 14 +-- sbin/pfctl/pfctl_optimize.c | 82 ++++++++--------- sbin/pfctl/pfctl_parser.c | 2 +- sbin/pfctl/pfctl_parser.h | 14 +-- usr.sbin/bsnmpd/modules/snmp_pf/pf_snmp.c | 17 ++-- 12 files changed, 416 insertions(+), 262 deletions(-) diff --git a/contrib/pf/ftp-proxy/filter.c b/contrib/pf/ftp-proxy/filter.c index db3735565dac..dad6324808bc 100644 --- a/contrib/pf/ftp-proxy/filter.c +++ b/contrib/pf/ftp-proxy/filter.c @@ -50,7 +50,11 @@ int server_lookup6(struct sockaddr_in6 *, struct sockaddr_in6 *, struct sockaddr_in6 *); static struct pfioc_pooladdr pfp; -static struct pfioc_rule pfr; +static struct pfctl_rule pfrule; +static char pfanchor[PF_ANCHOR_NAME_SIZE]; +static char pfanchor_call[PF_ANCHOR_NAME_SIZE]; +static uint32_t pfticket; +static uint32_t pfpool_ticket; static struct pfioc_trans pft; static struct pfioc_trans_e pfte[TRANS_SIZE]; static int dev, rule_log; @@ -68,9 +72,9 @@ add_filter(u_int32_t id, u_int8_t dir, struct sockaddr *src, if (prepare_rule(id, PF_RULESET_FILTER, src, dst, d_port) == -1) return (-1); - pfr.rule.direction = dir; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.direction = dir; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -99,14 +103,14 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(nat)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); - pfr.rule.rpool.proxy_port[0] = nat_range_low; - pfr.rule.rpool.proxy_port[1] = nat_range_high; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.rpool.proxy_port[0] = nat_range_low; + pfrule.rpool.proxy_port[1] = nat_range_high; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -134,13 +138,13 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, &satosin6(rdr)->sin6_addr.s6_addr, 16); memset(&pfp.addr.addr.v.a.mask.addr8, 255, 16); } - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); - pfr.rule.rpool.proxy_port[0] = rdr_port; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.rpool.proxy_port[0] = rdr_port; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -237,21 +241,21 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, } memset(&pfp, 0, sizeof pfp); - memset(&pfr, 0, sizeof pfr); + memset(&pfrule, 0, sizeof pfrule); snprintf(an, PF_ANCHOR_NAME_SIZE, "%s/%d.%d", FTP_PROXY_ANCHOR, getpid(), id); strlcpy(pfp.anchor, an, PF_ANCHOR_NAME_SIZE); - strlcpy(pfr.anchor, an, PF_ANCHOR_NAME_SIZE); + strlcpy(pfanchor, an, PF_ANCHOR_NAME_SIZE); switch (rs_num) { case PF_RULESET_FILTER: - pfr.ticket = pfte[TRANS_FILTER].ticket; + pfticket = pfte[TRANS_FILTER].ticket; break; case PF_RULESET_NAT: - pfr.ticket = pfte[TRANS_NAT].ticket; + pfticket = pfte[TRANS_NAT].ticket; break; case PF_RULESET_RDR: - pfr.ticket = pfte[TRANS_RDR].ticket; + pfticket = pfte[TRANS_RDR].ticket; break; default: errno = EINVAL; @@ -259,30 +263,30 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, } if (ioctl(dev, DIOCBEGINADDRS, &pfp) == -1) return (-1); - pfr.pool_ticket = pfp.ticket; + pfpool_ticket = pfp.ticket; /* Generic for all rule types. */ - pfr.rule.af = src->sa_family; - pfr.rule.proto = IPPROTO_TCP; - pfr.rule.src.addr.type = PF_ADDR_ADDRMASK; - pfr.rule.dst.addr.type = PF_ADDR_ADDRMASK; + pfrule.af = src->sa_family; + pfrule.proto = IPPROTO_TCP; + pfrule.src.addr.type = PF_ADDR_ADDRMASK; + pfrule.dst.addr.type = PF_ADDR_ADDRMASK; if (src->sa_family == AF_INET) { - memcpy(&pfr.rule.src.addr.v.a.addr.v4, + memcpy(&pfrule.src.addr.v.a.addr.v4, &satosin(src)->sin_addr.s_addr, 4); - memset(&pfr.rule.src.addr.v.a.mask.addr8, 255, 4); - memcpy(&pfr.rule.dst.addr.v.a.addr.v4, + memset(&pfrule.src.addr.v.a.mask.addr8, 255, 4); + memcpy(&pfrule.dst.addr.v.a.addr.v4, &satosin(dst)->sin_addr.s_addr, 4); - memset(&pfr.rule.dst.addr.v.a.mask.addr8, 255, 4); + memset(&pfrule.dst.addr.v.a.mask.addr8, 255, 4); } else { - memcpy(&pfr.rule.src.addr.v.a.addr.v6, + memcpy(&pfrule.src.addr.v.a.addr.v6, &satosin6(src)->sin6_addr.s6_addr, 16); - memset(&pfr.rule.src.addr.v.a.mask.addr8, 255, 16); - memcpy(&pfr.rule.dst.addr.v.a.addr.v6, + memset(&pfrule.src.addr.v.a.mask.addr8, 255, 16); + memcpy(&pfrule.dst.addr.v.a.addr.v6, &satosin6(dst)->sin6_addr.s6_addr, 16); - memset(&pfr.rule.dst.addr.v.a.mask.addr8, 255, 16); + memset(&pfrule.dst.addr.v.a.mask.addr8, 255, 16); } - pfr.rule.dst.port_op = PF_OP_EQ; - pfr.rule.dst.port[0] = htons(d_port); + pfrule.dst.port_op = PF_OP_EQ; + pfrule.dst.port[0] = htons(d_port); switch (rs_num) { case PF_RULESET_FILTER: @@ -291,32 +295,32 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, * from $src to $dst port = $d_port flags S/SA keep state * (max 1) [queue qname] [tag tagname] */ - pfr.rule.action = PF_PASS; - pfr.rule.quick = 1; - pfr.rule.log = rule_log; - pfr.rule.keep_state = 1; - pfr.rule.flags = TH_SYN; - pfr.rule.flagset = (TH_SYN|TH_ACK); - pfr.rule.max_states = 1; + pfrule.action = PF_PASS; + pfrule.quick = 1; + pfrule.log = rule_log; + pfrule.keep_state = 1; + pfrule.flags = TH_SYN; + pfrule.flagset = (TH_SYN|TH_ACK); + pfrule.max_states = 1; if (qname != NULL) - strlcpy(pfr.rule.qname, qname, sizeof pfr.rule.qname); + strlcpy(pfrule.qname, qname, sizeof pfrule.qname); if (tagname != NULL) { - pfr.rule.quick = 0; - strlcpy(pfr.rule.tagname, tagname, - sizeof pfr.rule.tagname); + pfrule.quick = 0; + strlcpy(pfrule.tagname, tagname, + sizeof pfrule.tagname); } break; case PF_RULESET_NAT: /* * nat inet[6] proto tcp from $src to $dst port $d_port -> $nat */ - pfr.rule.action = PF_NAT; + pfrule.action = PF_NAT; break; case PF_RULESET_RDR: /* * rdr inet[6] proto tcp from $src to $dst port $d_port -> $rdr */ - pfr.rule.action = PF_RDR; + pfrule.action = PF_RDR; break; default: errno = EINVAL; diff --git a/contrib/pf/tftp-proxy/filter.c b/contrib/pf/tftp-proxy/filter.c index 0b87d568809f..1689d3465fd3 100644 --- a/contrib/pf/tftp-proxy/filter.c +++ b/contrib/pf/tftp-proxy/filter.c @@ -54,7 +54,11 @@ int server_lookup6(struct sockaddr_in6 *, struct sockaddr_in6 *, struct sockaddr_in6 *, u_int8_t); static struct pfioc_pooladdr pfp; -static struct pfioc_rule pfr; +static struct pfctl_rule pfrule; +static uint32_t pfticket; +static uint32_t pfpool_ticket; +static char pfanchor[PF_ANCHOR_NAME_SIZE]; +static char pfanchor_call[PF_ANCHOR_NAME_SIZE]; static struct pfioc_trans pft; static struct pfioc_trans_e pfte[TRANS_SIZE]; static int dev, rule_log; @@ -72,9 +76,9 @@ add_filter(u_int32_t id, u_int8_t dir, struct sockaddr *src, if (prepare_rule(id, PF_RULESET_FILTER, src, dst, d_port, proto) == -1) return (-1); - pfr.rule.direction = dir; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.direction = dir; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -106,10 +110,10 @@ add_nat(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, if (ioctl(dev, DIOCADDADDR, &pfp) == -1) return (-1); - pfr.rule.rpool.proxy_port[0] = nat_range_low; - pfr.rule.rpool.proxy_port[1] = nat_range_high; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.rpool.proxy_port[0] = nat_range_low; + pfrule.rpool.proxy_port[1] = nat_range_high; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -140,9 +144,9 @@ add_rdr(u_int32_t id, struct sockaddr *src, struct sockaddr *dst, if (ioctl(dev, DIOCADDADDR, &pfp) == -1) return (-1); - pfr.rule.rpool.proxy_port[0] = rdr_port; - if (pfctl_add_rule(dev, &pfr.rule, pfr.anchor, pfr.anchor_call, - pfr.ticket, pfr.pool_ticket)) + pfrule.rpool.proxy_port[0] = rdr_port; + if (pfctl_add_rule(dev, &pfrule, pfanchor, pfanchor_call, + pfticket, pfpool_ticket)) return (-1); return (0); @@ -244,21 +248,21 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, } memset(&pfp, 0, sizeof pfp); - memset(&pfr, 0, sizeof pfr); + memset(&pfrule, 0, sizeof pfrule); snprintf(an, PF_ANCHOR_NAME_SIZE, "%s/%d.%d", FTP_PROXY_ANCHOR, getpid(), id); strlcpy(pfp.anchor, an, PF_ANCHOR_NAME_SIZE); - strlcpy(pfr.anchor, an, PF_ANCHOR_NAME_SIZE); + strlcpy(pfanchor, an, PF_ANCHOR_NAME_SIZE); switch (rs_num) { case PF_RULESET_FILTER: - pfr.ticket = pfte[TRANS_FILTER].ticket; + pfticket = pfte[TRANS_FILTER].ticket; break; case PF_RULESET_NAT: - pfr.ticket = pfte[TRANS_NAT].ticket; + pfticket = pfte[TRANS_NAT].ticket; break; case PF_RULESET_RDR: - pfr.ticket = pfte[TRANS_RDR].ticket; + pfticket = pfte[TRANS_RDR].ticket; break; default: errno = EINVAL; @@ -266,30 +270,30 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, } if (ioctl(dev, DIOCBEGINADDRS, &pfp) == -1) return (-1); - pfr.pool_ticket = pfp.ticket; + pfpool_ticket = pfp.ticket; /* Generic for all rule types. */ - pfr.rule.af = src->sa_family; - pfr.rule.proto = proto; - pfr.rule.src.addr.type = PF_ADDR_ADDRMASK; - pfr.rule.dst.addr.type = PF_ADDR_ADDRMASK; + pfrule.af = src->sa_family; + pfrule.proto = proto; + pfrule.src.addr.type = PF_ADDR_ADDRMASK; + pfrule.dst.addr.type = PF_ADDR_ADDRMASK; if (src->sa_family == AF_INET) { - memcpy(&pfr.rule.src.addr.v.a.addr.v4, + memcpy(&pfrule.src.addr.v.a.addr.v4, &satosin(src)->sin_addr.s_addr, 4); - memset(&pfr.rule.src.addr.v.a.mask.addr8, 255, 4); - memcpy(&pfr.rule.dst.addr.v.a.addr.v4, + memset(&pfrule.src.addr.v.a.mask.addr8, 255, 4); + memcpy(&pfrule.dst.addr.v.a.addr.v4, &satosin(dst)->sin_addr.s_addr, 4); - memset(&pfr.rule.dst.addr.v.a.mask.addr8, 255, 4); + memset(&pfrule.dst.addr.v.a.mask.addr8, 255, 4); } else { - memcpy(&pfr.rule.src.addr.v.a.addr.v6, + memcpy(&pfrule.src.addr.v.a.addr.v6, &satosin6(src)->sin6_addr.s6_addr, 16); - memset(&pfr.rule.src.addr.v.a.mask.addr8, 255, 16); - memcpy(&pfr.rule.dst.addr.v.a.addr.v6, + memset(&pfrule.src.addr.v.a.mask.addr8, 255, 16); + memcpy(&pfrule.dst.addr.v.a.addr.v6, &satosin6(dst)->sin6_addr.s6_addr, 16); - memset(&pfr.rule.dst.addr.v.a.mask.addr8, 255, 16); + memset(&pfrule.dst.addr.v.a.mask.addr8, 255, 16); } - pfr.rule.dst.port_op = PF_OP_EQ; - pfr.rule.dst.port[0] = htons(d_port); + pfrule.dst.port_op = PF_OP_EQ; + pfrule.dst.port[0] = htons(d_port); switch (rs_num) { case PF_RULESET_FILTER: @@ -298,34 +302,34 @@ prepare_rule(u_int32_t id, int rs_num, struct sockaddr *src, * from $src to $dst port = $d_port flags S/SAFR keep state * (max 1) [queue qname] */ - pfr.rule.action = PF_PASS; - pfr.rule.quick = 1; - pfr.rule.log = rule_log; - pfr.rule.keep_state = 1; + pfrule.action = PF_PASS; + pfrule.quick = 1; + pfrule.log = rule_log; + pfrule.keep_state = 1; #ifdef __FreeBSD__ - pfr.rule.flags = (proto == IPPROTO_TCP ? TH_SYN : 0); - pfr.rule.flagset = (proto == IPPROTO_TCP ? + pfrule.flags = (proto == IPPROTO_TCP ? TH_SYN : 0); + pfrule.flagset = (proto == IPPROTO_TCP ? (TH_SYN|TH_ACK|TH_FIN|TH_RST) : 0); #else - pfr.rule.flags = (proto == IPPROTO_TCP ? TH_SYN : NULL); - pfr.rule.flagset = (proto == IPPROTO_TCP ? + pfrule.flags = (proto == IPPROTO_TCP ? TH_SYN : NULL); + pfrule.flagset = (proto == IPPROTO_TCP ? (TH_SYN|TH_ACK|TH_FIN|TH_RST) : NULL); #endif - pfr.rule.max_states = 1; + pfrule.max_states = 1; if (qname != NULL) - strlcpy(pfr.rule.qname, qname, sizeof pfr.rule.qname); + strlcpy(pfrule.qname, qname, sizeof pfrule.qname); break; case PF_RULESET_NAT: /* * nat inet[6] proto tcp from $src to $dst port $d_port -> $nat */ - pfr.rule.action = PF_NAT; + pfrule.action = PF_NAT; break; case PF_RULESET_RDR: /* * rdr inet[6] proto tcp from $src to $dst port $d_port -> $rdr */ - pfr.rule.action = PF_RDR; + pfrule.action = PF_RDR; break; default: errno = EINVAL; diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index e0d429112f5b..dc174d8d5b72 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -256,7 +256,7 @@ pf_nvrule_uid_to_rule_uid(const nvlist_t *nvl, struct pf_rule_uid *uid) static void pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, - const struct pf_rule *r) + const struct pfctl_rule *r) { nvlist_t *nvl = nvlist_create(0); @@ -267,14 +267,14 @@ pfctl_nv_add_divert(nvlist_t *nvparent, const char *name, } static void -pf_nvdivert_to_divert(const nvlist_t *nvl, struct pf_rule *rule) +pf_nvdivert_to_divert(const nvlist_t *nvl, struct pfctl_rule *rule) { pf_nvaddr_to_addr(nvlist_get_nvlist(nvl, "addr"), &rule->divert.addr); rule->divert.port = nvlist_get_number(nvl, "port"); } static void -pf_nvrule_to_rule(const nvlist_t *nvl, struct pf_rule *rule) +pf_nvrule_to_rule(const nvlist_t *nvl, struct pfctl_rule *rule) { const uint64_t *skip; size_t skipcount; @@ -373,7 +373,7 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pf_rule *rule) } int -pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, +pfctl_add_rule(int dev, const struct pfctl_rule *r, const char *anchor, const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket) { struct pfioc_nv nv; @@ -482,7 +482,7 @@ pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, const char *anchor, - u_int32_t ruleset, struct pf_rule *rule, char *anchor_call) + u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call) { struct pfioc_nv nv; nvlist_t *nvl; diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 65ff2179f23d..996830619489 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -36,10 +36,147 @@ #include +struct pfctl_anchor; + +struct pfctl_rule { + struct pf_rule_addr src; + struct pf_rule_addr dst; + union pf_rule_ptr skip[PF_SKIP_COUNT]; + char label[PF_RULE_LABEL_SIZE]; + char ifname[IFNAMSIZ]; + char qname[PF_QNAME_SIZE]; + char pqname[PF_QNAME_SIZE]; + char tagname[PF_TAG_NAME_SIZE]; + char match_tagname[PF_TAG_NAME_SIZE]; + + char overload_tblname[PF_TABLE_NAME_SIZE]; + + TAILQ_ENTRY(pfctl_rule) entries; + struct pf_pool rpool; + + u_int64_t evaluations; + u_int64_t packets[2]; + u_int64_t bytes[2]; + + struct pfi_kif *kif; + struct pfctl_anchor *anchor; + struct pfr_ktable *overload_tbl; + + pf_osfp_t os_fingerprint; + + int rtableid; + u_int32_t timeout[PFTM_MAX]; + u_int32_t max_states; + u_int32_t max_src_nodes; + u_int32_t max_src_states; + u_int32_t max_src_conn; + struct { + u_int32_t limit; + u_int32_t seconds; + } max_src_conn_rate; + u_int32_t qid; + u_int32_t pqid; + u_int32_t nr; + u_int32_t prob; + uid_t cuid; + pid_t cpid; + + counter_u64_t states_cur; + counter_u64_t states_tot; + counter_u64_t src_nodes; + + u_int16_t return_icmp; + u_int16_t return_icmp6; + u_int16_t max_mss; + u_int16_t tag; + u_int16_t match_tag; + u_int16_t scrub_flags; + + struct pf_rule_uid uid; + struct pf_rule_gid gid; + + u_int32_t rule_flag; + u_int8_t action; + u_int8_t direction; + u_int8_t log; + u_int8_t logif; + u_int8_t quick; + u_int8_t ifnot; + u_int8_t match_tag_not; + u_int8_t natpass; + + u_int8_t keep_state; + sa_family_t af; + u_int8_t proto; + u_int8_t type; + u_int8_t code; + u_int8_t flags; + u_int8_t flagset; + u_int8_t min_ttl; + u_int8_t allow_opts; + u_int8_t rt; + u_int8_t return_ttl; + u_int8_t tos; + u_int8_t set_tos; + u_int8_t anchor_relative; + u_int8_t anchor_wildcard; + + u_int8_t flush; + u_int8_t prio; + u_int8_t set_prio[2]; + + struct { + struct pf_addr addr; + u_int16_t port; + } divert; + + uint64_t u_states_cur; + uint64_t u_states_tot; + uint64_t u_src_nodes; +}; + +TAILQ_HEAD(pfctl_rulequeue, pfctl_rule); + +struct pfctl_ruleset { + struct { + struct pfctl_rulequeue queues[2]; + struct { + struct pfctl_rulequeue *ptr; + struct pfctl_rule **ptr_array; + u_int32_t rcount; + u_int32_t ticket; + int open; + } active, inactive; + } rules[PF_RULESET_MAX]; + struct pfctl_anchor *anchor; + u_int32_t tticket; + int tables; + int topen; +}; + +RB_HEAD(pfctl_anchor_global, pfctl_anchor); +RB_HEAD(pfctl_anchor_node, pfctl_anchor); +struct pfctl_anchor { + RB_ENTRY(pfctl_anchor) entry_global; + RB_ENTRY(pfctl_anchor) entry_node; + struct pfctl_anchor *parent; + struct pfctl_anchor_node children; + char name[PF_ANCHOR_NAME_SIZE]; + char path[MAXPATHLEN]; + struct pfctl_ruleset ruleset; + int refcnt; /* anchor rules */ + int match; /* XXX: used for pfctl black magic */ +}; +RB_PROTOTYPE(pfctl_anchor_global, pfctl_anchor, entry_global, + pf_anchor_compare); +RB_PROTOTYPE(pfctl_anchor_node, pfctl_anchor, entry_node, + pf_anchor_compare); + int pfctl_get_rule(int dev, u_int32_t nr, u_int32_t ticket, - const char *anchor, u_int32_t ruleset, struct pf_rule *rule, + const char *anchor, u_int32_t ruleset, struct pfctl_rule *rule, char *anchor_call); -int pfctl_add_rule(int dev, const struct pf_rule *r, const char *anchor, - const char *anchor_call, u_int32_t ticket, u_int32_t pool_ticket); +int pfctl_add_rule(int dev, const struct pfctl_rule *r, + const char *anchor, const char *anchor_call, u_int32_t ticket, + u_int32_t pool_ticket); #endif diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 89e421e6b5ad..08da7e6bddd6 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -317,10 +317,10 @@ static struct node_state_opt *keep_state_defaults = NULL; int disallow_table(struct node_host *, const char *); int disallow_urpf_failed(struct node_host *, const char *); int disallow_alias(struct node_host *, const char *); -int rule_consistent(struct pf_rule *, int); -int filter_consistent(struct pf_rule *, int); -int nat_consistent(struct pf_rule *); -int rdr_consistent(struct pf_rule *); +int rule_consistent(struct pfctl_rule *, int); +int filter_consistent(struct pfctl_rule *, int); +int nat_consistent(struct pfctl_rule *); +int rdr_consistent(struct pfctl_rule *); int process_tabledef(char *, struct table_opts *); void expand_label_str(char *, size_t, const char *, const char *); void expand_label_if(const char *, char *, size_t, const char *); @@ -333,7 +333,7 @@ void expand_label_nr(const char *, char *, size_t); void expand_label(char *, size_t, const char *, u_int8_t, struct node_host *, struct node_port *, struct node_host *, struct node_port *, u_int8_t); -void expand_rule(struct pf_rule *, struct node_if *, +void expand_rule(struct pfctl_rule *, struct node_if *, struct node_host *, struct node_proto *, struct node_os *, struct node_host *, struct node_port *, struct node_host *, struct node_port *, struct node_uid *, struct node_gid *, @@ -348,10 +348,10 @@ int expand_skip_interface(struct node_if *); int check_rulestate(int); int getservice(char *); -int rule_label(struct pf_rule *, char *); +int rule_label(struct pfctl_rule *, char *); int rt_tableid_max(void); -void mv_rules(struct pf_ruleset *, struct pf_ruleset *); +void mv_rules(struct pfctl_ruleset *, struct pfctl_ruleset *); void decide_address_family(struct node_host *, sa_family_t *); void remove_invalid_hosts(struct node_host **, sa_family_t *); int invalid_redirect(struct node_host *, sa_family_t); @@ -788,7 +788,7 @@ pfa_anchorlist : /* empty */ pfa_anchor : '{' { char ta[PF_ANCHOR_NAME_SIZE]; - struct pf_ruleset *rs; + struct pfctl_ruleset *rs; /* steping into a brace anchor */ pf->asd++; @@ -814,7 +814,7 @@ pfa_anchor : '{' anchorrule : ANCHOR anchorname dir quick interface af proto fromto filter_opts pfa_anchor { - struct pf_rule r; + struct pfctl_rule r; struct node_proto *proto; if (check_rulestate(PFCTL_STATE_FILTER)) { @@ -833,7 +833,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto memset(&r, 0, sizeof(r)); if (pf->astack[pf->asd + 1]) { /* move inline rules into relative location */ - pf_anchor_setup(&r, + pfctl_anchor_setup(&r, &pf->astack[pf->asd]->ruleset, $2 ? $2 : pf->alast->name); @@ -946,7 +946,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto pf->astack[pf->asd + 1] = NULL; } | NATANCHOR string interface af proto fromto rtable { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_NAT)) { free($2); @@ -967,7 +967,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto free($2); } | RDRANCHOR string interface af proto fromto rtable { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_NAT)) { free($2); @@ -1009,7 +1009,7 @@ anchorrule : ANCHOR anchorname dir quick interface af proto fromto free($2); } | BINATANCHOR string interface af proto fromto rtable { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_NAT)) { free($2); @@ -1087,7 +1087,7 @@ scrubaction : no SCRUB { scrubrule : scrubaction dir logquick interface af proto fromto scrub_opts { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_SCRUB)) YYERROR; @@ -1247,7 +1247,7 @@ fragcache : FRAGMENT REASSEMBLE { $$ = 0; /* default */ } ; antispoof : ANTISPOOF logquick antispoof_ifspc af antispoof_opts { - struct pf_rule r; + struct pfctl_rule r; struct node_host *h = NULL, *hh; struct node_if *i, *j; @@ -2022,7 +2022,7 @@ qassign_item : STRING { pfrule : action dir logquick interface route af proto fromto filter_opts { - struct pf_rule r; + struct pfctl_rule r; struct node_state_opt *o; struct node_proto *proto; int srctrack = 0; @@ -4071,7 +4071,7 @@ nataction : no NAT natpasslog { natrule : nataction interface af proto fromto tag tagged rtable redirpool pool_opts { - struct pf_rule r; + struct pfctl_rule r; if (check_rulestate(PFCTL_STATE_NAT)) YYERROR; @@ -4230,7 +4230,7 @@ natrule : nataction interface af proto fromto tag tagged rtable binatrule : no BINAT natpasslog interface af proto FROM ipspec toipspec tag tagged rtable redirection { - struct pf_rule binat; + struct pfctl_rule binat; struct pf_pooladdr *pa; if (check_rulestate(PFCTL_STATE_NAT)) @@ -4615,7 +4615,7 @@ disallow_alias(struct node_host *h, const char *fmt) } int -rule_consistent(struct pf_rule *r, int anchor_call) +rule_consistent(struct pfctl_rule *r, int anchor_call) { int problems = 0; @@ -4643,7 +4643,7 @@ rule_consistent(struct pf_rule *r, int anchor_call) } int -filter_consistent(struct pf_rule *r, int anchor_call) +filter_consistent(struct pfctl_rule *r, int anchor_call) { int problems = 0; @@ -4706,13 +4706,13 @@ filter_consistent(struct pf_rule *r, int anchor_call) } int -nat_consistent(struct pf_rule *r) +nat_consistent(struct pfctl_rule *r) { return (0); /* yeah! */ } int -rdr_consistent(struct pf_rule *r) +rdr_consistent(struct pfctl_rule *r) { int problems = 0; @@ -5248,7 +5248,7 @@ expand_queue(struct pf_altq *a, struct node_if *interfaces, } void -expand_rule(struct pf_rule *r, +expand_rule(struct pfctl_rule *r, struct node_if *interfaces, struct node_host *rpool_hosts, struct node_proto *protos, struct node_os *src_oses, struct node_host *src_hosts, struct node_port *src_ports, @@ -6080,10 +6080,10 @@ symget(const char *nam) } void -mv_rules(struct pf_ruleset *src, struct pf_ruleset *dst) +mv_rules(struct pfctl_ruleset *src, struct pfctl_ruleset *dst) { int i; - struct pf_rule *r; + struct pfctl_rule *r; for (i = 0; i < PF_RULESET_MAX; ++i) { while ((r = TAILQ_FIRST(src->rules[i].active.ptr)) @@ -6214,7 +6214,7 @@ getservice(char *n) } int -rule_label(struct pf_rule *r, char *s) +rule_label(struct pfctl_rule *r, char *s) { if (s) { if (strlcpy(r->label, s, sizeof(r->label)) >= diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c index baac1deb4fa7..f5cddf481871 100644 --- a/sbin/pfctl/pf_ruleset.c +++ b/sbin/pfctl/pf_ruleset.c @@ -73,22 +73,23 @@ __FBSDID("$FreeBSD$"); #define DPFPRINTF(format, x...) ((void)0) #endif /* PFDEBUG */ -struct pf_anchor_global pf_anchors; -struct pf_anchor pf_main_anchor; +struct pfctl_anchor_global pf_anchors; +struct pfctl_anchor pf_main_anchor; #undef V_pf_anchors #define V_pf_anchors pf_anchors #undef pf_main_ruleset #define pf_main_ruleset pf_main_anchor.ruleset -static __inline int pf_anchor_compare(struct pf_anchor *, - struct pf_anchor *); -static struct pf_anchor *pf_find_anchor(const char *); +static __inline int pf_anchor_compare(struct pfctl_anchor *, + struct pfctl_anchor *); +static struct pfctl_anchor *pf_find_anchor(const char *); -RB_GENERATE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare); -RB_GENERATE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); +RB_GENERATE(pfctl_anchor_global, pfctl_anchor, entry_global, + pf_anchor_compare); +RB_GENERATE(pfctl_anchor_node, pfctl_anchor, entry_node, pf_anchor_compare); static __inline int -pf_anchor_compare(struct pf_anchor *a, struct pf_anchor *b) +pf_anchor_compare(struct pfctl_anchor *a, struct pfctl_anchor *b) { int c = strcmp(a->path, b->path); @@ -126,11 +127,11 @@ pf_get_ruleset_number(u_int8_t action) } void -pf_init_ruleset(struct pf_ruleset *ruleset) +pf_init_ruleset(struct pfctl_ruleset *ruleset) { int i; - memset(ruleset, 0, sizeof(struct pf_ruleset)); + memset(ruleset, 0, sizeof(struct pfctl_ruleset)); for (i = 0; i < PF_RULESET_MAX; i++) { TAILQ_INIT(&ruleset->rules[i].queues[0]); TAILQ_INIT(&ruleset->rules[i].queues[1]); @@ -139,24 +140,24 @@ pf_init_ruleset(struct pf_ruleset *ruleset) } } -static struct pf_anchor * +static struct pfctl_anchor * pf_find_anchor(const char *path) { - struct pf_anchor *key, *found; + struct pfctl_anchor *key, *found; - key = (struct pf_anchor *)rs_malloc(sizeof(*key)); + key = (struct pfctl_anchor *)rs_malloc(sizeof(*key)); if (key == NULL) return (NULL); strlcpy(key->path, path, sizeof(key->path)); - found = RB_FIND(pf_anchor_global, &V_pf_anchors, key); + found = RB_FIND(pfctl_anchor_global, &V_pf_anchors, key); rs_free(key); return (found); } -struct pf_ruleset * +struct pfctl_ruleset * pf_find_ruleset(const char *path) { - struct pf_anchor *anchor; + struct pfctl_anchor *anchor; while (*path == '/') path++; @@ -169,12 +170,12 @@ pf_find_ruleset(const char *path) return (&anchor->ruleset); } -struct pf_ruleset * +struct pfctl_ruleset * pf_find_or_create_ruleset(const char *path) { char *p, *q, *r; - struct pf_ruleset *ruleset; - struct pf_anchor *anchor = NULL, *dup, *parent = NULL; + struct pfctl_ruleset *ruleset; + struct pfctl_anchor *anchor = NULL, *dup, *parent = NULL; if (path[0] == 0) return (&pf_main_ruleset); @@ -212,7 +213,7 @@ pf_find_or_create_ruleset(const char *path) rs_free(p); return (NULL); } - anchor = (struct pf_anchor *)rs_malloc(sizeof(*anchor)); + anchor = (struct pfctl_anchor *)rs_malloc(sizeof(*anchor)); if (anchor == NULL) { rs_free(p); return (NULL); @@ -225,7 +226,7 @@ pf_find_or_create_ruleset(const char *path) strlcat(anchor->path, "/", sizeof(anchor->path)); } strlcat(anchor->path, anchor->name, sizeof(anchor->path)); - if ((dup = RB_INSERT(pf_anchor_global, &V_pf_anchors, anchor)) != + if ((dup = RB_INSERT(pfctl_anchor_global, &V_pf_anchors, anchor)) != NULL) { printf("pf_find_or_create_ruleset: RB_INSERT1 " "'%s' '%s' collides with '%s' '%s'\n", @@ -236,13 +237,13 @@ pf_find_or_create_ruleset(const char *path) } if (parent != NULL) { anchor->parent = parent; - if ((dup = RB_INSERT(pf_anchor_node, &parent->children, + if ((dup = RB_INSERT(pfctl_anchor_node, &parent->children, anchor)) != NULL) { printf("pf_find_or_create_ruleset: " "RB_INSERT2 '%s' '%s' collides with " "'%s' '%s'\n", anchor->path, anchor->name, dup->path, dup->name); - RB_REMOVE(pf_anchor_global, &V_pf_anchors, + RB_REMOVE(pfctl_anchor_global, &V_pf_anchors, anchor); rs_free(anchor); rs_free(p); @@ -262,9 +263,9 @@ pf_find_or_create_ruleset(const char *path) } void -pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) +pf_remove_if_empty_ruleset(struct pfctl_ruleset *ruleset) { - struct pf_anchor *parent; + struct pfctl_anchor *parent; int i; while (ruleset != NULL) { @@ -278,9 +279,9 @@ pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) !TAILQ_EMPTY(ruleset->rules[i].inactive.ptr) || ruleset->rules[i].inactive.open) return; - RB_REMOVE(pf_anchor_global, &V_pf_anchors, ruleset->anchor); + RB_REMOVE(pfctl_anchor_global, &V_pf_anchors, ruleset->anchor); if ((parent = ruleset->anchor->parent) != NULL) - RB_REMOVE(pf_anchor_node, &parent->children, + RB_REMOVE(pfctl_anchor_node, &parent->children, ruleset->anchor); rs_free(ruleset->anchor); if (parent == NULL) @@ -289,11 +290,11 @@ pf_remove_if_empty_ruleset(struct pf_ruleset *ruleset) } } int -pf_anchor_setup(struct pf_rule *r, const struct pf_ruleset *s, +pfctl_anchor_setup(struct pfctl_rule *r, const struct pfctl_ruleset *s, const char *name) { char *p, *path; - struct pf_ruleset *ruleset; + struct pfctl_ruleset *ruleset; r->anchor = NULL; r->anchor_relative = 0; @@ -314,7 +315,7 @@ pf_anchor_setup(struct pf_rule *r, const struct pf_ruleset *s, strlcpy(path, s->anchor->path, MAXPATHLEN); while (name[0] == '.' && name[1] == '.' && name[2] == '/') { if (!path[0]) { - printf("pf_anchor_setup: .. beyond root\n"); + printf("pfctl_anchor_setup: .. beyond root\n"); rs_free(path); return (1); *** 688 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Apr 10 09:16:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3B315E006F; Sat, 10 Apr 2021 09:16: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 4FHTrq2J4jz4nlT; Sat, 10 Apr 2021 09:16: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 05FB96A22; Sat, 10 Apr 2021 09:16: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 13A9GQDb069110; Sat, 10 Apr 2021 09:16:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A9GQD6069109; Sat, 10 Apr 2021 09:16:26 GMT (envelope-from git) Date: Sat, 10 Apr 2021 09:16:26 GMT Message-Id: <202104100916.13A9GQD6069109@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: a9b338b260be - main - pf: Move prototypes for userspace functions to userspace header 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: a9b338b260be39cc74dddb599d6c95b8794ca98b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 09:16:28 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a9b338b260be39cc74dddb599d6c95b8794ca98b commit a9b338b260be39cc74dddb599d6c95b8794ca98b Author: Kristof Provost AuthorDate: 2021-04-07 17:49:51 +0000 Commit: Kristof Provost CommitDate: 2021-04-10 09:16:02 +0000 pf: Move prototypes for userspace functions to userspace header These functions no longer exist in the kernel, so there's no reason to keep the prototypes in a kernel header. Move them to pfctl where they're actually implemented. Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29643 --- sbin/pfctl/pf_ruleset.c | 2 ++ sbin/pfctl/pfctl.h | 8 ++++++++ sys/netpfil/pf/pf.h | 9 +-------- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/sbin/pfctl/pf_ruleset.c b/sbin/pfctl/pf_ruleset.c index 7c337d7a2da7..baac1deb4fa7 100644 --- a/sbin/pfctl/pf_ruleset.c +++ b/sbin/pfctl/pf_ruleset.c @@ -64,6 +64,8 @@ __FBSDID("$FreeBSD$"); #define rs_malloc(x) calloc(1, x) #define rs_free(x) free(x) +#include "pfctl.h" + #ifdef PFDEBUG #include #define DPFPRINTF(format, x...) fprintf(stderr, format , ##x) diff --git a/sbin/pfctl/pfctl.h b/sbin/pfctl/pfctl.h index f43b71e19fec..5aa94b2bb0c8 100644 --- a/sbin/pfctl/pfctl.h +++ b/sbin/pfctl/pfctl.h @@ -128,4 +128,12 @@ u_int32_t pfctl_get_ticket(struct pfr_buffer *, int, const char *); int pfctl_trans(int, struct pfr_buffer *, u_long, int); +int pf_get_ruleset_number(u_int8_t); +void pf_init_ruleset(struct pf_ruleset *); +int pf_anchor_setup(struct pf_rule *, + const struct pf_ruleset *, const char *); +void pf_remove_if_empty_ruleset(struct pf_ruleset *); +struct pf_ruleset *pf_find_ruleset(const char *); +struct pf_ruleset *pf_find_or_create_ruleset(const char *); + #endif /* _PFCTL_H_ */ diff --git a/sys/netpfil/pf/pf.h b/sys/netpfil/pf/pf.h index bc6cd92ae7b8..3e358de8aba5 100644 --- a/sys/netpfil/pf/pf.h +++ b/sys/netpfil/pf/pf.h @@ -637,13 +637,6 @@ struct pf_anchor { RB_PROTOTYPE(pf_anchor_global, pf_anchor, entry_global, pf_anchor_compare); RB_PROTOTYPE(pf_anchor_node, pf_anchor, entry_node, pf_anchor_compare); -/* these ruleset functions can be linked into userland programs (pfctl) */ -int pf_get_ruleset_number(u_int8_t); -void pf_init_ruleset(struct pf_ruleset *); -int pf_anchor_setup(struct pf_rule *, - const struct pf_ruleset *, const char *); -void pf_remove_if_empty_ruleset(struct pf_ruleset *); -struct pf_ruleset *pf_find_ruleset(const char *); -struct pf_ruleset *pf_find_or_create_ruleset(const char *); +int pf_get_ruleset_number(u_int8_t); #endif /* _NET_PF_H_ */ From owner-dev-commits-src-all@freebsd.org Sat Apr 10 09:16:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0545C5E040A; Sat, 10 Apr 2021 09:16:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FHTrt28N9z4nV0; Sat, 10 Apr 2021 09:16: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 46E92675D; Sat, 10 Apr 2021 09:16: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 13A9GTB8069152; Sat, 10 Apr 2021 09:16:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13A9GTT5069151; Sat, 10 Apr 2021 09:16:29 GMT (envelope-from git) Date: Sat, 10 Apr 2021 09:16:29 GMT Message-Id: <202104100916.13A9GTT5069151@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: ab5707a5cf86 - main - libpfctl: Fix u_* counters 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: ab5707a5cf86ed66dbd11e03ad9676766da9a47b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 09:16:31 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ab5707a5cf86ed66dbd11e03ad9676766da9a47b commit ab5707a5cf86ed66dbd11e03ad9676766da9a47b Author: Kristof Provost AuthorDate: 2021-04-08 08:36:18 +0000 Commit: Kristof Provost CommitDate: 2021-04-10 09:16:03 +0000 libpfctl: Fix u_* counters struct pf_rule had a few counter_u64_t counters. Those couldn't be usefully comminicated with userspace, so the fields were doubled up in uint64_t u_* versions. Now that we use struct pfctl_rule (i.e. a fully userspace version) we can safely change the structure and remove this wart. Reviewed by: glebius MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29645 --- lib/libpfctl/libpfctl.c | 6 +++--- lib/libpfctl/libpfctl.h | 10 +++------- sbin/pfctl/pfctl.c | 6 +++--- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c index dc174d8d5b72..2a7b64f1cbc8 100644 --- a/lib/libpfctl/libpfctl.c +++ b/lib/libpfctl/libpfctl.c @@ -367,9 +367,9 @@ pf_nvrule_to_rule(const nvlist_t *nvl, struct pfctl_rule *rule) pf_nvdivert_to_divert(nvlist_get_nvlist(nvl, "divert"), rule); - rule->u_states_cur = nvlist_get_number(nvl, "states_cur"); - rule->u_states_tot = nvlist_get_number(nvl, "states_tot"); - rule->u_src_nodes = nvlist_get_number(nvl, "src_nodes"); + rule->states_cur = nvlist_get_number(nvl, "states_cur"); + rule->states_tot = nvlist_get_number(nvl, "states_tot"); + rule->src_nodes = nvlist_get_number(nvl, "src_nodes"); } int diff --git a/lib/libpfctl/libpfctl.h b/lib/libpfctl/libpfctl.h index 996830619489..95f6d4e3c77f 100644 --- a/lib/libpfctl/libpfctl.h +++ b/lib/libpfctl/libpfctl.h @@ -81,9 +81,9 @@ struct pfctl_rule { uid_t cuid; pid_t cpid; - counter_u64_t states_cur; - counter_u64_t states_tot; - counter_u64_t src_nodes; + uint64_t states_cur; + uint64_t states_tot; + uint64_t src_nodes; u_int16_t return_icmp; u_int16_t return_icmp6; @@ -129,10 +129,6 @@ struct pfctl_rule { struct pf_addr addr; u_int16_t port; } divert; - - uint64_t u_states_cur; - uint64_t u_states_tot; - uint64_t u_src_nodes; }; TAILQ_HEAD(pfctl_rulequeue, pfctl_rule); diff --git a/sbin/pfctl/pfctl.c b/sbin/pfctl/pfctl.c index 548aab0f839e..bc646ab335e1 100644 --- a/sbin/pfctl/pfctl.c +++ b/sbin/pfctl/pfctl.c @@ -891,12 +891,12 @@ pfctl_print_rule_counters(struct pfctl_rule *rule, int opts) (unsigned long long)(rule->packets[0] + rule->packets[1]), (unsigned long long)(rule->bytes[0] + - rule->bytes[1]), (uintmax_t)rule->u_states_cur); + rule->bytes[1]), (uintmax_t)rule->states_cur); if (!(opts & PF_OPT_DEBUG)) printf(" [ Inserted: uid %u pid %u " "State Creations: %-6ju]\n", (unsigned)rule->cuid, (unsigned)rule->cpid, - (uintmax_t)rule->u_states_tot); + (uintmax_t)rule->states_tot); } } @@ -1012,7 +1012,7 @@ pfctl_show_rules(int dev, char *path, int opts, enum pfctl_show format, (unsigned long long)rule.bytes[0], (unsigned long long)rule.packets[1], (unsigned long long)rule.bytes[1], - (uintmax_t)rule.u_states_tot); + (uintmax_t)rule.states_tot); } break; case PFCTL_SHOW_RULES: From owner-dev-commits-src-all@freebsd.org Sat Apr 10 11:53:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 385FA5E334E; Sat, 10 Apr 2021 11:53: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 4FHYLG0ySlz3CrW; Sat, 10 Apr 2021 11:53: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 13DAB11013; Sat, 10 Apr 2021 11:53: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 13ABrfvl080766; Sat, 10 Apr 2021 11:53:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ABrfiF080765; Sat, 10 Apr 2021 11:53:41 GMT (envelope-from git) Date: Sat, 10 Apr 2021 11:53:41 GMT Message-Id: <202104101153.13ABrfiF080765@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 44faff9f4a0f - main - Adjust .arcconfig to land onto 'main' by default MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 44faff9f4a0f25588df8b217e7c94af8bd84d113 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 11:53:42 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=44faff9f4a0f25588df8b217e7c94af8bd84d113 commit 44faff9f4a0f25588df8b217e7c94af8bd84d113 Author: Dimitry Andric AuthorDate: 2021-04-10 11:51:16 +0000 Commit: Dimitry Andric CommitDate: 2021-04-10 11:51:16 +0000 Adjust .arcconfig to land onto 'main' by default Otherwise, commands like "arc land" will default to 'master' instead. MFC after: immediately --- .arcconfig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.arcconfig b/.arcconfig index 4ecf2640194e..dec83771f390 100644 --- a/.arcconfig +++ b/.arcconfig @@ -1,5 +1,7 @@ { "repository.callsign" : "S", "phabricator.uri" : "https://reviews.freebsd.org/", - "history.immutable" : true + "history.immutable" : true, + "arc.land.onto.default": "main", + "arc.land.onto": ["main"] } From owner-dev-commits-src-all@freebsd.org Sat Apr 10 12:02:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1C335E425E; Sat, 10 Apr 2021 12:02: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 4FHYX95PtMz3Dbs; Sat, 10 Apr 2021 12:02: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 A240610CDD; Sat, 10 Apr 2021 12:02: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 13AC2Hmr092269; Sat, 10 Apr 2021 12:02:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13AC2Hgh092268; Sat, 10 Apr 2021 12:02:17 GMT (envelope-from git) Date: Sat, 10 Apr 2021 12:02:17 GMT Message-Id: <202104101202.13AC2Hgh092268@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 3b00222f156d - main - Avoid raising unexpected floating point exceptions in libm MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3b00222f156dca5700c839d73e36daf479fa640c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 12:02:17 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=3b00222f156dca5700c839d73e36daf479fa640c commit 3b00222f156dca5700c839d73e36daf479fa640c Author: Dimitry Andric AuthorDate: 2021-04-09 23:07:54 +0000 Commit: Dimitry Andric CommitDate: 2021-04-10 11:59:57 +0000 Avoid raising unexpected floating point exceptions in libm When using clang with x86_64 CPUs that support AVX, some floating point transformations may raise exceptions that would not have been raised by the original code. To avoid this, use the -fp-exception-behavior=maytrap flag, introduced in clang 10.0.0. In particular, this fixes a number of test failures with ctanhf(3) and ctanf(3), when libm is compiled with -mavx. An unexpected FE_INVALID exception is then raised, because clang emits vdivps instructions to perform certain divides. (The vdivps instruction operates on multiple single-precision float operands simultaneously, but the exceptions may be influenced by unused parts of the XMM registers. In this particular case, it was calculating 0 / 0, which results in FE_INVALID.) If -fp-exception-behavior=maytrap is specified however, clang uses vdivss instructions instead, which work on one operand, and should not raise unexpected exceptions. Reported by: olivier Reviewed by: arichardson PR: 254911 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29686 --- lib/msun/Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/msun/Makefile b/lib/msun/Makefile index 4491bc216a4c..959dbd113ec1 100644 --- a/lib/msun/Makefile +++ b/lib/msun/Makefile @@ -34,6 +34,16 @@ CFLAGS+= -I${.CURDIR}/ld128 CFLAGS+= -I${.CURDIR}/${ARCH_SUBDIR} +.include +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 100000 +# When using clang with x86_64 CPUs that support AVX, some floating point +# transformations may raise exceptions that would not have been raised by the +# original code. To avoid this, use the -fp-exception-behavior=maytrap flag, +# introduced in clang 10.0.0. +# See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=254911 +CFLAGS+= -ffp-exception-behavior=maytrap +.endif + .PATH: ${.CURDIR}/bsdsrc .PATH: ${.CURDIR}/src .PATH: ${.CURDIR}/man @@ -113,7 +123,6 @@ COMMON_SRCS+= catrigl.c \ # 'long double' [-Werror=overflow] # if( y >= LDBL_MAX ) # See also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=130067 -.include .if ${COMPILER_TYPE} == "gcc" CFLAGS.e_powl.c+= -Wno-error=overflow .endif From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:12:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E9F55E6261; Sat, 10 Apr 2021 13:12: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 4FHb5f2ZlWz3Hxc; Sat, 10 Apr 2021 13:12: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 4B04B11DD0; Sat, 10 Apr 2021 13:12: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 13ADCs0T087317; Sat, 10 Apr 2021 13:12:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADCsP1087316; Sat, 10 Apr 2021 13:12:54 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:12:54 GMT Message-Id: <202104101312.13ADCsP1087316@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Tai-hwa Liang Subject: git: 50f1778f6e61 - stable/12 - net: fixing a memory leak in if_deregister_com_alloc() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avatar X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 50f1778f6e61dd5855f684bdc43c8f1977e11ff0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:12:54 -0000 The branch stable/12 has been updated by avatar: URL: https://cgit.FreeBSD.org/src/commit/?id=50f1778f6e61dd5855f684bdc43c8f1977e11ff0 commit 50f1778f6e61dd5855f684bdc43c8f1977e11ff0 Author: Tai-hwa Liang AuthorDate: 2021-03-06 14:36:35 +0000 Commit: Tai-hwa Liang CommitDate: 2021-04-10 13:11:01 +0000 net: fixing a memory leak in if_deregister_com_alloc() Drain the callbacks upon if_deregister_com_alloc() such that the if_com_free[type] won't be nullified before if_destroy(). Taking fwip(4) as an example, before this fix, kldunload if_fwip will go through the following: 1. fwip_detach() 2. if_free() -> schedule if_destroy() through NET_EPOCH_CALL 3. fwip_detach() returns 4. firewire_modevent(MOD_UNLOAD) -> if_deregister_com_alloc() 5. kernel complains about: Warning: memory type fw_com leaked memory on destroy (1 allocations, 64 bytes leaked). 6. EPOCH runs if_destroy() -> if_free_internal() By this time, if_com_free[if_alloctype] is NULL since it's already nullified by if_deregister_com_alloc(); hence, firewire_free() won't have a chance to release the allocated fw_com. Reviewed by: hselasky, glebius MFC after: 2 weeks (cherry picked from commit 092f3f081265c68cd8de0234ba8e46560ccc061e) --- sys/net/if.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/net/if.c b/sys/net/if.c index 2ae8121043b0..f2ef88d3f28e 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -4172,6 +4172,14 @@ if_deregister_com_alloc(u_char type) ("if_deregister_com_alloc: %d not registered", type)); KASSERT(if_com_free[type] != NULL, ("if_deregister_com_alloc: %d free not registered", type)); + + /* + * Ensure all pending EPOCH(9) callbacks have been executed. This + * fixes issues about late invocation of if_destroy(), which leads + * to memory leak from if_com_alloc[type] allocated if_l2com. + */ + epoch_drain_callbacks(net_epoch_preempt); + if_com_alloc[type] = NULL; if_com_free[type] = NULL; } From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:29:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C81605E6745; Sat, 10 Apr 2021 13:29: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 4FHbTF5L8kz3Jm6; Sat, 10 Apr 2021 13:29: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 AA0A611FBE; Sat, 10 Apr 2021 13:29: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 13ADTrN8001849; Sat, 10 Apr 2021 13:29:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADTrsI001848; Sat, 10 Apr 2021 13:29:53 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:29:53 GMT Message-Id: <202104101329.13ADTrsI001848@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 7962978754d3 - stable/13 - Unbreak MSG_CMSG_CLOEXEC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7962978754d3372460c9f2bdcd6d8f27ad8f89e8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:29:53 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7962978754d3372460c9f2bdcd6d8f27ad8f89e8 commit 7962978754d3372460c9f2bdcd6d8f27ad8f89e8 Author: Alex Richardson AuthorDate: 2021-03-18 20:52:20 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 12:52:15 +0000 Unbreak MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC has not been working since 2015 (SVN r284380) because _finstall expects O_CLOEXEC and not UF_EXCLOSE as the flags argument. This was probably not noticed because we don't have a test for this flag so this commit adds one. I found this problem because one of the libwayland tests was failing. Fixes: ea31808c3b07 ("fd: move out actual fp installation to _finstall") MFC after: 3 days Reviewed By: mjg, kib Differential Revision: https://reviews.freebsd.org/D29328 (cherry picked from commit 6ceacebdf5221133943ab3b6b56751c8b51c3e2b) --- sys/kern/uipc_usrreq.c | 2 +- tests/sys/kern/unix_passfd_test.c | 45 ++++++++++++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index ca23ccbdb05e..4466ae8822cd 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -2067,7 +2067,7 @@ unp_externalize(struct mbuf *control, struct mbuf **controlp, int flags) } for (i = 0; i < newfds; i++, fdp++) { _finstall(fdesc, fdep[i]->fde_file, *fdp, - (flags & MSG_CMSG_CLOEXEC) != 0 ? UF_EXCLOSE : 0, + (flags & MSG_CMSG_CLOEXEC) != 0 ? O_CLOEXEC : 0, &fdep[i]->fde_caps); unp_externalize_fp(fdep[i]->fde_file); } diff --git a/tests/sys/kern/unix_passfd_test.c b/tests/sys/kern/unix_passfd_test.c index 2fac0b3f1a0a..2b5cdde012c1 100644 --- a/tests/sys/kern/unix_passfd_test.c +++ b/tests/sys/kern/unix_passfd_test.c @@ -194,7 +194,7 @@ localcreds(int sockfd) static void recvfd_payload(int sockfd, int *recv_fd, void *buf, size_t buflen, - size_t cmsgsz) + size_t cmsgsz, int recvmsg_flags) { struct cmsghdr *cmsghdr; struct msghdr msghdr; @@ -216,7 +216,7 @@ recvfd_payload(int sockfd, int *recv_fd, void *buf, size_t buflen, msghdr.msg_iov = &iovec; msghdr.msg_iovlen = 1; - len = recvmsg(sockfd, &msghdr, 0); + len = recvmsg(sockfd, &msghdr, recvmsg_flags); ATF_REQUIRE_MSG(len != -1, "recvmsg failed: %s", strerror(errno)); ATF_REQUIRE_MSG((size_t)len == buflen, "recvmsg: %zd bytes received; expected %zd", len, buflen); @@ -243,12 +243,12 @@ recvfd_payload(int sockfd, int *recv_fd, void *buf, size_t buflen, } static void -recvfd(int sockfd, int *recv_fd) +recvfd(int sockfd, int *recv_fd, int flags) { char ch = 0; recvfd_payload(sockfd, recv_fd, &ch, sizeof(ch), - CMSG_SPACE(sizeof(int))); + CMSG_SPACE(sizeof(int)), flags); } /* @@ -266,9 +266,33 @@ ATF_TC_BODY(simple_send_fd, tc) tempfile(&putfd); dofstat(putfd, &putfd_stat); sendfd(fd[0], putfd); - recvfd(fd[1], &getfd); + recvfd(fd[1], &getfd, 0); + dofstat(getfd, &getfd_stat); + samefile(&putfd_stat, &getfd_stat); + close(putfd); + close(getfd); + closesocketpair(fd); +} + +/* + * Like simple_send_fd but also sets MSG_CMSG_CLOEXEC and checks that the + * received file descriptor has the FD_CLOEXEC flag set. + */ +ATF_TC_WITHOUT_HEAD(simple_send_fd_msg_cmsg_cloexec); +ATF_TC_BODY(simple_send_fd_msg_cmsg_cloexec, tc) +{ + struct stat getfd_stat, putfd_stat; + int fd[2], getfd, putfd; + + domainsocketpair(fd); + tempfile(&putfd); + dofstat(putfd, &putfd_stat); + sendfd(fd[0], putfd); + recvfd(fd[1], &getfd, MSG_CMSG_CLOEXEC); dofstat(getfd, &getfd_stat); samefile(&putfd_stat, &getfd_stat); + ATF_REQUIRE_EQ_MSG(fcntl(getfd, F_GETFD) & FD_CLOEXEC, FD_CLOEXEC, + "FD_CLOEXEC not set on the received file descriptor"); close(putfd); close(getfd); closesocketpair(fd); @@ -289,7 +313,7 @@ ATF_TC_BODY(send_and_close, tc) dofstat(putfd, &putfd_stat); sendfd(fd[0], putfd); close(putfd); - recvfd(fd[1], &getfd); + recvfd(fd[1], &getfd, 0); dofstat(getfd, &getfd_stat); samefile(&putfd_stat, &getfd_stat); close(getfd); @@ -331,8 +355,8 @@ ATF_TC_BODY(two_files, tc) sendfd(fd[0], putfd_2); close(putfd_1); close(putfd_2); - recvfd(fd[1], &getfd_1); - recvfd(fd[1], &getfd_2); + recvfd(fd[1], &getfd_1, 0); + recvfd(fd[1], &getfd_2, 0); dofstat(getfd_1, &getfd_1_stat); dofstat(getfd_2, &getfd_2_stat); samefile(&putfd_1_stat, &getfd_1_stat); @@ -355,7 +379,7 @@ ATF_TC_BODY(bundle, tc) sendfd(fd[0], fd[0]); close(fd[0]); - recvfd(fd[1], &getfd); + recvfd(fd[1], &getfd, 0); close(getfd); close(fd[1]); } @@ -430,7 +454,7 @@ ATF_TC_BODY(rights_creds_payload, tc) len = sendfd_payload(fd[0], putfd, buf, sendspace); ATF_REQUIRE_MSG(len < sendspace, "sendmsg: %zu bytes sent", len); recvfd_payload(fd[1], &getfd, buf, len, - CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + CMSG_SPACE(sizeof(int))); + CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + CMSG_SPACE(sizeof(int)), 0); close(putfd); close(getfd); @@ -695,6 +719,7 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, simple_send_fd); + ATF_TP_ADD_TC(tp, simple_send_fd_msg_cmsg_cloexec); ATF_TP_ADD_TC(tp, send_and_close); ATF_TP_ADD_TC(tp, send_and_cancel); ATF_TP_ADD_TC(tp, two_files); From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:29:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14EE85E6D00; Sat, 10 Apr 2021 13:29: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 4FHbTG6tcmz3JZP; Sat, 10 Apr 2021 13:29: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 D987911DF8; Sat, 10 Apr 2021 13:29: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 13ADTso1001872; Sat, 10 Apr 2021 13:29:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADTsap001869; Sat, 10 Apr 2021 13:29:54 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:29:54 GMT Message-Id: <202104101329.13ADTsap001869@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 6462d714c766 - stable/13 - Silence unused parameter warnings in the RISC-V fenv.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6462d714c76639fc34edd8345f0bd814ad688db4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:29:55 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=6462d714c76639fc34edd8345f0bd814ad688db4 commit 6462d714c76639fc34edd8345f0bd814ad688db4 Author: Alex Richardson AuthorDate: 2021-03-22 17:47:50 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 12:52:40 +0000 Silence unused parameter warnings in the RISC-V fenv.h After increasing the lib/msun/tests WARNS to 6, this triggers a compilation error for RISC-V. Fixes: 87d65c747a43 ("lib/msun: Allow building tests with WARNS=6") Reported by: Jenkins (cherry picked from commit 15211f19509282d9c9a418d4e5b6ac75d9d1fc85) --- lib/msun/riscv/fenv.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/msun/riscv/fenv.h b/lib/msun/riscv/fenv.h index f9d840d156fa..6c8c2861bc97 100644 --- a/lib/msun/riscv/fenv.h +++ b/lib/msun/riscv/fenv.h @@ -186,7 +186,7 @@ fegetenv(fenv_t *__envp) } __fenv_static inline int -feholdexcept(fenv_t *__envp) +feholdexcept(fenv_t *__envp __unused) { /* No exception traps. */ @@ -226,7 +226,7 @@ int fedisableexcept(int __mask); int fegetexcept(void); #else static inline int -feenableexcept(int __mask) +feenableexcept(int __mask __unused) { /* No exception traps. */ @@ -235,7 +235,7 @@ feenableexcept(int __mask) } static inline int -fedisableexcept(int __mask) +fedisableexcept(int __mask __unused) { /* No exception traps. */ From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:29:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68FC35E674F; Sat, 10 Apr 2021 13:29: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 4FHbTJ29Tjz3Jjs; Sat, 10 Apr 2021 13:29: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 1C8C91223A; Sat, 10 Apr 2021 13:29: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 13ADTtDa001898; Sat, 10 Apr 2021 13:29:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADTtOa001897; Sat, 10 Apr 2021 13:29:55 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:29:55 GMT Message-Id: <202104101329.13ADTtOa001897@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 502d647d75c8 - stable/13 - tests/sys/netgraph: Further CI fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 502d647d75c81ea63735b898b94ebad0de13c58d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:29:56 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=502d647d75c81ea63735b898b94ebad0de13c58d commit 502d647d75c81ea63735b898b94ebad0de13c58d Author: Alex Richardson AuthorDate: 2021-03-19 18:34:29 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 12:53:36 +0000 tests/sys/netgraph: Further CI fixes I was trying to debug why this test is working locally but failing in CI. While doing so I made some small changes to allow running it with set -e. It turns out the problem is that find_iface does not return anything in Jenkins, so all following tests fail with obscure error messages. To handle this case exit early if $eth is empty. Reviewed By: lwhsu Differential Revision: https://reviews.freebsd.org/D29340 (cherry picked from commit 7dd1f932c1f51bfe10da7bc8875879cdcdd40821) --- tests/sys/netgraph/ng_macfilter_test.sh | 57 +++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/tests/sys/netgraph/ng_macfilter_test.sh b/tests/sys/netgraph/ng_macfilter_test.sh index 269de3e130aa..482f32e5d335 100755 --- a/tests/sys/netgraph/ng_macfilter_test.sh +++ b/tests/sys/netgraph/ng_macfilter_test.sh @@ -29,6 +29,8 @@ # # $FreeBSD$ +set -e + progname="$(basename $0 .sh)" entries_lst="/tmp/$progname.entries.lst" entries2_lst="/tmp/$progname.entries2.lst" @@ -124,7 +126,7 @@ test_not_ok () { local msg="$1" _test_next - _test_fails + _test_fail echo "not ok $TSTNR - $msg" return 1 @@ -183,9 +185,24 @@ test_ge () { test_not_ok "$v1 <= $v2 $msg" fi } -test_rc () { test_eq $? $1 "$2"; } -test_failure () { test_ne $? 0 "$1"; } -test_success () { test_eq $? 0 "$1"; } +test_failure () { + msg=$1 + shift + if ! "$@"; then + test_ok "$msg - \"$@\" failed as expected" + else + test_not_ok "$msg - expected \"$@\" to fail but succeeded" + fi +} +test_success () { + msg=$1 + shift + if ! "$@"; then + test_not_ok "$msg - \"$@\" failed unexpectedly" + else + test_ok "$msg - \"$@\" succeeded" + fi +} gethooks () { ngctl msg MF: 'gethooks' \ @@ -217,6 +234,13 @@ genmac () { test_title "Setting up system..." load_modules netgraph ng_socket ng_ether ng_macfilter ng_one2many eth=$(find_iface) +if [ -z "$eth" ]; then + echo "1..1" + echo "not ok 1 - Could not find a valid interface" + echo "Available interfaces:" + ifconfig + exit 1 +fi test_comment "Using $eth..." @@ -239,31 +263,23 @@ test_cnt 46 ################################################################################ test_title "Test: Duplicate default hook" -ngctl connect MF: O2M: default many99 2>/dev/null -test_failure "duplicate connect of default hook" - +test_failure "duplicate connect of default hook" ngctl connect MF: O2M: default many99 ################################################################################ test_title "Test: Add and remove hooks" -ngctl connect MF: O2M: xxx1 many$((HOOKS + 1)) -test_success "connect MF:xxx1 to O2M:many$((HOOKS + 1))" -ngctl connect MF: O2M: xxx2 many$((HOOKS + 2)) -test_success "connect MF:xxx2 to O2M:many$((HOOKS + 2))" -ngctl connect MF: O2M: xxx3 many$((HOOKS + 3)) -test_success "connect MF:xxx3 to O2M:many$((HOOKS + 3))" +test_success "connect MF:xxx1 to O2M:many$((HOOKS + 1))" ngctl connect MF: O2M: xxx1 many$((HOOKS + 1)) +test_success "connect MF:xxx2 to O2M:many$((HOOKS + 2))" ngctl connect MF: O2M: xxx2 many$((HOOKS + 2)) +test_success "connect MF:xxx3 to O2M:many$((HOOKS + 3))" ngctl connect MF: O2M: xxx3 many$((HOOKS + 3)) hooks=$(gethooks) test_eq $created_hooks:xxx1:xxx2:xxx3 $hooks 'hooks after adding xxx1-3' -ngctl rmhook MF: xxx1 -test_success "rmhook MF:xxx$i" +test_success "rmhook MF:xxx$i" ngctl rmhook MF: xxx1 hooks=$(gethooks) test_eq $created_hooks:xxx2:xxx3 $hooks 'hooks after removing xxx1' -ngctl rmhook MF: xxx2 -test_success "rmhook MF:xxx$i" +test_success "rmhook MF:xxx$i" ngctl rmhook MF: xxx2 hooks=$(gethooks) test_eq $created_hooks:xxx3 $hooks 'hooks after removing xxx2' -ngctl rmhook MF: xxx3 -test_success "rmhook MF:xxx$i" +test_success "rmhook MF:xxx$i" ngctl rmhook MF: xxx3 hooks=$(gethooks) test_eq $created_hooks $hooks 'hooks after removing xxx3' @@ -418,8 +434,7 @@ done ################################################################################ test_title "Test: Resetting macfilter..." -ngctl msg MF: reset -test_success "**** reset failed" +test_success "**** reset failed" ngctl msg MF: reset test_eq $(countmacs) 0 'MACs in table' test_bail_on_fail From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:29:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 51B6E5E6C1A; Sat, 10 Apr 2021 13:29: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 4FHbTK1fz5z3JgP; Sat, 10 Apr 2021 13:29: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 29F05121A0; Sat, 10 Apr 2021 13:29: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 13ADTv98001921; Sat, 10 Apr 2021 13:29:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADTvEV001920; Sat, 10 Apr 2021 13:29:57 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:29:57 GMT Message-Id: <202104101329.13ADTvEV001920@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 57971fe46793 - stable/13 - bsd.compiler.mk: Detect distribution-provided GCC when executed as cc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 57971fe46793911bcd976928fed8b19df4497a0b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:29:57 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=57971fe46793911bcd976928fed8b19df4497a0b commit 57971fe46793911bcd976928fed8b19df4497a0b Author: Jessica Clarke AuthorDate: 2021-02-09 21:40:24 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 12:55:29 +0000 bsd.compiler.mk: Detect distribution-provided GCC when executed as cc Clang always prints "clang $VERSION" regardless of the name used to execute it, whereas GCC prints "$progname $VERSION", meaning if CC is set to cc and cc is GCC it will print "cc $VERSION". We are able to detect some of those cases since it then prints "($PKGVERSION)", where the default is "GCC", but many distributions override that to print their name and the package version number (e.g. "Debian 10.2.1-6"), so nothing tells us it's GCC other than the fact that it's not Clang (and that there's an FSF copyright disclaimer). However, GCC's -v option will always print "gcc version $VERSION", so fall back on using that to detect GCC. Whilst Clang also supports this option, we should never get here, so Clang handling is not added. Reviewed by: brooks, emaste, arichardson Differential Revision: https://reviews.freebsd.org/D28315 (cherry picked from commit 9c6954329a9285547881ddd60e393b7c55ed30c4) --- share/mk/bsd.compiler.mk | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/share/mk/bsd.compiler.mk b/share/mk/bsd.compiler.mk index 8253669fe279..fa8e6c44a17e 100644 --- a/share/mk/bsd.compiler.mk +++ b/share/mk/bsd.compiler.mk @@ -187,7 +187,16 @@ ${X_}COMPILER_TYPE:= gcc . elif ${_v:Mclang} || ${_v:M(clang-*.*.*)} ${X_}COMPILER_TYPE:= clang . else +# With GCC, cc --version prints "cc $VERSION ($PKGVERSION)", so if a +# distribution overrides the default GCC PKGVERSION it is not identified. +# However, its -v output always says "gcc version" in it, so fall back on that. +_gcc_version!= ${${cc}:N${CCACHE_BIN}} -v 2>&1 | grep "gcc version" +. if !empty(_gcc_version) +${X_}COMPILER_TYPE:= gcc +. else .error Unable to determine compiler type for ${cc}=${${cc}}. Consider setting ${X_}COMPILER_TYPE. +. endif +.undef _gcc_version . endif .endif .if !defined(${X_}COMPILER_VERSION) From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:30:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F10BA5E6D1C; Sat, 10 Apr 2021 13:29: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 4FHbTM39cbz3Jpt; Sat, 10 Apr 2021 13:29: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 5D7B91223C; Sat, 10 Apr 2021 13:29: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 13ADTxmq001966; Sat, 10 Apr 2021 13:29:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADTxwx001964; Sat, 10 Apr 2021 13:29:59 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:29:59 GMT Message-Id: <202104101329.13ADTxwx001964@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 0a0e327fad67 - stable/13 - tools/build/make.py: Don't call brew --prefix if --cross-bindir is set MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0a0e327fad6745fa48091cbdaeb6fea36ac5dd69 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:30:00 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=0a0e327fad6745fa48091cbdaeb6fea36ac5dd69 commit 0a0e327fad6745fa48091cbdaeb6fea36ac5dd69 Author: Alex Richardson AuthorDate: 2021-02-26 17:49:03 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 12:56:02 +0000 tools/build/make.py: Don't call brew --prefix if --cross-bindir is set Also updated the logic to use subprocess.run() instead of the old subprocess.getoutput() which also includes stderr and therefore can trigger an exception inside Path().exists(). Reported by: gnn (cherry picked from commit a26ace4db6d974215a4d882948da80eae2b3b0d4) --- tools/build/make.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tools/build/make.py b/tools/build/make.py index bc6d8fb449bb..c34147f6ac21 100755 --- a/tools/build/make.py +++ b/tools/build/make.py @@ -124,9 +124,14 @@ def default_cross_toolchain(): # default to homebrew-installed clang on MacOS if available if sys.platform.startswith("darwin"): if shutil.which("brew"): - llvm_dir = subprocess.getoutput("brew --prefix llvm") - if llvm_dir and Path(llvm_dir, "bin").exists(): - return str(Path(llvm_dir, "bin")) + llvm_dir = subprocess.run(["brew", "--prefix", "llvm"], + capture_output=True).stdout.strip() + debug("Inferred LLVM dir as", llvm_dir) + try: + if llvm_dir and Path(llvm_dir.decode("utf-8"), "bin").exists(): + return str(Path(llvm_dir.decode("utf-8"), "bin")) + except OSError: + return None return None @@ -137,7 +142,7 @@ if __name__ == "__main__": help="Directory to look for cc/c++/cpp/ld to build " "host (" + sys.platform + ") binaries", default="/usr/bin") - parser.add_argument("--cross-bindir", default=default_cross_toolchain(), + parser.add_argument("--cross-bindir", default=None, help="Directory to look for cc/c++/cpp/ld to build " "target binaries (only needed if XCC/XCPP/XLD " "are not set)") @@ -165,6 +170,8 @@ if __name__ == "__main__": except ImportError: pass parsed_args, bmake_args = parser.parse_known_args() + if parsed_args.cross_bindir is None: + parsed_args.cross_bindir = default_cross_toolchain() MAKEOBJDIRPREFIX = os.getenv("MAKEOBJDIRPREFIX") if not MAKEOBJDIRPREFIX: From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:29:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A06C05E6C86; Sat, 10 Apr 2021 13:29: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 4FHbTL3w8lz3Jpk; Sat, 10 Apr 2021 13:29: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 3F89B1223B; Sat, 10 Apr 2021 13:29: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 13ADTwGh001943; Sat, 10 Apr 2021 13:29:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADTwf6001942; Sat, 10 Apr 2021 13:29:58 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:29:58 GMT Message-Id: <202104101329.13ADTwf6001942@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 350123947584 - stable/13 - tools/build/make.py: drop workaround for cc --version not being parsed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 350123947584fb26062eb4b4d7c36185ed3b2830 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:29:58 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=350123947584fb26062eb4b4d7c36185ed3b2830 commit 350123947584fb26062eb4b4d7c36185ed3b2830 Author: Alex Richardson AuthorDate: 2021-02-13 13:54:20 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 12:55:54 +0000 tools/build/make.py: drop workaround for cc --version not being parsed Previously bsd.compiler.mk was not able to detect the compiler type for Ubuntu's /usr/bin/cc unless we were invoking the /usr/bin/gcc symlink. This problem has been fixed by 9c6954329a9285547881ddd60e393b7c55ed30c4 so we can drop the workaround from make.py. Reviewed By: jrtc27 Differential Revision: https://reviews.freebsd.org/D28323 (cherry picked from commit 88db1cc9f197a376817ce27ba269348666bbd4b7) --- tools/build/make.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tools/build/make.py b/tools/build/make.py index e692fef11e05..bc6d8fb449bb 100755 --- a/tools/build/make.py +++ b/tools/build/make.py @@ -182,13 +182,6 @@ if __name__ == "__main__": sys.exit("TARGET= and TARGET_ARCH= must be set explicitly " "when building on non-FreeBSD") # infer values for CC/CXX/CPP - - if sys.platform.startswith( - "linux") and parsed_args.host_compiler_type == "cc": - # FIXME: bsd.compiler.mk doesn't handle the output of GCC if it - # is /usr/bin/cc on Ubuntu since it doesn't contain the GCC string. - parsed_args.host_compiler_type = "gcc" - if parsed_args.host_compiler_type == "gcc": default_cc, default_cxx, default_cpp = ("gcc", "g++", "cpp") # FIXME: this should take values like `clang-9` and then look for @@ -225,8 +218,8 @@ if __name__ == "__main__": if not shutil.which("strip"): if sys.platform.startswith("darwin"): # On macOS systems we have to use /usr/bin/strip. - sys.exit("Cannot find required tool 'strip'. Please install the" - " host compiler and command line tools.") + sys.exit("Cannot find required tool 'strip'. Please install " + "the host compiler and command line tools.") if parsed_args.host_compiler_type == "clang": strip_binary = "llvm-strip" else: From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:30:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAA595E6760; Sat, 10 Apr 2021 13:30: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 4FHbTN4PP6z3Jpy; Sat, 10 Apr 2021 13:30: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 749721223D; Sat, 10 Apr 2021 13:30: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 13ADU0qm002177; Sat, 10 Apr 2021 13:30:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADU0dQ002164; Sat, 10 Apr 2021 13:30:00 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:30:00 GMT Message-Id: <202104101330.13ADU0dQ002164@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 4eaec3eb5f9e - stable/13 - tools/build/make.py: Avoid calling brew --prefix on macOS unnecessarily MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4eaec3eb5f9e67eb20be00c20ff28537c3a51285 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:30:01 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=4eaec3eb5f9e67eb20be00c20ff28537c3a51285 commit 4eaec3eb5f9e67eb20be00c20ff28537c3a51285 Author: Alex Richardson AuthorDate: 2021-03-05 10:21:12 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 12:56:08 +0000 tools/build/make.py: Avoid calling brew --prefix on macOS unnecessarily If all the require variables (XCC/XCXX/XCPP/XLD) are already set in the environment, we don't have to infer a default value for the cross toolchain path. This avoids an additional `brew --prefix` call when building with cheribuild (since it already sets all these variables). (cherry picked from commit 2b181156c893843266c2825098360db2364dbd23) --- tools/build/make.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/tools/build/make.py b/tools/build/make.py index c34147f6ac21..0cf831a3c966 100755 --- a/tools/build/make.py +++ b/tools/build/make.py @@ -119,6 +119,15 @@ def check_required_make_env_var(varname, binary_name, bindir): if parsed_args.debug: run([guess, "--version"]) +def check_xtool_make_env_var(varname, binary_name): + # Avoid calling brew --prefix on macOS if all variables are already set: + if os.getenv(varname): + return + global parsed_args + if parsed_args.cross_bindir is None: + parsed_args.cross_bindir = default_cross_toolchain() + return check_required_make_env_var(varname, binary_name, + parsed_args.cross_bindir) def default_cross_toolchain(): # default to homebrew-installed clang on MacOS if available @@ -170,8 +179,6 @@ if __name__ == "__main__": except ImportError: pass parsed_args, bmake_args = parser.parse_known_args() - if parsed_args.cross_bindir is None: - parsed_args.cross_bindir = default_cross_toolchain() MAKEOBJDIRPREFIX = os.getenv("MAKEOBJDIRPREFIX") if not MAKEOBJDIRPREFIX: @@ -209,16 +216,11 @@ if __name__ == "__main__": # On non-FreeBSD we need to explicitly pass XCC/XLD/X_COMPILER_TYPE use_cross_gcc = parsed_args.cross_compiler_type == "gcc" - check_required_make_env_var("XCC", "gcc" if use_cross_gcc else "clang", - parsed_args.cross_bindir) - check_required_make_env_var("XCXX", - "g++" if use_cross_gcc else "clang++", - parsed_args.cross_bindir) - check_required_make_env_var("XCPP", - "cpp" if use_cross_gcc else "clang-cpp", - parsed_args.cross_bindir) - check_required_make_env_var("XLD", "ld" if use_cross_gcc else "ld.lld", - parsed_args.cross_bindir) + check_xtool_make_env_var("XCC", "gcc" if use_cross_gcc else "clang") + check_xtool_make_env_var("XCXX", "g++" if use_cross_gcc else "clang++") + check_xtool_make_env_var("XCPP", + "cpp" if use_cross_gcc else "clang-cpp") + check_xtool_make_env_var("XLD", "ld" if use_cross_gcc else "ld.lld") # We also need to set STRIPBIN if there is no working strip binary # in $PATH. @@ -232,7 +234,7 @@ if __name__ == "__main__": else: strip_binary = "strip" check_required_make_env_var("STRIPBIN", strip_binary, - parsed_args.cross_bindir) + parsed_args.host_bindir) if os.getenv("STRIPBIN") or "STRIPBIN" in new_env_vars: # If we are setting STRIPBIN, we have to set XSTRIPBIN to the # default if it is not set otherwise already. From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:30:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 133CA5E6A3C; Sat, 10 Apr 2021 13:30: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 4FHbTP4rknz3JZn; Sat, 10 Apr 2021 13:30: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 93C00121A1; Sat, 10 Apr 2021 13:30: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 13ADU1pH003444; Sat, 10 Apr 2021 13:30:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADU1qC003433; Sat, 10 Apr 2021 13:30:01 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:30:01 GMT Message-Id: <202104101330.13ADU1qC003433@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 2cb6b07ca506 - stable/13 - Always build the sanitizer runtimes when compiling with clang MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2cb6b07ca506d2c1876279d477022022194e4cc9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:30:02 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=2cb6b07ca506d2c1876279d477022022194e4cc9 commit 2cb6b07ca506d2c1876279d477022022194e4cc9 Author: Alex Richardson AuthorDate: 2021-02-10 15:25:14 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 13:01:04 +0000 Always build the sanitizer runtimes when compiling with clang This allows instrumenting e.g. test binaries even when compiling with an external clang (e.g. CROSS_TOOLCHAIN=llvm11). I have some upcoming patches that allow building the entire base system with ASan/UBSan/etc. instrumentation and this is required in preparation for this. Reviewed By: dim, emaste Differential Revision: https://reviews.freebsd.org/D28532 (cherry picked from commit 7676b388adbc81a2ad46b43852cd9bc7ac7fad7e) --- lib/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Makefile b/lib/Makefile index ddb627917215..90f1f7f3cd73 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -175,7 +175,7 @@ SUBDIR.${MK_STATS}+= libstats # The libraries under libclang_rt can only be built by clang, and only make # sense to build when clang is enabled at all. Furthermore, they can only be # built for certain architectures. -.if ${MK_CLANG} != "no" && ${COMPILER_TYPE} == "clang" && \ +.if ${COMPILER_TYPE} == "clang" && \ (${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \ ${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "i386" || \ ${MACHINE_CPUARCH} == "powerpc") From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:30:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 25B4A5E6763; Sat, 10 Apr 2021 13:30: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 4FHbTQ6WYvz3Jgd; Sat, 10 Apr 2021 13:30: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 A1F151203B; Sat, 10 Apr 2021 13:30: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 13ADU2Nb003863; Sat, 10 Apr 2021 13:30:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADU2Rk003860; Sat, 10 Apr 2021 13:30:02 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:30:02 GMT Message-Id: <202104101330.13ADU2Rk003860@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 54d6cf9ec82b - stable/13 - Allow using sanitizers for ssp tests with out-of-tree compiler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 54d6cf9ec82b92c8d2dd2104139e1dc05e95c344 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:30:03 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=54d6cf9ec82b92c8d2dd2104139e1dc05e95c344 commit 54d6cf9ec82b92c8d2dd2104139e1dc05e95c344 Author: Alex Richardson AuthorDate: 2021-03-12 17:15:00 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 13:01:04 +0000 Allow using sanitizers for ssp tests with out-of-tree compiler With an out-of-tree Clang, we can use the -resource-dir flag when linking to point it at the runtime libraries from the current SYSROOT. This moves the path to the clang-internal library directory to a separate .mk file that can be used by Makefiles that want to find the sanitizer libraries. I intend to re-use this .mk file for my upcoming changes that allow building the entire base system with ASAN/UBSAN/MSAN. Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D28852 (cherry picked from commit fe525d3f916602ddac3286641dab8f5e274daa44) --- lib/libc/tests/ssp/Makefile | 27 ++++++++++++--------------- lib/libclang_rt/Makefile.inc | 12 ++---------- lib/libclang_rt/compiler-rt-vars.mk | 24 ++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 25 deletions(-) diff --git a/lib/libc/tests/ssp/Makefile b/lib/libc/tests/ssp/Makefile index 655130ab309d..452c57246e39 100644 --- a/lib/libc/tests/ssp/Makefile +++ b/lib/libc/tests/ssp/Makefile @@ -6,9 +6,10 @@ MK_WERROR= no WARNS?= 2 CFLAGS.h_raw+= -fstack-protector-all -Wstack-protector -.if ${COMPILER_TYPE} == "clang" && ${CC} == "cc" -# Only use -fsanitize=bounds when using the in-tree compiler. Otherwise -# we may link to a sanitizer library targeted at a newer kernel/libc. +.if ${COMPILER_TYPE} == "clang" +# Only use -fsanitize=bounds when using clang. Otherwise we are not able to +# override the sanitizer runtime libraries to be the ones installed on the +# target system. CFLAGS.h_raw+= -fsanitize=bounds .elif ${COMPILER_TYPE} == "gcc" CFLAGS.h_raw+= --param ssp-buffer-size=1 @@ -25,24 +26,20 @@ PROGS+= h_getcwd PROGS+= h_memcpy PROGS+= h_memmove PROGS+= h_memset -# This testcase doesn't run properly when not compiled with -fsantize=bounds -# with clang, which is currently contingent on a compiler_rt update -# # XXX: the h_raw/h_read testcases don't cause a SIGABRT with in-tree gcc right # now on amd64 when it trips the stack bounds specified in t_ssp.sh . This # probably needs to be fixed as it's currently hardcoded. -# -# sanitizer is not tested or supported for ARM right now. sbruno -.if ${COMPILER_TYPE} == "clang" && ${CC} == "cc" && !defined(_SKIP_BUILD) && \ +.if ${COMPILER_TYPE} == "clang" && !defined(_SKIP_BUILD) && \ (!defined(_RECURSING_PROGS) || ${PROG} == "h_raw") -.if !defined(_CLANG_RESOURCE_DIR) -_CLANG_RESOURCE_DIR!= ${CC:N${CCACHE_BIN}} -print-resource-dir -.export _CLANG_RESOURCE_DIR -.endif -_libclang_rt_arch= ${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/} -_libclang_rt_ubsan= ${_CLANG_RESOURCE_DIR}/lib/freebsd/libclang_rt.ubsan_standalone-${_libclang_rt_arch}.a +.include "${SRCTOP}/lib/libclang_rt/compiler-rt-vars.mk" +_libclang_rt_ubsan= ${SYSROOT}${SANITIZER_LIBDIR}/libclang_rt.ubsan_standalone-${CRTARCH}.a .if exists(${_libclang_rt_ubsan}) PROGS+= h_raw +LDADD.h_raw+= ${SANITIZER_LDFLAGS} +.else +.if make(all) +.info "Could not find runtime library ${_libclang_rt_ubsan}, skipping h_raw" +.endif .endif .endif PROGS+= h_read diff --git a/lib/libclang_rt/Makefile.inc b/lib/libclang_rt/Makefile.inc index 01bfd72b5a7e..946d3f4c77a7 100644 --- a/lib/libclang_rt/Makefile.inc +++ b/lib/libclang_rt/Makefile.inc @@ -2,20 +2,12 @@ .include -# armv[67] is a bit special since we allow a soft-floating version via -# CPUTYPE matching *soft*. This variant may not actually work though. -.if ${MACHINE_ARCH:Marmv[67]*} != "" && \ - (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") -CRTARCH?= armhf -.else -CRTARCH?= ${MACHINE_ARCH:C/amd64/x86_64/} -.endif CRTSRC= ${SRCTOP}/contrib/llvm-project/compiler-rt +.include "compiler-rt-vars.mk" .PATH: ${CRTSRC}/lib -CLANGDIR= /usr/lib/clang/11.0.1 -LIBDIR= ${CLANGDIR}/lib/freebsd +LIBDIR= ${SANITIZER_LIBDIR} SHLIBDIR= ${LIBDIR} NO_PIC= diff --git a/lib/libclang_rt/compiler-rt-vars.mk b/lib/libclang_rt/compiler-rt-vars.mk new file mode 100644 index 000000000000..17424785c372 --- /dev/null +++ b/lib/libclang_rt/compiler-rt-vars.mk @@ -0,0 +1,24 @@ +CLANG_SUBDIR=clang/11.0.1 +CLANGDIR= /usr/lib/${CLANG_SUBDIR} +SANITIZER_LIBDIR= ${CLANGDIR}/lib/freebsd + +# armv[67] is a bit special since we allow a soft-floating version via +# CPUTYPE matching *soft*. This variant may not actually work though. +.if ${MACHINE_ARCH:Marmv[67]*} != "" && \ + (!defined(CPUTYPE) || ${CPUTYPE:M*soft*} == "") +CRTARCH?= armhf +.else +CRTARCH?= ${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/} +.endif + +.if ${COMPILER_TYPE} == "clang" +# The only way to set the path to the sanitizer libraries with clang is to +# override the resource directory. +# Note: lib/freebsd is automatically appended to the -resource-dir value. +SANITIZER_LDFLAGS= -resource-dir=${SYSROOT}${CLANGDIR} +# Also set RPATH to ensure that the dynamically linked runtime libs are found. +SANITIZER_LDFLAGS+= -Wl,--enable-new-dtags +SANITIZER_LDFLAGS+= -Wl,-rpath,${SANITIZER_LIBDIR} +.else +.error "Unknown link flags for -fsanitize=... COMPILER_TYPE=${COMPILER_TYPE}" +.endif From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:30:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 299FB5E6BF0; Sat, 10 Apr 2021 13:30: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 4FHbTR6lVCz3Jdt; Sat, 10 Apr 2021 13:30: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 B8E941223E; Sat, 10 Apr 2021 13:30: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 13ADU3HY004071; Sat, 10 Apr 2021 13:30:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADU353004068; Sat, 10 Apr 2021 13:30:03 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:30:03 GMT Message-Id: <202104101330.13ADU353004068@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: d435574abffd - stable/13 - ng_macfilter_test: Skip rather than fail if there is no network MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d435574abffd58044f0184ebd857298ad637132f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:30:04 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=d435574abffd58044f0184ebd857298ad637132f commit d435574abffd58044f0184ebd857298ad637132f Author: Alex Richardson AuthorDate: 2021-03-25 11:14:46 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 13:01:04 +0000 ng_macfilter_test: Skip rather than fail if there is no network This should bring the number of Jenkins failures from 4 down to 3. Locally kyua now prints `skipped: could not find a valid interface [0.115s]` when I run it in QEMU without a network device. Reviewed By: lwhsu MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29414 (cherry picked from commit 6f30d1c851467d1f504f469a1b3a75a043ff070f) --- tests/sys/netgraph/ng_macfilter_test.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/sys/netgraph/ng_macfilter_test.sh b/tests/sys/netgraph/ng_macfilter_test.sh index 482f32e5d335..85940e473951 100755 --- a/tests/sys/netgraph/ng_macfilter_test.sh +++ b/tests/sys/netgraph/ng_macfilter_test.sh @@ -235,8 +235,7 @@ test_title "Setting up system..." load_modules netgraph ng_socket ng_ether ng_macfilter ng_one2many eth=$(find_iface) if [ -z "$eth" ]; then - echo "1..1" - echo "not ok 1 - Could not find a valid interface" + echo "1..0 # SKIP could not find a valid interface" echo "Available interfaces:" ifconfig exit 1 From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:30:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 841B75E6D86; Sat, 10 Apr 2021 13:30: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 4FHbTS71qNz3Jgq; Sat, 10 Apr 2021 13:30: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 D5C501223F; Sat, 10 Apr 2021 13:30: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 13ADU4Mq004284; Sat, 10 Apr 2021 13:30:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADU4lc004282; Sat, 10 Apr 2021 13:30:04 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:30:04 GMT Message-Id: <202104101330.13ADU4lc004282@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 0eafcef4552c - stable/13 - RISC-V: Fix feenableexcept return value MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0eafcef4552c8ce43a144eea724628a815c09700 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:30:05 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=0eafcef4552c8ce43a144eea724628a815c09700 commit 0eafcef4552c8ce43a144eea724628a815c09700 Author: Alex Richardson AuthorDate: 2021-03-25 11:15:41 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 13:01:05 +0000 RISC-V: Fix feenableexcept return value The man page says "The feenableexcept(), fedisableexcept(), and fegetexcept() functions return a bitmap of the exceptions that were unmasked prior to the call.", so we should return zero not -1. Reviewed By: mhorne MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29386 (cherry picked from commit dd5ed53a2f93a5a54efe96bed6bbd0f18b6bdbe2) --- lib/msun/riscv/fenv.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/msun/riscv/fenv.h b/lib/msun/riscv/fenv.h index 6c8c2861bc97..f5c56f73b229 100644 --- a/lib/msun/riscv/fenv.h +++ b/lib/msun/riscv/fenv.h @@ -231,7 +231,7 @@ feenableexcept(int __mask __unused) /* No exception traps. */ - return (-1); + return (0); } static inline int From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:30:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CFEFF5E6C38; Sat, 10 Apr 2021 13:30: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 4FHbTV3jMKz3Jmv; Sat, 10 Apr 2021 13:30: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 DCCF112240; Sat, 10 Apr 2021 13:30: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 13ADU5g8004495; Sat, 10 Apr 2021 13:30:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADU5Of004493; Sat, 10 Apr 2021 13:30:05 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:30:05 GMT Message-Id: <202104101330.13ADU5Of004493@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 3496971e61dc - stable/13 - lib/libc/net/nsdispatch.c: Fix missing unlock and add locking annotations MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3496971e61dc9f6e725e57fb7b5f0c57631bbfc2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:30:07 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=3496971e61dc9f6e725e57fb7b5f0c57631bbfc2 commit 3496971e61dc9f6e725e57fb7b5f0c57631bbfc2 Author: Alex Richardson AuthorDate: 2021-03-25 11:22:10 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 13:01:05 +0000 lib/libc/net/nsdispatch.c: Fix missing unlock and add locking annotations The error cases (goto fin) of _nsdispatch were missing the unlock. This change also drops the checks for __isthreaded since the pthread stubs are already no-ops if threads are not being used. Dropping those conditionals allows clang's thread safety analysis to deal with the file and also makes the code a bit more readable. While touching the file also add a few more assertions in debug mode that the right locks are held. Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D29372 (cherry picked from commit 5245bf7b92b74e556527b4916a8deba386fe5772) --- lib/libc/net/nsdispatch.c | 201 +++++++++++++++++++++++++++++----------------- 1 file changed, 129 insertions(+), 72 deletions(-) diff --git a/lib/libc/net/nsdispatch.c b/lib/libc/net/nsdispatch.c index b0f80d079b0b..d504a86d524b 100644 --- a/lib/libc/net/nsdispatch.c +++ b/lib/libc/net/nsdispatch.c @@ -69,6 +69,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -76,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -97,7 +99,52 @@ enum _nss_constants { * Global NSS data structures are mostly read-only, but we update * them when we read or re-read the nsswitch.conf. */ -static pthread_rwlock_t nss_lock = PTHREAD_RWLOCK_INITIALIZER; +static pthread_rwlock_t nss_lock = PTHREAD_RWLOCK_INITIALIZER; +#ifndef NDEBUG +static void *nss_wlock_owner __guarded_by(nss_lock); +#endif + +static inline /* __lock_annotate(locks_excluded(nss_lock)) */ +__locks_exclusive(nss_lock) int +nss_wlock(void) +{ + int err; + + err = _pthread_rwlock_wrlock(&nss_lock); +#ifndef NDEBUG + assert(nss_wlock_owner == NULL); + nss_wlock_owner = _pthread_self(); +#endif + assert(err == 0 && "Locking should not have failed!"); + return (err); +} + +/* + * XXX: The manpage says already held lock may result in EDEADLK, but + * actually libthr returns always EBUSY, so we need the extra owner + * variable for assertions. + */ +#define ASSERT_NSS_WLOCK_HELD() \ + do { \ + if (__isthreaded) { \ + assert(_pthread_rwlock_trywrlock(&nss_lock) == EBUSY); \ + assert(nss_wlock_owner == _pthread_self()); \ + } \ + } while (0) + +static inline __requires_exclusive(nss_lock) __unlocks(nss_lock) int +nss_wunlock(void) +{ + int err; + + ASSERT_NSS_WLOCK_HELD(); +#ifndef NDEBUG + nss_wlock_owner = NULL; +#endif + err = _pthread_rwlock_unlock(&nss_lock); + assert(err == 0 && "Unlocking should not have failed!"); + return (err); +} /* * Runtime determination of whether we are dynamically linked or not. @@ -114,12 +161,12 @@ const ns_src __nsdefaultsrc[] = { }; /* Database, source mappings. */ -static unsigned int _nsmapsize; -static ns_dbt *_nsmap = NULL; +static unsigned int _nsmapsize __guarded_by(nss_lock); +static ns_dbt *_nsmap __guarded_by(nss_lock); /* NSS modules. */ -static unsigned int _nsmodsize; -static ns_mod *_nsmod; +static unsigned int _nsmodsize __guarded_by(nss_lock); +static ns_mod *_nsmod __guarded_by(nss_lock); /* Placeholder for builtin modules' dlopen `handle'. */ static int __nss_builtin_handle; @@ -166,8 +213,7 @@ typedef int (*vector_comparison)(const void *, const void *); typedef void (*vector_free_elem)(void *); static void vector_sort(void *, unsigned int, size_t, vector_comparison); -static void vector_free(void *, unsigned int *, size_t, - vector_free_elem); +static void _vector_free(void *, unsigned int, size_t, vector_free_elem); static void *vector_ref(unsigned int, void *, unsigned int, size_t); static void *vector_search(const void *, void *, unsigned int, size_t, vector_comparison); @@ -238,22 +284,24 @@ vector_ref(unsigned int i, void *vec, unsigned int count, size_t esize) } -#define VECTOR_FREE(v, c, s, f) \ - do { vector_free(v, c, s, f); v = NULL; } while (0) +#define VECTOR_FREE(vec, count, es, fe) do { \ + _vector_free(vec, count, es, fe); \ + vec = NULL; \ + count = 0; \ +} while (0) static void -vector_free(void *vec, unsigned int *count, size_t esize, +_vector_free(void *vec, unsigned int count, size_t esize, vector_free_elem free_elem) { unsigned int i; void *elem; - for (i = 0; i < *count; i++) { - elem = vector_ref(i, vec, *count, esize); + for (i = 0; i < count; i++) { + elem = vector_ref(i, vec, count, esize); if (elem != NULL) free_elem(elem); } free(vec); - *count = 0; } /* @@ -282,13 +330,14 @@ mtab_compare(const void *a, const void *b) /* * NSS nsmap management. */ -void +__requires_exclusive(nss_lock) void _nsdbtaddsrc(ns_dbt *dbt, const ns_src *src) { const ns_mod *modp; - dbt->srclist = vector_append(src, dbt->srclist, &dbt->srclistsize, - sizeof(*src)); + ASSERT_NSS_WLOCK_HELD(); + dbt->srclist = vector_append(src, dbt->srclist, + (unsigned int *)&dbt->srclistsize, sizeof(*src)); modp = vector_search(&src->name, _nsmod, _nsmodsize, sizeof(*_nsmod), string_compare); if (modp == NULL) @@ -325,26 +374,28 @@ _nsdbtdump(const ns_dbt *dbt) } #endif +#ifndef NS_REREAD_CONF +static int __guarded_by(nss_lock) already_initialized = 0; +#endif /* * The first time nsdispatch is called (during a process's lifetime, * or after nsswitch.conf has been updated), nss_configure will * prepare global data needed by NSS. */ -static int -nss_configure(void) +static __requires_shared(nss_lock) int +__lock_annotate(no_thread_safety_analysis) /* RWLock upgrade not supported. */ +do_nss_configure(void) { - static time_t confmod; - static int already_initialized = 0; + static time_t __guarded_by(nss_lock) confmod = 0; struct stat statbuf; - int result, isthreaded; + int result; const char *path; #ifdef NS_CACHING void *handle; #endif result = 0; - isthreaded = __isthreaded; #if defined(_NSS_DEBUG) && defined(_NSS_SHOOT_FOOT) /* NOTE WELL: THIS IS A SECURITY HOLE. This must only be built * for debugging purposes and MUST NEVER be used in production. @@ -353,36 +404,33 @@ nss_configure(void) if (path == NULL) #endif path = _PATH_NS_CONF; + + result = _pthread_rwlock_unlock(&nss_lock); + if (result != 0) + return (result); + result = nss_wlock(); + if (result != 0) + return (result); #ifndef NS_REREAD_CONF /* - * Define NS_REREAD_CONF to have nsswitch notice changes - * to nsswitch.conf(5) during runtime. This involves calling - * stat(2) every time, which can result in performance hit. + * Another thread could have already run the initialization + * logic while we were waiting for the write lock. Check + * already_initialized to avoid re-initializing. */ if (already_initialized) - return (0); - already_initialized = 1; + goto fin; #endif /* NS_REREAD_CONF */ + ASSERT_NSS_WLOCK_HELD(); if (stat(path, &statbuf) != 0) - return (0); + goto fin; if (statbuf.st_mtime <= confmod) - return (0); - if (isthreaded) { - (void)_pthread_rwlock_unlock(&nss_lock); - result = _pthread_rwlock_wrlock(&nss_lock); - if (result != 0) - return (result); - if (stat(path, &statbuf) != 0) - goto fin; - if (statbuf.st_mtime <= confmod) - goto fin; - } + goto fin; _nsyyin = fopen(path, "re"); if (_nsyyin == NULL) goto fin; - VECTOR_FREE(_nsmap, &_nsmapsize, sizeof(*_nsmap), + VECTOR_FREE(_nsmap, _nsmapsize, sizeof(*_nsmap), (vector_free_elem)ns_dbt_free); - VECTOR_FREE(_nsmod, &_nsmodsize, sizeof(*_nsmod), + VECTOR_FREE(_nsmod, _nsmodsize, sizeof(*_nsmod), (vector_free_elem)ns_mod_free); if (confmod == 0) (void)atexit(nss_atexit); @@ -400,22 +448,42 @@ nss_configure(void) dlclose(handle); } #endif +#ifndef NS_REREAD_CONF + already_initialized = 1; +#endif fin: - if (isthreaded) { - (void)_pthread_rwlock_unlock(&nss_lock); - if (result == 0) - result = _pthread_rwlock_rdlock(&nss_lock); - } + result = nss_wunlock(); + if (result == 0) + result = _pthread_rwlock_rdlock(&nss_lock); + return (result); +} + +static __requires_shared(nss_lock) int +nss_configure(void) +{ + int result; +#ifndef NS_REREAD_CONF + /* + * Define NS_REREAD_CONF to have nsswitch notice changes + * to nsswitch.conf(5) during runtime. This involves calling + * stat(2) every time, which can result in performance hit. + */ + if (already_initialized) + return (0); +#endif /* NS_REREAD_CONF */ + result = do_nss_configure(); return (result); } -void +__requires_exclusive(nss_lock) void _nsdbtput(const ns_dbt *dbt) { unsigned int i; ns_dbt *p; + ASSERT_NSS_WLOCK_HELD(); + for (i = 0; i < _nsmapsize; i++) { p = vector_ref(i, _nsmap, _nsmapsize, sizeof(*_nsmap)); if (string_compare(&dbt->name, &p->name) == 0) { @@ -478,13 +546,15 @@ nss_load_builtin_modules(void) * argument is non-NULL, assume a built-in module and use reg_fn to * register it. Otherwise, search for a dynamic NSS module. */ -static void +static __requires_exclusive(nss_lock) void nss_load_module(const char *source, nss_module_register_fn reg_fn) { char buf[PATH_MAX]; ns_mod mod; nss_module_register_fn fn; + ASSERT_NSS_WLOCK_HELD(); + memset(&mod, 0, sizeof(mod)); mod.name = strdup(source); if (mod.name == NULL) { @@ -548,9 +618,9 @@ fin: vector_sort(_nsmod, _nsmodsize, sizeof(*_nsmod), string_compare); } -static int exiting = 0; +static int exiting __guarded_by(nss_lock) = 0; -static void +static __requires_exclusive(nss_lock) void ns_mod_free(ns_mod *mod) { @@ -569,24 +639,19 @@ ns_mod_free(ns_mod *mod) static void nss_atexit(void) { - int isthreaded; - + (void)nss_wlock(); exiting = 1; - isthreaded = __isthreaded; - if (isthreaded) - (void)_pthread_rwlock_wrlock(&nss_lock); - VECTOR_FREE(_nsmap, &_nsmapsize, sizeof(*_nsmap), + VECTOR_FREE(_nsmap, _nsmapsize, sizeof(*_nsmap), (vector_free_elem)ns_dbt_free); - VECTOR_FREE(_nsmod, &_nsmodsize, sizeof(*_nsmod), + VECTOR_FREE(_nsmod, _nsmapsize, sizeof(*_nsmod), (vector_free_elem)ns_mod_free); - if (isthreaded) - (void)_pthread_rwlock_unlock(&nss_lock); + (void)nss_wunlock(); } /* * Finally, the actual implementation. */ -static nss_method +static __requires_shared(nss_lock) nss_method nss_method_lookup(const char *source, const char *database, const char *method, const ns_dtab disp_tab[], void **mdata) { @@ -625,7 +690,7 @@ fb_endstate(void *p) __weak_reference(_nsdispatch, nsdispatch); -int +__requires_unlocked(nss_lock) int _nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database, const char *method_name, const ns_src defaults[], ...) { @@ -634,7 +699,7 @@ _nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database, const ns_src *srclist; nss_method method, fb_method; void *mdata; - int isthreaded, serrno, i, result, srclistsize; + int serrno, i, result, srclistsize; struct fb_state *st; int saved_depth; @@ -647,15 +712,8 @@ _nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database, dbt = NULL; fb_method = NULL; - isthreaded = __isthreaded; serrno = errno; - if (isthreaded) { - result = _pthread_rwlock_rdlock(&nss_lock); - if (result != 0) { - result = NS_UNAVAIL; - goto fin; - } - } + (void)_pthread_rwlock_rdlock(&nss_lock); result = fb_getstate(&st); if (result != 0) { @@ -774,10 +832,9 @@ _nsdispatch(void *retval, const ns_dtab disp_tab[], const char *database, } #endif /* NS_CACHING */ - if (isthreaded) - (void)_pthread_rwlock_unlock(&nss_lock); --st->dispatch_depth; fin: + (void)_pthread_rwlock_unlock(&nss_lock); errno = serrno; return (result); } From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:30:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7051D5E6C3B; Sat, 10 Apr 2021 13:30: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 4FHbTW1NJYz3JQ6; Sat, 10 Apr 2021 13:30: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 EAB2A123ED; Sat, 10 Apr 2021 13:30: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 13ADU62D004710; Sat, 10 Apr 2021 13:30:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADU6Na004708; Sat, 10 Apr 2021 13:30:06 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:30:06 GMT Message-Id: <202104101330.13ADU6Na004708@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 52b6501bd7de - stable/13 - libsa: Remove conflicting .global/.weak directive MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 52b6501bd7de28af8cfdfc62b8763dd580ba8ca3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:30:07 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=52b6501bd7de28af8cfdfc62b8763dd580ba8ca3 commit 52b6501bd7de28af8cfdfc62b8763dd580ba8ca3 Author: Alex Richardson AuthorDate: 2021-03-30 13:52:31 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 13:01:05 +0000 libsa: Remove conflicting .global/.weak directive LLVM12 complains if you change the symbol binding: `error: _longjmp changed binding to STB_GLOBAL` In this case LLVM actually ignored the weak directive and used the later .global, but GNU as would mark the symbol as weak. None of the other architectures mark the libsa _setjmp as weak so just drop this directive. (cherry picked from commit 59b2caef0537661397caf2ce1398cf802cb864b4) --- stand/libsa/amd64/_setjmp.S | 1 - 1 file changed, 1 deletion(-) diff --git a/stand/libsa/amd64/_setjmp.S b/stand/libsa/amd64/_setjmp.S index 6d9a5fa13f8d..53ea6e9b5d52 100644 --- a/stand/libsa/amd64/_setjmp.S +++ b/stand/libsa/amd64/_setjmp.S @@ -63,7 +63,6 @@ ENTRY(_setjmp) ret END(_setjmp) - .weak CNAME(_longjmp) ENTRY(_longjmp) movq %rdi,%rdx /* Restore the mxcsr, but leave exception flags intact. */ From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:30:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7D015E6D94; Sat, 10 Apr 2021 13:30: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 4FHbTX33xwz3Jh0; Sat, 10 Apr 2021 13:30: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 0DB1411DFB; Sat, 10 Apr 2021 13:30: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 13ADU7fN004922; Sat, 10 Apr 2021 13:30:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADU7oI004920; Sat, 10 Apr 2021 13:30:07 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:30:07 GMT Message-Id: <202104101330.13ADU7oI004920@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 30626f9ad5ef - stable/13 - sys/dev/md: Drop unncessary __GLOBL(mfs_root) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 30626f9ad5effa12daa2f9f4b9c30c98e20b0200 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:30:09 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=30626f9ad5effa12daa2f9f4b9c30c98e20b0200 commit 30626f9ad5effa12daa2f9f4b9c30c98e20b0200 Author: Alex Richardson AuthorDate: 2021-03-30 13:53:41 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 13:01:05 +0000 sys/dev/md: Drop unncessary __GLOBL(mfs_root) LLVM12 complains if you change the symbol binding: error: mfs_root_end changed binding to STB_WEAK [-Werror,-Winline-asm] error: mfs_root changed binding to STB_WEAK [-Werror,-Winline-asm] (cherry picked from commit 69e18c9b7b12e7fd97a740d8748d8718021a1e34) --- sys/dev/md/md.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 5c2cb2f25d2e..c5c90d9173ad 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -187,8 +187,6 @@ int mfs_root_size; #else extern volatile u_char __weak_symbol mfs_root; extern volatile u_char __weak_symbol mfs_root_end; -__GLOBL(mfs_root); -__GLOBL(mfs_root_end); #define mfs_root_size ((uintptr_t)(&mfs_root_end - &mfs_root)) #endif #endif From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:30:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F7855E6CBD; Sat, 10 Apr 2021 13:30: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 4FHbTZ2rxJz3Jn5; Sat, 10 Apr 2021 13:30: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 3C176123EF; Sat, 10 Apr 2021 13:30: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 13ADUAvm005340; Sat, 10 Apr 2021 13:30:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADUACI005337; Sat, 10 Apr 2021 13:30:10 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:30:10 GMT Message-Id: <202104101330.13ADUACI005337@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 676010ab86f5 - stable/13 - tests/sys/net/routing: XFAIL the two failing tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 676010ab86f51643a2382cbd222102181c746d00 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:30:11 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=676010ab86f51643a2382cbd222102181c746d00 commit 676010ab86f51643a2382cbd222102181c746d00 Author: Alex Richardson AuthorDate: 2021-04-07 09:33:21 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 13:01:05 +0000 tests/sys/net/routing: XFAIL the two failing tests They have been failing for 1.5 months and the patch to fix them is stuck in review so mark them as XFAIL for now to get Jenkins back to green. To be reverted when https://reviews.freebsd.org/D28886 (or similar) is commited. Reviewed By: kp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29528 (cherry picked from commit 83532eb68cd06a3517bb7b5e5a34afcf798de914) --- tests/sys/net/routing/test_rtsock_l3.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/sys/net/routing/test_rtsock_l3.c b/tests/sys/net/routing/test_rtsock_l3.c index 9486ac466965..91816679400f 100644 --- a/tests/sys/net/routing/test_rtsock_l3.c +++ b/tests/sys/net/routing/test_rtsock_l3.c @@ -383,6 +383,9 @@ ATF_TC_BODY(rtm_get_v4_hostbits_failure, tc) { DECLARE_TEST_VARS; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_expect_fail("Needs https://reviews.freebsd.org/D28886"); + c = presetup_ipv4(tc); /* Q the same prefix */ @@ -447,6 +450,9 @@ ATF_TC_BODY(rtm_add_v4_no_rtf_host_failure, tc) { DECLARE_TEST_VARS; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_expect_fail("Needs https://reviews.freebsd.org/D28886"); + c = presetup_ipv4(tc); /* Create IPv4 subnetwork with smaller prefix */ From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:30:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B38405E6E12; Sat, 10 Apr 2021 13:30:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FHbTb65p1z3Jks; Sat, 10 Apr 2021 13:30: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 4EC3F123F0; Sat, 10 Apr 2021 13:30: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 13ADUBLS005599; Sat, 10 Apr 2021 13:30:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADUBPh005593; Sat, 10 Apr 2021 13:30:11 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:30:11 GMT Message-Id: <202104101330.13ADUBPh005593@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: d612bd6d0d5d - stable/13 - libarchive: Make test_read_append_filter_wrong_program pass again MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d612bd6d0d5dc5bc8e6ac10aec845e2ae2fe933b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:30:13 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=d612bd6d0d5dc5bc8e6ac10aec845e2ae2fe933b commit d612bd6d0d5dc5bc8e6ac10aec845e2ae2fe933b Author: Alex Richardson AuthorDate: 2021-04-07 10:35:10 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 13:01:05 +0000 libarchive: Make test_read_append_filter_wrong_program pass again libarchive: Apply upstream commit a1b7bf8013fb7a11a486794247daae592db6f5ae This fixes the failing test_read_append_filter_wrong_program test in CI which has been failing since 01-Dec-2020. Commit message from https://github.com/libarchive/libarchive/commit/a1b7bf8013fb7a11a486794247daae592db6f5ae Silence stderr in test_read_append_filter_program When the FreeBSD testsuite runs the libarchive tests it checks that stderr is empty. Since #1382 this is no longer the case. This change restores the behaviour of silencing bunzip2 stderr but doesn't bring back the output text check. Partially reverts 2e7aa5d9 MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29036 (cherry picked from commit 2bca8aa7a79ad2b6683e8f5a5c373de81c5baca2) --- .../libarchive/test/test_read_set_format.c | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/contrib/libarchive/libarchive/test/test_read_set_format.c b/contrib/libarchive/libarchive/test/test_read_set_format.c index f357bada82c3..c760de0056d3 100644 --- a/contrib/libarchive/libarchive/test/test_read_set_format.c +++ b/contrib/libarchive/libarchive/test/test_read_set_format.c @@ -201,6 +201,11 @@ DEFINE_TEST(test_read_append_filter_wrong_program) { struct archive_entry *ae; struct archive *a; +#if !defined(_WIN32) || defined(__CYGWIN__) + FILE * fp; + int fd; + fpos_t pos; +#endif /* * If we have "bunzip2 -q", try using that. @@ -210,6 +215,14 @@ DEFINE_TEST(test_read_append_filter_wrong_program) return; } +#if !defined(_WIN32) || defined(__CYGWIN__) + /* bunzip2 will write to stderr, redirect it to a file */ + fflush(stderr); + fgetpos(stderr, &pos); + assert((fd = dup(fileno(stderr))) != -1); + fp = freopen("stderr1", "w", stderr); +#endif + assert((a = archive_read_new()) != NULL); assertA(0 == archive_read_set_format(a, ARCHIVE_FORMAT_TAR)); assertEqualIntA(a, ARCHIVE_OK, @@ -219,4 +232,15 @@ DEFINE_TEST(test_read_append_filter_wrong_program) assertA(archive_read_next_header(a, &ae) < (ARCHIVE_WARN)); assertEqualIntA(a, ARCHIVE_WARN, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + +#if !defined(_WIN32) || defined(__CYGWIN__) + /* restore stderr */ + if (fp != NULL) { + fflush(stderr); + dup2(fd, fileno(stderr)); + clearerr(stderr); + (void)fsetpos(stderr, &pos); + } + close(fd); +#endif } From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:30:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81BC35E6CB5; Sat, 10 Apr 2021 13:30: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 4FHbTY1sjwz3JbM; Sat, 10 Apr 2021 13:30: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 27176123EE; Sat, 10 Apr 2021 13:30: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 13ADU9Vu005130; Sat, 10 Apr 2021 13:30:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADU9DR005127; Sat, 10 Apr 2021 13:30:09 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:30:09 GMT Message-Id: <202104101330.13ADU9DR005127@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: c5cde5af4b82 - stable/13 - resolv_test: Fix racy exit check, remove mutexes, and reduce output MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c5cde5af4b825ecb150e38c47fa60a0f1749a67a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:30:09 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=c5cde5af4b825ecb150e38c47fa60a0f1749a67a commit c5cde5af4b825ecb150e38c47fa60a0f1749a67a Author: Alex Richardson AuthorDate: 2021-03-30 14:00:16 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 13:01:05 +0000 resolv_test: Fix racy exit check, remove mutexes, and reduce output Instead of polling nleft[i] (without appropriate memory barriers!) and using sleep() to detect the exit just call pthread_join() on all threads. Also replace the use of a mutex that guarding the increments with atomic fetch_add. This should reduce the runtime of this test on SMP systems. Finally, remove all the debug printfs unless DEBUG_OUTPUT is set in the environment. Test Plan: still fails sometimes on qemu (but maybe less often?) Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D29390 (cherry picked from commit 85425bdc5a80c948f99aa046f9c48512466806dd) --- lib/libc/tests/resolv/resolv_test.c | 174 ++++++++++++++++++------------------ 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/lib/libc/tests/resolv/resolv_test.c b/lib/libc/tests/resolv/resolv_test.c index 12f1dca76a56..4f17469fa0cb 100644 --- a/lib/libc/tests/resolv/resolv_test.c +++ b/lib/libc/tests/resolv/resolv_test.c @@ -38,6 +38,7 @@ __RCSID("$NetBSD: resolv.c,v 1.6 2004/05/23 16:59:11 christos Exp $"); #include #include #include +#include #include #include #include @@ -57,15 +58,19 @@ enum method { }; static StringList *hosts = NULL; -static int *ask = NULL; -static int *got = NULL; +static _Atomic(int) *ask = NULL; +static _Atomic(int) *got = NULL; +static bool debug_output = 0; static void load(const char *); -static void resolvone(int, enum method); +static void resolvone(long, int, enum method); static void *resolvloop(void *); -static void run(int *, enum method); +static pthread_t run(int, enum method, long); -static pthread_mutex_t stats = PTHREAD_MUTEX_INITIALIZER; +#define DBG(...) do { \ + if (debug_output) \ + dprintf(STDOUT_FILENO, __VA_ARGS__); \ + } while (0) static void load(const char *fname) @@ -93,11 +98,11 @@ load(const char *fname) } static int -resolv_getaddrinfo(pthread_t self, char *host, int port) +resolv_getaddrinfo(long threadnum, char *host, int port, const char **errstr) { - char portstr[6], buf[1024], hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; + char portstr[6], hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; struct addrinfo hints, *res; - int error, len; + int error; snprintf(portstr, sizeof(portstr), "%d", port); memset(&hints, 0, sizeof(hints)); @@ -105,96 +110,85 @@ resolv_getaddrinfo(pthread_t self, char *host, int port) hints.ai_flags = AI_PASSIVE; hints.ai_socktype = SOCK_STREAM; error = getaddrinfo(host, portstr, &hints, &res); - len = snprintf(buf, sizeof(buf), "%p: host %s %s\n", - self, host, error ? "not found" : "ok"); - (void)write(STDOUT_FILENO, buf, len); if (error == 0) { + DBG("T%ld: host %s ok\n", threadnum, host); memset(hbuf, 0, sizeof(hbuf)); memset(pbuf, 0, sizeof(pbuf)); getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf), - pbuf, sizeof(pbuf), 0); - len = snprintf(buf, sizeof(buf), - "%p: reverse %s %s\n", self, hbuf, pbuf); - (void)write(STDOUT_FILENO, buf, len); - } - if (error == 0) + pbuf, sizeof(pbuf), 0); + DBG("T%ld: reverse %s %s\n", threadnum, hbuf, pbuf); freeaddrinfo(res); + } else { + *errstr = gai_strerror(error); + DBG("T%ld: host %s not found: %s\n", threadnum, host, *errstr); + } return error; } static int -resolv_gethostby(pthread_t self, char *host) +resolv_gethostby(long threadnum, char *host, const char **errstr) { char buf[1024]; struct hostent *hp, *hp2; - int len; hp = gethostbyname(host); - len = snprintf(buf, sizeof(buf), "%p: host %s %s\n", - self, host, (hp == NULL) ? "not found" : "ok"); - (void)write(STDOUT_FILENO, buf, len); if (hp) { + DBG("T%ld: host %s ok\n", threadnum, host); memcpy(buf, hp->h_addr, hp->h_length); hp2 = gethostbyaddr(buf, hp->h_length, hp->h_addrtype); if (hp2) { - len = snprintf(buf, sizeof(buf), - "%p: reverse %s\n", self, hp2->h_name); - (void)write(STDOUT_FILENO, buf, len); + DBG("T%ld: reverse %s\n", threadnum, hp2->h_name); } + } else { + *errstr = hstrerror(h_errno); + DBG("T%ld: host %s not found: %s\n", threadnum, host, *errstr); } - return hp ? 0 : -1; + return hp ? 0 : h_errno; } static int -resolv_getipnodeby(pthread_t self, char *host) +resolv_getipnodeby(long threadnum, char *host, const char **errstr) { char buf[1024]; struct hostent *hp, *hp2; - int len, h_error; + int error = 0; - hp = getipnodebyname(host, AF_INET, 0, &h_error); - len = snprintf(buf, sizeof(buf), "%p: host %s %s\n", - self, host, (hp == NULL) ? "not found" : "ok"); - (void)write(STDOUT_FILENO, buf, len); + hp = getipnodebyname(host, AF_INET, 0, &error); if (hp) { + DBG("T%ld: host %s ok\n", threadnum, host); memcpy(buf, hp->h_addr, hp->h_length); hp2 = getipnodebyaddr(buf, hp->h_length, hp->h_addrtype, - &h_error); + &error); if (hp2) { - len = snprintf(buf, sizeof(buf), - "%p: reverse %s\n", self, hp2->h_name); - (void)write(STDOUT_FILENO, buf, len); - } - if (hp2) + DBG("T%ld: reverse %s\n", threadnum, hp2->h_name); freehostent(hp2); - } - if (hp) + } freehostent(hp); - return hp ? 0 : -1; + } else { + *errstr = hstrerror(error); + DBG("T%ld: host %s not found: %s\n", threadnum, host, *errstr); + } + return hp ? 0 : error; } static void -resolvone(int n, enum method method) +resolvone(long threadnum, int n, enum method method) { - char buf[1024]; - pthread_t self = pthread_self(); + const char* errstr = NULL; size_t i = (random() & 0x0fffffff) % hosts->sl_cur; char *host = hosts->sl_str[i]; - int error, len; + int error; - len = snprintf(buf, sizeof(buf), "%p: %d resolving %s %d\n", - self, n, host, (int)i); - (void)write(STDOUT_FILENO, buf, len); - error = 0; + DBG("T%ld: %d resolving %s %zd\n", threadnum, n, host, i); switch (method) { case METHOD_GETADDRINFO: - error = resolv_getaddrinfo(self, host, i); + error = resolv_getaddrinfo(threadnum, host, i, &errstr); break; case METHOD_GETHOSTBY: - error = resolv_gethostby(self, host); + error = resolv_gethostby(threadnum, host, &errstr); break; case METHOD_GETIPNODEBY: - error = resolv_getipnodeby(self, host); + error = resolv_getipnodeby(threadnum, host, &errstr); break; default: /* UNREACHABLE */ @@ -203,38 +197,43 @@ resolvone(int n, enum method method) abort(); break; } - pthread_mutex_lock(&stats); - ask[i]++; - got[i] += error == 0; - pthread_mutex_unlock(&stats); + atomic_fetch_add_explicit(&ask[i], 1, memory_order_relaxed); + if (error == 0) + atomic_fetch_add_explicit(&got[i], 1, memory_order_relaxed); + else if (got[i] != 0) + fprintf(stderr, + "T%ld ERROR after previous success for %s: %d (%s)\n", + threadnum, hosts->sl_str[i], error, errstr); } struct resolvloop_args { - int *nhosts; + int nhosts; enum method method; + long threadnum; }; static void * resolvloop(void *p) { struct resolvloop_args *args = p; + int nhosts = args->nhosts; - if (*args->nhosts == 0) { + if (nhosts == 0) { free(args); return NULL; } - do - resolvone(*args->nhosts, args->method); - while (--(*args->nhosts)); + do { + resolvone(args->threadnum, nhosts, args->method); + } while (--nhosts); free(args); - return NULL; + return (void *)(uintptr_t)nhosts; } -static void -run(int *nhosts, enum method method) +static pthread_t +run(int nhosts, enum method method, long i) { - pthread_t self; + pthread_t t; int rc; struct resolvloop_args *args; @@ -244,59 +243,60 @@ run(int *nhosts, enum method method) args->nhosts = nhosts; args->method = method; - self = pthread_self(); - rc = pthread_create(&self, NULL, resolvloop, args); + args->threadnum = i + 1; + rc = pthread_create(&t, NULL, resolvloop, args); ATF_REQUIRE_MSG(rc == 0, "pthread_create failed: %s", strerror(rc)); + return t; } static int run_tests(const char *hostlist_file, enum method method) { size_t nthreads = NTHREADS; + pthread_t *threads; size_t nhosts = NHOSTS; size_t i; - int c, done, *nleft; + int c; hosts = sl_init(); srandom(1234); + debug_output = getenv("DEBUG_OUTPUT") != NULL; load(hostlist_file); ATF_REQUIRE_MSG(0 < hosts->sl_cur, "0 hosts in %s", hostlist_file); - nleft = malloc(nthreads * sizeof(int)); - ATF_REQUIRE(nleft != NULL); - ask = calloc(hosts->sl_cur, sizeof(int)); ATF_REQUIRE(ask != NULL); got = calloc(hosts->sl_cur, sizeof(int)); ATF_REQUIRE(got != NULL); + threads = calloc(nthreads, sizeof(pthread_t)); + ATF_REQUIRE(threads != NULL); + for (i = 0; i < nthreads; i++) { - nleft[i] = nhosts; - run(&nleft[i], method); + threads[i] = run(nhosts, method, i); } + /* Wait for all threads to join and check that they checked all hosts */ + for (i = 0; i < nthreads; i++) { + size_t remaining; - for (done = 0; !done;) { - done = 1; - for (i = 0; i < nthreads; i++) { - if (nleft[i] != 0) { - done = 0; - break; - } - } - sleep(1); + remaining = (uintptr_t)pthread_join(threads[i], NULL); + ATF_CHECK_EQ_MSG(0, remaining, + "Thread %zd still had %zd hosts to check!", i, remaining); } + c = 0; for (i = 0; i < hosts->sl_cur; i++) { - if (ask[i] != got[i] && got[i] != 0) { - printf("Error: host %s ask %d got %d\n", - hosts->sl_str[i], ask[i], got[i]); - c++; + if (got[i] != 0) { + ATF_CHECK_EQ_MSG(ask[i], got[i], + "Error: host %s ask %d got %d", hosts->sl_str[i], + ask[i], got[i]); + c += ask[i] != got[i]; } } - free(nleft); + free(threads); free(ask); free(got); sl_free(hosts, 1); From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:30:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3AE615E6D55; Sat, 10 Apr 2021 13:30: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 4FHbTc5K4Yz3JsV; Sat, 10 Apr 2021 13:30:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6BBF611D76; Sat, 10 Apr 2021 13:30:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13ADUCqq006075; Sat, 10 Apr 2021 13:30:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADUCHv006073; Sat, 10 Apr 2021 13:30:12 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:30:12 GMT Message-Id: <202104101330.13ADUCHv006073@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 7755e8ae322b - stable/13 - ifconfig: fix UBSan signed shift error MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7755e8ae322b63875d7f7f426e61ce0bcb9e0086 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:30:13 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7755e8ae322b63875d7f7f426e61ce0bcb9e0086 commit 7755e8ae322b63875d7f7f426e61ce0bcb9e0086 Author: Alex Richardson AuthorDate: 2021-01-19 11:35:21 +0000 Commit: Alex Richardson CommitDate: 2021-04-10 13:01:56 +0000 ifconfig: fix UBSan signed shift error Use 1u since UBSan complains about 1 << 31. (cherry picked from commit 94ac312a71683a3a1a928c6adfe927d6bb45044f) --- sbin/ifconfig/ifconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index 8b1a242db634..5e114b43c126 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -1515,7 +1515,7 @@ printb(const char *s, unsigned v, const char *bits) bits++; putchar('<'); while ((i = *bits++) != '\0') { - if (v & (1 << (i-1))) { + if (v & (1u << (i-1))) { if (any) putchar(','); any = 1; From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:43:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 839F85CC193; Sat, 10 Apr 2021 13:43: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 4FHbn43Kvzz3MH3; Sat, 10 Apr 2021 13:43: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 6523E12656; Sat, 10 Apr 2021 13:43: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 13ADhaPE027494; Sat, 10 Apr 2021 13:43:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADha8u027493; Sat, 10 Apr 2021 13:43:36 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:43:36 GMT Message-Id: <202104101343.13ADha8u027493@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: 15ca66220874 - main - libnv: Use PICFLAG rather than -fPIC 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: 15ca66220874c177602c13a114b2f3d17773b788 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:43:36 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=15ca66220874c177602c13a114b2f3d17773b788 commit 15ca66220874c177602c13a114b2f3d17773b788 Author: Kristof Provost AuthorDate: 2021-04-10 09:23:57 +0000 Commit: Kristof Provost CommitDate: 2021-04-10 13:43:28 +0000 libnv: Use PICFLAG rather than -fPIC Suggested by: andrew MFC after: 4 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") --- lib/libnv/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libnv/Makefile b/lib/libnv/Makefile index 854cd2c7f3f3..6105f6244fce 100644 --- a/lib/libnv/Makefile +++ b/lib/libnv/Makefile @@ -10,7 +10,7 @@ SHLIB_MAJOR= 0 .PATH: ${SRCTOP}/sys/contrib/libnv ${SRCTOP}/sys/sys CFLAGS+=-I${.CURDIR} -CFLAGS+=-fPIC +CFLAGS+=${PICFLAG} SRCS= cnvlist.c SRCS+= dnvlist.c From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:47:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 566DB5CC521; Sat, 10 Apr 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 4FHbt22262z3M8V; Sat, 10 Apr 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 2E0631279E; Sat, 10 Apr 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 13ADlsoI027945; Sat, 10 Apr 2021 13:47:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADlsox027944; Sat, 10 Apr 2021 13:47:54 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:47:54 GMT Message-Id: <202104101347.13ADlsox027944@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: c3a456defaf2 - main - Always use inp fib in the inp_lookup_mcast_ifp(). 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: c3a456defaf28df8d6f47704d606248f6c22146c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:47:54 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=c3a456defaf28df8d6f47704d606248f6c22146c commit c3a456defaf28df8d6f47704d606248f6c22146c Author: Alexander V. Chernikov AuthorDate: 2021-04-05 19:58:57 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-10 13:47:49 +0000 Always use inp fib in the inp_lookup_mcast_ifp(). inp_lookup_mcast_ifp() is static and is only used in the inp_join_group(). The latter function is also static, and is only used in the inp_setmoptions(), which relies on inp being non-NULL. As a result, in the current code, inp_lookup_mcast_ifp() is always called with non-NULL inp. Eliminate unused RT_DEFAULT_FIB condition and always use inp fib instead. Differential Revision: https://reviews.freebsd.org/D29594 Reviewed by: kp MFC after: 2 weeks --- sys/netinet/in_mcast.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sys/netinet/in_mcast.c b/sys/netinet/in_mcast.c index 392856785dd2..f0827fcf3451 100644 --- a/sys/netinet/in_mcast.c +++ b/sys/netinet/in_mcast.c @@ -1865,8 +1865,7 @@ inp_getmoptions(struct inpcb *inp, struct sockopt *sopt) * specific physical links in the networking stack, or which need * to join link-scope groups before IPv4 addresses are configured. * - * If inp is non-NULL, use this socket's current FIB number for any - * required FIB lookup. + * Use this socket's current FIB number for any required FIB lookup. * If ina is INADDR_ANY, look up the group address in the unicast FIB, * and use its ifp; usually, this points to the default next-hop. * @@ -1887,8 +1886,8 @@ inp_lookup_mcast_ifp(const struct inpcb *inp, struct rm_priotracker in_ifa_tracker; struct ifnet *ifp; struct nhop_object *nh; - uint32_t fibnum; + KASSERT(inp != NULL, ("%s: inp must not be NULL", __func__)); KASSERT(gsin->sin_family == AF_INET, ("%s: not AF_INET", __func__)); KASSERT(IN_MULTICAST(ntohl(gsin->sin_addr.s_addr)), ("%s: not multicast", __func__)); @@ -1901,8 +1900,7 @@ inp_lookup_mcast_ifp(const struct inpcb *inp, if_ref(ifp); IN_IFADDR_RUNLOCK(&in_ifa_tracker); } else { - fibnum = inp ? inp->inp_inc.inc_fibnum : RT_DEFAULT_FIB; - nh = fib4_lookup(fibnum, gsin->sin_addr, 0, NHR_NONE, 0); + nh = fib4_lookup(inp->inp_inc.inc_fibnum, gsin->sin_addr, 0, NHR_NONE, 0); if (nh != NULL) { ifp = nh->nh_ifp; if_ref(ifp); From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:47:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 825125CC241; Sat, 10 Apr 2021 13:47: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 4FHbt3383Jz3MHd; Sat, 10 Apr 2021 13:47: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 54D0B12657; Sat, 10 Apr 2021 13:47: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 13ADltTq027966; Sat, 10 Apr 2021 13:47:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADlteY027965; Sat, 10 Apr 2021 13:47:55 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:47:55 GMT Message-Id: <202104101347.13ADlteY027965@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: caf2f62765f9 - main - Allow to specify debugnet fib in sysctl/tunable. 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: caf2f62765f9087a6e0002b1c47c3c6f65a8ae0b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:47:55 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=caf2f62765f9087a6e0002b1c47c3c6f65a8ae0b commit caf2f62765f9087a6e0002b1c47c3c6f65a8ae0b Author: Alexander V. Chernikov AuthorDate: 2021-04-05 19:48:07 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-10 13:47:49 +0000 Allow to specify debugnet fib in sysctl/tunable. Differential Revision: https://reviews.freebsd.org/D29593 Reviewed by: donner MFC after: 2 weeks --- sys/net/debugnet.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/net/debugnet.c b/sys/net/debugnet.c index 3930a87d46dc..bb59ff33a93f 100644 --- a/sys/net/debugnet.c +++ b/sys/net/debugnet.c @@ -91,6 +91,10 @@ int debugnet_nretries = 10; SYSCTL_INT(_net_debugnet, OID_AUTO, nretries, CTLFLAG_RWTUN, &debugnet_nretries, 0, "Number of retransmit attempts before giving up"); +int debugnet_fib = RT_DEFAULT_FIB; +SYSCTL_INT(_net_debugnet, OID_AUTO, fib, CTLFLAG_RWTUN, + &debugnet_fib, 0, + "Fib to use when sending dump"); static bool g_debugnet_pcb_inuse; static struct debugnet_pcb g_dnet_pcb; @@ -658,7 +662,7 @@ debugnet_connect(const struct debugnet_conn_params *dcp, }; CURVNET_SET(vnet0); - nh = fib4_lookup_debugnet(RT_DEFAULT_FIB, dest_sin.sin_addr, 0, + nh = fib4_lookup_debugnet(debugnet_fib, dest_sin.sin_addr, 0, NHR_NONE); CURVNET_RESTORE(); From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:50:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 171D75CC787; Sat, 10 Apr 2021 13:50: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 4FHbwq084Bz3MC0; Sat, 10 Apr 2021 13:50: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 EC148122DD; Sat, 10 Apr 2021 13:50: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 13ADoIkk035151; Sat, 10 Apr 2021 13:50:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADoIWJ035145; Sat, 10 Apr 2021 13:50:18 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:50:18 GMT Message-Id: <202104101350.13ADoIWJ035145@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: 63dceebe6856 - main - Appease -Wsign-compare in radix.c 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: 63dceebe68569c3a7ebd07d0a6123264da625149 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:50:19 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=63dceebe68569c3a7ebd07d0a6123264da625149 commit 63dceebe68569c3a7ebd07d0a6123264da625149 Author: Alexander V. Chernikov AuthorDate: 2021-04-10 13:48:25 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-10 13:48:25 +0000 Appease -Wsign-compare in radix.c Differential Revision: https://reviews.freebsd.org/D29661 Submitted by: zec MFC after 2 weeks --- sys/net/radix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/radix.c b/sys/net/radix.c index 1f58318e52ae..931bf6db871b 100644 --- a/sys/net/radix.c +++ b/sys/net/radix.c @@ -428,7 +428,7 @@ rn_insert(void *v_arg, struct radix_head *head, int *dupentry, int head_off = top->rn_offset, vlen = LEN(v); struct radix_node *t = rn_search(v_arg, top); caddr_t cp = v + head_off; - int b; + unsigned b; struct radix_node *p, *tt, *x; /* * Find first bit at which v and t->rn_key differ From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:58:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F61E5CC8A0; Sat, 10 Apr 2021 13:58: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 4FHc6K3DhQz3MDC; Sat, 10 Apr 2021 13:58: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 61B9112923; Sat, 10 Apr 2021 13:58: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 13ADwXdn041181; Sat, 10 Apr 2021 13:58:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADwXro041180; Sat, 10 Apr 2021 13:58:33 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:58:33 GMT Message-Id: <202104101358.13ADwXro041180@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 9535440569ca - stable/13 - amd64: implement strlen in assembly, take 2 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9535440569ca468b12030142d6631704b658ece6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:58:33 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=9535440569ca468b12030142d6631704b658ece6 commit 9535440569ca468b12030142d6631704b658ece6 Author: Mateusz Guzik AuthorDate: 2021-04-10 13:52:49 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 13:53:46 +0000 amd64: implement strlen in assembly, take 2 Tested with glibc test suite. The C variant in libkern performs excessive branching to find the zero byte instead of using the bsfq instruction. The same code patched to use it is still slower than the routine implemented here as the compiler keeps neglecting to perform certain optimizations (like using leaq). On top of that the routine can be used as a starting point for copyinstr which operates on words intead of bytes. The previous attempt had an instance of swapped operands to andq when dealing with fully aligned case, which had a side effect of breaking the code for certain corner cases. Noted by jrtc27. Sample results: $(perl -e "print 'A' x 3"): stock: 211198039 patched:338626619 asm: 465609618 $(perl -e "print 'A' x 100"): stock: 83151997 patched: 98285919 asm: 120719888 Reviewed by: jhb, kib Differential Revision: https://reviews.freebsd.org/D28779 (cherry picked from commit 5fa12fe0cd203efcbb2ac21e7c3e3fb9b2f801ae) --- sys/amd64/amd64/support.S | 66 +++++++++++++++++++++++++++++++++++++++++++++++ sys/conf/files | 1 - sys/conf/files.arm | 1 + sys/conf/files.i386 | 1 + sys/conf/files.mips | 1 + sys/conf/files.powerpc | 1 + sys/conf/files.riscv | 1 + 7 files changed, 71 insertions(+), 1 deletion(-) diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index b623fba277db..4c0f7da87ef8 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -697,6 +697,72 @@ ENTRY(fillw) ret END(fillw) +/* + * strlen(string) + * %rdi + * + * Uses the ((x - 0x01....01) & ~x & 0x80....80) trick. + * + * 0x01....01 is replaced with 0x0 - 0x01....01 so that it can be added + * with leaq. + * + * For a description see either: + * - "Hacker's Delight" by Henry S. Warren, Jr. + * - "Optimizing subroutines in assembly language: An optimization guide for x86 platforms" + * by Agner Fog + * + * The latter contains a 32-bit variant of the same algorithm coded in assembly for i386. + */ +ENTRY(strlen) + PUSH_FRAME_POINTER + movabsq $0xfefefefefefefeff,%r8 + movabsq $0x8080808080808080,%r9 + + movq %rdi,%r10 + movq %rdi,%rcx + testb $7,%dil + jz 2f + + /* + * Handle misaligned reads: align to 8 and fill + * the spurious bytes. + */ + andq $~7,%rdi + movq (%rdi),%r11 + shlq $3,%rcx + movq $-1,%rdx + shlq %cl,%rdx + notq %rdx + orq %rdx,%r11 + + leaq (%r11,%r8),%rcx + notq %r11 + andq %r11,%rcx + andq %r9,%rcx + jnz 3f + + /* + * Main loop. + */ + ALIGN_TEXT +1: + leaq 8(%rdi),%rdi +2: + movq (%rdi),%r11 + leaq (%r11,%r8),%rcx + notq %r11 + andq %r11,%rcx + andq %r9,%rcx + jz 1b +3: + bsfq %rcx,%rcx + shrq $3,%rcx + leaq (%rcx,%rdi),%rax + subq %r10,%rax + POP_FRAME_POINTER + ret +END(strlen) + /*****************************************************************************/ /* copyout and fubyte family */ /*****************************************************************************/ diff --git a/sys/conf/files b/sys/conf/files index e68aa2118791..9ec7292a741b 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4086,7 +4086,6 @@ libkern/strdup.c standard libkern/strndup.c standard libkern/strlcat.c standard libkern/strlcpy.c standard -libkern/strlen.c standard libkern/strncat.c standard libkern/strncmp.c standard libkern/strncpy.c standard diff --git a/sys/conf/files.arm b/sys/conf/files.arm index eb3a23b5fc21..69986585bdf6 100644 --- a/sys/conf/files.arm +++ b/sys/conf/files.arm @@ -127,6 +127,7 @@ libkern/lshrdi3.c standard libkern/memcmp.c standard libkern/moddi3.c standard libkern/qdivrem.c standard +libkern/strlen.c standard libkern/ucmpdi2.c standard libkern/udivdi3.c standard libkern/umoddi3.c standard diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index b5192e47a738..de759a9f7c83 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -219,6 +219,7 @@ libkern/memcmp.c standard libkern/memset.c standard libkern/moddi3.c standard libkern/qdivrem.c standard +libkern/strlen.c standard libkern/ucmpdi2.c standard libkern/udivdi3.c standard libkern/umoddi3.c standard diff --git a/sys/conf/files.mips b/sys/conf/files.mips index c18f0a5c69be..7ee5b0019bd7 100644 --- a/sys/conf/files.mips +++ b/sys/conf/files.mips @@ -66,6 +66,7 @@ libkern/ucmpdi2.c optional mips | mipshf | mipsel | mipselhf libkern/ashldi3.c standard libkern/ashrdi3.c standard libkern/memcmp.c standard +libkern/strlen.c standard # cfe support dev/cfe/cfe_api.c optional cfe diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 3022fd6f6e39..347abee153d2 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -129,6 +129,7 @@ libkern/memcmp.c standard libkern/memset.c standard libkern/moddi3.c optional powerpc | powerpcspe libkern/qdivrem.c optional powerpc | powerpcspe +libkern/strlen.c standard libkern/ucmpdi2.c optional powerpc | powerpcspe libkern/udivdi3.c optional powerpc | powerpcspe libkern/umoddi3.c optional powerpc | powerpcspe diff --git a/sys/conf/files.riscv b/sys/conf/files.riscv index 3969528db07e..7ecea016b9a3 100644 --- a/sys/conf/files.riscv +++ b/sys/conf/files.riscv @@ -29,6 +29,7 @@ libkern/flsl.c standard libkern/flsll.c standard libkern/memcmp.c standard libkern/memset.c standard +libkern/strlen.c standard riscv/riscv/autoconf.c standard riscv/riscv/bus_machdep.c standard riscv/riscv/bus_space_asm.S standard From owner-dev-commits-src-all@freebsd.org Sat Apr 10 13:58:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C35895CC549; Sat, 10 Apr 2021 13:58: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 4FHc6L4npBz3MDF; Sat, 10 Apr 2021 13:58:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8785A12997; Sat, 10 Apr 2021 13:58: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 13ADwYRe041202; Sat, 10 Apr 2021 13:58:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13ADwY3a041201; Sat, 10 Apr 2021 13:58:34 GMT (envelope-from git) Date: Sat, 10 Apr 2021 13:58:34 GMT Message-Id: <202104101358.13ADwY3a041201@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: c16fc9eae3ad - stable/13 - amd64: import asm strlen into libc 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c16fc9eae3adca98f6d12ec4f54e043db1f8902b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 13:58:34 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=c16fc9eae3adca98f6d12ec4f54e043db1f8902b commit c16fc9eae3adca98f6d12ec4f54e043db1f8902b Author: Mateusz Guzik AuthorDate: 2021-02-21 21:20:04 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 13:54:12 +0000 amd64: import asm strlen into libc Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D28845 (cherry picked from commit 7f06b217c53c3f5e4ac81eb11125adfb71359ac6) --- lib/libc/amd64/string/Makefile.inc | 1 + lib/libc/amd64/string/strlen.S | 81 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/lib/libc/amd64/string/Makefile.inc b/lib/libc/amd64/string/Makefile.inc index db88ac723539..cb370bc6be1c 100644 --- a/lib/libc/amd64/string/Makefile.inc +++ b/lib/libc/amd64/string/Makefile.inc @@ -8,4 +8,5 @@ MDSRCS+= \ memset.S \ strcat.S \ strcmp.S \ + strlen.S \ stpcpy.S diff --git a/lib/libc/amd64/string/strlen.S b/lib/libc/amd64/string/strlen.S new file mode 100644 index 000000000000..1d2428e3420e --- /dev/null +++ b/lib/libc/amd64/string/strlen.S @@ -0,0 +1,81 @@ +/* + * Written by Mateusz Guzik + * Public domain. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Note: this routine was written with kernel use in mind (read: no simd), + * it is only present in userspace as a temporary measure until something + * better gets imported. + */ + +#define ALIGN_TEXT .p2align 4,0x90 /* 16-byte alignment, nop filled */ + +/* + * strlen(string) + * %rdi + * + * Uses the ((x - 0x01....01) & ~x & 0x80....80) trick. + * + * 0x01....01 is replaced with 0x0 - 0x01....01 so that it can be added + * with leaq. + * + * For a description see either: + * - "Hacker's Delight" by Henry S. Warren, Jr. + * - "Optimizing subroutines in assembly language: An optimization guide for x86 platforms" + * by Agner Fog + * + * The latter contains a 32-bit variant of the same algorithm coded in assembly for i386. + */ +ENTRY(strlen) + movabsq $0xfefefefefefefeff,%r8 + movabsq $0x8080808080808080,%r9 + + movq %rdi,%r10 + movq %rdi,%rcx + testb $7,%dil + jz 2f + + /* + * Handle misaligned reads: align to 8 and fill + * the spurious bytes. + */ + andq $~7,%rdi + movq (%rdi),%r11 + shlq $3,%rcx + movq $-1,%rdx + shlq %cl,%rdx + notq %rdx + orq %rdx,%r11 + + leaq (%r11,%r8),%rcx + notq %r11 + andq %r11,%rcx + andq %r9,%rcx + jnz 3f + + /* + * Main loop. + */ + ALIGN_TEXT +1: + leaq 8(%rdi),%rdi +2: + movq (%rdi),%r11 + leaq (%r11,%r8),%rcx + notq %r11 + andq %r11,%rcx + andq %r9,%rcx + jz 1b +3: + bsfq %rcx,%rcx + shrq $3,%rcx + leaq (%rcx,%rdi),%rax + subq %r10,%rax + ret +END(strlen) + + .section .note.GNU-stack,"",%progbits From owner-dev-commits-src-all@freebsd.org Sat Apr 10 14:01:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44F6B5CC8DD; Sat, 10 Apr 2021 14:01: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 4FHcB31XKwz3My6; Sat, 10 Apr 2021 14:01: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 27B4D12C26; Sat, 10 Apr 2021 14:01: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 13AE1lXv055050; Sat, 10 Apr 2021 14:01:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13AE1l15055049; Sat, 10 Apr 2021 14:01:47 GMT (envelope-from git) Date: Sat, 10 Apr 2021 14:01:47 GMT Message-Id: <202104101401.13AE1l15055049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 8393e034dace - stable/13 - cache: temporarily drop the assert that dvp != vp when adding an entry 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 8393e034dacec0bbafdd470c3cceaecc693357ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 14:01:47 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=8393e034dacec0bbafdd470c3cceaecc693357ea commit 8393e034dacec0bbafdd470c3cceaecc693357ea Author: Mateusz Guzik AuthorDate: 2021-02-27 22:23:23 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 14:00:57 +0000 cache: temporarily drop the assert that dvp != vp when adding an entry Historically it was allowed for any names, but arguably should never be even attempted. Allow it again since there is a release pending and allowing it is bug-compatible with previous behavior. Reported by: otis (cherry picked from commit 1239a722214c245e642733fdea2b1348101598af) --- sys/kern/vfs_cache.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/kern/vfs_cache.c b/sys/kern/vfs_cache.c index b5fa21eea887..8819ef483af5 100644 --- a/sys/kern/vfs_cache.c +++ b/sys/kern/vfs_cache.c @@ -2394,7 +2394,12 @@ cache_enter_time(struct vnode *dvp, struct vnode *vp, struct componentname *cnp, KASSERT(cnp->cn_namelen <= NAME_MAX, ("%s: passed len %ld exceeds NAME_MAX (%d)", __func__, cnp->cn_namelen, NAME_MAX)); +#ifdef notyet + /* + * Not everything doing this is weeded out yet. + */ VNPASS(dvp != vp, dvp); +#endif VNPASS(!VN_IS_DOOMED(dvp), dvp); VNPASS(dvp->v_type != VNON, dvp); if (vp != NULL) { From owner-dev-commits-src-all@freebsd.org Sat Apr 10 14:04:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 83DD15CCCB7; Sat, 10 Apr 2021 14: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 4FHcDw3LHBz3N28; Sat, 10 Apr 2021 14: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 6585F12B32; Sat, 10 Apr 2021 14: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 13AE4Gob055514; Sat, 10 Apr 2021 14:04:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13AE4G9i055513; Sat, 10 Apr 2021 14:04:16 GMT (envelope-from git) Date: Sat, 10 Apr 2021 14:04:16 GMT Message-Id: <202104101404.13AE4G9i055513@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: bae9fd0b3346 - main - Only use -fp-exception-behavior=maytrap on x86, for now MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bae9fd0b33462e9506c3ac3400089c6dbc4aee8f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 14:04:16 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=bae9fd0b33462e9506c3ac3400089c6dbc4aee8f commit bae9fd0b33462e9506c3ac3400089c6dbc4aee8f Author: Dimitry Andric AuthorDate: 2021-04-10 14:02:49 +0000 Commit: Dimitry Andric CommitDate: 2021-04-10 14:02:58 +0000 Only use -fp-exception-behavior=maytrap on x86, for now After 3b00222f156d, it turns out that clang only supports strict floating point semantics for SystemZ and x86 at the moment, while for other architectures it is still experimental. Therefore, only use -fp-exception-behavior=maytrap on x86 for now, otherwise this option results in "error: overriding currently unsupported use of floating point exceptions on this target [-Werror,-Wunsupported-floating-point-opt]" on other architectures. Fixes: 3b00222f156d PR: 254911 MFC after: 1 week --- lib/msun/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/msun/Makefile b/lib/msun/Makefile index 959dbd113ec1..0a486bb5a086 100644 --- a/lib/msun/Makefile +++ b/lib/msun/Makefile @@ -35,7 +35,8 @@ CFLAGS+= -I${.CURDIR}/ld128 CFLAGS+= -I${.CURDIR}/${ARCH_SUBDIR} .include -.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 100000 +.if ${COMPILER_TYPE} == "clang" && ${COMPILER_VERSION} >= 100000 && \ + (${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386") # When using clang with x86_64 CPUs that support AVX, some floating point # transformations may raise exceptions that would not have been raised by the # original code. To avoid this, use the -fp-exception-behavior=maytrap flag, From owner-dev-commits-src-all@freebsd.org Sat Apr 10 14:20:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB6085CD720; Sat, 10 Apr 2021 14:20: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 4FHcbz5lTcz3Nk4; Sat, 10 Apr 2021 14:20: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 B859712D3E; Sat, 10 Apr 2021 14:20: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 13AEKlbw077146; Sat, 10 Apr 2021 14:20:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13AEKlfK077140; Sat, 10 Apr 2021 14:20:47 GMT (envelope-from git) Date: Sat, 10 Apr 2021 14:20:47 GMT Message-Id: <202104101420.13AEKlfK077140@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?B?U3RlZmFuIEXDn2Vy?= Subject: git: 0ca6ce5e976a - stable/13 - [bc] Update to version 4.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0ca6ce5e976a045ab1e81ec3469957a64f15ab12 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 14:20:47 -0000 The branch stable/13 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=0ca6ce5e976a045ab1e81ec3469957a64f15ab12 commit 0ca6ce5e976a045ab1e81ec3469957a64f15ab12 Author: Stefan Eßer AuthorDate: 2021-04-06 08:44:52 +0000 Commit: Stefan Eßer CommitDate: 2021-04-10 14:18:50 +0000 [bc] Update to version 4.0.0 This version fixes an issue (missing pop of top-of-stack value in the "P" command of the dc program). This issue did not affect the bc program, since it does not use dc as an back-end to actually perform the calculations as was the case with the traditional bc and dc programs. The major number has been bumped due to Windows support that has been added to this version. It does not correspond to a major change that might affect FreeBSD. (cherry picked from commit b55a927bc884d7780d65a508572023b0dc2dede9) --- contrib/bc/Makefile.in | 11 +- contrib/bc/NEWS.md | 25 + contrib/bc/README.md | 107 +- contrib/bc/bc.sln | 31 + contrib/bc/bc.vcxproj | 278 +++++ contrib/bc/bc.vcxproj.filters | 182 ++++ contrib/bc/bcl.sln | 31 + contrib/bc/bcl.vcxproj | 161 +++ contrib/bc/bcl.vcxproj.filters | 96 ++ contrib/bc/configure | 1322 ++++++++++++++++++++++- contrib/bc/configure.sh | 2 + contrib/bc/gen/bc_help.txt | 19 +- contrib/bc/gen/dc_help.txt | 17 +- contrib/bc/gen/strgen.c | 56 +- contrib/bc/include/bcl.h | 102 ++ contrib/bc/include/file.h | 34 +- contrib/bc/include/history.h | 3 + contrib/bc/include/num.h | 3 +- contrib/bc/include/status.h | 59 - contrib/bc/include/version.h | 41 + contrib/bc/include/vm.h | 32 +- contrib/bc/karatsuba.py | 10 +- contrib/bc/manpage.sh | 2 +- contrib/bc/manuals/bc.1.md.in | 23 +- contrib/bc/manuals/bc/A.1 | 1901 ++++++++++++++++++--------------- contrib/bc/manuals/bc/A.1.md | 18 +- contrib/bc/manuals/bc/E.1 | 905 +++++++++------- contrib/bc/manuals/bc/E.1.md | 18 +- contrib/bc/manuals/bc/EH.1 | 905 +++++++++------- contrib/bc/manuals/bc/EH.1.md | 18 +- contrib/bc/manuals/bc/EHN.1 | 905 +++++++++------- contrib/bc/manuals/bc/EHN.1.md | 18 +- contrib/bc/manuals/bc/EHNP.1 | 894 +++++++++------- contrib/bc/manuals/bc/EHNP.1.md | 8 +- contrib/bc/manuals/bc/EHP.1 | 894 +++++++++------- contrib/bc/manuals/bc/EHP.1.md | 8 +- contrib/bc/manuals/bc/EN.1 | 905 +++++++++------- contrib/bc/manuals/bc/EN.1.md | 18 +- contrib/bc/manuals/bc/ENP.1 | 894 +++++++++------- contrib/bc/manuals/bc/ENP.1.md | 8 +- contrib/bc/manuals/bc/EP.1 | 894 +++++++++------- contrib/bc/manuals/bc/EP.1.md | 8 +- contrib/bc/manuals/bc/H.1 | 1901 ++++++++++++++++++--------------- contrib/bc/manuals/bc/H.1.md | 18 +- contrib/bc/manuals/bc/HN.1 | 1901 ++++++++++++++++++--------------- contrib/bc/manuals/bc/HN.1.md | 18 +- contrib/bc/manuals/bc/HNP.1 | 1892 +++++++++++++++++--------------- contrib/bc/manuals/bc/HNP.1.md | 8 +- contrib/bc/manuals/bc/HP.1 | 1892 +++++++++++++++++--------------- contrib/bc/manuals/bc/HP.1.md | 8 +- contrib/bc/manuals/bc/N.1 | 1901 ++++++++++++++++++--------------- contrib/bc/manuals/bc/N.1.md | 18 +- contrib/bc/manuals/bc/NP.1 | 1892 +++++++++++++++++--------------- contrib/bc/manuals/bc/NP.1.md | 8 +- contrib/bc/manuals/bc/P.1 | 1892 +++++++++++++++++--------------- contrib/bc/manuals/bc/P.1.md | 8 +- contrib/bc/manuals/bcl.3 | 1751 +++++++++++++++--------------- contrib/bc/manuals/build.md | 121 ++- contrib/bc/manuals/dc.1.md.in | 61 +- contrib/bc/manuals/dc/A.1 | 1386 ++++++++++++++---------- contrib/bc/manuals/dc/A.1.md | 56 +- contrib/bc/manuals/dc/E.1 | 1197 ++++++++++++--------- contrib/bc/manuals/dc/E.1.md | 56 +- contrib/bc/manuals/dc/EH.1 | 1197 ++++++++++++--------- contrib/bc/manuals/dc/EH.1.md | 56 +- contrib/bc/manuals/dc/EHN.1 | 1197 ++++++++++++--------- contrib/bc/manuals/dc/EHN.1.md | 56 +- contrib/bc/manuals/dc/EHNP.1 | 1185 +++++++++++--------- contrib/bc/manuals/dc/EHNP.1.md | 46 +- contrib/bc/manuals/dc/EHP.1 | 1185 +++++++++++--------- contrib/bc/manuals/dc/EHP.1.md | 46 +- contrib/bc/manuals/dc/EN.1 | 1197 ++++++++++++--------- contrib/bc/manuals/dc/EN.1.md | 56 +- contrib/bc/manuals/dc/ENP.1 | 1185 +++++++++++--------- contrib/bc/manuals/dc/ENP.1.md | 46 +- contrib/bc/manuals/dc/EP.1 | 1185 +++++++++++--------- contrib/bc/manuals/dc/EP.1.md | 46 +- contrib/bc/manuals/dc/H.1 | 1386 ++++++++++++++---------- contrib/bc/manuals/dc/H.1.md | 56 +- contrib/bc/manuals/dc/HN.1 | 1386 ++++++++++++++---------- contrib/bc/manuals/dc/HN.1.md | 56 +- contrib/bc/manuals/dc/HNP.1 | 1374 ++++++++++++++---------- contrib/bc/manuals/dc/HNP.1.md | 46 +- contrib/bc/manuals/dc/HP.1 | 1374 ++++++++++++++---------- contrib/bc/manuals/dc/HP.1.md | 46 +- contrib/bc/manuals/dc/N.1 | 1386 ++++++++++++++---------- contrib/bc/manuals/dc/N.1.md | 56 +- contrib/bc/manuals/dc/NP.1 | 1374 ++++++++++++++---------- contrib/bc/manuals/dc/NP.1.md | 46 +- contrib/bc/manuals/dc/P.1 | 1374 ++++++++++++++---------- contrib/bc/manuals/dc/P.1.md | 46 +- contrib/bc/manuals/header_bc.txt | 2 +- contrib/bc/manuals/header_bcl.txt | 2 +- contrib/bc/manuals/header_dc.txt | 2 +- contrib/bc/release.sh | 33 +- contrib/bc/src/args.c | 9 + contrib/bc/src/data.c | 6 + contrib/bc/src/file.c | 71 +- contrib/bc/src/history.c | 63 +- contrib/bc/src/main.c | 6 +- contrib/bc/src/num.c | 29 +- contrib/bc/src/program.c | 36 +- contrib/bc/src/rand.c | 36 +- contrib/bc/src/read.c | 29 +- contrib/bc/src/vm.c | 132 ++- contrib/bc/tests/dc/scripts/easter.sh | 47 + contrib/bc/tests/other.sh | 37 +- usr.bin/gh-bc/Makefile | 2 - 108 files changed, 28963 insertions(+), 20119 deletions(-) diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in index aab7f9b569e5..2b50476a79fe 100644 --- a/contrib/bc/Makefile.in +++ b/contrib/bc/Makefile.in @@ -29,8 +29,6 @@ # .POSIX: -VERSION = 3.3.4 - SRC = %%SRC%% OBJ = %%OBJ%% GCDA = %%GCDA%% @@ -128,6 +126,8 @@ MAIN_EXEC = $(EXEC_PREFIX)$(%%MAIN_EXEC%%)$(EXEC_SUFFIX) EXEC = $(%%EXEC%%) NLSPATH = %%NLSPATH%% +BC_BUILD_TYPE = %%BUILD_TYPE%% + BC_ENABLE_LIBRARY = %%LIBRARY%% BC_ENABLE_HISTORY = %%HISTORY%% @@ -158,7 +158,7 @@ TEST_STARS = "****************************************************************** BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%% CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED) -CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DVERSION=$(VERSION) %%LONG_BIT_DEFINE%% +CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DBUILD_TYPE=$(BC_BUILD_TYPE) %%LONG_BIT_DEFINE%% CPPFLAGS3 = $(CPPFLAGS2) -DEXECPREFIX=$(EXEC_PREFIX) -DMAINEXEC=$(MAIN_EXEC) CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN) @@ -322,9 +322,6 @@ coverage_output: coverage:%%COVERAGE_PREREQS%% -version: - @printf '%s' "$(VERSION)" - libcname: @printf '%s' "$(BC_LIB_C)" @@ -341,6 +338,7 @@ clean_gen: clean:%%CLEAN_PREREQS%% @printf 'Cleaning files...\n' + @$(RM) -f src/*.tmp gen/*.tmp @$(RM) -f $(OBJ) @$(RM) -f $(BC_EXEC) @$(RM) -f $(DC_EXEC) @@ -352,6 +350,7 @@ clean:%%CLEAN_PREREQS%% @$(RM) -f $(DC_HELP_C) $(DC_HELP_O) @$(RM) -fr $(BC_TEST_OUTPUTS) $(DC_TEST_OUTPUTS) @$(RM) -fr $(BC_FUZZ_OUTPUTS) $(DC_FUZZ_OUTPUTS) + @$(RM) -fr Debug/ Release/ clean_config: clean @printf 'Cleaning config...\n' diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index 3374ab57bc41..011cb9138912 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,5 +1,30 @@ # News +## 4.0.0 + +This is a production release with many fixes, a new command-line option, and a +big surprise: + +* A bug was fixed in `dc`'s `P` command where the item on the stack was *not* + popped. +* Various bugs in the manuals have been fixed. +* A known bug was fixed where history did not interact well with prompts printed + by user code without newlines. +* A new command-line option, `-R` and `--no-read-prompt` was added to disable + just the prompt when using `read()` (`bc`) or `?` (`dc`). +* And finally, **official support for Windows was added**. + +The last item is why this is a major version bump. + +Currently, only one set of build options (extra math and prompt enabled, history +and NLS/locale support disabled, both calculators enabled) is supported on +Windows. However, both debug and release builds are supported. + +In addition, Windows builds are supported for the the library (`bcl`). + +For more details about how to build on Windows, see the [README][5] or the +[build manual][13]. + ## 3.3.4 This is a production release that fixes a small bug. diff --git a/contrib/bc/README.md b/contrib/bc/README.md index 6a37a8bfb8da..852c8956a73d 100644 --- a/contrib/bc/README.md +++ b/contrib/bc/README.md @@ -24,13 +24,16 @@ This `bc` is Free and Open Source Software (FOSS). It is offered under the BSD ## Prerequisites -This `bc` only requires a C99-compatible compiler and a (mostly) POSIX -2008-compatible system with the XSI (X/Open System Interfaces) option group. +This `bc` only requires either: + +1. Windows 10 or later, or +2. A C99-compatible compiler and a (mostly) POSIX 2008-compatible system with + the XSI (X/Open System Interfaces) option group. Since POSIX 2008 with XSI requires the existence of a C99 compiler as `c99`, any POSIX and XSI-compatible system will have everything needed. -Systems that are known to work: +POSIX-compatible systems that are known to work: * Linux * FreeBSD @@ -41,17 +44,68 @@ Systems that are known to work: * AIX * HP-UX* (except for history) +In addition, there is compatibility code to make this `bc` work on Windows. + Please submit bug reports if this `bc` does not build out of the box on any -system besides Windows. +system. ## Build -This `bc` should build unmodified on any POSIX-compliant system. +### Windows + +There is no guarantee that this `bc` will work on any version of Windows earlier +than Windows 10 (I cannot test on earlier versions), but it is guaranteed to +work on Windows 10 at least. + +Also, if building with MSBuild, the MSBuild bundled with Visual Studio is +required. + +**Note**: Unlike the POSIX-compatible platforms, only one build configuration is +supported on Windows: extra math and prompt enabled, history and NLS (locale +support) disabled, with both calculators built. + +#### `bc` + +To build `bc`, you can open the `bc.sln` file in Visual Studio, select the +configuration, and build. + +You can also build using MSBuild with the following from the root directory: + +``` +msbuild -property:Configuration= bc.sln +``` + +where `` is either one of `Debug` or `Release`. + +#### `bcl` (Library) + +To build the library, you can open the `bcl.sln` file in Visual Studio, select +the configuration, and build. + +You can also build using MSBuild with the following from the root directory: + +``` +msbuild -property:Configuration= bcl.sln +``` + +where `` is either one of `Debug` or `Release`. + +### POSIX-Compatible Systems + +This `bc` should build unmodified on any POSIX-compliant system or on Windows +starting with Windows 10 (though earlier versions may work). For more complex build requirements than the ones below, see the [build manual][5]. -### Default +On POSIX-compatible systems, `bc` is built as `bin/bc` and `dc` is built as +`bin/dc` by default. On Windows, they are built as `Release/bc/bc.exe` and +`Release/bc/dc.exe`. + +**Note**: On Windows, `dc.exe` is just copied from `bc.exe`; it is not linked. +Patches are welcome for a way to do that. + +#### Default For the default build with optimization, use the following commands in the root directory: @@ -61,7 +115,7 @@ directory: make ``` -### One Calculator +#### One Calculator To only build `bc`, use the following commands: @@ -77,7 +131,7 @@ To only build `dc`, use the following commands: make ``` -### Debug +#### Debug For debug builds, use the following commands in the root directory: @@ -86,7 +140,7 @@ For debug builds, use the following commands in the root directory: make ``` -### Install +#### Install To install, use the following command: @@ -99,7 +153,7 @@ other locations, use the `PREFIX` environment variable when running `configure.sh` or pass the `--prefix=` option to `configure.sh`. See the [build manual][5], or run `./configure.sh --help`, for more details. -### Library +#### Library This `bc` does provide a way to build a math library with C bindings. This is done by the `-a` or `--library` options to `configure.sh`: @@ -114,11 +168,12 @@ see the [build manual][5]. The library API can be found in [`manuals/bcl.3.md`][26] or `man bcl` once the library is installed. -The library is built as `bin/libbcl.a`. +The library is built as `bin/libbcl.a` on POSIX-compatible systems or as +`Release/bcl/bcl.lib` on Windows. -### Package and Distro Maintainers +#### Package and Distro Maintainers -#### Recommended Compiler +##### Recommended Compiler When I ran benchmarks with my `bc` compiled under `clang`, it performed much better than when compiled under `gcc`. I recommend compiling this `bc` with @@ -127,7 +182,7 @@ better than when compiled under `gcc`. I recommend compiling this `bc` with I also recommend building this `bc` with C11 if you can because `bc` will detect a C11 compiler and add `_Noreturn` to any relevant function(s). -#### Recommended Optimizations +##### Recommended Optimizations I wrote this `bc` with Separation of Concerns, which means that there are many small functions that could be inlined. However, they are often called across @@ -154,12 +209,12 @@ However, I recommend ***NOT*** using `-march=native`. Doing so will reduce this `bc`'s performance, at least when building with link-time optimization. See the [benchmarks][19] for more details. -#### Stripping Binaries +##### Stripping Binaries By default, non-debug binaries are stripped, but stripping can be disabled with the `-T` option to `configure.sh`. -#### Using This `bc` as an Alternative +##### Using This `bc` as an Alternative If this `bc` is packaged as an alternative to an already existing `bc` package, it is possible to rename it in the build to prevent name collision. To prepend @@ -181,7 +236,7 @@ allowed. **Note**: The suggested name (and package name) when `bc` is not available is `bc-gh`. -#### Karatsuba Number +##### Karatsuba Number Package and distro maintainers have one tool at their disposal to build this `bc` in the optimal configuration: `karatsuba.py`. @@ -217,6 +272,7 @@ translations will also be added as they are provided. This `bc` compares favorably to GNU `bc`. +* This `bc` builds natively on Windows. * It has more extensions, which make this `bc` more useful for scripting. * This `bc` is a bit more POSIX compliant. * It has a much less buggy parser. The GNU `bc` will give parse errors for what @@ -246,7 +302,9 @@ To see what algorithms this `bc` uses, see the [algorithms manual][7]. ## Locales -Currently, this `bc` only has support for English (and US English), French, +Currently, there is no locale support on Windows. + +Additionally, this `bc` only has support for English (and US English), French, German, Portuguese, Dutch, Polish, Russian, Japanese, and Chinese locales. Patches are welcome for translations; use the existing `*.msg` files in `locales/` as a starting point. @@ -276,7 +334,8 @@ Other projects based on this bc are: ## Language -This `bc` is written in pure ISO C99, using POSIX 2008 APIs. +This `bc` is written in pure ISO C99, using POSIX 2008 APIs with custom Windows +compatibility code. ## Commit Messages @@ -294,6 +353,13 @@ tarballs. Files: .gitignore The git ignore file (maintainer use only). + .gitattributes The git attributes file (maintainer use only). + bc.sln The Visual Studio solution file for bc. + bc.vcxproj The Visual Studio project file for bc. + bc.vcxproj.filters The Visual Studio filters file for bc. + bcl.sln The Visual Studio solution file for bcl. + bcl.vcxproj The Visual Studio project file for bcl. + bcl.vcxproj.filters The Visual Studio filters file for bcl. configure A symlink to configure.sh to make packaging easier. configure.sh The configure script. functions.sh A script with functions used by other scripts. @@ -304,7 +370,8 @@ Files: locale_install.sh A script to install locales, if desired. locale_uninstall.sh A script to uninstall locales. Makefile.in The Makefile template. - manpage.sh Script to generate man pages from markdown files. + manpage.sh Script to generate man pages from markdown files + (maintainer use only). NOTICE.md List of contributors and copyright owners. RELEASE.md A checklist for making a release (maintainer use only). release.sh A script to test for release (maintainer use only). diff --git a/contrib/bc/bc.sln b/contrib/bc/bc.sln new file mode 100644 index 000000000000..584b28d13bf6 --- /dev/null +++ b/contrib/bc/bc.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31129.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bc", "bc.vcxproj", "{D5086CFE-052C-4742-B005-E05DB983BBA2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x64.ActiveCfg = Debug|x64 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x64.Build.0 = Debug|x64 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x86.ActiveCfg = Debug|Win32 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x86.Build.0 = Debug|Win32 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x64.ActiveCfg = Release|x64 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x64.Build.0 = Release|x64 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x86.ActiveCfg = Release|Win32 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7869B1FB-A7C4-4FCF-8B99-F696DB2765EC} + EndGlobalSection +EndGlobal diff --git a/contrib/bc/bc.vcxproj b/contrib/bc/bc.vcxproj new file mode 100644 index 000000000000..ba0a7f6f1dd6 --- /dev/null +++ b/contrib/bc/bc.vcxproj @@ -0,0 +1,278 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + {D5086CFE-052C-4742-B005-E05DB983BBA2} + Win32Proj + + + + Application + true + v142 + + + Application + false + v142 + + + Application + true + v142 + + + Application + false + v142 + + + + + + + + + + + + + + + + + + + + + Building strgen + CL /Fo:$(Configuration)\$(ProjectName)\ /Fe:$(Configuration)\$(ProjectName)\strgen.exe gen\strgen.c + gen\strgen.c + $(Configuration)\$(ProjectName)\strgen.exe + + + Generating $(Configuration)\$(ProjectName)/lib.c + START $(Configuration)\$(ProjectName)/strgen gen\lib.bc $(Configuration)\$(ProjectName)/lib.c bc_lib bc_lib_name BC_ENABLED 1 + $(Configuration)\$(ProjectName)\strgen.exe;gen\lib.bc + $(Configuration)\$(ProjectName)\lib.c + + + Generating $(Configuration)\$(ProjectName)/lib2.c + START $(Configuration)\$(ProjectName)/strgen gen\lib2.bc $(Configuration)\$(ProjectName)/lib2.c bc_lib2 bc_lib2_name BC_ENABLED 1 + $(Configuration)\$(ProjectName)\strgen.exe;gen\lib2.bc + $(Configuration)\$(ProjectName)\lib2.c + + + Generating $(Configuration)\$(ProjectName)/bc_help.c + START $(Configuration)\$(ProjectName)/strgen gen\bc_help.txt $(Configuration)\$(ProjectName)\bc_help.c bc_help "" BC_ENABLED + $(Configuration)\$(ProjectName)\strgen.exe;gen\bc_help.txt + $(Configuration)\$(ProjectName)\bc_help.c + + + Generating $(Configuration)\$(ProjectName)/dc_help.c + START $(Configuration)\$(ProjectName)/strgen gen\dc_help.txt $(Configuration)\$(ProjectName)\dc_help.c dc_help "" DC_ENABLED + $(Configuration)\$(ProjectName)\strgen.exe;gen\dc_help.txt + $(Configuration)\$(ProjectName)\dc_help.c + + + + ClCompile + + + + true + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + + + true + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + false + /W3 %(AdditionalOptions) + + + MachineX86 + true + Console + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies) + + + copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe" + + + Copying bc to dc... + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + MaxSpeed + false + /W3 %(AdditionalOptions) + + + MachineX86 + false + Console + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies) + true + true + + + copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe" + + + Copying bc to dc... + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + false + /W3 %(AdditionalOptions) + + + MachineX64 + true + Console + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies) + + + copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe" + + + Copying bc to dc... + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + MaxSpeed + false + /W3 %(AdditionalOptions) + Default + + + MachineX64 + false + Console + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies) + + + copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe" + + + Copying bc to dc... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/contrib/bc/bc.vcxproj.filters b/contrib/bc/bc.vcxproj.filters new file mode 100644 index 000000000000..bc72b60519e9 --- /dev/null +++ b/contrib/bc/bc.vcxproj.filters @@ -0,0 +1,182 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + + + + + + + + + + + Resource Files + + + Resource Files + + + + + Resource Files + + + Resource Files + + + \ No newline at end of file diff --git a/contrib/bc/bcl.sln b/contrib/bc/bcl.sln new file mode 100644 index 000000000000..77009a439db3 --- /dev/null +++ b/contrib/bc/bcl.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31129.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bcl", "bcl.vcxproj", "{D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution *** 66043 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Apr 10 14:23:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 561CB5CD7F8; Sat, 10 Apr 2021 14:23:28 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay103.isp.belgacom.be (mailrelay103.isp.belgacom.be [195.238.20.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign RSA OV SSL CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FHcg34j7Bz3PH1; Sat, 10 Apr 2021 14:23:27 +0000 (UTC) (envelope-from tijl@freebsd.org) IronPort-SDR: TsG7+/7dCWQ6PdPVNLOOZ+9pd2uz/xo1jxvfbeTsCHcGmB5zTWHrGRsoER8taE6swUnCw+QYOh X65PN/Rjh+pXURi7GMVyr0x/P4p3iX+ywuvX5qBQ6xDOUWiVDku2nUoUHGrHf/nH0qi1VhY0iP 8KKHufqKp9axYqYCv1iCddEkQSZ1Jqnd/1abjsxFXTNYGipzROop91yzeHlmGHeXaO5WhIS8gT 6hmkIr2VB9jjHhUN6shiSyk5k8sThgWWaffJAh3YzPYsiaIuWLlJ59LjvODDRp95vWfnLCLKs+ TwA= X-IPAS-Result: =?us-ascii?q?A2A4AAAVtHFg/wSs8lFaGwEBAQEBAQEBBQEBARIBAQEDA?= =?us-ascii?q?wEBAUAJgTgDAQEBCwGDIVYBUBqNRoY4ghsDOQGcKwsBAQEBAQEBAQEzCgQBA?= =?us-ascii?q?YRQAoF4JjcGDgIDAQEBAwIDAQEBAQEGAQEBAQEBBQQBgQOFFzkNgjgig2sBB?= =?us-ascii?q?To/EAsYLlcGE4JygwsLrB2BNIEBgz8BgRiDZoEDBoE5AYZuhl5DgguENT6BU?= =?us-ascii?q?XgXBBiBDYYOIgSCR4EOLIFZKQIPAZ4pnQKCQ1KJY5MKMpQjkE6GR4k0kQSZU?= =?us-ascii?q?oF9TTAIgyRQGQ6OVohNhUc/Ay8LLQIGCgEBAwmKTIJFAQE?= IronPort-PHdr: A9a23:L6L/rBJXVcyCeEg+atmcuF1hWUAX047cDksu8pMizoh2WeGdxfzKA kXT6L1XgUPTWs2DsrQY0ruQ6vC6EjVZv96oizMrSNR0TRgLiMEbzUQLIfWuLgnFFsPsdDEwB 89YVVVorDmROElRH9viNRWJ+iXhpTEdFQ/iOgVrO+/7BpDdj9it1+C15pbffxhEiCCybL9vK Bi6txjdu8oIjYdtN6o91xrEqWZUdupLwm9lOUidlAvm6Meq+55j/SVQu/Y/+MNFTK73Yac2Q 6FGATo/K2w669HluhfFTQuU+3sTSX4WnQZSAwjE9x71QJH8uTbnu+Vn2SmaOcr2Ta0oWTmn8 qxmRgPkhDsBOjUk9mzcl85+g79BoB+5qRJxw5DabpyWOvV8cKPScs8VS2VaU8ZNVSFMGJ+wY 5cTA+YfO+tTsonzp0EJrRu7HQSiGubtyjtVjXLo2q061P8hHh/D3AM6GdIOq2nfodLpNKcTU +C1yLLFwzXZb/xIxzjw9ZXGfB47rfGLR7JwftPcxE8yHAzKklues5bqPy+J1usTqWib6fJtW PyrhmM6pQx8piSiy8Qih4TVmI4Y1FPJ+DhnzIsxIdC1SVN2bMO6HZVeuCyXOY97TMw/Tm10t yg3y6ALtJ+1ciUM1Z8pyRnfa/mdfIiJ5BLuTOiRIS1mi317Y72/nAu9/VKnyu3mWcm51ktBo CldktTUtX0Bygbf5taIR/dj5EutxDSC2x7J5uxLJ00/iLDVJIQ7wrEqk5oeqUHDHijrl0rol KKWbUAk+vSw6+Tgf7XmuoeQN49qhQH6NaQjgs+/Dv48MggPWmiU5/681Lr58U3lQbVKjPk2n rPFv5DdIsQbvbC2AwpP3YYl8BazFTCm0M4XnXUfLVJFfgyIj5TxNlzNPfz0F+mzjluynDtx2 vzLPKPtDo/CI3TblbfuZ7d960pSyAopytBf4opZCq0AIPLxXk/8r9LYDgUnPAOq2OnnE8hy2 pkZWWKVDa+VKLnSvkOQ5uIzP+mMY5cYtyvjJPg7/vLhkXg5mVoYfamowZsXc2m0Hu98I0qFe Hbsh80OEWYMvgclQuzqkkONXiBIaHapQq0w/DY7CJipDY3bXICinKSB3DunHp1Rfm1JF06DE Wnxe4qYXPcMbSeSIs59kjwfTLShUJUh2g23uADgz7pnKvHZ+iMCtZ39ytd6/PbTmgwo+TxzF cSd3HmHT3tokWMQWz82wKd/rFRmyleZzad0muBXFdtW5/NMUwc6KYLcwPJgC9DpQQ/BcM2JR 0i4Tdq9GjE+U8g9w9gUY0ZyA9+ilAzM3zK2A78JkLyGHIA08rjG0HjqJsdw0HjG1LM/gFY4W cRPLnCpirR49wjJCI6a23mewoumaq0G0Gbx82KK1njGmkhAUQNqWKHMFSQDfELNv/zX/E7PZ YSCT7M9PV0S59SFL/52jdmhplJBX/rmMdLFKzatmmW0LTiSy76mV6asfH8SinaOQHMYmhweq C7VfTM1AT2s9jq2MQ== IronPort-HdrOrdr: A9a23:esr0TKEd3NiiHyJ+pLqF+ZHXdLJzesId70hD6mlaTxtJfsuE0/ 2/hfhz726ItB89elEF3eqBNq6JXG/G+fdOirU5EL++UGDd2VeAA41v4IDryT+lOwCWzJ866Y 5OaK57YeedMXFejdzmpCmUeuxQueWv1aCzmKPjyG1wRhthcKFq425Ce32mO2h3XhQDOZ0iCJ GH7NFGrDblQHIMc62AdwM4dszig/GOq578ex4BAHccmXWzpBel8qTzHRTd/jp2aVNy6Iwv+2 TEjAD1j5/L25uG4yTRzmrCq6lR8eGP9vJ4GMeOhsIJQw+Ati+UYu1aNYGqjXQcquuo9FE2jc nUr34bTrxOwkKUVGmwuBPs1Q6I6kdN11bSjXuzxUf4rdeRfkNcN+NxwaZQch7U8CMbzbJB+Z MO5G6BsYFLSTvKgD7wjuK4My1Cpw6/qX46me4ciHxTOLFuDYNskQ== X-IronPort-Anti-Spam-Filtered: true Received: from 4.172-242-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.242.172.4]) by relay.proximus.be with ESMTP; 10 Apr 2021 16:23:25 +0200 Received: from localhost (localhost [127.0.0.1]) by kalimero.tijl.coosemans.org (8.16.1/8.16.1) with ESMTP id 13AENO99001490; Sat, 10 Apr 2021 16:23:24 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Date: Sat, 10 Apr 2021 16:23:24 +0200 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Edward Tomasz Napierala Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 44f3b1aa980e - main - rc: kldxref only needs to depend on rootfs, not FILESYSTEMS Message-ID: <20210410162324.343d3624@FreeBSD.org> In-Reply-To: <202104100832.13A8WiAg015126@gitrepo.freebsd.org> References: <202104100832.13A8WiAg015126@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4FHcg34j7Bz3PH1 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 14:23:28 -0000 On Sat, 10 Apr 2021 08:32:44 GMT Edward Tomasz Napierala wrote: > The branch main has been updated by trasz: > > URL: https://cgit.FreeBSD.org/src/commit/?id=44f3b1aa980e747ce9b72ba4333c80a99d8cd966 > > commit 44f3b1aa980e747ce9b72ba4333c80a99d8cd966 > Author: Edward Tomasz Napierala > AuthorDate: 2021-04-10 08:19:25 +0000 > Commit: Edward Tomasz Napierala > CommitDate: 2021-04-10 08:31:12 +0000 > > rc: kldxref only needs to depend on rootfs, not FILESYSTEMS > > This makes it run a bit earlier in the startup, which will > be useful for the linux rc script later on. > > Reviewed By: imp (earlier version) > Sponsored By: EPSRC > Differential Revision: https://reviews.freebsd.org/D29589 > --- > libexec/rc/rc.d/kldxref | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libexec/rc/rc.d/kldxref b/libexec/rc/rc.d/kldxref > index 4d232ee0d4cf..4c1fa15f2a35 100755 > --- a/libexec/rc/rc.d/kldxref > +++ b/libexec/rc/rc.d/kldxref > @@ -4,7 +4,7 @@ > # > > # PROVIDE: kldxref > -# REQUIRE: FILESYSTEMS > +# REQUIRE: root > # BEFORE: netif > # KEYWORD: nojail > kldxref is in /usr which may be a separate file system so this requires at least mountcritlocal. From owner-dev-commits-src-all@freebsd.org Sat Apr 10 14:25:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E2E25CD95D; Sat, 10 Apr 2021 14:25:21 +0000 (UTC) (envelope-from tijl@freebsd.org) Received: from mailrelay109.isp.belgacom.be (mailrelay109.isp.belgacom.be [195.238.20.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay.skynet.be", Issuer "GlobalSign RSA OV SSL CA 2018" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FHcjD5Pp5z3PNQ; Sat, 10 Apr 2021 14:25:20 +0000 (UTC) (envelope-from tijl@freebsd.org) IronPort-SDR: DKQ38tHSTxSLcJCIC+8wTxB9wssQiiMUHHIXvgbJM0WkSnCJsl92Cis0s+5Fok9wQxnDY110hm LbuiwbW0XGL4ea/0L5/auXImzTSbonKopmKr6xmyWkqvs8rLP5lNBTaMHGv2Ylo2XE4R8XdMpi dA+njS/Oxxxe+2H5b6/ph+MNAMXe/DMz7dv/0F1vkb15+WJC/4Md8mRqVH6yYhYqeBf44JmjLA 5UIV2007oVjVZKF4YBJ4hOWtdPRZL8PilbudvQRzHfQeXRWUKj+P2r892etC0KfIyQ3kehs0Jm ePk= X-IPAS-Result: =?us-ascii?q?A2AEAAAVtHFg/wSs8lFaGgEBAQEBAQEBAQEDAQEBARIBA?= =?us-ascii?q?QEBAgIBAQEBQAmBNQUBAQEBCwGDIVYBUBqMZmCGOIIeOQGaL4F8CwEBAQEBA?= =?us-ascii?q?QEBATMKBAEBhFACgXgmNAkOAgMBAQEDAgMBAQEBAQYBAQEBAQEFBAGBA4UXO?= =?us-ascii?q?Q2COCKDawEFOj8QCw4KLlcGE4JygwsLrB2BNIEBgz8BgRiDZoEDBoE5AY1MQ?= =?us-ascii?q?4ILgRODIj6BUXgXBBiHPQSCR4EOLIEbeAEXnhKdAoJDUoljkwoylCOQToZHm?= =?us-ascii?q?jiZPIITTTAIgyRQGQ6XI4VHPwMvCy0CBgoBAQMJjREBAQ?= IronPort-PHdr: A9a23:iim61xFUefTFmZLEhaMFzJ1Gfw5LhN3EVjU92t8ck7tLN56b1NHcB iT32/xhgRfzUJnB7Loc0qyK6vGmADxaqs/Y7jgrS99lb1c9k8IYnggtUoauKHbQC7rUVRE8B 9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUhrwOhBoKevrB4Xck9q41/yo+53Ufg5EmCexbal9I RmrqQjdrNQajIh8Jqo+1xfFv3pFcPlKyG11Il6egwzy7dqq8p559CRQtfMh98peXqj/Yq81U 79WAik4Pm4s/MHkugXNQgWJ5nsHT2UZiQFIDBTf7BH7RZj+rC33vfdg1SaAPM32Sbc0WSm+7 6puVRTlhjsLOyI//WrKjMF7kaBVrw+7pxFnzYDaYJ+bOud9cKzfc9MVSnZOUMlKWixdAI6xd ZcDA/YdMepGqYT2ulsArQG5BQmpHO7h1DpKhnvr1qAk1OQhFhrG0xIlH90UtnTUt8j+OaAOU eC0zqnIyS7OYfNM2Tjj9ofFbw0vr/+WUbJ3a8rRxlAiGgXYhVqftYLrJSma1vgRs2eF9epgU /qihnAjpgxsrDWiwtshh4rHi48J1FzJ6yZ0zZsrKdC8TEN2YMOpHYZOui+UOIZ7TMcvTW51t SomxbMLuIO2cSkExpkh2hXRZfuHc42S7RLiUuacOTl4hGh7d72hnBmy6lWvxvf7Vsmu31ZHq DdOnNrUtn0V1BHf99KLRuVy80u/wzqDygLe5v9eLU07k6fQNoQvzaQqlpUJtETOBir2mELrg 6CIbkgk4e2o6/j/YrXhu5+cK5d4igHgPaQqncyyGec4PRIKX2ia/OSzyqfj/UrjTLVWj/02k K3ZvIrGKsQcoa65GBFa0oM55Ba5FDeqytMYnWMILF5deRKHiZbmO03WLf37EPuzmUqgnTh1y /zcI7HsAIvBImLMnbv5eLZy8U9cyA49zdBF4JJUD6kMIO7yWk/zsNzVFRE5MxaqzOn5E9p9z Z4RVXiIAq+DP6PeqUWI6f43I+mQeI8Vvy7wJOU76P7wlHM2hVgdfays3ZsWdHC4Be1qI16DY XXwm9sBFH0Fvgs4TOHxhl2CSyBcaGipUKIn+z43EoWmDZ3MRoq1mryOwD+7HoFKZmBBEl2DD Gnnd5udV/gQbyKSJ8phkj0YVbi6UoMhzguuuxPjx7V9KurU/jYVtZz51Ndr+eLcjgoy+iFuA 8SayWGNQHl+nnkUSD8uwKB/vUt9x0+Y0ahin/NUDMBc5/RMUgc/NJ7c0/B6BM7oWgLaZdqJR kymTcu4Dj4qVdI+3sUCY0FnG9WtlhrDxTalA6cJl7yXA5w56qfc0GL3J8Zg0HvG2rMhgEc4T cRULm2pm7Rz9w/JB47GwA2lkPOHcKEV2jPA8C+9xGaJoAkMVQd2TI3rR30STHD669Pj6RWRY aWpDOEb1Q8J4smFMaZPY9vyxQFaRfXnEPrEbm+boEv2AgyHkODfJLH2cnkQiX2OQHMPlBoeq C7uCA== IronPort-HdrOrdr: A9a23:leL4a6tLQefq3VMHTg0D1WvW7skCVIMji2hD6mlwRA09T+Wzkc eykPMHkSLugDEKV3063fyGMq+MQXTTnKQFnLU5F7GkQQXgpS+UPJhvhLGSuQHINg/f0qpm1a lme7VjE9GYNzNHpOvz/QXQKadd/PCp/Kykju/VzTNMYGhRGsRdxihjDALzKDwReCBiBYAlUL qwj/A3xQaIXHQMc4CGAWMYVPLIvN3BmPvdASIuIh489U2ziim146TxCBiS0lMmVSlTqI1Skl TttyzcyuGdv+qgyhnavlWjiKh+vNf60NNMCIitp6EuRQnEsQqjaIR/V7Dqhllcyt2H0kogk9 XHvn4bTrxOwk7WF1vF2CfF6k3J2yo15zvYxUafmmb45fH+LQhWN+NxwapEbx2c0EY7pdd6yq 4O5X6BroFaFwmopkrAzumNfStD0kCzpWMmme4VkmY3a+cjQY4Uh4Qa5UtUHpAhMUvBibwPIa 1VDM/a7PNtaFufK1r4kwBUsbiRd0V2BQ6NSkwassya1FFt7QtE83c= X-IronPort-Anti-Spam-Filtered: true Received: from 4.172-242-81.adsl-dyn.isp.belgacom.be (HELO kalimero.tijl.coosemans.org) ([81.242.172.4]) by relay.proximus.be with ESMTP; 10 Apr 2021 16:25:18 +0200 Received: from localhost (localhost [127.0.0.1]) by kalimero.tijl.coosemans.org (8.16.1/8.16.1) with ESMTP id 13AEPIB2001508; Sat, 10 Apr 2021 16:25:18 +0200 (CEST) (envelope-from tijl@FreeBSD.org) Date: Sat, 10 Apr 2021 16:25:17 +0200 From: =?UTF-8?B?VMSzbA==?= Coosemans To: Emmanuel Vadot Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 8c3eaf244a41 - main - pkgbase: Install all BSM includes with INCS Message-ID: <20210410162517.56e112f9@FreeBSD.org> In-Reply-To: <202103160613.12G6DJlN061954@gitrepo.freebsd.org> References: <202103160613.12G6DJlN061954@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4FHcjD5Pp5z3PNQ 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:5432, ipnet:195.238.0.0/19, country:BE] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 14:25:21 -0000 On Tue, 16 Mar 2021 06:13:19 GMT Emmanuel Vadot wrote: > The branch main has been updated by manu: > > URL: https://cgit.FreeBSD.org/src/commit/?id=8c3eaf244a417a4ee105834410a52144206102e5 > > commit 8c3eaf244a417a4ee105834410a52144206102e5 > Author: Emmanuel Vadot > AuthorDate: 2021-03-16 06:12:46 +0000 > Commit: Emmanuel Vadot > CommitDate: 2021-03-16 06:12:46 +0000 > > pkgbase: Install all BSM includes with INCS > > Now they are correctly taggued and put them into the libbsm package > > Reviewed by: bapt > Differential Revision: https://reviews.freebsd.org/D29165 > MFC after: 2 weeks > --- > include/Makefile | 27 +++++++++++++++++++++++++-- > 1 file changed, 25 insertions(+), 2 deletions(-) > > diff --git a/include/Makefile b/include/Makefile > index 8ddfd7015918..cf760359d2f5 100644 > --- a/include/Makefile > +++ b/include/Makefile > @@ -38,7 +38,7 @@ PHDRS= sched.h _semaphore.h > LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ > syslog.h ucontext.h > > -LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \ > +LDIRS= cam geom net net80211 netgraph netinet netinet6 \ > netipsec netsmb nfs nfsclient nfsserver sys vm > > LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ > @@ -58,7 +58,6 @@ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ > netinet/cc \ > netinet/netdump \ > netinet/tcp_stacks \ > - security/audit \ > security/mac_biba security/mac_bsdextended security/mac_lomac \ > security/mac_mls security/mac_partition \ > security/mac_veriexec \ > @@ -76,6 +75,25 @@ ACPICADIR= ${INCLUDEDIR}/dev/acpica > AGP= agpreg.h > AGPDIR= ${INCLUDEDIR}/dev/agp > > +.PATH: ${SRCTOP}/sys/bsm > +BSM= audit.h \ > + audit_errno.h \ > + audit_internal.h \ > + audit_record.h \ > + audit_domain.h \ > + audit_fcntl.h \ > + audit_kevents.h \ > + audit_socket_type.h > +BSMPACKAGE= libbsm > +BSMDIR= ${INCLUDEDIR}/bsm > + > +.PATH: ${SRCTOP}/sys/security/audit > +SECAUDIT= audit.h \ > + audit_ioctl.h \ > + audit_private.h > +SECAUDITPACKAGE= libbsm > +SECAUDITDIR= ${INCLUDEDIR}/security/audit > + > .PATH: ${SRCTOP}/sys/fs/cd9660 > FS9660= cd9660_mount.h \ > cd9660_node.h \ > @@ -175,6 +193,11 @@ INCSGROUPS= INCS \ > VERIEXEC \ > WG > > +.if ${MK_AUDIT} != "no" > +INCSGROUPS+= BSM > +INCSGROUPS+= SECAUDIT > +.endif > + > .if ${MK_IPFILTER} != "no" > INCSGROUPS+= IPFILTER > .endif This breaks builds with WITHOUT_AUDIT because sys/ucred.h includes bsm/audit.h. It looks like bsm headers need to be installed unconditionally for now. From owner-dev-commits-src-all@freebsd.org Sat Apr 10 14:35:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42FF95CE281; Sat, 10 Apr 2021 14:35: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 4FHcwp1K8Mz3PQx; Sat, 10 Apr 2021 14:35: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 158F713223; Sat, 10 Apr 2021 14:35: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 13AEZM3F095219; Sat, 10 Apr 2021 14:35:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13AEZMVV095218; Sat, 10 Apr 2021 14:35:22 GMT (envelope-from git) Date: Sat, 10 Apr 2021 14:35:22 GMT Message-Id: <202104101435.13AEZMVV095218@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: 4d7f08c84bcf - main - rtld: unstaticise lockinfo and obj_from_addr() 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: 4d7f08c84bcfcd75ba23b06e07a8e5dba1d4a44f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 14:35:22 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4d7f08c84bcfcd75ba23b06e07a8e5dba1d4a44f commit 4d7f08c84bcfcd75ba23b06e07a8e5dba1d4a44f Author: Konstantin Belousov AuthorDate: 2021-04-10 12:30:59 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-10 14:33:33 +0000 rtld: unstaticise lockinfo and obj_from_addr() Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29633 --- libexec/rtld-elf/rtld.c | 3 +-- libexec/rtld-elf/rtld.h | 1 + libexec/rtld-elf/rtld_lock.c | 2 +- libexec/rtld-elf/rtld_lock.h | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 29ab4e93d4da..1ff9ecefa2c1 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -124,7 +124,6 @@ static Obj_Entry *load_object(const char *, int fd, const Obj_Entry *, int); static void map_stacks_exec(RtldLockState *); static int obj_disable_relro(Obj_Entry *); static int obj_enforce_relro(Obj_Entry *); -static Obj_Entry *obj_from_addr(const void *); static void objlist_call_fini(Objlist *, Obj_Entry *, RtldLockState *); static void objlist_call_init(Objlist *, RtldLockState *); static void objlist_clear(Objlist *); @@ -2688,7 +2687,7 @@ errp: return (NULL); } -static Obj_Entry * +Obj_Entry * obj_from_addr(const void *addr) { Obj_Entry *obj; diff --git a/libexec/rtld-elf/rtld.h b/libexec/rtld-elf/rtld.h index 6a2f62fc6189..060b83b2cdad 100644 --- a/libexec/rtld-elf/rtld.h +++ b/libexec/rtld-elf/rtld.h @@ -389,6 +389,7 @@ Obj_Entry *globallist_curr(const Obj_Entry *obj); Obj_Entry *globallist_next(const Obj_Entry *obj); void obj_free(Obj_Entry *); Obj_Entry *obj_new(void); +Obj_Entry *obj_from_addr(const void *); void _rtld_bind_start(void); void *rtld_resolve_ifunc(const Obj_Entry *obj, const Elf_Sym *def); void symlook_init(SymLook *, const char *); diff --git a/libexec/rtld-elf/rtld_lock.c b/libexec/rtld-elf/rtld_lock.c index c453584b96e2..d94bd1a283e9 100644 --- a/libexec/rtld-elf/rtld_lock.c +++ b/libexec/rtld-elf/rtld_lock.c @@ -192,7 +192,7 @@ def_thread_clr_flag(int mask) /* * Public interface exposed to the rest of the dynamic linker. */ -static struct RtldLockInfo lockinfo; +struct RtldLockInfo lockinfo; static struct RtldLockInfo deflockinfo; static __inline int diff --git a/libexec/rtld-elf/rtld_lock.h b/libexec/rtld-elf/rtld_lock.h index 9aa769b1f7e6..ecc733a06e44 100644 --- a/libexec/rtld-elf/rtld_lock.h +++ b/libexec/rtld-elf/rtld_lock.h @@ -63,6 +63,8 @@ extern rtld_lock_t rtld_bind_lock; extern rtld_lock_t rtld_libc_lock; extern rtld_lock_t rtld_phdr_lock; +extern struct RtldLockInfo lockinfo; + #define RTLD_LOCK_UNLOCKED 0 #define RTLD_LOCK_RLOCKED 1 #define RTLD_LOCK_WLOCKED 2 From owner-dev-commits-src-all@freebsd.org Sat Apr 10 14:35:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FF685CE121; Sat, 10 Apr 2021 14:35: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 4FHcwq2GQwz3PfX; Sat, 10 Apr 2021 14:35: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 4100B13287; Sat, 10 Apr 2021 14:35: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 13AEZN2a095240; Sat, 10 Apr 2021 14:35:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13AEZNnB095239; Sat, 10 Apr 2021 14:35:23 GMT (envelope-from git) Date: Sat, 10 Apr 2021 14:35:23 GMT Message-Id: <202104101435.13AEZNnB095239@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: 08bfbd43594b - main - rtld: workaround for broken ABI 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: 08bfbd43594b7642de0d2487550f36b0ee1eceba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 14:35:23 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=08bfbd43594b7642de0d2487550f36b0ee1eceba commit 08bfbd43594b7642de0d2487550f36b0ee1eceba Author: Konstantin Belousov AuthorDate: 2021-04-10 12:32:24 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-10 14:33:33 +0000 rtld: workaround for broken ABI Right now, libthr does not initialize RtldLockInfo.rtli_version when calling _rtld_thread_init(), which makes versioning the interface troublesome. Add a workaround: if the calling object of _rtld_thread_init() exports the "_pli_rtli_version" symbol, then consider rtli_version initialized. Otherwise, forcibly set it to RTLI_VERSION_ONE, currently defined as RTLI_VERSION. Export "_pli_rtli_version" from libthr and properly initialize rtli_version. Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29633 --- lib/libthr/pthread.map | 3 +++ lib/libthr/thread/thr_rtld.c | 8 ++++++++ libexec/rtld-elf/rtld_lock.c | 17 ++++++++++++++++- libexec/rtld-elf/rtld_lock.h | 4 +++- 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/lib/libthr/pthread.map b/lib/libthr/pthread.map index 232d65084ba9..15195ce0847b 100644 --- a/lib/libthr/pthread.map +++ b/lib/libthr/pthread.map @@ -296,6 +296,9 @@ FBSDprivate_1.0 { _thread_size_key; _thread_state_running; _thread_state_zoombie; + + /* ABI bug workaround, indicate that pli->rtli_version is valid */ + _pli_rtli_version; }; FBSD_1.1 { diff --git a/lib/libthr/thread/thr_rtld.c b/lib/libthr/thread/thr_rtld.c index 291ca17e2068..5848fc6d5f61 100644 --- a/lib/libthr/thread/thr_rtld.c +++ b/lib/libthr/thread/thr_rtld.c @@ -182,6 +182,13 @@ _thr_rtld_clr_flag(int mask __unused) return (0); } +/* + * ABI bug workaround: This symbol must be present for rtld to accept + * RTLI_VERSION from RtldLockInfo + */ +extern char _pli_rtli_version; +char _pli_rtli_version; + void _thr_rtld_init(void) { @@ -205,6 +212,7 @@ _thr_rtld_init(void) mprotect(NULL, 0, 0); _rtld_get_stack_prot(); + li.rtli_version = RTLI_VERSION; li.lock_create = _thr_rtld_lock_create; li.lock_destroy = _thr_rtld_lock_destroy; li.rlock_acquire = _thr_rtld_rlock_acquire; diff --git a/libexec/rtld-elf/rtld_lock.c b/libexec/rtld-elf/rtld_lock.c index d94bd1a283e9..4d54c687ee6f 100644 --- a/libexec/rtld-elf/rtld_lock.c +++ b/libexec/rtld-elf/rtld_lock.c @@ -344,8 +344,23 @@ lockdflt_init(void) void _rtld_thread_init(struct RtldLockInfo *pli) { - int flags, i; + const Obj_Entry *obj; + SymLook req; void *locks[RTLD_LOCK_CNT]; + int flags, i, res; + + if (pli == NULL) { + lockinfo.rtli_version = RTLI_VERSION; + } else { + lockinfo.rtli_version = RTLI_VERSION_ONE; + obj = obj_from_addr(pli->lock_create); + if (obj != NULL) { + symlook_init(&req, "_pli_rtli_version"); + res = symlook_obj(&req, obj); + if (res == 0) + lockinfo.rtli_version = pli->rtli_version; + } + } /* disable all locking while this function is running */ flags = thread_mask_set(~0); diff --git a/libexec/rtld-elf/rtld_lock.h b/libexec/rtld-elf/rtld_lock.h index ecc733a06e44..7a61a1a525e2 100644 --- a/libexec/rtld-elf/rtld_lock.h +++ b/libexec/rtld-elf/rtld_lock.h @@ -30,7 +30,9 @@ #ifndef _RTLD_LOCK_H_ #define _RTLD_LOCK_H_ -#define RTLI_VERSION 0x01 +#define RTLI_VERSION_ONE 0x01 +#define RTLI_VERSION 0x01 + #define MAX_RTLD_LOCKS 8 struct RtldLockInfo From owner-dev-commits-src-all@freebsd.org Sat Apr 10 14:35:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2C605CE014; Sat, 10 Apr 2021 14:35: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 4FHcwr4JXzz3PR8; Sat, 10 Apr 2021 14:35: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 6844713198; Sat, 10 Apr 2021 14:35: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 13AEZOYD095261; Sat, 10 Apr 2021 14:35:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13AEZOuk095260; Sat, 10 Apr 2021 14:35:24 GMT (envelope-from git) Date: Sat, 10 Apr 2021 14:35:24 GMT Message-Id: <202104101435.13AEZOuk095260@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: 4d9128da54f8 - main - rtld: make dlerror() thread-local 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: 4d9128da54f8f8e2a29190ffb18880c4f116a205 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 14:35:24 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=4d9128da54f8f8e2a29190ffb18880c4f116a205 commit 4d9128da54f8f8e2a29190ffb18880c4f116a205 Author: Konstantin Belousov AuthorDate: 2021-04-07 22:02:33 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-10 14:33:34 +0000 rtld: make dlerror() thread-local PR: 95339 Discussed with: arichardson Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D29633 --- lib/libthr/thread/thr_private.h | 4 ++++ lib/libthr/thread/thr_rtld.c | 21 +++++++++++++++++++++ libexec/rtld-elf/rtld.c | 38 ++++++++++++++++++++------------------ libexec/rtld-elf/rtld_lock.c | 33 +++++++++++++++++++++++++++++++++ libexec/rtld-elf/rtld_lock.h | 7 ++++++- 5 files changed, 84 insertions(+), 19 deletions(-) diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h index a1258940a896..a5bbc5997d30 100644 --- a/lib/libthr/thread/thr_private.h +++ b/lib/libthr/thread/thr_private.h @@ -577,6 +577,10 @@ struct pthread { /* pthread_set/get_name_np */ char *name; + + /* rtld thread-local dlerror message and seen control */ + char dlerror_msg[512]; + int dlerror_seen; }; #define THR_SHOULD_GC(thrd) \ diff --git a/lib/libthr/thread/thr_rtld.c b/lib/libthr/thread/thr_rtld.c index 5848fc6d5f61..1967ea14859d 100644 --- a/lib/libthr/thread/thr_rtld.c +++ b/lib/libthr/thread/thr_rtld.c @@ -189,6 +189,24 @@ _thr_rtld_clr_flag(int mask __unused) extern char _pli_rtli_version; char _pli_rtli_version; +static char * +_thr_dlerror_loc(void) +{ + struct pthread *curthread; + + curthread = _get_curthread(); + return (curthread->dlerror_msg); +} + +static int * +_thr_dlerror_seen(void) +{ + struct pthread *curthread; + + curthread = _get_curthread(); + return (&curthread->dlerror_seen); +} + void _thr_rtld_init(void) { @@ -221,6 +239,9 @@ _thr_rtld_init(void) li.thread_set_flag = _thr_rtld_set_flag; li.thread_clr_flag = _thr_rtld_clr_flag; li.at_fork = NULL; + li.dlerror_loc = _thr_dlerror_loc; + li.dlerror_loc_sz = sizeof(curthread->dlerror_msg); + li.dlerror_seen = _thr_dlerror_seen; /* * Preresolve the symbols needed for the fork interposer. We diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 1ff9ecefa2c1..fce455a0ee79 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -195,7 +195,6 @@ int __sys_openat(int, const char *, int, ...); /* * Data declarations. */ -static char *error_message; /* Message for dlerror(), or NULL */ struct r_debug r_debug __exported; /* for GDB; */ static bool libmap_disable; /* Disable libmap */ static bool ld_loadfltr; /* Immediate filters processing */ @@ -443,6 +442,8 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp) assert(aux_info[AT_BASE] != NULL); init_rtld((caddr_t) aux_info[AT_BASE]->a_un.a_ptr, aux_info); + dlerror_dflt_init(); + __progname = obj_rtld.path; argv0 = argv[0] != NULL ? argv[0] : "(null)"; environ = env; @@ -927,14 +928,14 @@ _rtld_bind(Obj_Entry *obj, Elf_Size reloff) void _rtld_error(const char *fmt, ...) { - static char buf[512]; - va_list ap; + va_list ap; - va_start(ap, fmt); - rtld_vsnprintf(buf, sizeof buf, fmt, ap); - error_message = buf; - va_end(ap); - LD_UTRACE(UTRACE_RTLD_ERROR, NULL, NULL, 0, 0, error_message); + va_start(ap, fmt); + rtld_vsnprintf(lockinfo.dlerror_loc(), lockinfo.dlerror_loc_sz, + fmt, ap); + va_end(ap); + *lockinfo.dlerror_seen() = 0; + LD_UTRACE(UTRACE_RTLD_ERROR, NULL, NULL, 0, 0, lockinfo.dlerror_loc()); } /* @@ -943,7 +944,7 @@ _rtld_error(const char *fmt, ...) static char * errmsg_save(void) { - return error_message == NULL ? NULL : xstrdup(error_message); + return (xstrdup(lockinfo.dlerror_loc())); } /* @@ -953,12 +954,12 @@ errmsg_save(void) static void errmsg_restore(char *saved_msg) { - if (saved_msg == NULL) - error_message = NULL; - else { - _rtld_error("%s", saved_msg); - free(saved_msg); - } + if (saved_msg == NULL) + _rtld_error(""); + else { + _rtld_error("%s", saved_msg); + free(saved_msg); + } } static const char * @@ -3389,9 +3390,10 @@ dlclose_locked(void *handle, RtldLockState *lockstate) char * dlerror(void) { - char *msg = error_message; - error_message = NULL; - return msg; + if (*(lockinfo.dlerror_seen()) != 0) + return (NULL); + *lockinfo.dlerror_seen() = 1; + return (lockinfo.dlerror_loc()); } /* diff --git a/libexec/rtld-elf/rtld_lock.c b/libexec/rtld-elf/rtld_lock.c index 4d54c687ee6f..94e931c2f760 100644 --- a/libexec/rtld-elf/rtld_lock.c +++ b/libexec/rtld-elf/rtld_lock.c @@ -59,6 +59,21 @@ void _rtld_thread_init(struct RtldLockInfo *) __exported; void _rtld_atfork_pre(int *) __exported; void _rtld_atfork_post(int *) __exported; +static char def_dlerror_msg[512]; +static int def_dlerror_seen_val; + +static char * +def_dlerror_loc(void) +{ + return (def_dlerror_msg); +} + +static int * +def_dlerror_seen(void) +{ + return (&def_dlerror_seen_val); +} + #define WAFLAG 0x1 /* A writer holds the lock */ #define RC_INCR 0x2 /* Adjusts count of readers desiring lock */ @@ -299,6 +314,14 @@ lock_restart_for_upgrade(RtldLockState *lockstate) } } +void +dlerror_dflt_init(void) +{ + lockinfo.dlerror_loc = def_dlerror_loc; + lockinfo.dlerror_loc_sz = sizeof(def_dlerror_msg); + lockinfo.dlerror_seen = def_dlerror_seen; +} + void lockdflt_init(void) { @@ -313,6 +336,9 @@ lockdflt_init(void) deflockinfo.thread_set_flag = def_thread_set_flag; deflockinfo.thread_clr_flag = def_thread_clr_flag; deflockinfo.at_fork = NULL; + deflockinfo.dlerror_loc = def_dlerror_loc; + deflockinfo.dlerror_loc_sz = sizeof(def_dlerror_msg); + deflockinfo.dlerror_seen = def_dlerror_seen; for (i = 0; i < RTLD_LOCK_CNT; i++) { rtld_locks[i].mask = (1 << i); @@ -404,6 +430,13 @@ _rtld_thread_init(struct RtldLockInfo *pli) lockinfo.thread_set_flag = pli->thread_set_flag; lockinfo.thread_clr_flag = pli->thread_clr_flag; lockinfo.at_fork = pli->at_fork; + if (lockinfo.rtli_version > RTLI_VERSION_ONE && pli != NULL) { + strlcpy(pli->dlerror_loc(), lockinfo.dlerror_loc(), + lockinfo.dlerror_loc_sz); + lockinfo.dlerror_loc = pli->dlerror_loc; + lockinfo.dlerror_loc_sz = pli->dlerror_loc_sz; + lockinfo.dlerror_seen = pli->dlerror_seen; + } /* restore thread locking state, this time with new locks */ thread_mask_clear(~0); diff --git a/libexec/rtld-elf/rtld_lock.h b/libexec/rtld-elf/rtld_lock.h index 7a61a1a525e2..fdbdc9917075 100644 --- a/libexec/rtld-elf/rtld_lock.h +++ b/libexec/rtld-elf/rtld_lock.h @@ -31,7 +31,7 @@ #define _RTLD_LOCK_H_ #define RTLI_VERSION_ONE 0x01 -#define RTLI_VERSION 0x01 +#define RTLI_VERSION 0x02 #define MAX_RTLD_LOCKS 8 @@ -46,6 +46,9 @@ struct RtldLockInfo int (*thread_set_flag)(int); int (*thread_clr_flag)(int); void (*at_fork)(void); + char *(*dlerror_loc)(void); + int *(*dlerror_seen)(void); + int dlerror_loc_sz; }; #if defined(IN_RTLD) || defined(PTHREAD_KERNEL) @@ -80,6 +83,8 @@ void lock_release(rtld_lock_t, RtldLockState *); void lock_upgrade(rtld_lock_t, RtldLockState *); void lock_restart_for_upgrade(RtldLockState *); +void dlerror_dflt_init(void); + #endif /* IN_RTLD */ #endif From owner-dev-commits-src-all@freebsd.org Sat Apr 10 14:43:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EA985CE700; Sat, 10 Apr 2021 14:43: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 4FHd6F70wqz3Pyn; Sat, 10 Apr 2021 14:43: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 E31F913511; Sat, 10 Apr 2021 14:43: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 13AEhXaQ008184; Sat, 10 Apr 2021 14:43:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13AEhXNE008183; Sat, 10 Apr 2021 14:43:33 GMT (envelope-from git) Date: Sat, 10 Apr 2021 14:43:33 GMT Message-Id: <202104101443.13AEhXNE008183@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: =?utf-8?B?U3RlZmFuIEXDn2Vy?= Subject: git: 19f2e30f4224 - stable/12 - [bc] Update to version 4.0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 19f2e30f422458bce4ee3d6dfeb9aeeff4e37786 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 14:43:34 -0000 The branch stable/12 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=19f2e30f422458bce4ee3d6dfeb9aeeff4e37786 commit 19f2e30f422458bce4ee3d6dfeb9aeeff4e37786 Author: Stefan Eßer AuthorDate: 2021-04-06 08:44:52 +0000 Commit: Stefan Eßer CommitDate: 2021-04-10 14:43:21 +0000 [bc] Update to version 4.0.0 This version fixes an issue (missing pop of top-of-stack value in the "P" command of the dc program). This issue did not affect the bc program, since it does not use dc as an back-end to actually perform the calculations as was the case with the traditional bc and dc programs. The major number has been bumped due to Windows support that has been added to this version. It does not correspond to a major change that might affect FreeBSD. (cherry picked from commit b55a927bc884d7780d65a508572023b0dc2dede9) --- contrib/bc/Makefile.in | 11 +- contrib/bc/NEWS.md | 25 + contrib/bc/README.md | 107 +- contrib/bc/bc.sln | 31 + contrib/bc/bc.vcxproj | 278 +++++ contrib/bc/bc.vcxproj.filters | 182 ++++ contrib/bc/bcl.sln | 31 + contrib/bc/bcl.vcxproj | 161 +++ contrib/bc/bcl.vcxproj.filters | 96 ++ contrib/bc/configure | 1322 ++++++++++++++++++++++- contrib/bc/configure.sh | 2 + contrib/bc/gen/bc_help.txt | 19 +- contrib/bc/gen/dc_help.txt | 17 +- contrib/bc/gen/strgen.c | 56 +- contrib/bc/include/bcl.h | 102 ++ contrib/bc/include/file.h | 34 +- contrib/bc/include/history.h | 3 + contrib/bc/include/num.h | 3 +- contrib/bc/include/status.h | 59 - contrib/bc/include/version.h | 41 + contrib/bc/include/vm.h | 32 +- contrib/bc/karatsuba.py | 10 +- contrib/bc/manpage.sh | 2 +- contrib/bc/manuals/bc.1.md.in | 23 +- contrib/bc/manuals/bc/A.1 | 1901 ++++++++++++++++++--------------- contrib/bc/manuals/bc/A.1.md | 18 +- contrib/bc/manuals/bc/E.1 | 905 +++++++++------- contrib/bc/manuals/bc/E.1.md | 18 +- contrib/bc/manuals/bc/EH.1 | 905 +++++++++------- contrib/bc/manuals/bc/EH.1.md | 18 +- contrib/bc/manuals/bc/EHN.1 | 905 +++++++++------- contrib/bc/manuals/bc/EHN.1.md | 18 +- contrib/bc/manuals/bc/EHNP.1 | 894 +++++++++------- contrib/bc/manuals/bc/EHNP.1.md | 8 +- contrib/bc/manuals/bc/EHP.1 | 894 +++++++++------- contrib/bc/manuals/bc/EHP.1.md | 8 +- contrib/bc/manuals/bc/EN.1 | 905 +++++++++------- contrib/bc/manuals/bc/EN.1.md | 18 +- contrib/bc/manuals/bc/ENP.1 | 894 +++++++++------- contrib/bc/manuals/bc/ENP.1.md | 8 +- contrib/bc/manuals/bc/EP.1 | 894 +++++++++------- contrib/bc/manuals/bc/EP.1.md | 8 +- contrib/bc/manuals/bc/H.1 | 1901 ++++++++++++++++++--------------- contrib/bc/manuals/bc/H.1.md | 18 +- contrib/bc/manuals/bc/HN.1 | 1901 ++++++++++++++++++--------------- contrib/bc/manuals/bc/HN.1.md | 18 +- contrib/bc/manuals/bc/HNP.1 | 1892 +++++++++++++++++--------------- contrib/bc/manuals/bc/HNP.1.md | 8 +- contrib/bc/manuals/bc/HP.1 | 1892 +++++++++++++++++--------------- contrib/bc/manuals/bc/HP.1.md | 8 +- contrib/bc/manuals/bc/N.1 | 1901 ++++++++++++++++++--------------- contrib/bc/manuals/bc/N.1.md | 18 +- contrib/bc/manuals/bc/NP.1 | 1892 +++++++++++++++++--------------- contrib/bc/manuals/bc/NP.1.md | 8 +- contrib/bc/manuals/bc/P.1 | 1892 +++++++++++++++++--------------- contrib/bc/manuals/bc/P.1.md | 8 +- contrib/bc/manuals/bcl.3 | 1751 +++++++++++++++--------------- contrib/bc/manuals/build.md | 121 ++- contrib/bc/manuals/dc.1.md.in | 61 +- contrib/bc/manuals/dc/A.1 | 1386 ++++++++++++++---------- contrib/bc/manuals/dc/A.1.md | 56 +- contrib/bc/manuals/dc/E.1 | 1197 ++++++++++++--------- contrib/bc/manuals/dc/E.1.md | 56 +- contrib/bc/manuals/dc/EH.1 | 1197 ++++++++++++--------- contrib/bc/manuals/dc/EH.1.md | 56 +- contrib/bc/manuals/dc/EHN.1 | 1197 ++++++++++++--------- contrib/bc/manuals/dc/EHN.1.md | 56 +- contrib/bc/manuals/dc/EHNP.1 | 1185 +++++++++++--------- contrib/bc/manuals/dc/EHNP.1.md | 46 +- contrib/bc/manuals/dc/EHP.1 | 1185 +++++++++++--------- contrib/bc/manuals/dc/EHP.1.md | 46 +- contrib/bc/manuals/dc/EN.1 | 1197 ++++++++++++--------- contrib/bc/manuals/dc/EN.1.md | 56 +- contrib/bc/manuals/dc/ENP.1 | 1185 +++++++++++--------- contrib/bc/manuals/dc/ENP.1.md | 46 +- contrib/bc/manuals/dc/EP.1 | 1185 +++++++++++--------- contrib/bc/manuals/dc/EP.1.md | 46 +- contrib/bc/manuals/dc/H.1 | 1386 ++++++++++++++---------- contrib/bc/manuals/dc/H.1.md | 56 +- contrib/bc/manuals/dc/HN.1 | 1386 ++++++++++++++---------- contrib/bc/manuals/dc/HN.1.md | 56 +- contrib/bc/manuals/dc/HNP.1 | 1374 ++++++++++++++---------- contrib/bc/manuals/dc/HNP.1.md | 46 +- contrib/bc/manuals/dc/HP.1 | 1374 ++++++++++++++---------- contrib/bc/manuals/dc/HP.1.md | 46 +- contrib/bc/manuals/dc/N.1 | 1386 ++++++++++++++---------- contrib/bc/manuals/dc/N.1.md | 56 +- contrib/bc/manuals/dc/NP.1 | 1374 ++++++++++++++---------- contrib/bc/manuals/dc/NP.1.md | 46 +- contrib/bc/manuals/dc/P.1 | 1374 ++++++++++++++---------- contrib/bc/manuals/dc/P.1.md | 46 +- contrib/bc/manuals/header_bc.txt | 2 +- contrib/bc/manuals/header_bcl.txt | 2 +- contrib/bc/manuals/header_dc.txt | 2 +- contrib/bc/release.sh | 33 +- contrib/bc/src/args.c | 9 + contrib/bc/src/data.c | 6 + contrib/bc/src/file.c | 71 +- contrib/bc/src/history.c | 63 +- contrib/bc/src/main.c | 6 +- contrib/bc/src/num.c | 29 +- contrib/bc/src/program.c | 36 +- contrib/bc/src/rand.c | 36 +- contrib/bc/src/read.c | 29 +- contrib/bc/src/vm.c | 132 ++- contrib/bc/tests/dc/scripts/easter.sh | 47 + contrib/bc/tests/other.sh | 37 +- usr.bin/gh-bc/Makefile | 2 - 108 files changed, 28963 insertions(+), 20119 deletions(-) diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in index aab7f9b569e5..2b50476a79fe 100644 --- a/contrib/bc/Makefile.in +++ b/contrib/bc/Makefile.in @@ -29,8 +29,6 @@ # .POSIX: -VERSION = 3.3.4 - SRC = %%SRC%% OBJ = %%OBJ%% GCDA = %%GCDA%% @@ -128,6 +126,8 @@ MAIN_EXEC = $(EXEC_PREFIX)$(%%MAIN_EXEC%%)$(EXEC_SUFFIX) EXEC = $(%%EXEC%%) NLSPATH = %%NLSPATH%% +BC_BUILD_TYPE = %%BUILD_TYPE%% + BC_ENABLE_LIBRARY = %%LIBRARY%% BC_ENABLE_HISTORY = %%HISTORY%% @@ -158,7 +158,7 @@ TEST_STARS = "****************************************************************** BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%% CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED) -CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DVERSION=$(VERSION) %%LONG_BIT_DEFINE%% +CPPFLAGS2 = $(CPPFLAGS1) -I./include/ -DBUILD_TYPE=$(BC_BUILD_TYPE) %%LONG_BIT_DEFINE%% CPPFLAGS3 = $(CPPFLAGS2) -DEXECPREFIX=$(EXEC_PREFIX) -DMAINEXEC=$(MAIN_EXEC) CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN) @@ -322,9 +322,6 @@ coverage_output: coverage:%%COVERAGE_PREREQS%% -version: - @printf '%s' "$(VERSION)" - libcname: @printf '%s' "$(BC_LIB_C)" @@ -341,6 +338,7 @@ clean_gen: clean:%%CLEAN_PREREQS%% @printf 'Cleaning files...\n' + @$(RM) -f src/*.tmp gen/*.tmp @$(RM) -f $(OBJ) @$(RM) -f $(BC_EXEC) @$(RM) -f $(DC_EXEC) @@ -352,6 +350,7 @@ clean:%%CLEAN_PREREQS%% @$(RM) -f $(DC_HELP_C) $(DC_HELP_O) @$(RM) -fr $(BC_TEST_OUTPUTS) $(DC_TEST_OUTPUTS) @$(RM) -fr $(BC_FUZZ_OUTPUTS) $(DC_FUZZ_OUTPUTS) + @$(RM) -fr Debug/ Release/ clean_config: clean @printf 'Cleaning config...\n' diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index 3374ab57bc41..011cb9138912 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,5 +1,30 @@ # News +## 4.0.0 + +This is a production release with many fixes, a new command-line option, and a +big surprise: + +* A bug was fixed in `dc`'s `P` command where the item on the stack was *not* + popped. +* Various bugs in the manuals have been fixed. +* A known bug was fixed where history did not interact well with prompts printed + by user code without newlines. +* A new command-line option, `-R` and `--no-read-prompt` was added to disable + just the prompt when using `read()` (`bc`) or `?` (`dc`). +* And finally, **official support for Windows was added**. + +The last item is why this is a major version bump. + +Currently, only one set of build options (extra math and prompt enabled, history +and NLS/locale support disabled, both calculators enabled) is supported on +Windows. However, both debug and release builds are supported. + +In addition, Windows builds are supported for the the library (`bcl`). + +For more details about how to build on Windows, see the [README][5] or the +[build manual][13]. + ## 3.3.4 This is a production release that fixes a small bug. diff --git a/contrib/bc/README.md b/contrib/bc/README.md index 6a37a8bfb8da..852c8956a73d 100644 --- a/contrib/bc/README.md +++ b/contrib/bc/README.md @@ -24,13 +24,16 @@ This `bc` is Free and Open Source Software (FOSS). It is offered under the BSD ## Prerequisites -This `bc` only requires a C99-compatible compiler and a (mostly) POSIX -2008-compatible system with the XSI (X/Open System Interfaces) option group. +This `bc` only requires either: + +1. Windows 10 or later, or +2. A C99-compatible compiler and a (mostly) POSIX 2008-compatible system with + the XSI (X/Open System Interfaces) option group. Since POSIX 2008 with XSI requires the existence of a C99 compiler as `c99`, any POSIX and XSI-compatible system will have everything needed. -Systems that are known to work: +POSIX-compatible systems that are known to work: * Linux * FreeBSD @@ -41,17 +44,68 @@ Systems that are known to work: * AIX * HP-UX* (except for history) +In addition, there is compatibility code to make this `bc` work on Windows. + Please submit bug reports if this `bc` does not build out of the box on any -system besides Windows. +system. ## Build -This `bc` should build unmodified on any POSIX-compliant system. +### Windows + +There is no guarantee that this `bc` will work on any version of Windows earlier +than Windows 10 (I cannot test on earlier versions), but it is guaranteed to +work on Windows 10 at least. + +Also, if building with MSBuild, the MSBuild bundled with Visual Studio is +required. + +**Note**: Unlike the POSIX-compatible platforms, only one build configuration is +supported on Windows: extra math and prompt enabled, history and NLS (locale +support) disabled, with both calculators built. + +#### `bc` + +To build `bc`, you can open the `bc.sln` file in Visual Studio, select the +configuration, and build. + +You can also build using MSBuild with the following from the root directory: + +``` +msbuild -property:Configuration= bc.sln +``` + +where `` is either one of `Debug` or `Release`. + +#### `bcl` (Library) + +To build the library, you can open the `bcl.sln` file in Visual Studio, select +the configuration, and build. + +You can also build using MSBuild with the following from the root directory: + +``` +msbuild -property:Configuration= bcl.sln +``` + +where `` is either one of `Debug` or `Release`. + +### POSIX-Compatible Systems + +This `bc` should build unmodified on any POSIX-compliant system or on Windows +starting with Windows 10 (though earlier versions may work). For more complex build requirements than the ones below, see the [build manual][5]. -### Default +On POSIX-compatible systems, `bc` is built as `bin/bc` and `dc` is built as +`bin/dc` by default. On Windows, they are built as `Release/bc/bc.exe` and +`Release/bc/dc.exe`. + +**Note**: On Windows, `dc.exe` is just copied from `bc.exe`; it is not linked. +Patches are welcome for a way to do that. + +#### Default For the default build with optimization, use the following commands in the root directory: @@ -61,7 +115,7 @@ directory: make ``` -### One Calculator +#### One Calculator To only build `bc`, use the following commands: @@ -77,7 +131,7 @@ To only build `dc`, use the following commands: make ``` -### Debug +#### Debug For debug builds, use the following commands in the root directory: @@ -86,7 +140,7 @@ For debug builds, use the following commands in the root directory: make ``` -### Install +#### Install To install, use the following command: @@ -99,7 +153,7 @@ other locations, use the `PREFIX` environment variable when running `configure.sh` or pass the `--prefix=` option to `configure.sh`. See the [build manual][5], or run `./configure.sh --help`, for more details. -### Library +#### Library This `bc` does provide a way to build a math library with C bindings. This is done by the `-a` or `--library` options to `configure.sh`: @@ -114,11 +168,12 @@ see the [build manual][5]. The library API can be found in [`manuals/bcl.3.md`][26] or `man bcl` once the library is installed. -The library is built as `bin/libbcl.a`. +The library is built as `bin/libbcl.a` on POSIX-compatible systems or as +`Release/bcl/bcl.lib` on Windows. -### Package and Distro Maintainers +#### Package and Distro Maintainers -#### Recommended Compiler +##### Recommended Compiler When I ran benchmarks with my `bc` compiled under `clang`, it performed much better than when compiled under `gcc`. I recommend compiling this `bc` with @@ -127,7 +182,7 @@ better than when compiled under `gcc`. I recommend compiling this `bc` with I also recommend building this `bc` with C11 if you can because `bc` will detect a C11 compiler and add `_Noreturn` to any relevant function(s). -#### Recommended Optimizations +##### Recommended Optimizations I wrote this `bc` with Separation of Concerns, which means that there are many small functions that could be inlined. However, they are often called across @@ -154,12 +209,12 @@ However, I recommend ***NOT*** using `-march=native`. Doing so will reduce this `bc`'s performance, at least when building with link-time optimization. See the [benchmarks][19] for more details. -#### Stripping Binaries +##### Stripping Binaries By default, non-debug binaries are stripped, but stripping can be disabled with the `-T` option to `configure.sh`. -#### Using This `bc` as an Alternative +##### Using This `bc` as an Alternative If this `bc` is packaged as an alternative to an already existing `bc` package, it is possible to rename it in the build to prevent name collision. To prepend @@ -181,7 +236,7 @@ allowed. **Note**: The suggested name (and package name) when `bc` is not available is `bc-gh`. -#### Karatsuba Number +##### Karatsuba Number Package and distro maintainers have one tool at their disposal to build this `bc` in the optimal configuration: `karatsuba.py`. @@ -217,6 +272,7 @@ translations will also be added as they are provided. This `bc` compares favorably to GNU `bc`. +* This `bc` builds natively on Windows. * It has more extensions, which make this `bc` more useful for scripting. * This `bc` is a bit more POSIX compliant. * It has a much less buggy parser. The GNU `bc` will give parse errors for what @@ -246,7 +302,9 @@ To see what algorithms this `bc` uses, see the [algorithms manual][7]. ## Locales -Currently, this `bc` only has support for English (and US English), French, +Currently, there is no locale support on Windows. + +Additionally, this `bc` only has support for English (and US English), French, German, Portuguese, Dutch, Polish, Russian, Japanese, and Chinese locales. Patches are welcome for translations; use the existing `*.msg` files in `locales/` as a starting point. @@ -276,7 +334,8 @@ Other projects based on this bc are: ## Language -This `bc` is written in pure ISO C99, using POSIX 2008 APIs. +This `bc` is written in pure ISO C99, using POSIX 2008 APIs with custom Windows +compatibility code. ## Commit Messages @@ -294,6 +353,13 @@ tarballs. Files: .gitignore The git ignore file (maintainer use only). + .gitattributes The git attributes file (maintainer use only). + bc.sln The Visual Studio solution file for bc. + bc.vcxproj The Visual Studio project file for bc. + bc.vcxproj.filters The Visual Studio filters file for bc. + bcl.sln The Visual Studio solution file for bcl. + bcl.vcxproj The Visual Studio project file for bcl. + bcl.vcxproj.filters The Visual Studio filters file for bcl. configure A symlink to configure.sh to make packaging easier. configure.sh The configure script. functions.sh A script with functions used by other scripts. @@ -304,7 +370,8 @@ Files: locale_install.sh A script to install locales, if desired. locale_uninstall.sh A script to uninstall locales. Makefile.in The Makefile template. - manpage.sh Script to generate man pages from markdown files. + manpage.sh Script to generate man pages from markdown files + (maintainer use only). NOTICE.md List of contributors and copyright owners. RELEASE.md A checklist for making a release (maintainer use only). release.sh A script to test for release (maintainer use only). diff --git a/contrib/bc/bc.sln b/contrib/bc/bc.sln new file mode 100644 index 000000000000..584b28d13bf6 --- /dev/null +++ b/contrib/bc/bc.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31129.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bc", "bc.vcxproj", "{D5086CFE-052C-4742-B005-E05DB983BBA2}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x64.ActiveCfg = Debug|x64 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x64.Build.0 = Debug|x64 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x86.ActiveCfg = Debug|Win32 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Debug|x86.Build.0 = Debug|Win32 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x64.ActiveCfg = Release|x64 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x64.Build.0 = Release|x64 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x86.ActiveCfg = Release|Win32 + {D5086CFE-052C-4742-B005-E05DB983BBA2}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7869B1FB-A7C4-4FCF-8B99-F696DB2765EC} + EndGlobalSection +EndGlobal diff --git a/contrib/bc/bc.vcxproj b/contrib/bc/bc.vcxproj new file mode 100644 index 000000000000..ba0a7f6f1dd6 --- /dev/null +++ b/contrib/bc/bc.vcxproj @@ -0,0 +1,278 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + {D5086CFE-052C-4742-B005-E05DB983BBA2} + Win32Proj + + + + Application + true + v142 + + + Application + false + v142 + + + Application + true + v142 + + + Application + false + v142 + + + + + + + + + + + + + + + + + + + + + Building strgen + CL /Fo:$(Configuration)\$(ProjectName)\ /Fe:$(Configuration)\$(ProjectName)\strgen.exe gen\strgen.c + gen\strgen.c + $(Configuration)\$(ProjectName)\strgen.exe + + + Generating $(Configuration)\$(ProjectName)/lib.c + START $(Configuration)\$(ProjectName)/strgen gen\lib.bc $(Configuration)\$(ProjectName)/lib.c bc_lib bc_lib_name BC_ENABLED 1 + $(Configuration)\$(ProjectName)\strgen.exe;gen\lib.bc + $(Configuration)\$(ProjectName)\lib.c + + + Generating $(Configuration)\$(ProjectName)/lib2.c + START $(Configuration)\$(ProjectName)/strgen gen\lib2.bc $(Configuration)\$(ProjectName)/lib2.c bc_lib2 bc_lib2_name BC_ENABLED 1 + $(Configuration)\$(ProjectName)\strgen.exe;gen\lib2.bc + $(Configuration)\$(ProjectName)\lib2.c + + + Generating $(Configuration)\$(ProjectName)/bc_help.c + START $(Configuration)\$(ProjectName)/strgen gen\bc_help.txt $(Configuration)\$(ProjectName)\bc_help.c bc_help "" BC_ENABLED + $(Configuration)\$(ProjectName)\strgen.exe;gen\bc_help.txt + $(Configuration)\$(ProjectName)\bc_help.c + + + Generating $(Configuration)\$(ProjectName)/dc_help.c + START $(Configuration)\$(ProjectName)/strgen gen\dc_help.txt $(Configuration)\$(ProjectName)\dc_help.c dc_help "" DC_ENABLED + $(Configuration)\$(ProjectName)\strgen.exe;gen\dc_help.txt + $(Configuration)\$(ProjectName)\dc_help.c + + + + ClCompile + + + + true + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + + + true + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + $(SolutionDir)\$(Configuration)\$(ProjectName)\ + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + false + /W3 %(AdditionalOptions) + + + MachineX86 + true + Console + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies) + + + copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe" + + + Copying bc to dc... + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + MaxSpeed + false + /W3 %(AdditionalOptions) + + + MachineX86 + false + Console + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies) + true + true + + + copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe" + + + Copying bc to dc... + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + Level3 + ProgramDatabase + Disabled + false + /W3 %(AdditionalOptions) + + + MachineX64 + true + Console + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies) + + + copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe" + + + Copying bc to dc... + + + + + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions);BC_ENABLED=1;DC_ENABLED=1;BC_ENABLE_EXTRA_MATH=1;BC_ENABLE_HISTORY=0;BC_ENABLE_NLS=0;BC_ENABLE_PROMPT=1;BC_DEBUG_CODE=0;BC_ENABLE_LIBRARY=0;EXECSUFFIX=.exe;BUILD_TYPE=HN + $(SolutionDir)\include;%(AdditionalIncludeDirectories) + MultiThreadedDLL + Level3 + ProgramDatabase + MaxSpeed + false + /W3 %(AdditionalOptions) + Default + + + MachineX64 + false + Console + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;bcrypt.lib;ucrt.lib;%(AdditionalDependencies) + + + copy /b "$(SolutionDir)\$(Configuration)\$(ProjectName)\bc.exe" "$(SolutionDir)\$(Configuration)\$(ProjectName)\dc.exe" + + + Copying bc to dc... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/contrib/bc/bc.vcxproj.filters b/contrib/bc/bc.vcxproj.filters new file mode 100644 index 000000000000..bc72b60519e9 --- /dev/null +++ b/contrib/bc/bc.vcxproj.filters @@ -0,0 +1,182 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + + + + + + + + + + + Resource Files + + + Resource Files + + + + + Resource Files + + + Resource Files + + + \ No newline at end of file diff --git a/contrib/bc/bcl.sln b/contrib/bc/bcl.sln new file mode 100644 index 000000000000..77009a439db3 --- /dev/null +++ b/contrib/bc/bcl.sln @@ -0,0 +1,31 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31129.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "bcl", "bcl.vcxproj", "{D2CC3DCF-7919-4DEF-839D-E9B897EC3E8E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution *** 66043 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sat Apr 10 15:18:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE60A5CF25C for ; Sat, 10 Apr 2021 15:18:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FHdtY4mSMz3hD2 for ; Sat, 10 Apr 2021 15:18:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72c.google.com with SMTP id c123so4118291qke.1 for ; Sat, 10 Apr 2021 08:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZVeIIpQlvReYXs7JaR6DHcuTODBRDiQMCM3ScSmW85o=; b=iLBZtT+xRgvVwsxzOxkTOkxCkXarDz8kAlbj/J9BR+OLMEEx3vh4acbHpkDlz3ghvi FYSEh//wkLcSmHa/2YnAzcqB8sNvuZlWQVj5Z7l7l0+WxQtwmLJmCtaiMLjx6rj3aXDu JtVGThYhY9thOAp0SLO6bkOzp9eSnQMEeFvB9QXZFabaLi0BPwgDL3ETUB1dzIzcLmTS CFn7ZadG07hIqTZPcU4nagvLV1CtsHOTwvfLptzdUz/GwuJXJKeZyiLmuOQdsQNeYdaM VKqSkfixnPScyH5lgG9zGxi8JNYgsfIIF7E34C2nsWR3bhouLGSdcOSHj/CMlU1kfHi8 xaTQ== 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=ZVeIIpQlvReYXs7JaR6DHcuTODBRDiQMCM3ScSmW85o=; b=jJvCzTbSlf0k6M0ZPMmyDXMODkKqFAuM3oalCka0/HBtI2MLX4ojFleQyTQ+sAP04N 1qqRr+4CFXDAxCXaNtc1dpZw1LbdGOmj1sXUnmp6EuM03e/m8i6TQe1UxyHVjBWBMhvV LodsL5oLbP19V6QPRjsAAzG3ygwHhueqZjP+xh52ot+0l5NPhCSg/UVMzLNsyMtygZim LhT3ye/C0bcIWIhoPaNyLInjnFX28rbb7MfSHy1sUT/UIXozu2mkFJiY8trJAqIMx1Gu 14Dt2ouE+ANga8bbzPuhdlZEhCBa/uYs/OsGffB0m6+iUFp4ezRSytKgl0AuLAbUkrvJ PcEw== X-Gm-Message-State: AOAM5319QJw79JNdzVEYsV0tvjPN6JyE3wrxRf10VXeWt+f1TIEYqq4g Tw1qk6lZWmIqU9cB5d+E6jOv50uHmYTjhNojDt4Tug== X-Google-Smtp-Source: ABdhPJyfMRyeTIfQmIc+nsUrh4R8y2fpSADwcVM0XrSmxhNlte4+G6bMaMjfs3Rs/E/ckRjczQLnEDku9gNY00Fw8EE= X-Received: by 2002:a37:611:: with SMTP id 17mr5288281qkg.206.1618067908496; Sat, 10 Apr 2021 08:18:28 -0700 (PDT) MIME-Version: 1.0 References: <202104100832.13A8WiAg015126@gitrepo.freebsd.org> <20210410162324.343d3624@FreeBSD.org> In-Reply-To: <20210410162324.343d3624@FreeBSD.org> From: Warner Losh Date: Sat, 10 Apr 2021 09:18:16 -0600 Message-ID: Subject: Re: git: 44f3b1aa980e - main - rc: kldxref only needs to depend on rootfs, not FILESYSTEMS To: =?UTF-8?Q?T=C4=B3l_Coosemans?= Cc: Edward Tomasz Napierala , src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4FHdtY4mSMz3hD2 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 15:18:29 -0000 On Sat, Apr 10, 2021, 8:23 AM T=C4=B3l Coosemans wrote: > On Sat, 10 Apr 2021 08:32:44 GMT Edward Tomasz Napierala > wrote: > > The branch main has been updated by trasz: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D44f3b1aa980e747ce9b72ba4333c80a= 99d8cd966 > > > > commit 44f3b1aa980e747ce9b72ba4333c80a99d8cd966 > > Author: Edward Tomasz Napierala > > AuthorDate: 2021-04-10 08:19:25 +0000 > > Commit: Edward Tomasz Napierala > > CommitDate: 2021-04-10 08:31:12 +0000 > > > > rc: kldxref only needs to depend on rootfs, not FILESYSTEMS > > > > This makes it run a bit earlier in the startup, which will > > be useful for the linux rc script later on. > > > > Reviewed By: imp (earlier version) > > Sponsored By: EPSRC > > Differential Revision: https://reviews.freebsd.org/D29589 > > --- > > libexec/rc/rc.d/kldxref | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libexec/rc/rc.d/kldxref b/libexec/rc/rc.d/kldxref > > index 4d232ee0d4cf..4c1fa15f2a35 100755 > > --- a/libexec/rc/rc.d/kldxref > > +++ b/libexec/rc/rc.d/kldxref > > @@ -4,7 +4,7 @@ > > # > > > > # PROVIDE: kldxref > > -# REQUIRE: FILESYSTEMS > > +# REQUIRE: root > > # BEFORE: netif > > # KEYWORD: nojail > > > > kldxref is in /usr which may be a separate file system so this requires > at least mountcritlocal. > I'd forgotten that detail. Maybe we should move it there. Warner > From owner-dev-commits-src-all@freebsd.org Sat Apr 10 15:27:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7AA105CF8D6 for ; Sat, 10 Apr 2021 15:27:57 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x72d.google.com (mail-qk1-x72d.google.com [IPv6:2607:f8b0:4864:20::72d]) (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 4FHf5T2nQjz3hWX for ; Sat, 10 Apr 2021 15:27:57 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x72d.google.com with SMTP id c123so4134108qke.1 for ; Sat, 10 Apr 2021 08:27:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Wm0hHA2juysPoxxyL+aoV14wRM+y6dvLeN2sJIh0kFc=; b=hMko1qDl8b5tHTTz6t17Xu214ubtk73Ih1rLmJwLFztE2ITcbbraCPLXOOnGwzszMx oNuK5WA2umTO6kgK0JMi3gOTXWfcaTz4aSb/iaVcpERA7yJkvfmuFCMuLI+FuQBmfFjs gtpI7SvxbWozfdjMaT4zMRk6BqTTNM3tBPFaoLK+BS6YziY4xTImmsusYqXtyH5yuiB+ KgvDyGim0mN3MTOqjQZzFZCSigI2QjMD3bxYF8X30ZB/NKFt0cDgPZS8uZM9u1433t7W Ixn6ovLem1na8UjKQtI62ZXtGZDryJITCr2n1OvYegezK3WD07G2Gkq44oyJOxbolfqy +7iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Wm0hHA2juysPoxxyL+aoV14wRM+y6dvLeN2sJIh0kFc=; b=nsZRT3zO1KOahWO5DF+vJVReYP6VDLNNrKIyV+BxeiSXJZ5W3On8/TA1uvZI6etzDF OXEfj0AP00CtHZPaiZBDO6RPPkKXKqdfefUvtBIMuMrS+WAIUDFM5e1qI9SJNVqULs3z 34JQ3VoFWaO/cyIFcK1d83UXX8ymr5enByICx/0BWZnWU+6iq3/WEtIW1+9SN0QyAL/h /DzLt+4AKa+AkF8YazNus+Qz4EAf/qtFKq56ZZeI6JYPriovFZxLdxBqDO2w2V9QCtrw zmFDPukSYha7Kyau3Ext2vsyh479BjTn4BE3nmpiHcMB1z/VsoUWx1t1+FbGzd8tn+B6 JkAw== X-Gm-Message-State: AOAM533lA9E0BrYfLgnzFOeRSi06ozdfgXnb437hurM0P0xhLy6SCkB2 Ukusb0rn7MIEzMjD5+pfDmJWVg== X-Google-Smtp-Source: ABdhPJwofQeIRZRvxkN2L2T0h1fsmei3q5VAkLVZAFfn9M8qaZGpKMokCEusONwM5U14MtuQQnJBTQ== X-Received: by 2002:a05:620a:108f:: with SMTP id g15mr19650939qkk.298.1618068476310; Sat, 10 Apr 2021 08:27:56 -0700 (PDT) Received: from mutt-hbsd (pool-100-16-222-53.bltmmd.fios.verizon.net. [100.16.222.53]) by smtp.gmail.com with ESMTPSA id e14sm3908095qte.78.2021.04.10.08.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Apr 2021 08:27:55 -0700 (PDT) Date: Sat, 10 Apr 2021 11:27:54 -0400 From: Shawn Webb To: Kristof Provost Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 0dd13c77432a - main - libnv: Build PIC Message-ID: <20210410152754.4isx26qyvz6k3qbo@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 14.0-CURRENT-HBSD FreeBSD 14.0-CURRENT-HBSD X-PGP-Key: https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/blob/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc References: <202104100916.13A9GMOp069019@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="bn3s3dhmbz3p573s" Content-Disposition: inline In-Reply-To: <202104100916.13A9GMOp069019@gitrepo.freebsd.org> X-Rspamd-Queue-Id: 4FHf5T2nQjz3hWX 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 15:27:57 -0000 --bn3s3dhmbz3p573s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Apr 10, 2021 at 09:16:22AM +0000, Kristof Provost wrote: > The branch main has been updated by kp: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D0dd13c77432ade1ae94c9661cb= ad5537e3e6ab1d >=20 > commit 0dd13c77432ade1ae94c9661cbad5537e3e6ab1d > Author: Kristof Provost > AuthorDate: 2021-04-02 15:06:02 +0000 > Commit: Kristof Provost > CommitDate: 2021-04-10 09:16:01 +0000 >=20 > libnv: Build PIC > =20 > Build libnv as position independent code so we can use it from shared > libraries. > =20 > MFC after: 4 weeks > Sponsored by: Rubicon Communications, LLC ("Netgate") > Differential Revision: https://reviews.freebsd.org/D29561 > --- > lib/libnv/Makefile | 1 + > 1 file changed, 1 insertion(+) >=20 > diff --git a/lib/libnv/Makefile b/lib/libnv/Makefile > index b13758931c4e..854cd2c7f3f3 100644 > --- a/lib/libnv/Makefile > +++ b/lib/libnv/Makefile > @@ -10,6 +10,7 @@ SHLIB_MAJOR=3D 0 > =20 > .PATH: ${SRCTOP}/sys/contrib/libnv ${SRCTOP}/sys/sys > CFLAGS+=3D-I${.CURDIR} > +CFLAGS+=3D-fPIC Wouldn't the better fix be renaming LIB to SHLIB like every other PIC lib? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A= 4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --bn3s3dhmbz3p573s Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmBxw/gACgkQ/y5nonf4 4fqb9Q//QQXXForXJWJb9XCneQhDkG+++fMY8Qyfed7UJCZ8exmk9GPl9TiQgt+h tX62sdpSqTUCHXlXd+xa+zUc/RvXz8vBXXTtNRIlkaNuP1HWCkioS0QQ+u5Or4NP VQFsBnysiynLzd9WEl/fykA2O9vQ7lVjs0HOsl2KDp6pG13/k2kAG7XPg7ZHezrq qDsrAkrIaYVK5BTltVZghv/l5ZsbYJo8mYfYgbKBZocceMw20HaR7uHvbRt3C6Ju efvrBOpzcdaeZG/WU+chm+r7yh80pWQuCrg7sFgc+/6Q6ZWrz8zazxKG4UK3pb/L DPm6ThozdlC3+mc3naIHgK6dXtgh41avTvU/dl4ZGtliuSUfUR1NHQmZ41/hZTGK JM/4socOUOCw6e+llK2cgFsFwOzHup5xbyb2CeCnH/MSqgmCyC1RaPenkqrzSVmq HTJjDVxyhT3UTycIak6NFmDbja9MAu6Sw0KSiVCfAH6T/vThzxqKs35vS09AAJ0m Xz3qpSKylYuwkKlX2OCeFVizfd7cg4Z2tLIilyVjZuiQZjDu1UksSFSXFKwbjZCz tBTefSnat4SDh42mXl2BPJ7NbzySthtqAx5s5QtYNwnFMAhOhKtEdlojqjLGuU9I TkHqnPHTJ6jDNdFUi+3YdkXSp06Kc/JfNMpSWj1LX54xPwPDvRg= =th8p -----END PGP SIGNATURE----- --bn3s3dhmbz3p573s-- From owner-dev-commits-src-all@freebsd.org Sat Apr 10 15:53:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C08C5D02F9; Sat, 10 Apr 2021 15:53: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 4FHffs25fFz3kCk; Sat, 10 Apr 2021 15:53: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 3AD3314231; Sat, 10 Apr 2021 15:53: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 13AFrPoJ000537; Sat, 10 Apr 2021 15:53:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13AFrPoZ000536; Sat, 10 Apr 2021 15:53:25 GMT (envelope-from git) Date: Sat, 10 Apr 2021 15:53:25 GMT Message-Id: <202104101553.13AFrPoZ000536@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: 7f5f3fcc32bf - main - Fix direct route installation with net/bird. 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: 7f5f3fcc32bfa553faa007579dfcaed84be3b047 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 15:53:25 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=7f5f3fcc32bfa553faa007579dfcaed84be3b047 commit 7f5f3fcc32bfa553faa007579dfcaed84be3b047 Author: Alexander V. Chernikov AuthorDate: 2021-04-10 15:25:24 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-10 15:31:16 +0000 Fix direct route installation with net/bird. Slighly relax the gateway validation rules imposed by the 2fe5a79425c7, by requiring only first 8 bytes (everyhing before sdl_data to be present in the AF_LINK gateway. Reported by: olivier --- sys/net/rtsock.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 12e485f917c8..c0996d318fb2 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1381,20 +1381,21 @@ cleanup_xaddrs_gateway(struct rt_addrinfo *info) #endif case AF_LINK: { - struct sockaddr_dl_short *gw_sdl; + struct sockaddr_dl *gw_sdl; - gw_sdl = (struct sockaddr_dl_short *)gw; - if (gw_sdl->sdl_len < sizeof(struct sockaddr_dl_short)) { + size_t sdl_min_len = offsetof(struct sockaddr_dl, sdl_data); + gw_sdl = (struct sockaddr_dl *)gw; + if (gw_sdl->sdl_len < sdl_min_len) { printf("gw sdl_len too small\n"); return (EINVAL); } const struct sockaddr_dl_short sdl = { .sdl_family = AF_LINK, - .sdl_len = sizeof(struct sockaddr_dl_short), + .sdl_len = sdl_min_len, .sdl_index = gw_sdl->sdl_index, }; - *gw_sdl = sdl; + memcpy(gw_sdl, &sdl, sdl_min_len); break; } } From owner-dev-commits-src-all@freebsd.org Sat Apr 10 16:20:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D52B85D0D4F; Sat, 10 Apr 2021 16:20:21 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FHgFx2k35z3kj0; Sat, 10 Apr 2021 16:20:20 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.66.148.124]) by shaw.ca with ESMTPA id VGLIlW8SieHr9VGLKlHpX4; Sat, 10 Apr 2021 10:20:19 -0600 X-Authority-Analysis: v=2.4 cv=Yq/K+6UX c=1 sm=1 tr=0 ts=6071d043 a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=3YhXtTcJ-WEA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=xN-WTXkyU223RTnX_BEA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 295E4229B; Sat, 10 Apr 2021 09:20:16 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 13AGKF0B007790; Sat, 10 Apr 2021 09:20:16 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202104101620.13AGKF0B007790@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: =?UTF-8?B?VMSzbA==?= Coosemans cc: Edward Tomasz Napierala , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 44f3b1aa980e - main - rc: kldxref only needs to depend on rootfs, not FILESYSTEMS In-reply-to: <20210410162324.343d3624@FreeBSD.org> References: <202104100832.13A8WiAg015126@gitrepo.freebsd.org> <20210410162324.343d3624@FreeBSD.org> Comments: In-reply-to =?UTF-8?B?VMSzbA==?= Coosemans message dated "Sat, 10 Apr 2021 16:23:24 +0200." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 10 Apr 2021 09:20:15 -0700 X-CMAE-Envelope: MS4xfMmsdcX5SFG2UE9MiIXYcfr9svnupMxugaLX5yZMopo1OlnpAPpGJJggjEQ0Eo+Pfxz92qTX4/fa3Ktzf23UAlGyEdHZxGMvex32STWElRlgLIEboRH7 nx78D01vyIOXgzebRjIlPboG8YXtVJflxmRIqQ4TksdwfyhVXZLdreDdge6PLiNqlrpDJfqWEJH9zpA8X2yRCzPMKJTlDVmx5pzQSMbw8jhzSkpk2LYaWypk uScAYajPWrU4TYHJCj1kK0laYQSfzGoFjWMV5f6B5Rl0CUEuc+Oo2Xtc/VDs48/Xu1TgVUVXzFPpAKc5DJsdGBBtgBR22n4vctGXqWx25HI9GTb3idFgpKvS 8IiiwUFu X-Rspamd-Queue-Id: 4FHgFx2k35z3kj0 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 16:20:21 -0000 In message <20210410162324.343d3624@FreeBSD.org>, =?UTF-8?B?VMSzbA==?= Cooseman s writes: > On Sat, 10 Apr 2021 08:32:44 GMT Edward Tomasz Napierala > wrote: > > The branch main has been updated by trasz: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=44f3b1aa980e747ce9b72ba4333c80 > a99d8cd966 > > > > commit 44f3b1aa980e747ce9b72ba4333c80a99d8cd966 > > Author: Edward Tomasz Napierala > > AuthorDate: 2021-04-10 08:19:25 +0000 > > Commit: Edward Tomasz Napierala > > CommitDate: 2021-04-10 08:31:12 +0000 > > > > rc: kldxref only needs to depend on rootfs, not FILESYSTEMS > > > > This makes it run a bit earlier in the startup, which will > > be useful for the linux rc script later on. > > > > Reviewed By: imp (earlier version) > > Sponsored By: EPSRC > > Differential Revision: https://reviews.freebsd.org/D29589 > > --- > > libexec/rc/rc.d/kldxref | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/libexec/rc/rc.d/kldxref b/libexec/rc/rc.d/kldxref > > index 4d232ee0d4cf..4c1fa15f2a35 100755 > > --- a/libexec/rc/rc.d/kldxref > > +++ b/libexec/rc/rc.d/kldxref > > @@ -4,7 +4,7 @@ > > # > > > > # PROVIDE: kldxref > > -# REQUIRE: FILESYSTEMS > > +# REQUIRE: root > > # BEFORE: netif > > # KEYWORD: nojail > > > > kldxref is in /usr which may be a separate file system so this requires > at least mountcritlocal. > Yes, this will be a problem here on two of my systems. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Sat Apr 10 16:58:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 559E65D2263; Sat, 10 Apr 2021 16:58:57 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FHh6S62x6z3mgr; Sat, 10 Apr 2021 16:58:56 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.66.148.124]) by shaw.ca with ESMTPA id VGwflWMh8eHr9VGwhlHxg3; Sat, 10 Apr 2021 10:58:55 -0600 X-Authority-Analysis: v=2.4 cv=Yq/K+6UX c=1 sm=1 tr=0 ts=6071d94f a=Cwc3rblV8FOMdVN/wOAqyQ==:117 a=Cwc3rblV8FOMdVN/wOAqyQ==:17 a=kj9zAlcOel0A:10 a=3YhXtTcJ-WEA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=Q0dhoez1tl3BAHiCBI8A:9 a=JOWeiY5itpwPQvuQ8dm/GawRuwE=:19 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id CC771226C; Sat, 10 Apr 2021 09:58:52 -0700 (PDT) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 13AGwq0t098644; Sat, 10 Apr 2021 09:58:52 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202104101658.13AGwq0t098644@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Warner Losh cc: =?UTF-8?Q?T=C4=B3l_Coosemans?= , Edward Tomasz Napierala , src-committers , "" , dev-commits-src-main@freebsd.org Subject: Re: git: 44f3b1aa980e - main - rc: kldxref only needs to depend on rootfs, not FILESYSTEMS In-reply-to: References: <202104100832.13A8WiAg015126@gitrepo.freebsd.org> <20210410162324.343d3624@FreeBSD.org> Comments: In-reply-to Warner Losh message dated "Sat, 10 Apr 2021 09:18:16 -0600." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 10 Apr 2021 09:58:52 -0700 X-CMAE-Envelope: MS4xfAPQRauiGXSidjlQIJRTWwZlumek8N8yiX4WjbwMSad7XRR8U3Hqoc7VxG1VVqsAkh3y0Mojpi2TSKWHZgF32xB2dQ9NEZtCXH4guRj2KTmZQLzYNLpF MdlADWMwKRKSIGgzz/zBOPL4kJ6gjc9AdGvubmwF3EDmFAB45/+Cd56RlG+gY+ThCMvsdWgfVqyVDUnFs3lqZTQPW3NApW9ZYuE1neV7B5u0FENxYobOiCSQ GRaXbYROe3c1z6KWhRBSNIXnBSr+3nnsvkznTDSXzkMzIiLZhaUYQ4dMkkzZn3WfOM9SHRK06GBKu6+MisUz2ckAFuZaH4uEuyStuoEg9A7u7oyTq527hx0x 8q7gVAjTjg4CfaLKB9vblUTobzF7ew== X-Rspamd-Queue-Id: 4FHh6S62x6z3mgr 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 16:58:57 -0000 In message , Warner Losh writes: > --000000000000e89f2905bf9fcabb > Content-Type: text/plain; charset="UTF-8" > Content-Transfer-Encoding: quoted-printable > > On Sat, Apr 10, 2021, 8:23 AM T=C4=B3l Coosemans wrote: > > > On Sat, 10 Apr 2021 08:32:44 GMT Edward Tomasz Napierala > > wrote: > > > The branch main has been updated by trasz: > > > > > > URL: > > https://cgit.FreeBSD.org/src/commit/?id=3D44f3b1aa980e747ce9b72ba4333c80a= > 99d8cd966 > > > > > > commit 44f3b1aa980e747ce9b72ba4333c80a99d8cd966 > > > Author: Edward Tomasz Napierala > > > AuthorDate: 2021-04-10 08:19:25 +0000 > > > Commit: Edward Tomasz Napierala > > > CommitDate: 2021-04-10 08:31:12 +0000 > > > > > > rc: kldxref only needs to depend on rootfs, not FILESYSTEMS > > > > > > This makes it run a bit earlier in the startup, which will > > > be useful for the linux rc script later on. > > > > > > Reviewed By: imp (earlier version) > > > Sponsored By: EPSRC > > > Differential Revision: https://reviews.freebsd.org/D29589 > > > --- > > > libexec/rc/rc.d/kldxref | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/libexec/rc/rc.d/kldxref b/libexec/rc/rc.d/kldxref > > > index 4d232ee0d4cf..4c1fa15f2a35 100755 > > > --- a/libexec/rc/rc.d/kldxref > > > +++ b/libexec/rc/rc.d/kldxref > > > @@ -4,7 +4,7 @@ > > > # > > > > > > # PROVIDE: kldxref > > > -# REQUIRE: FILESYSTEMS > > > +# REQUIRE: root > > > # BEFORE: netif > > > # KEYWORD: nojail > > > > > > > kldxref is in /usr which may be a separate file system so this requires > > at least mountcritlocal. > > > > I'd forgotten that detail. Maybe we should move it there. This makes a lot more sense because systems that NFS mount /usr may still break if the dependency is mountcritlocal. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-dev-commits-src-all@freebsd.org Sat Apr 10 20:35:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F14F5D7357; Sat, 10 Apr 2021 20:35: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 4FHmvq1qTXz4R3r; Sat, 10 Apr 2021 20:35: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 2D03B17B35; Sat, 10 Apr 2021 20:35: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 13AKZ3MB070699; Sat, 10 Apr 2021 20:35:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13AKZ3us070698; Sat, 10 Apr 2021 20:35:03 GMT (envelope-from git) Date: Sat, 10 Apr 2021 20:35:03 GMT Message-Id: <202104102035.13AKZ3us070698@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: a7fbfdee732b - main - zfs: change format string in zio_fini to get rid of the cast 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: a7fbfdee732bd8728d0e642016bf8b6548cfa1bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 20:35:03 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=a7fbfdee732bd8728d0e642016bf8b6548cfa1bb commit a7fbfdee732bd8728d0e642016bf8b6548cfa1bb Author: Mateusz Guzik AuthorDate: 2021-04-10 19:12:00 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-10 20:33:43 +0000 zfs: change format string in zio_fini to get rid of the cast --- sys/contrib/openzfs/module/zfs/zio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/contrib/openzfs/module/zfs/zio.c b/sys/contrib/openzfs/module/zfs/zio.c index a7820e75670b..8b4a9a220c3d 100644 --- a/sys/contrib/openzfs/module/zfs/zio.c +++ b/sys/contrib/openzfs/module/zfs/zio.c @@ -293,9 +293,9 @@ zio_fini(void) for (i = 0; i < n; i++) { if (zio_buf_cache[i] != NULL) - panic("zio_fini: zio_buf_cache[%d] != NULL", (int)i); + panic("zio_fini: zio_buf_cache[%zd] != NULL", i); if (zio_data_buf_cache[i] != NULL) - panic("zio_fini: zio_data_buf_cache[%d] != NULL", (int)i); + panic("zio_fini: zio_data_buf_cache[%zd] != NULL", i); } kmem_cache_destroy(zio_link_cache); From owner-dev-commits-src-all@freebsd.org Sat Apr 10 22:53:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FDA25DAB11; Sat, 10 Apr 2021 22:53: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 4FHqzp46DBz4WvM; Sat, 10 Apr 2021 22:53: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 7FBAA19999; Sat, 10 Apr 2021 22:53: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 13AMrgdO055449; Sat, 10 Apr 2021 22:53:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13AMrgvM055448; Sat, 10 Apr 2021 22:53:42 GMT (envelope-from git) Date: Sat, 10 Apr 2021 22:53:42 GMT Message-Id: <202104102253.13AMrgvM055448@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: 22cefe3d8378 - main - nfsd: fix replies from session cache for multiple retries 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: 22cefe3d8378f58adcdbb2c7589b9f30c2a38315 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 22:53:42 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=22cefe3d8378f58adcdbb2c7589b9f30c2a38315 commit 22cefe3d8378f58adcdbb2c7589b9f30c2a38315 Author: Rick Macklem AuthorDate: 2021-04-10 22:50:25 +0000 Commit: Rick Macklem CommitDate: 2021-04-10 22:50:25 +0000 nfsd: fix replies from session cache for multiple retries Recent testing of network partitioning a FreeBSD NFSv4.1 server from a Linux NFSv4.1 client identified problems with both the FreeBSD server and Linux client. Commit 05a39c2c1c18 fixed replying with the cached reply in in the session slot if same session slot sequence#. However, the code uses the reply and, as such, will fail for a subsequent retry of the RPC. A subsequent retry would be an extremely rare event, but this patch fixes this, so long as m_copym(..M_NOWAIT) does not fail, which should also be a rare event. This fix affects the exceedingly rare case where a NFSv4 client retries a non-idempotent RPC, such as a lock operation, multiple times. Note that retries only occur after the client has needed to create a new TCP connection, with a new TCP connection for each retry. MFC after: 2 weeks --- sys/fs/nfs/nfs_commonsubs.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index e9b2af17d8b4..43bb396d9cfd 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -4619,6 +4619,7 @@ int nfsv4_seqsession(uint32_t seqid, uint32_t slotid, uint32_t highslot, struct nfsslot *slots, struct mbuf **reply, uint16_t maxslot) { + struct mbuf *m; int error; error = 0; @@ -4632,8 +4633,14 @@ nfsv4_seqsession(uint32_t seqid, uint32_t slotid, uint32_t highslot, error = NFSERR_DELAY; else if (slots[slotid].nfssl_reply != NULL) { if (reply != NULL) { - *reply = slots[slotid].nfssl_reply; - slots[slotid].nfssl_reply = NULL; + m = m_copym(slots[slotid].nfssl_reply, 0, + M_COPYALL, M_NOWAIT); + if (m != NULL) + *reply = m; + else { + *reply = slots[slotid].nfssl_reply; + slots[slotid].nfssl_reply = NULL; + } } slots[slotid].nfssl_inprog = 1; error = NFSERR_REPLYFROMCACHE; @@ -4660,10 +4667,29 @@ void nfsv4_seqsess_cacherep(uint32_t slotid, struct nfsslot *slots, int repstat, struct mbuf **rep) { + struct mbuf *m; if (repstat == NFSERR_REPLYFROMCACHE) { - *rep = slots[slotid].nfssl_reply; - slots[slotid].nfssl_reply = NULL; + if (slots[slotid].nfssl_reply != NULL) { + /* + * We cannot sleep here, but copy will usually + * succeed. + */ + m = m_copym(slots[slotid].nfssl_reply, 0, M_COPYALL, + M_NOWAIT); + if (m != NULL) + *rep = m; + else { + /* + * Multiple retries would be extremely rare, + * so using the cached reply will likely + * be ok. + */ + *rep = slots[slotid].nfssl_reply; + slots[slotid].nfssl_reply = NULL; + } + } else + *rep = NULL; } else { if (slots[slotid].nfssl_reply != NULL) m_freem(slots[slotid].nfssl_reply); From owner-dev-commits-src-all@freebsd.org Sun Apr 11 00:56:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F157E5DCFDC; Sun, 11 Apr 2021 00:56: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 4FHtjP6b7Wz4c7r; Sun, 11 Apr 2021 00:56: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 D544B1B125; Sun, 11 Apr 2021 00:56: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 13B0uPmf014311; Sun, 11 Apr 2021 00:56:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13B0uPXT014310; Sun, 11 Apr 2021 00:56:25 GMT (envelope-from git) Date: Sun, 11 Apr 2021 00:56:25 GMT Message-Id: <202104110056.13B0uPXT014310@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: c28f5f9b3e99 - stable/13 - Add sysctl debug.uma_reclaim 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/stable/13 X-Git-Reftype: branch X-Git-Commit: c28f5f9b3e99e3785228e05907a00f36b249c37a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 00:56:26 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=c28f5f9b3e99e3785228e05907a00f36b249c37a commit c28f5f9b3e99e3785228e05907a00f36b249c37a Author: Konstantin Belousov AuthorDate: 2021-04-04 16:28:14 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-11 00:35:16 +0000 Add sysctl debug.uma_reclaim (cherry picked from commit 89619b747bcff379dca98e975a98865a45366417) --- sys/vm/vm_kern.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 8d6e4f678970..93c9e8c638bc 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -898,3 +898,23 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, 0, debug_vm_lowmem, "I", "set to trigger vm_lowmem event with given flags"); + +static int +debug_uma_reclaim(SYSCTL_HANDLER_ARGS) +{ + int error, i; + + i = 0; + error = sysctl_handle_int(oidp, &i, 0, req); + if (error != 0) + return (error); + if (i != UMA_RECLAIM_TRIM && i != UMA_RECLAIM_DRAIN && + i != UMA_RECLAIM_DRAIN_CPU) + return (EINVAL); + uma_reclaim(i); + return (0); +} + +SYSCTL_PROC(_debug, OID_AUTO, uma_reclaim, + CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, 0, debug_uma_reclaim, "I", + "set to generate request to reclaim uma caches"); From owner-dev-commits-src-all@freebsd.org Sun Apr 11 00:56:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 904E15DD0D3; Sun, 11 Apr 2021 00:56: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 4FHtjR05xjz4cJj; Sun, 11 Apr 2021 00:56: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 E9BF31B31A; Sun, 11 Apr 2021 00:56: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 13B0uQdp014332; Sun, 11 Apr 2021 00:56:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13B0uQpm014331; Sun, 11 Apr 2021 00:56:26 GMT (envelope-from git) Date: Sun, 11 Apr 2021 00:56:26 GMT Message-Id: <202104110056.13B0uQpm014331@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: de87ea5a43a8 - stable/13 - struct mount uppers: correct locking annotations 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/stable/13 X-Git-Reftype: branch X-Git-Commit: de87ea5a43a850079b5f8901795f3769c85c6f89 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 00:56:27 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=de87ea5a43a850079b5f8901795f3769c85c6f89 commit de87ea5a43a850079b5f8901795f3769c85c6f89 Author: Konstantin Belousov AuthorDate: 2021-04-08 22:03:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-11 00:35:23 +0000 struct mount uppers: correct locking annotations (cherry picked from commit 5af1131de7fc18c795ed28e69d9393f78875d3e5) --- sys/sys/mount.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/sys/mount.h b/sys/sys/mount.h index e6a74bf1fb60..8b5712d19215 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -196,6 +196,7 @@ _Static_assert(sizeof(struct mount_pcpu) == 16, * l - mnt_listmtx * m - mountlist_mtx * i - interlock + * i* - interlock of uppers' list head * v - vnode freelist mutex * * Unmarked fields are considered stable as long as a ref is held. @@ -240,8 +241,8 @@ struct mount { struct vnodelst mnt_lazyvnodelist; /* (l) list of lazy vnodes */ int mnt_lazyvnodelistsize; /* (l) # of lazy vnodes */ struct lock mnt_explock; /* vfs_export walkers lock */ - TAILQ_ENTRY(mount) mnt_upper_link; /* (m) we in the all uppers */ - TAILQ_HEAD(, mount) mnt_uppers; /* (m) upper mounts over us*/ + TAILQ_ENTRY(mount) mnt_upper_link; /* (i*) we in the all uppers */ + TAILQ_HEAD(, mount) mnt_uppers; /* (i) upper mounts over us */ }; /* From owner-dev-commits-src-all@freebsd.org Sun Apr 11 04:59:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31EB45E1178; Sun, 11 Apr 2021 04:59: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 4FJ05Y6n9dz4mgJ; Sun, 11 Apr 2021 04:59: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 DB8781E159; Sun, 11 Apr 2021 04:59: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 13B4xD0k031157; Sun, 11 Apr 2021 04:59:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13B4xDgN031156; Sun, 11 Apr 2021 04:59:13 GMT (envelope-from git) Date: Sun, 11 Apr 2021 04:59:13 GMT Message-Id: <202104110459.13B4xDgN031156@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: feea35bed0dd - main - zfs: make vnlru_free_vfsops use conditional on version 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: feea35bed0dd7a029b70b700cc3c0d2139e3deb8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 04:59:14 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=feea35bed0dd7a029b70b700cc3c0d2139e3deb8 commit feea35bed0dd7a029b70b700cc3c0d2139e3deb8 Author: Mateusz Guzik AuthorDate: 2021-04-11 04:49:24 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-11 04:57:26 +0000 zfs: make vnlru_free_vfsops use conditional on version Diff reduction against upstream. --- sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c index 0d5cffbe8d1e..201dbc423336 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c @@ -51,8 +51,10 @@ #include #include +#if __FreeBSD_version >= 1300139 static struct sx arc_vnlru_lock; static struct vnode *arc_vnlru_marker; +#endif extern struct vfsops zfs_vfsops; @@ -160,9 +162,13 @@ arc_prune_task(void *arg) arc_reduce_target_size(ptob(nr_scan)); free(arg, M_TEMP); +#if __FreeBSD_version >= 1300139 sx_xlock(&arc_vnlru_lock); vnlru_free_vfsops(nr_scan, &zfs_vfsops, arc_vnlru_marker); sx_xunlock(&arc_vnlru_lock); +#else + vnlru_free(nr_scan, &zfs_vfsops); +#endif } /* @@ -239,8 +245,10 @@ arc_lowmem_init(void) { arc_event_lowmem = EVENTHANDLER_REGISTER(vm_lowmem, arc_lowmem, NULL, EVENTHANDLER_PRI_FIRST); +#if __FreeBSD_version >= 1300139 arc_vnlru_marker = vnlru_alloc_marker(); sx_init(&arc_vnlru_lock, "arc vnlru lock"); +#endif } void @@ -248,10 +256,12 @@ arc_lowmem_fini(void) { if (arc_event_lowmem != NULL) EVENTHANDLER_DEREGISTER(vm_lowmem, arc_event_lowmem); +#if __FreeBSD_version >= 1300139 if (arc_vnlru_marker != NULL) { vnlru_free_marker(arc_vnlru_marker); sx_destroy(&arc_vnlru_lock); } +#endif } void From owner-dev-commits-src-all@freebsd.org Sun Apr 11 06:43:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB0725E285D; Sun, 11 Apr 2021 06:43: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 4FJ2PT4Qfzz4r2w; Sun, 11 Apr 2021 06:43: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 8A3751F9A9; Sun, 11 Apr 2021 06:43: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 13B6h9im076305; Sun, 11 Apr 2021 06:43:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13B6h91E076304; Sun, 11 Apr 2021 06:43:09 GMT (envelope-from git) Date: Sun, 11 Apr 2021 06:43:09 GMT Message-Id: <202104110643.13B6h91E076304@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: 97ed4babb516 - main - zfs: avoid memory allocation in arc_prune_async 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: 97ed4babb51636d8a4b11bc7b207c3219ffcd0e3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 06:43:09 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=97ed4babb51636d8a4b11bc7b207c3219ffcd0e3 commit 97ed4babb51636d8a4b11bc7b207c3219ffcd0e3 Author: Mateusz Guzik AuthorDate: 2021-04-11 05:15:41 +0000 Commit: Mateusz Guzik CommitDate: 2021-04-11 05:19:56 +0000 zfs: avoid memory allocation in arc_prune_async --- sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c index 201dbc423336..e73efd810e53 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c @@ -158,10 +158,13 @@ arc_default_max(uint64_t min, uint64_t allmem) static void arc_prune_task(void *arg) { - int64_t nr_scan = *(int64_t *)arg; +#ifdef __LP64__ + int64_t nr_scan = (int64_t)arg; +#else + int64_t nr_scan = (int32_t)arg; +#endif arc_reduce_target_size(ptob(nr_scan)); - free(arg, M_TEMP); #if __FreeBSD_version >= 1300139 sx_xlock(&arc_vnlru_lock); vnlru_free_vfsops(nr_scan, &zfs_vfsops, arc_vnlru_marker); @@ -185,13 +188,14 @@ arc_prune_task(void *arg) void arc_prune_async(int64_t adjust) { - int64_t *adjustptr; - if ((adjustptr = malloc(sizeof (int64_t), M_TEMP, M_NOWAIT)) == NULL) - return; +#ifndef __LP64__ + if (adjust > __LONG_MAX) + adjust = __LONG_MAX; +#endif - *adjustptr = adjust; + adjustptr = (void *)adjust; taskq_dispatch(arc_prune_taskq, arc_prune_task, adjustptr, TQ_SLEEP); ARCSTAT_BUMP(arcstat_prune); } From owner-dev-commits-src-all@freebsd.org Sun Apr 11 06:47:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8AD8F5E2DD9; Sun, 11 Apr 2021 06:47: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 4FJ2W03KzZz4rVv; Sun, 11 Apr 2021 06:47: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 65D641F8A5; Sun, 11 Apr 2021 06:47: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 13B6lu2E076794; Sun, 11 Apr 2021 06:47:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13B6luH2076793; Sun, 11 Apr 2021 06:47:56 GMT (envelope-from git) Date: Sun, 11 Apr 2021 06:47:56 GMT Message-Id: <202104110647.13B6luH2076793@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ka Ho Ng Subject: git: b77f5f5553e8 - main - vnode_pager_setsize.9: Some clarifications on the manpage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: khng X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b77f5f5553e8ac7868b4b234a36bda3cf2db0907 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 06:47:56 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=b77f5f5553e8ac7868b4b234a36bda3cf2db0907 commit b77f5f5553e8ac7868b4b234a36bda3cf2db0907 Author: Ka Ho Ng AuthorDate: 2021-04-11 06:45:37 +0000 Commit: Ka Ho Ng CommitDate: 2021-04-11 06:47:40 +0000 vnode_pager_setsize.9: Some clarifications on the manpage A number of changes: - Clarifies the locking rules when calling the routine. - Correct the description regarding the content range to be purged. - Document the effects on page fault handler. MFC after: 3 days MFC with: 86a52e262a6f Sponsored by: The FreeBSD Foundation Reviewed by: bcr, kib Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D29637 --- share/man/man9/vnode_pager_setsize.9 | 41 ++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/share/man/man9/vnode_pager_setsize.9 b/share/man/man9/vnode_pager_setsize.9 index c59a01796f20..0dc3b2057930 100644 --- a/share/man/man9/vnode_pager_setsize.9 +++ b/share/man/man9/vnode_pager_setsize.9 @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 6, 2021 +.Dd April 8, 2021 .Dt VNODE_PAGER_SETSIZE 9 .Os .Sh NAME @@ -41,26 +41,31 @@ .Fn vnode_pager_setsize "struct vnode *vp" "vm_ooffset_t nsize" .Sh DESCRIPTION .Nm -lets the VM system know about a change in size for a file. -Content beyond the new EOF specified by the -.Fa nsize -argument will be purged from the cache. -This function is useful for use within file system code to implement -truncation in -.Xr VOP_SETATTR 9 . -.Sh IMPLEMENTATION NOTES +lets the VM system know about a change in size for a file, +and updates the object size and vnode pager size of the vm object in +.Fa vp +with +.Fa nsize . +Page faults on the object mapping with offset beyond the new object +size results in +.Va SIGBUS . +.Pp +Pages between the old EOF and the new EOF are removed from the object queue +if the file size shrinks. In case the new EOF specified by the .Fa nsize -argument is not aligned to page boundaries, -partial-page area starting beyond the EOF will be zeroed. -In partial-page area, -for content occupying whole blocks within block -boundaries, -the dirty bits for the corresponding blocks will be cleared. -.Sh LOCKING -Writer lock of the VM object of +argument is not aligned to page boundary, +partial-page area starting beyond the EOF is zeroed and marked invalid. +if the page exists resident. +.Pp +In case the vnode .Fa vp -will be held within the function. +does not have a VM object allocated, the effect of calling this function is no-op. +.Pp +This function must be used within file system code to implement truncation +if the file system allocates vm objects for vnodes. +.Sh LOCKS +The vnode should be exclusively locked on entry and will still be locked on exit. .Sh SEE ALSO .Xr vnode 9 .Sh HISTORY From owner-dev-commits-src-all@freebsd.org Sun Apr 11 07:25:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 882F05E3353; Sun, 11 Apr 2021 07:25: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 4FJ3LN0V2Yz4sHb; Sun, 11 Apr 2021 07:25: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 03B6020190; Sun, 11 Apr 2021 07:25: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 13B7PVNW029429; Sun, 11 Apr 2021 07:25:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13B7PVfj029428; Sun, 11 Apr 2021 07:25:31 GMT (envelope-from git) Date: Sun, 11 Apr 2021 07:25:31 GMT Message-Id: <202104110725.13B7PVfj029428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 1a4e959eb34a - main - sh: fix debug build MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a4e959eb34ae03a96f6d0dea68b6a6a88ac4462 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 07:25:32 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=1a4e959eb34ae03a96f6d0dea68b6a6a88ac4462 commit 1a4e959eb34ae03a96f6d0dea68b6a6a88ac4462 Author: Piotr Pawel Stefaniak AuthorDate: 2021-04-11 07:09:28 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-04-11 07:23:14 +0000 sh: fix debug build Approved by: jilles --- bin/sh/show.c | 7 +++---- bin/sh/show.h | 2 ++ bin/sh/trap.c | 4 ---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/bin/sh/show.c b/bin/sh/show.c index 04dc123381af..01035d76093d 100644 --- a/bin/sh/show.c +++ b/bin/sh/show.c @@ -73,7 +73,7 @@ static void shtree(union node *n, int ind, char *pfx, FILE *fp) { struct nodelist *lp; - char *s; + const char *s; if (n == NULL) return; @@ -125,7 +125,7 @@ shcmd(union node *cmd, FILE *fp) { union node *np; int first; - char *s; + const char *s; int dftfd; first = 1; @@ -274,8 +274,7 @@ indent(int amount, char *pfx, FILE *fp) */ -FILE *tracefile; - +static FILE *tracefile; #if DEBUG >= 2 int debug = 1; #else diff --git a/bin/sh/show.h b/bin/sh/show.h index 1dbdaa152b33..790a62e2942c 100644 --- a/bin/sh/show.h +++ b/bin/sh/show.h @@ -39,4 +39,6 @@ void trargs(char **); void trputc(int); void trputs(const char *); void opentrace(void); + +extern int debug; #endif diff --git a/bin/sh/trap.c b/bin/sh/trap.c index d7a98604c22c..d7ef40274270 100644 --- a/bin/sh/trap.c +++ b/bin/sh/trap.c @@ -274,12 +274,8 @@ setsignal(int signo) break; case SIGQUIT: #ifdef DEBUG - { - extern int debug; - if (debug) break; - } #endif action = S_CATCH; break; From owner-dev-commits-src-all@freebsd.org Sun Apr 11 07:49:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D58BF5E35F0; Sun, 11 Apr 2021 07:49: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 4FJ3sk5d3Wz4tQg; Sun, 11 Apr 2021 07:49: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 B48082026E; Sun, 11 Apr 2021 07:49: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 13B7nE4D056024; Sun, 11 Apr 2021 07:49:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13B7nEDd056023; Sun, 11 Apr 2021 07:49:14 GMT (envelope-from git) Date: Sun, 11 Apr 2021 07:49:14 GMT Message-Id: <202104110749.13B7nEDd056023@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2670d879f366 - stable/12 - struct mount uppers: correct locking annotations 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 2670d879f366435ec3072b46d5a4818915b13132 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 07:49:14 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2670d879f366435ec3072b46d5a4818915b13132 commit 2670d879f366435ec3072b46d5a4818915b13132 Author: Konstantin Belousov AuthorDate: 2021-04-08 22:03:06 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-11 07:38:08 +0000 struct mount uppers: correct locking annotations (cherry picked from commit 5af1131de7fc18c795ed28e69d9393f78875d3e5) --- sys/sys/mount.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/sys/mount.h b/sys/sys/mount.h index d099e453ec1a..f1a42cb3d29b 100644 --- a/sys/sys/mount.h +++ b/sys/sys/mount.h @@ -186,6 +186,7 @@ struct vfsopt { * l - mnt_listmtx * m - mountlist_mtx * i - interlock + * i* - interlock of uppers' list head * v - vnode freelist mutex * * Unmarked fields are considered stable as long as a ref is held. @@ -229,8 +230,8 @@ struct mount { struct vnodelst mnt_tmpfreevnodelist; /* (l) list of free vnodes */ int mnt_tmpfreevnodelistsize;/* (l) # of free vnodes */ struct lock mnt_explock; /* vfs_export walkers lock */ - TAILQ_ENTRY(mount) mnt_upper_link; /* (m) we in the all uppers */ - TAILQ_HEAD(, mount) mnt_uppers; /* (m) upper mounts over us*/ + TAILQ_ENTRY(mount) mnt_upper_link; /* (i*) we in the all uppers */ + TAILQ_HEAD(, mount) mnt_uppers; /* (i) upper mounts over us */ }; /* From owner-dev-commits-src-all@freebsd.org Sun Apr 11 07:49:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EE9D5E3BE3; Sun, 11 Apr 2021 07:49: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 4FJ3sl6DNSz4swD; Sun, 11 Apr 2021 07:49: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 C7CD12026F; Sun, 11 Apr 2021 07:49: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 13B7nFOM056051; Sun, 11 Apr 2021 07:49:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13B7nFvb056050; Sun, 11 Apr 2021 07:49:15 GMT (envelope-from git) Date: Sun, 11 Apr 2021 07:49:15 GMT Message-Id: <202104110749.13B7nFvb056050@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 7f676ba9c69c - stable/12 - Add sysctl debug.uma_reclaim 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 7f676ba9c69c577255faf63b3dce711f1959b495 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 07:49:16 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7f676ba9c69c577255faf63b3dce711f1959b495 commit 7f676ba9c69c577255faf63b3dce711f1959b495 Author: Konstantin Belousov AuthorDate: 2021-04-04 16:28:14 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-11 07:48:51 +0000 Add sysctl debug.uma_reclaim (cherry picked from commit 89619b747bcff379dca98e975a98865a45366417) --- sys/vm/vm_kern.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sys/vm/vm_kern.c b/sys/vm/vm_kern.c index 83d58a194f62..80e7dd3c823b 100644 --- a/sys/vm/vm_kern.c +++ b/sys/vm/vm_kern.c @@ -860,3 +860,21 @@ debug_vm_lowmem(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_debug, OID_AUTO, vm_lowmem, CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, 0, debug_vm_lowmem, "I", "set to trigger vm_lowmem event with given flags"); + +static int +debug_uma_reclaim(SYSCTL_HANDLER_ARGS) +{ + int error, i; + + i = 0; + error = sysctl_handle_int(oidp, &i, 0, req); + if (error != 0) + return (error); + if (i != 0) + uma_reclaim(); + return (0); +} + +SYSCTL_PROC(_debug, OID_AUTO, uma_reclaim, + CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, 0, debug_uma_reclaim, "I", + "set to generate request to reclaim uma caches"); From owner-dev-commits-src-all@freebsd.org Sun Apr 11 08:16:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A19DC5E47D1; Sun, 11 Apr 2021 08:16: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 4FJ4TK43mgz4vdJ; Sun, 11 Apr 2021 08:16: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 79A7220D82; Sun, 11 Apr 2021 08:16: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 13B8GbT9095480; Sun, 11 Apr 2021 08:16:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13B8GbwG095479; Sun, 11 Apr 2021 08:16:37 GMT (envelope-from git) Date: Sun, 11 Apr 2021 08:16:37 GMT Message-Id: <202104110816.13B8GbwG095479@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: 9b33518ada2e - main - rtld_lock.h: add some comments about versioning of struct RtldLockInfo 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: 9b33518ada2ebda727ca3c7979cdcdb30716f737 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 08:16:37 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9b33518ada2ebda727ca3c7979cdcdb30716f737 commit 9b33518ada2ebda727ca3c7979cdcdb30716f737 Author: Konstantin Belousov AuthorDate: 2021-04-11 08:12:48 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-11 08:16:13 +0000 rtld_lock.h: add some comments about versioning of struct RtldLockInfo Sponsored by: The FreeBSD Foundation MFC after: 6 days --- libexec/rtld-elf/rtld_lock.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libexec/rtld-elf/rtld_lock.h b/libexec/rtld-elf/rtld_lock.h index fdbdc9917075..c88b558b72b8 100644 --- a/libexec/rtld-elf/rtld_lock.h +++ b/libexec/rtld-elf/rtld_lock.h @@ -35,9 +35,20 @@ #define MAX_RTLD_LOCKS 8 +/* + * This structure is part of the ABI between rtld and threading + * libraries, like libthr and even libc_r. Its layout is fixed and + * can be changed only by appending new fields at the end, with the + * bump of RTLI_VERSION. + */ struct RtldLockInfo { + /* + * Valid if the object calling _rtld_thread_init() exported + * symbol _pli_rtli_version. Otherwise assume RTLI_VERSION_ONE. + */ unsigned int rtli_version; + void *(*lock_create)(void); void (*lock_destroy)(void *); void (*rlock_acquire)(void *); @@ -46,6 +57,8 @@ struct RtldLockInfo int (*thread_set_flag)(int); int (*thread_clr_flag)(int); void (*at_fork)(void); + + /* Version 2 fields */ char *(*dlerror_loc)(void); int *(*dlerror_seen)(void); int dlerror_loc_sz; From owner-dev-commits-src-all@freebsd.org Sun Apr 11 08:37:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59B035E5728; Sun, 11 Apr 2021 08:37: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 4FJ4xj24mrz3CFJ; Sun, 11 Apr 2021 08:37: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 2ABC220D3C; Sun, 11 Apr 2021 08:37: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 13B8bj5T022221; Sun, 11 Apr 2021 08:37:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13B8bjV8022220; Sun, 11 Apr 2021 08:37:45 GMT (envelope-from git) Date: Sun, 11 Apr 2021 08:37:45 GMT Message-Id: <202104110837.13B8bjV8022220@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: a212f56d10d0 - main - Balance parentheses in sysctl descriptions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a212f56d10d04508849cd817d2c595dd61107890 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 08:37:45 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=a212f56d10d04508849cd817d2c595dd61107890 commit a212f56d10d04508849cd817d2c595dd61107890 Author: Piotr Pawel Stefaniak AuthorDate: 2021-04-11 08:29:34 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-04-11 08:30:55 +0000 Balance parentheses in sysctl descriptions --- sys/amd64/amd64/trap.c | 2 +- sys/kern/kern_timeout.c | 2 +- sys/x86/x86/cpu_machdep.c | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 01519d9a7c16..4ce31ce47a45 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -1135,7 +1135,7 @@ SYSCTL_PROC(_machdep, OID_AUTO, syscall_ret_flush_l1d, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, machdep_syscall_ret_flush_l1d, "I", "Flush L1D on syscall return with error (0 - off, 1 - on, " - "2 - use hw only, 3 - use sw only"); + "2 - use hw only, 3 - use sw only)"); /* * System call handler for native binaries. The trap frame is already diff --git a/sys/kern/kern_timeout.c b/sys/kern/kern_timeout.c index 5bb948610da1..cc1521adf151 100644 --- a/sys/kern/kern_timeout.c +++ b/sys/kern/kern_timeout.c @@ -119,7 +119,7 @@ static int pin_pcpu_swi = 0; SYSCTL_INT(_kern, OID_AUTO, pin_default_swi, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &pin_default_swi, 0, "Pin the default (non-per-cpu) swi (shared with PCPU 0 swi)"); SYSCTL_INT(_kern, OID_AUTO, pin_pcpu_swi, CTLFLAG_RDTUN | CTLFLAG_NOFETCH, &pin_pcpu_swi, - 0, "Pin the per-CPU swis (except PCPU 0, which is also default"); + 0, "Pin the per-CPU swis (except PCPU 0, which is also default)"); /* * TODO: diff --git a/sys/x86/x86/cpu_machdep.c b/sys/x86/x86/cpu_machdep.c index 5bac8eb91eac..eb94285ad606 100644 --- a/sys/x86/x86/cpu_machdep.c +++ b/sys/x86/x86/cpu_machdep.c @@ -970,12 +970,12 @@ hw_ssb_disable_handler(SYSCTL_HANDLER_ARGS) SYSCTL_PROC(_hw, OID_AUTO, spec_store_bypass_disable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, hw_ssb_disable_handler, "I", - "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto"); + "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto)"); SYSCTL_PROC(_machdep_mitigations_ssb, OID_AUTO, disable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, hw_ssb_disable_handler, "I", - "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto"); + "Speculative Store Bypass Disable (0 - off, 1 - on, 2 - auto)"); int hw_mds_disable; @@ -1189,13 +1189,13 @@ SYSCTL_PROC(_hw, OID_AUTO, mds_disable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, sysctl_mds_disable_handler, "I", "Microarchitectural Data Sampling Mitigation " - "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO"); + "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO)"); SYSCTL_PROC(_machdep_mitigations_mds, OID_AUTO, disable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, sysctl_mds_disable_handler, "I", "Microarchitectural Data Sampling Mitigation " - "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO"); + "(0 - off, 1 - on VERW, 2 - on SW, 3 - on AUTO)"); /* * Intel Transactional Memory Asynchronous Abort Mitigation @@ -1334,7 +1334,7 @@ SYSCTL_PROC(_machdep_mitigations_taa, OID_AUTO, enable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, sysctl_taa_handler, "I", "TAA Mitigation enablement control " - "(0 - off, 1 - disable TSX, 2 - VERW, 3 - on AUTO"); + "(0 - off, 1 - disable TSX, 2 - VERW, 3 - on AUTO)"); static int sysctl_taa_state_handler(SYSCTL_HANDLER_ARGS) @@ -1407,7 +1407,7 @@ SYSCTL_PROC(_machdep_mitigations_rngds, OID_AUTO, enable, CTLTYPE_INT | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, NULL, 0, sysctl_rngds_mitg_enable_handler, "I", "MCU Optimization, disabling RDSEED mitigation control " - "(0 - mitigation disabled (RDSEED optimized), 1 - mitigation enabled"); + "(0 - mitigation disabled (RDSEED optimized), 1 - mitigation enabled)"); static int sysctl_rngds_state_handler(SYSCTL_HANDLER_ARGS) From owner-dev-commits-src-all@freebsd.org Sun Apr 11 09:18:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BAD65E6701; Sun, 11 Apr 2021 09:18: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 4FJ5rK1gKzz3Dm2; Sun, 11 Apr 2021 09:18: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 2C2D021269; Sun, 11 Apr 2021 09:18: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 13B9I9mU075229; Sun, 11 Apr 2021 09:18:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13B9I9OF075228; Sun, 11 Apr 2021 09:18:09 GMT (envelope-from git) Date: Sun, 11 Apr 2021 09:18:09 GMT Message-Id: <202104110918.13B9I9OF075228@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 1fdd6934d596 - main - getdirentries.2: remove unnecessary space MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1fdd6934d596b0259096d0c310e97a9c4ebf6b6b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 09:18:09 -0000 The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=1fdd6934d596b0259096d0c310e97a9c4ebf6b6b commit 1fdd6934d596b0259096d0c310e97a9c4ebf6b6b Author: Piotr Pawel Stefaniak AuthorDate: 2021-04-11 09:17:01 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2021-04-11 09:17:01 +0000 getdirentries.2: remove unnecessary space --- lib/libc/sys/getdirentries.2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2 index 658be9459af5..4185fb84f0f9 100644 --- a/lib/libc/sys/getdirentries.2 +++ b/lib/libc/sys/getdirentries.2 @@ -132,7 +132,7 @@ the end of the directory has been reached. .Pp If the .Fa basep -pointer value is non-NULL , +pointer value is non-NULL, the .Fn getdirentries system call writes the position of the block read into the location pointed to by From owner-dev-commits-src-all@freebsd.org Sun Apr 11 10:08:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29EB75E78E5; Sun, 11 Apr 2021 10:08: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 4FJ6y40mhCz3GqG; Sun, 11 Apr 2021 10:08: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 0D9F921C69; Sun, 11 Apr 2021 10:08: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 13BA8Bmm040991; Sun, 11 Apr 2021 10:08:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BA8Bqq040990; Sun, 11 Apr 2021 10:08:11 GMT (envelope-from git) Date: Sun, 11 Apr 2021 10:08:11 GMT Message-Id: <202104111008.13BA8Bqq040990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 236d1f8c1773 - stable/13 - [tcp] Fix ECN on finalizing sessions. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 236d1f8c1773a647891a9f37cc305dabde22f7f7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 10:08:12 -0000 The branch stable/13 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=236d1f8c1773a647891a9f37cc305dabde22f7f7 commit 236d1f8c1773a647891a9f37cc305dabde22f7f7 Author: Richard Scheffenegger AuthorDate: 2021-04-08 12:50:34 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-11 09:18:35 +0000 [tcp] Fix ECN on finalizing sessions. A subtle oversight would subtly change new data packets sent after a shutdown() or close() call, while the send buffer is still draining. MFC after: 3 days Reviewed By: #transport, tuexen Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29616 (cherry picked from commit 9f2eeb02623d6a847a90da68a5892c25b14ce2d4) --- sys/netinet/tcp_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index d4b5a328e2a6..e23cdc749e98 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1181,7 +1181,7 @@ send: tp->t_flags2 &= ~TF2_ECN_SND_ECE; } - if (tp->t_state == TCPS_ESTABLISHED && + if (TCPS_HAVEESTABLISHED(tp->t_state) && (tp->t_flags2 & TF2_ECN_PERMIT)) { /* * If the peer has ECN, mark data packets with From owner-dev-commits-src-all@freebsd.org Sun Apr 11 10:41:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE1545C86E8; Sun, 11 Apr 2021 10:41: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 4FJ7hV6Txgz3J9X; Sun, 11 Apr 2021 10:41: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 D1920228C2; Sun, 11 Apr 2021 10:41: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 13BAfUG7091838; Sun, 11 Apr 2021 10:41:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BAfUe3091837; Sun, 11 Apr 2021 10:41:30 GMT (envelope-from git) Date: Sun, 11 Apr 2021 10:41:30 GMT Message-Id: <202104111041.13BAfUe3091837@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 130abbf80364 - stable/12 - [tcp] Fix ECN on finalizing sessions. 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 130abbf803644dd12ea97dd55cbd19b7cf416738 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 10:41:31 -0000 The branch stable/12 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=130abbf803644dd12ea97dd55cbd19b7cf416738 commit 130abbf803644dd12ea97dd55cbd19b7cf416738 Author: Richard Scheffenegger AuthorDate: 2021-04-08 12:50:34 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-11 10:12:18 +0000 [tcp] Fix ECN on finalizing sessions. A subtle oversight would subtly change new data packets sent after a shutdown() or close() call, while the send buffer is still draining. MFC after: 3 days Reviewed By: #transport, tuexen Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29616 (cherry picked from commit 9f2eeb02623d6a847a90da68a5892c25b14ce2d4) --- sys/netinet/tcp_output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index eeb9ca20a2b8..323d61c3e39a 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1137,8 +1137,8 @@ send: } else flags |= TH_ECE|TH_CWR; } - - if (tp->t_state == TCPS_ESTABLISHED && + + if (TCPS_HAVEESTABLISHED(tp->t_state) && (tp->t_flags & TF_ECN_PERMIT)) { /* * If the peer has ECN, mark data packets with From owner-dev-commits-src-all@freebsd.org Sun Apr 11 11:10:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 366A65C96FE; Sun, 11 Apr 2021 11:10: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 4FJ8Kp0qq0z3L10; Sun, 11 Apr 2021 11:10: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 0AD5E22C65; Sun, 11 Apr 2021 11:10: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 13BBALOg028990; Sun, 11 Apr 2021 11:10:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BBALTV028989; Sun, 11 Apr 2021 11:10:21 GMT (envelope-from git) Date: Sun, 11 Apr 2021 11:10:21 GMT Message-Id: <202104111110.13BBALTV028989@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 8d589e0cf979 - stable/11 - [tcp] Fix ECN on finalizing sessions. 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/stable/11 X-Git-Reftype: branch X-Git-Commit: 8d589e0cf9793996f24f0d6fa9fddbf8b2ce0cdd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 11:10:22 -0000 The branch stable/11 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=8d589e0cf9793996f24f0d6fa9fddbf8b2ce0cdd commit 8d589e0cf9793996f24f0d6fa9fddbf8b2ce0cdd Author: Richard Scheffenegger AuthorDate: 2021-04-08 12:50:34 +0000 Commit: Richard Scheffenegger CommitDate: 2021-04-11 10:45:11 +0000 [tcp] Fix ECN on finalizing sessions. A subtle oversight would subtly change new data packets sent after a shutdown() or close() call, while the send buffer is still draining. MFC after: 3 days Reviewed By: #transport, tuexen Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29616 (cherry picked from commit 9f2eeb02623d6a847a90da68a5892c25b14ce2d4) --- sys/netinet/tcp_output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index d7fcd626d9cd..53e3623e7616 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1152,8 +1152,8 @@ send: } else flags |= TH_ECE|TH_CWR; } - - if (tp->t_state == TCPS_ESTABLISHED && + + if (TCPS_HAVEESTABLISHED(tp->t_state) && (tp->t_flags & TF_ECN_PERMIT)) { /* * If the peer has ECN, mark data packets with From owner-dev-commits-src-all@freebsd.org Sun Apr 11 11:44:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39D855CAB86; Sun, 11 Apr 2021 11:44: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 4FJ95T11qRz3MWY; Sun, 11 Apr 2021 11:44: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 15D982388C; Sun, 11 Apr 2021 11:44: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 13BBiiT3072829; Sun, 11 Apr 2021 11:44:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BBiiii072828; Sun, 11 Apr 2021 11:44:44 GMT (envelope-from git) Date: Sun, 11 Apr 2021 11:44:44 GMT Message-Id: <202104111144.13BBiiii072828@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: 9d7e450b64f1 - main - ptrace: remove dead call to FIX_SSTEP() 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: 9d7e450b64f1e605c718fba0f357d49541c8147b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 11:44:45 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9d7e450b64f1e605c718fba0f357d49541c8147b commit 9d7e450b64f1e605c718fba0f357d49541c8147b Author: Konstantin Belousov AuthorDate: 2021-04-11 09:02:34 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-11 11:44:30 +0000 ptrace: remove dead call to FIX_SSTEP() It was an alias for procfs_fix_sstep() long time ago. Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/sys_process.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 51c7bd662600..99bb2e992208 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -784,13 +784,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) /* Keep this process around until we finish this request. */ _PHOLD(p); -#ifdef FIX_SSTEP - /* - * Single step fixup ala procfs - */ - FIX_SSTEP(td2); -#endif - /* * Actually do the requests */ From owner-dev-commits-src-all@freebsd.org Sun Apr 11 11:44:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 899675CAB27; Sun, 11 Apr 2021 11:44: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 4FJ95V2rfPz3MWZ; Sun, 11 Apr 2021 11:44: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 40A8F2369D; Sun, 11 Apr 2021 11:44: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 13BBikAF072856; Sun, 11 Apr 2021 11:44:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BBikCw072855; Sun, 11 Apr 2021 11:44:46 GMT (envelope-from git) Date: Sun, 11 Apr 2021 11:44:46 GMT Message-Id: <202104111144.13BBikCw072855@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: a091c353235e - main - ptrace: restructure comments around reparenting on PT_DETACH 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: a091c353235e0ee97d2531e80d9d64e1648350f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 11:44:46 -0000 The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a091c353235e0ee97d2531e80d9d64e1648350f4 commit a091c353235e0ee97d2531e80d9d64e1648350f4 Author: Konstantin Belousov AuthorDate: 2021-04-11 09:06:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-04-11 11:44:30 +0000 ptrace: restructure comments around reparenting on PT_DETACH style code, and use {} for both branches. Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/kern/sys_process.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 99bb2e992208..c4dfc2def72a 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -1005,14 +1005,16 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) break; case PT_DETACH: /* - * Reset the process parent. - * - * NB: This clears P_TRACED before reparenting + * Clear P_TRACED before reparenting * a detached process back to its original * parent. Otherwise the debugee will be set * as an orphan of the debugger. */ p->p_flag &= ~(P_TRACED | P_WAITED); + + /* + * Reset the process parent. + */ if (p->p_oppid != p->p_pptr->p_pid) { PROC_LOCK(p->p_pptr); sigqueue_take(p->p_ksi); @@ -1025,9 +1027,11 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data) CTR3(KTR_PTRACE, "PT_DETACH: pid %d reparented to pid %d, sig %d", p->p_pid, pp->p_pid, data); - } else + } else { CTR2(KTR_PTRACE, "PT_DETACH: pid %d, sig %d", p->p_pid, data); + } + p->p_ptevents = 0; FOREACH_THREAD_IN_PROC(p, td3) { if ((td3->td_dbgflags & TDB_FSTP) != 0) { From owner-dev-commits-src-all@freebsd.org Sun Apr 11 12:25:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C16BA5CD222 for ; Sun, 11 Apr 2021 12:25:14 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 4FJB0B4xjYz3Q52 for ; Sun, 11 Apr 2021 12:25:14 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f45.google.com with SMTP id j4-20020a05600c4104b029010c62bc1e20so5292333wmi.3 for ; Sun, 11 Apr 2021 05:25:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=b+D2DQDOmjRg4DTbq5Axx+s8OFQH6gbaWh1oCu2lZD8=; b=jJdn769i9gfPlbt1trK9/M/ILQZyV38JHSf8AhUO4T4PZw6Wc81OWzfVEDFnhHKaTr R3L/N+OqaCPaPuxqoV66YfssTYNeVPm7XmNAb3IlzHyBFJazu4UPd1ZcW0mS7h4Jngei mc/Wp4LU6uhg7L7uxicN+opLiVgTa0qwwv0LgjYIt9NPNsv96rQO9RsBCIGAljJxb3Ek GMS2WSzV2kaOCKYMpHf94ICVjjpJPCVNOXw+WQbHmx29mWGBlvp+Ww6FlG7ryo9UGjyA +mv12L8NYrFcs8oUIzfshCOf+wGXIZaXmusyDla59sKCnjzFHpVeEClskDwkbzewdYDh TcMg== X-Gm-Message-State: AOAM530rRHutEjaWJwjwBWf2CDksmr6RpnSm07duXsnfM0kayil1WyVT pSdbUaqKIQ7zUgMgGrln6Nz5oweRI5ebYNEa X-Google-Smtp-Source: ABdhPJxKE13qlLZnOne2FVdzJGFwPiiP/TxxFzb562EvH0mLGYUD1MzL8vcy43jrwgc0OgbDIx9NRQ== X-Received: by 2002:a05:600c:3203:: with SMTP id r3mr5979893wmp.167.1618143912942; Sun, 11 Apr 2021 05:25:12 -0700 (PDT) Received: from [172.16.99.247] (global-184-7.nat-1.net.cam.ac.uk. [131.111.184.7]) by smtp.gmail.com with ESMTPSA id a22sm4225686wrc.59.2021.04.11.05.25.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Apr 2021 05:25:12 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\)) Subject: Re: git: 97ed4babb516 - main - zfs: avoid memory allocation in arc_prune_async From: Jessica Clarke In-Reply-To: <202104110643.13B6h91E076304@gitrepo.freebsd.org> Date: Sun, 11 Apr 2021 13:25:11 +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: <6F4745E7-CC46-4060-99A1-90C2A691EBC7@freebsd.org> References: <202104110643.13B6h91E076304@gitrepo.freebsd.org> To: Mateusz Guzik X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4FJB0B4xjYz3Q52 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 12:25:14 -0000 On 11 Apr 2021, at 07:43, Mateusz Guzik wrote: >=20 > The branch main has been updated by mjg: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D97ed4babb51636d8a4b11bc7b207c321= 9ffcd0e3 >=20 > commit 97ed4babb51636d8a4b11bc7b207c3219ffcd0e3 > Author: Mateusz Guzik > AuthorDate: 2021-04-11 05:15:41 +0000 > Commit: Mateusz Guzik > CommitDate: 2021-04-11 05:19:56 +0000 >=20 > zfs: avoid memory allocation in arc_prune_async > --- > sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c | 16 = ++++++++++------ > 1 file changed, 10 insertions(+), 6 deletions(-) >=20 > diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c = b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c > index 201dbc423336..e73efd810e53 100644 > --- a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c > +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c > @@ -158,10 +158,13 @@ arc_default_max(uint64_t min, uint64_t allmem) > static void > arc_prune_task(void *arg) > { > - int64_t nr_scan =3D *(int64_t *)arg; > +#ifdef __LP64__ > + int64_t nr_scan =3D (int64_t)arg; > +#else > + int64_t nr_scan =3D (int32_t)arg; > +#endif int64_t nr_scan =3D (intptr_t)arg;? > arc_reduce_target_size(ptob(nr_scan)); > - free(arg, M_TEMP); > #if __FreeBSD_version >=3D 1300139 > sx_xlock(&arc_vnlru_lock); > vnlru_free_vfsops(nr_scan, &zfs_vfsops, arc_vnlru_marker); > @@ -185,13 +188,14 @@ arc_prune_task(void *arg) > void > arc_prune_async(int64_t adjust) > { > - > int64_t *adjustptr; >=20 > - if ((adjustptr =3D malloc(sizeof (int64_t), M_TEMP, M_NOWAIT)) = =3D=3D NULL) > - return; > +#ifndef __LP64__ > + if (adjust > __LONG_MAX) > + adjust =3D __LONG_MAX; > +#endif The code is correct without the ifdef, is this just to suppress a = tautological condition warning? If so, be precise in your condition and use = __INT64_MAX__ > __LONG_MAX__? LP64 conflates a lot of things into one variable, and so = isn=E2=80=99t defined for CHERI, but IMO it=E2=80=99s better to be precise *anyway* = because then it=E2=80=99s more self-documenting why the #if is there. Jess From owner-dev-commits-src-all@freebsd.org Sun Apr 11 13:23:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F287A5CF0D3; Sun, 11 Apr 2021 13:23: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 4FJCHq6Yxhz3j2T; Sun, 11 Apr 2021 13:23: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 D4A0124BA7; Sun, 11 Apr 2021 13:23: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 13BDNpWE005315; Sun, 11 Apr 2021 13:23:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BDNpeC005314; Sun, 11 Apr 2021 13:23:51 GMT (envelope-from git) Date: Sun, 11 Apr 2021 13:23:51 GMT Message-Id: <202104111323.13BDNpeC005314@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: 15221c552b3c - main - Use if ... else when printing memory attributes 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: 15221c552b3cabcbf26613246e855010b176805a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 13:23:52 -0000 The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=15221c552b3cabcbf26613246e855010b176805a commit 15221c552b3cabcbf26613246e855010b176805a Author: Andrew Turner AuthorDate: 2021-04-11 09:00:00 +0000 Commit: Andrew Turner CommitDate: 2021-04-11 10:58:46 +0000 Use if ... else when printing memory attributes In vmstat there is a switch statement that converts these attributes to a string. As some values can be duplicate we have to hide these from userspace. Replace this switch statement with an if ... else macro that lets us repeat values without a compiler error. Reviewed by: kib MFC after: 2 weeks Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D29703 --- usr.bin/vmstat/vmstat.c | 54 +++++++++++++++++-------------------------------- 1 file changed, 18 insertions(+), 36 deletions(-) diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index aae3af8aeef8..403dc6e2a054 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -1538,66 +1538,48 @@ display_object(struct kinfo_vmobject *kvo) xo_emit("{:inactive/%5ju} ", (uintmax_t)kvo->kvo_inactive); xo_emit("{:refcount/%3d} ", kvo->kvo_ref_count); xo_emit("{:shadowcount/%3d} ", kvo->kvo_shadow_count); - switch (kvo->kvo_memattr) { + +#define MEMATTR_STR(type, val) \ + if (kvo->kvo_memattr == (type)) { \ + str = (val); \ + } else #ifdef VM_MEMATTR_UNCACHEABLE - case VM_MEMATTR_UNCACHEABLE: - str = "UC"; - break; + MEMATTR_STR(VM_MEMATTR_UNCACHEABLE, "UC") #endif #ifdef VM_MEMATTR_WRITE_COMBINING - case VM_MEMATTR_WRITE_COMBINING: - str = "WC"; - break; + MEMATTR_STR(VM_MEMATTR_WRITE_COMBINING, "WC") #endif #ifdef VM_MEMATTR_WRITE_THROUGH - case VM_MEMATTR_WRITE_THROUGH: - str = "WT"; - break; + MEMATTR_STR(VM_MEMATTR_WRITE_THROUGH, "WT") #endif #ifdef VM_MEMATTR_WRITE_PROTECTED - case VM_MEMATTR_WRITE_PROTECTED: - str = "WP"; - break; + MEMATTR_STR(VM_MEMATTR_WRITE_PROTECTED, "WP") #endif #ifdef VM_MEMATTR_WRITE_BACK - case VM_MEMATTR_WRITE_BACK: - str = "WB"; - break; + MEMATTR_STR(VM_MEMATTR_WRITE_BACK, "WB") #endif #ifdef VM_MEMATTR_WEAK_UNCACHEABLE - case VM_MEMATTR_WEAK_UNCACHEABLE: - str = "UC-"; - break; + MEMATTR_STR(VM_MEMATTR_WEAK_UNCACHEABLE, "UC-") #endif #ifdef VM_MEMATTR_WB_WA - case VM_MEMATTR_WB_WA: - str = "WB"; - break; + MEMATTR_STR(VM_MEMATTR_WB_WA, "WB") #endif #ifdef VM_MEMATTR_NOCACHE - case VM_MEMATTR_NOCACHE: - str = "NC"; - break; + MEMATTR_STR(VM_MEMATTR_NOCACHE, "NC") #endif #ifdef VM_MEMATTR_DEVICE - case VM_MEMATTR_DEVICE: - str = "DEV"; - break; + MEMATTR_STR(VM_MEMATTR_DEVICE, "DEV") #endif #ifdef VM_MEMATTR_CACHEABLE - case VM_MEMATTR_CACHEABLE: - str = "C"; - break; + MEMATTR_STR(VM_MEMATTR_CACHEABLE, "C") #endif #ifdef VM_MEMATTR_PREFETCHABLE - case VM_MEMATTR_PREFETCHABLE: - str = "PRE"; - break; + MEMATTR_STR(VM_MEMATTR_PREFETCHABLE, "PRE") #endif - default: + { str = "??"; - break; } +#undef MEMATTR_STR xo_emit("{:attribute/%-3s} ", str); switch (kvo->kvo_type) { case KVME_TYPE_NONE: From owner-dev-commits-src-all@freebsd.org Sun Apr 11 14:21:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFBCD5D0332; Sun, 11 Apr 2021 14:21: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 4FJDZb4b4xz3kwm; Sun, 11 Apr 2021 14:21: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 90AA725635; Sun, 11 Apr 2021 14:21: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 13BELhks081728; Sun, 11 Apr 2021 14:21:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BELhPv081727; Sun, 11 Apr 2021 14:21:43 GMT (envelope-from git) Date: Sun, 11 Apr 2021 14:21:43 GMT Message-Id: <202104111421.13BELhPv081727@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: 93457c4ec913 - main - rc: kldxref needs mountcritlocal, not root 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: 93457c4ec913d21fbb244cbe63da071de6b33f57 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 14:21:43 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=93457c4ec913d21fbb244cbe63da071de6b33f57 commit 93457c4ec913d21fbb244cbe63da071de6b33f57 Author: Edward Tomasz Napierala AuthorDate: 2021-04-11 14:19:33 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-04-11 14:19:33 +0000 rc: kldxref needs mountcritlocal, not root As pointed out by tijl@, kldxref(8) is in /usr/sbin, thus requires /usr to be mounted. Fixes: 44f3b1aa980 Sponsored By: EPSRC --- libexec/rc/rc.d/kldxref | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/kldxref b/libexec/rc/rc.d/kldxref index 4c1fa15f2a35..ae562448103b 100755 --- a/libexec/rc/rc.d/kldxref +++ b/libexec/rc/rc.d/kldxref @@ -4,7 +4,7 @@ # # PROVIDE: kldxref -# REQUIRE: root +# REQUIRE: mountcritlocal # BEFORE: netif # KEYWORD: nojail From owner-dev-commits-src-all@freebsd.org Sun Apr 11 14:24:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 755B95D0589; Sun, 11 Apr 2021 14:24: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 4FJDdm2xDKz3lBs; Sun, 11 Apr 2021 14:24: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 578E12517A; Sun, 11 Apr 2021 14:24: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 13BEOS79084399; Sun, 11 Apr 2021 14:24:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BEOSNd084398; Sun, 11 Apr 2021 14:24:28 GMT (envelope-from git) Date: Sun, 11 Apr 2021 14:24:28 GMT Message-Id: <202104111424.13BEOSNd084398@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: ec5325dbca62 - main - cam: make sure to clear even more CCBs allocated on the stack 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: ec5325dbca629d65179f14f68bbcdb9c014f1523 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 14:24:28 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=ec5325dbca629d65179f14f68bbcdb9c014f1523 commit ec5325dbca629d65179f14f68bbcdb9c014f1523 Author: Edward Tomasz Napierala AuthorDate: 2021-04-10 10:25:22 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-04-11 14:24:22 +0000 cam: make sure to clear even more CCBs allocated on the stack This is my second pass, this time over all of CAM except for the SCSI target bits. There should be no functional changes. Reviewed By: imp Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D29549 --- sys/cam/ata/ata_da.c | 2 ++ sys/cam/ata/ata_xpt.c | 3 +++ sys/cam/mmc/mmc_da.c | 1 + sys/cam/mmc/mmc_xpt.c | 1 + sys/cam/nvme/nvme_xpt.c | 2 ++ sys/cam/scsi/scsi_cd.c | 1 + sys/cam/scsi/scsi_enc_ses.c | 3 +++ sys/cam/scsi/scsi_sa.c | 2 ++ sys/cam/scsi/scsi_xpt.c | 2 ++ 9 files changed, 17 insertions(+) diff --git a/sys/cam/ata/ata_da.c b/sys/cam/ata/ata_da.c index 38d996510f98..c29235e64e81 100644 --- a/sys/cam/ata/ata_da.c +++ b/sys/cam/ata/ata_da.c @@ -1327,6 +1327,7 @@ adaasync(void *callback_arg, u_int32_t code, case AC_GETDEV_CHANGED: { softc = (struct ada_softc *)periph->softc; + memset(&cgd, 0, sizeof(cgd)); xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); @@ -1362,6 +1363,7 @@ adaasync(void *callback_arg, u_int32_t code, cam_periph_async(periph, code, path, arg); if (softc->state != ADA_STATE_NORMAL) break; + memset(&cgd, 0, sizeof(cgd)); xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); diff --git a/sys/cam/ata/ata_xpt.c b/sys/cam/ata/ata_xpt.c index 559e9a234b87..0f94e556745a 100644 --- a/sys/cam/ata/ata_xpt.c +++ b/sys/cam/ata/ata_xpt.c @@ -726,6 +726,7 @@ aproberequestdefaultnegotiation(struct cam_periph *periph) { struct ccb_trans_settings cts; + bzero(&cts, sizeof(cts)); xpt_setup_ccb(&cts.ccb_h, periph->path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_USER_SETTINGS; @@ -1693,6 +1694,7 @@ ata_device_transport(struct cam_path *path) ata_version(ident_buf->version_major) : cpi.transport_version; /* Tell the controller what we think */ + bzero(&cts, sizeof(cts)); xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; @@ -2125,6 +2127,7 @@ ata_announce_periph(struct cam_periph *periph) struct ccb_trans_settings cts; u_int speed, mb; + bzero(&cts, sizeof(cts)); _ata_announce_periph(periph, &cts, &speed); if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) return; diff --git a/sys/cam/mmc/mmc_da.c b/sys/cam/mmc/mmc_da.c index 127d1cb48602..7b2753d5c769 100644 --- a/sys/cam/mmc/mmc_da.c +++ b/sys/cam/mmc/mmc_da.c @@ -712,6 +712,7 @@ sddaasync(void *callback_arg, u_int32_t code, { CAM_DEBUG(path, CAM_DEBUG_TRACE, ("=> AC_GETDEV_CHANGED\n")); softc = (struct sdda_softc *)periph->softc; + memset(&cgd, 0, sizeof(cgd)); xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c index 22468fcea35a..d6b3761cb955 100644 --- a/sys/cam/mmc/mmc_xpt.c +++ b/sys/cam/mmc/mmc_xpt.c @@ -375,6 +375,7 @@ mmc_announce_periph(struct cam_periph *periph) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("mmc_announce_periph")); + memset(&cts, 0, sizeof(cts)); xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; diff --git a/sys/cam/nvme/nvme_xpt.c b/sys/cam/nvme/nvme_xpt.c index 126b284936bb..0fc359ecb042 100644 --- a/sys/cam/nvme/nvme_xpt.c +++ b/sys/cam/nvme/nvme_xpt.c @@ -634,6 +634,7 @@ nvme_device_transport(struct cam_path *path) path->device->protocol_version = cpi.protocol_version; /* Tell the controller what we think */ + memset(&cts, 0, sizeof(cts)); xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NONE); cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; @@ -792,6 +793,7 @@ nvme_announce_periph(struct cam_periph *periph) cam_periph_assert(periph, MA_OWNED); /* Ask the SIM for connection details */ + memset(&cts, 0, sizeof(cts)); xpt_setup_ccb(&cts.ccb_h, path, CAM_PRIORITY_NORMAL); cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; diff --git a/sys/cam/scsi/scsi_cd.c b/sys/cam/scsi/scsi_cd.c index e009b0a586c3..91d91a6a8e78 100644 --- a/sys/cam/scsi/scsi_cd.c +++ b/sys/cam/scsi/scsi_cd.c @@ -1259,6 +1259,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) status = done_ccb->ccb_h.status; + bzero(&cgd, sizeof(cgd)); xpt_setup_ccb(&cgd.ccb_h, done_ccb->ccb_h.path, CAM_PRIORITY_NORMAL); diff --git a/sys/cam/scsi/scsi_enc_ses.c b/sys/cam/scsi/scsi_enc_ses.c index 014fe9fcd525..32e523923fd2 100644 --- a/sys/cam/scsi/scsi_enc_ses.c +++ b/sys/cam/scsi/scsi_enc_ses.c @@ -974,6 +974,7 @@ ses_paths_iter(enc_softc_t *enc, enc_element_t *elm, != CAM_REQ_CMP) return; + memset(&cgd, 0, sizeof(cgd)); xpt_setup_ccb(&cgd.ccb_h, path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; xpt_action((union ccb *)&cgd); @@ -1035,6 +1036,7 @@ ses_setphyspath_callback(enc_softc_t *enc, enc_element_t *elm, args = (ses_setphyspath_callback_args_t *)arg; old_physpath = malloc(MAXPATHLEN, M_SCSIENC, M_WAITOK|M_ZERO); xpt_path_lock(path); + memset(&cdai, 0, sizeof(cdai)); xpt_setup_ccb(&cdai.ccb_h, path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.buftype = CDAI_TYPE_PHYS_PATH; @@ -1095,6 +1097,7 @@ ses_set_physpath(enc_softc_t *enc, enc_element_t *elm, * Assemble the components of the physical path starting with * the device ID of the enclosure itself. */ + memset(&cdai, 0, sizeof(cdai)); xpt_setup_ccb(&cdai.ccb_h, enc->periph->path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; cdai.flags = CDAI_FLAG_NONE; diff --git a/sys/cam/scsi/scsi_sa.c b/sys/cam/scsi/scsi_sa.c index 9441e0d4673b..6c7e20df9f6d 100644 --- a/sys/cam/scsi/scsi_sa.c +++ b/sys/cam/scsi/scsi_sa.c @@ -2403,6 +2403,7 @@ saregister(struct cam_periph *periph, void *arg) bzero(&ext_inq, sizeof(ext_inq)); + memset(&cdai, 0, sizeof(cdai)); xpt_setup_ccb(&cdai.ccb_h, periph->path, CAM_PRIORITY_NORMAL); cdai.ccb_h.func_code = XPT_DEV_ADVINFO; @@ -4416,6 +4417,7 @@ saextget(struct cdev *dev, struct cam_periph *periph, struct sbuf *sb, SASBADDVARSTR(sb, indent, periph->periph_name, %s, periph_name, strlen(periph->periph_name) + 1); SASBADDUINT(sb, indent, periph->unit_number, %u, unit_number); + memset(&cgd, 0, sizeof(cgd)); xpt_setup_ccb(&cgd.ccb_h, periph->path, CAM_PRIORITY_NORMAL); diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index 5db60fcccd01..bed1f3ad1373 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -2737,6 +2737,7 @@ scsi_set_transfer_settings(struct ccb_trans_settings *cts, struct cam_path *path inq_data = &device->inq_data; scsi = &cts->proto_specific.scsi; + memset(&cpi, 0, sizeof(cpi)); xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NONE); cpi.ccb_h.func_code = XPT_PATH_INQ; xpt_action((union ccb *)&cpi); @@ -3093,6 +3094,7 @@ scsi_announce_periph_sbuf(struct cam_periph *periph, struct sbuf *sb) struct ccb_trans_settings cts; u_int speed, freq, mb; + memset(&cts, 0, sizeof(cts)); _scsi_announce_periph(periph, &speed, &freq, &cts); if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) return; From owner-dev-commits-src-all@freebsd.org Sun Apr 11 15:58:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1324F5D2C60; Sun, 11 Apr 2021 15:58: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 4FJGkD05L1z3pwP; Sun, 11 Apr 2021 15:58: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 EA58526C52; Sun, 11 Apr 2021 15:58: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 13BFwRo6004338; Sun, 11 Apr 2021 15:58:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BFwRZS004337; Sun, 11 Apr 2021 15:58:27 GMT (envelope-from git) Date: Sun, 11 Apr 2021 15:58:27 GMT Message-Id: <202104111558.13BFwRZS004337@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Brandon Bergren Subject: git: 908d607bd100 - stable/13 - [PowerPC] Fix NUMA checking for powernv MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdragon X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 908d607bd100a96b416483975e8abfec636e85d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 15:58:28 -0000 The branch stable/13 has been updated by bdragon: URL: https://cgit.FreeBSD.org/src/commit/?id=908d607bd100a96b416483975e8abfec636e85d1 commit 908d607bd100a96b416483975e8abfec636e85d1 Author: Brandon Bergren AuthorDate: 2021-03-28 01:41:45 +0000 Commit: Brandon Bergren CommitDate: 2021-04-11 15:52:23 +0000 [PowerPC] Fix NUMA checking for powernv At this point in startup, vm_ndomains has not been initialized. Switch to checking kenv instead. Fixes incorrect NUMA information being set on multi-domain systems like Talos II. Submitted by: jhibbits (cherry picked from commit bd94c8ab29c3162bbb43973ee77ce245fe157fef) --- sys/powerpc/powernv/platform_powernv.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/powerpc/powernv/platform_powernv.c b/sys/powerpc/powernv/platform_powernv.c index 434b642a66a8..d7acc544c2ed 100644 --- a/sys/powerpc/powernv/platform_powernv.c +++ b/sys/powerpc/powernv/platform_powernv.c @@ -532,7 +532,9 @@ powernv_node_numa_domain(platform_t platform, phandle_t node) #ifndef NUMA return (0); #endif - if (vm_ndomains == 1) + i = 0; + TUNABLE_INT_FETCH("vm.numa.disabled", &i); + if (i) return (0); res = OF_getencprop(node, "ibm,associativity", From owner-dev-commits-src-all@freebsd.org Sun Apr 11 16:48:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C649A5D550E; Sun, 11 Apr 2021 16:48: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 4FJHqx5FRpz3spy; Sun, 11 Apr 2021 16:48: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 A3516271DE; Sun, 11 Apr 2021 16:48: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 13BGmTix069915; Sun, 11 Apr 2021 16:48:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BGmTCN069914; Sun, 11 Apr 2021 16:48:29 GMT (envelope-from git) Date: Sun, 11 Apr 2021 16:48:29 GMT Message-Id: <202104111648.13BGmTCN069914@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jens Schweikhardt Subject: git: 993d2d4bca45 - main - Make 20201030 a separate entry (insert forgotten newline). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: schweikh X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 993d2d4bca45d890365233601434921de02670f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 16:48:29 -0000 The branch main has been updated by schweikh: URL: https://cgit.FreeBSD.org/src/commit/?id=993d2d4bca45d890365233601434921de02670f1 commit 993d2d4bca45d890365233601434921de02670f1 Author: Jens Schweikhardt AuthorDate: 2021-04-11 16:41:59 +0000 Commit: Jens Schweikhardt CommitDate: 2021-04-11 16:41:59 +0000 Make 20201030 a separate entry (insert forgotten newline). --- UPDATING | 1 + 1 file changed, 1 insertion(+) diff --git a/UPDATING b/UPDATING index 6ef64664e6b7..bf97bd1ed33b 100644 --- a/UPDATING +++ b/UPDATING @@ -84,6 +84,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: Default value of net.add_addr_allfibs has been changed to 0. If you have multi-fib configuration and rely on existence of all interface routes in every fib, you need to set the above sysctl to 1. + 20201030: The internal pre-processor in the calendar(1) program has been extended to support more C pre-processor commands (e.g. #ifdef, #else, From owner-dev-commits-src-all@freebsd.org Sun Apr 11 17:13:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70E785D5C5F; Sun, 11 Apr 2021 17:13: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 4FJJP22mpLz3twg; Sun, 11 Apr 2021 17:13: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 5202A279E3; Sun, 11 Apr 2021 17:13: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 13BHDgAQ009772; Sun, 11 Apr 2021 17:13:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BHDg9Z009771; Sun, 11 Apr 2021 17:13:42 GMT (envelope-from git) Date: Sun, 11 Apr 2021 17:13:42 GMT Message-Id: <202104111713.13BHDg9Z009771@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: afbb64f1d85b - main - Fix vlan creation for the older ifconfig(8) binaries. 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: afbb64f1d85b7d8c2938031c3567946b5d10da4f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 17:13:42 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=afbb64f1d85b7d8c2938031c3567946b5d10da4f commit afbb64f1d85b7d8c2938031c3567946b5d10da4f Author: Alexander V. Chernikov AuthorDate: 2021-04-11 16:47:03 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-04-11 17:13:09 +0000 Fix vlan creation for the older ifconfig(8) binaries. Reported by: allanjude MFC after: immediately --- sys/net/if_vlan.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 229cd331c7a1..bd3a5335a97f 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -1015,6 +1015,10 @@ vlan_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) vid = vlr.vlr_tag; proto = vlr.vlr_proto; +#ifdef COMPAT_FREEBSD12 + if (proto == 0) + proto = ETHERTYPE_VLAN; +#endif p = ifunit_ref(vlr.vlr_parent); if (p == NULL) return (ENXIO); @@ -1947,6 +1951,10 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = ENOENT; break; } +#ifdef COMPAT_FREEBSD12 + if (vlr.vlr_proto == 0) + vlr.vlr_proto = ETHERTYPE_VLAN; +#endif oldmtu = ifp->if_mtu; error = vlan_config(ifv, p, vlr.vlr_tag, vlr.vlr_proto); if_rele(p); From owner-dev-commits-src-all@freebsd.org Sun Apr 11 18:27:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D9015D7BD5; Sun, 11 Apr 2021 18:27: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 4FJL2J0JChz4Rjv; Sun, 11 Apr 2021 18:27: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 F17CABCA; Sun, 11 Apr 2021 18:27: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 13BIRZYL002208; Sun, 11 Apr 2021 18:27:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BIRZuU002207; Sun, 11 Apr 2021 18:27:35 GMT (envelope-from git) Date: Sun, 11 Apr 2021 18:27:35 GMT Message-Id: <202104111827.13BIRZuU002207@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: 5a3426f453f9 - main - if_smsc: Add the ability to disable "turbo_mode", also called RX frame batching, similarly to the Linux driver, by a tunable read only sysctl. 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: 5a3426f453f970edda38367bea5ebf7385c3819d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 18:27:36 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=5a3426f453f970edda38367bea5ebf7385c3819d commit 5a3426f453f970edda38367bea5ebf7385c3819d Author: Hans Petter Selasky AuthorDate: 2021-04-11 18:24:41 +0000 Commit: Hans Petter Selasky CommitDate: 2021-04-11 18:25:58 +0000 if_smsc: Add the ability to disable "turbo_mode", also called RX frame batching, similarly to the Linux driver, by a tunable read only sysctl. Submitted by: Oleg Sidorkin PR: 254884 MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/usb/net/if_smsc.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/sys/dev/usb/net/if_smsc.c b/sys/dev/usb/net/if_smsc.c index 84610c894f4d..85cc955b9fbf 100644 --- a/sys/dev/usb/net/if_smsc.c +++ b/sys/dev/usb/net/if_smsc.c @@ -119,11 +119,19 @@ __FBSDID("$FreeBSD$"); #include "miibus_if.h" +SYSCTL_NODE(_hw_usb, OID_AUTO, smsc, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, + "USB smsc"); + +static bool smsc_rx_packet_batching = 1; + +SYSCTL_BOOL(_hw_usb_smsc, OID_AUTO, smsc_rx_packet_batching, CTLFLAG_RDTUN, + &smsc_rx_packet_batching, 0, + "If set, allows packet batching to increase throughput and latency. " + "Else throughput and latency is decreased."); + #ifdef USB_DEBUG static int smsc_debug = 0; -SYSCTL_NODE(_hw_usb, OID_AUTO, smsc, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, - "USB smsc"); SYSCTL_INT(_hw_usb_smsc, OID_AUTO, debug, CTLFLAG_RWTUN, &smsc_debug, 0, "Debug level"); #endif @@ -1377,7 +1385,9 @@ smsc_chip_init(struct smsc_softc *sc) * Burst capability is the number of URBs that can be in a burst of data/ * ethernet frames. */ - if (usbd_get_speed(sc->sc_ue.ue_udev) == USB_SPEED_HIGH) + if (!smsc_rx_packet_batching) + burst_cap = 0; + else if (usbd_get_speed(sc->sc_ue.ue_udev) == USB_SPEED_HIGH) burst_cap = 37; else burst_cap = 128; @@ -1404,7 +1414,8 @@ smsc_chip_init(struct smsc_softc *sc) /* The following setings are used for 'turbo mode', a.k.a multiple frames * per Rx transaction (again info taken form Linux driver). */ - reg_val |= (SMSC_HW_CFG_MEF | SMSC_HW_CFG_BCE); + if (smsc_rx_packet_batching) + reg_val |= (SMSC_HW_CFG_MEF | SMSC_HW_CFG_BCE); smsc_write_reg(sc, SMSC_HW_CFG, reg_val); From owner-dev-commits-src-all@freebsd.org Sun Apr 11 18:45:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BFFAF5D83A9 for ; Sun, 11 Apr 2021 18:45: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 4FJLRN56Ptz4SVq; Sun, 11 Apr 2021 18:45: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 A1E81100D; Sun, 11 Apr 2021 18:45: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 13BIjqWO028550; Sun, 11 Apr 2021 18:45:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BIjqgT028549; Sun, 11 Apr 2021 18:45:52 GMT (envelope-from git) Date: Sun, 11 Apr 2021 18:45:52 GMT Message-Id: <202104111845.13BIjqgT028549@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Muhammad Moinur Rahman Subject: git: d0f388fdb3b4 - internal/admin - Remove araujo@, ed@ and jpaetzel@ whose src bit has been safe kept - Remove $FreeBSD$ tag which is no longer necessary after git migration - Update some doc reference which should be in sync with this file MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bofh X-Git-Repository: src X-Git-Refname: refs/internal/admin X-Git-Reftype: branch X-Git-Commit: d0f388fdb3b4ea6a0323b6824487d71d7360e1f7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 18:45:52 -0000 The branch internal/admin has been updated by bofh (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d0f388fdb3b4ea6a0323b6824487d71d7360e1f7 commit d0f388fdb3b4ea6a0323b6824487d71d7360e1f7 Author: Muhammad Moinur Rahman AuthorDate: 2021-04-11 18:42:19 +0000 Commit: Muhammad Moinur Rahman CommitDate: 2021-04-11 18:42:19 +0000 Remove araujo@, ed@ and jpaetzel@ whose src bit has been safe kept - Remove $FreeBSD$ tag which is no longer necessary after git migration - Update some doc reference which should be in sync with this file Approved by: core (implicit with core-secretary@ hats on) --- access | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/access b/access index 94f6ebeb34fa..122b446b74cd 100644 --- a/access +++ b/access @@ -1,7 +1,5 @@ -# $FreeBSD$ -# -# Please try to keep the handbook (contrib/chapter.sgml authors.ent -# staff/chapter.sgml) in sync with this. +# Please try to keep the handbook (documentation/content/en/articles/contributors/contrib-committers.adoc +# documentation/content/en/articles/contributors/contrib-develalumni.adoc shared/authors.toml ) in sync with this. # # KEEP ALPHABETICALLY SORTED!!! # KEEP ALPHABETICALLY SORTED!!! @@ -28,7 +26,6 @@ andreast andrew anish antoine -araujo arichardson arybchik asomers @@ -67,7 +64,6 @@ dougm dteske dwmalone dwmalone=freebsd-committers@maths.tcd.ie eadler -ed emaste emax erj @@ -107,7 +103,6 @@ jlh jmallett jmg joerg freebsd-devel@uriah.heep.sax.de -jpaetzel jrtc27 jtl julian From owner-dev-commits-src-all@freebsd.org Sun Apr 11 19:32:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D28975D97BC; Sun, 11 Apr 2021 19:32: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 4FJMTd5cPxz4Vtb; Sun, 11 Apr 2021 19:32: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 B382B1A91; Sun, 11 Apr 2021 19:32: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 13BJWre3094814; Sun, 11 Apr 2021 19:32:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BJWrFt094813; Sun, 11 Apr 2021 19:32:53 GMT (envelope-from git) Date: Sun, 11 Apr 2021 19:32:53 GMT Message-Id: <202104111932.13BJWrFt094813@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 9f7ff9fe8450 - stable/13 - Remove tmpfs size and properly format generated fstab for arm 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 9f7ff9fe8450497fa3ca6049a56a667dfd878899 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 19:32:53 -0000 The branch stable/13 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=9f7ff9fe8450497fa3ca6049a56a667dfd878899 commit 9f7ff9fe8450497fa3ca6049a56a667dfd878899 Author: Daniel Engerg AuthorDate: 2021-03-17 14:00:57 +0000 Commit: Emmanuel Vadot CommitDate: 2021-04-11 19:32:13 +0000 Remove tmpfs size and properly format generated fstab for arm Remove tmpfs size limitation, this breaks make installworld and installation of some packages Format generated fstab using tabs to make it consistent and readable MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29283 (cherry picked from commit 5bffdafd6c5f2a8279a57172ab760ea66ed3d7d5) --- release/tools/arm.subr | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/release/tools/arm.subr b/release/tools/arm.subr index 2f91490c0859..811d6ddb402d 100644 --- a/release/tools/arm.subr +++ b/release/tools/arm.subr @@ -197,18 +197,18 @@ arm_install_base() { echo '# Custom /etc/fstab for FreeBSD embedded images' \ > ${CHROOTDIR}/${DESTDIR}/etc/fstab if [ "${PART_SCHEME}" == "GPT" ]; then - echo "/dev/ufs/rootfs / ufs rw 1 1" \ + echo "/dev/ufs/rootfs / ufs rw 1 1" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab - echo "/dev/msdosfs/EFI /boot/efi msdosfs rw,noatime 0 0" \ + echo "/dev/msdosfs/EFI /boot/efi msdosfs rw,noatime 0 0" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab fi if [ "${PART_SCHEME}" == "MBR" ]; then - echo "/dev/ufs/rootfs / ufs rw 1 1" \ + echo "/dev/ufs/rootfs / ufs rw 1 1" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab - echo "/dev/msdosfs/MSDOSBOOT /boot/msdos msdosfs rw,noatime 0 0" \ + echo "/dev/msdosfs/MSDOSBOOT /boot/msdos msdosfs rw,noatime 0 0" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab fi - echo "tmpfs /tmp tmpfs rw,mode=1777,size=50m 0 0" \ + echo "tmpfs /tmp tmpfs rw,mode=1777 0 0" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab local hostname From owner-dev-commits-src-all@freebsd.org Sun Apr 11 20:19:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 679D45DB219; Sun, 11 Apr 2021 20:19: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 4FJNWY2Sx0z4Xs4; Sun, 11 Apr 2021 20:19: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 4338C1F56; Sun, 11 Apr 2021 20:19: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 13BKJblO048364; Sun, 11 Apr 2021 20:19:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BKJbhl048363; Sun, 11 Apr 2021 20:19:37 GMT (envelope-from git) Date: Sun, 11 Apr 2021 20:19:37 GMT Message-Id: <202104112019.13BKJbhl048363@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Yuri Pankov Subject: git: 970ffdcefe89 - main - acpi(4): mention NONE as possible setting for hw.acpi.power_button_state MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuripv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 970ffdcefe89c6814f14e2dd59565346e32f8c18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 20:19:37 -0000 The branch main has been updated by yuripv: URL: https://cgit.FreeBSD.org/src/commit/?id=970ffdcefe89c6814f14e2dd59565346e32f8c18 commit 970ffdcefe89c6814f14e2dd59565346e32f8c18 Author: Yuri Pankov AuthorDate: 2021-04-11 20:17:06 +0000 Commit: Yuri Pankov CommitDate: 2021-04-11 20:17:06 +0000 acpi(4): mention NONE as possible setting for hw.acpi.power_button_state Reviewed by: manpages (gbe) Differential Revision: https://reviews.freebsd.org/D29577 --- share/man/man4/acpi.4 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/share/man/man4/acpi.4 b/share/man/man4/acpi.4 index 8c221be870aa..bf3f5f4d4128 100644 --- a/share/man/man4/acpi.4 +++ b/share/man/man4/acpi.4 @@ -126,14 +126,17 @@ with legacy rebooting support. .It Va hw.acpi.lid_switch_state Suspend state .Pq Li S1 Ns \[en] Ns Li S5 -to enter when the lid switch (i.e., a notebook screen) is closed. -Default is +to enter when the lid switch (i.e., a notebook screen) is closed, or .Dq Li NONE -(do nothing). +.Pq do nothing . +Default is +.Dq Li NONE . .It Va hw.acpi.power_button_state Suspend state .Pq Li S1 Ns \[en] Ns Li S5 -to enter when the power button is pressed. +to enter when the power button is pressed, or +.Dq Li NONE +.Pq do nothing . Default is .Li S5 (power-off nicely). From owner-dev-commits-src-all@freebsd.org Sun Apr 11 21:06:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C7395DDA04; Sun, 11 Apr 2021 21:06: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 4FJPYn38MHz4bf3; Sun, 11 Apr 2021 21:06: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 5F3B02EBB; Sun, 11 Apr 2021 21:06: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 13BL6bsv014589; Sun, 11 Apr 2021 21:06:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BL6boH014588; Sun, 11 Apr 2021 21:06:37 GMT (envelope-from git) Date: Sun, 11 Apr 2021 21:06:37 GMT Message-Id: <202104112106.13BL6boH014588@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?B?U3RlZmFuIEXDn2Vy?= Subject: git: 2a47875ea6a8 - main - ObsoleteFiles.inc: Add comment regarding optional files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2a47875ea6a8359fd329ef1760da91b54396436f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 21:06:37 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=2a47875ea6a8359fd329ef1760da91b54396436f commit 2a47875ea6a8359fd329ef1760da91b54396436f Author: Stefan Eßer AuthorDate: 2021-04-11 21:00:39 +0000 Commit: Stefan Eßer CommitDate: 2021-04-11 21:00:39 +0000 ObsoleteFiles.inc: Add comment regarding optional files I had added entries that depended on some build option to this file and have been informed, that those go into a different file in another directory. Mentioning /usr/src/tools/build/mk/OptionalObsoleteFiles.inc in this file should help other committers (and me) to not repeat that mistake. MFC after: 1 week --- ObsoleteFiles.inc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index f50b9befdd66..373e014ba074 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -11,6 +11,10 @@ # In case of a complete directory hierarchy the sorting is in depth first # order. # +# Files that are installed or removed depending on some build option +# are to be listed in /usr/src/tools/build/mk/OptionalObsoleteFiles.inc +# instead of in this file. +# # Before you commit changes to this file please check if any entries in # tools/build/mk/OptionalObsoleteFiles.inc can be removed. The following # command tells which files are listed more than once regardless of some From owner-dev-commits-src-all@freebsd.org Sun Apr 11 21:13:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C60B5DDB8E; Sun, 11 Apr 2021 21:13: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 4FJPjH0fckz4bty; Sun, 11 Apr 2021 21:13: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 09BFC2FC7; Sun, 11 Apr 2021 21:13: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 13BLD6iE027323; Sun, 11 Apr 2021 21:13:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BLD6r1027322; Sun, 11 Apr 2021 21:13:06 GMT (envelope-from git) Date: Sun, 11 Apr 2021 21:13:06 GMT Message-Id: <202104112113.13BLD6r1027322@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vincenzo Maffione Subject: git: 70275a6735df - main - netmap: don't use linux type struct device * MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 70275a6735df8a514f48be77418491f2f8dba817 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 21:13:07 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=70275a6735df8a514f48be77418491f2f8dba817 commit 70275a6735df8a514f48be77418491f2f8dba817 Author: Vincenzo Maffione AuthorDate: 2021-04-11 21:06:43 +0000 Commit: Vincenzo Maffione CommitDate: 2021-04-11 21:13:01 +0000 netmap: don't use linux type struct device * Such type cannot be used in code that is in common between FreeBSD and Linux. Use the FreeBSD type instead. MFC after: 3 days Reported by: markj Differential Revision: https://reviews.freebsd.org/D29677 --- sys/dev/netmap/netmap_mem2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/netmap/netmap_mem2.c b/sys/dev/netmap/netmap_mem2.c index 5edfc38e108d..e6c83efe9ea9 100644 --- a/sys/dev/netmap/netmap_mem2.c +++ b/sys/dev/netmap/netmap_mem2.c @@ -312,7 +312,7 @@ netmap_mem_rings_delete(struct netmap_adapter *na) static int netmap_mem_map(struct netmap_obj_pool *, struct netmap_adapter *); static int netmap_mem_unmap(struct netmap_obj_pool *, struct netmap_adapter *); -static int nm_mem_check_group(struct netmap_mem_d *, struct device *); +static int nm_mem_check_group(struct netmap_mem_d *, bus_dma_tag_t); static void nm_mem_release_id(struct netmap_mem_d *); nm_memid_t @@ -730,7 +730,7 @@ netmap_mem_find(nm_memid_t id) } static int -nm_mem_check_group(struct netmap_mem_d *nmd, struct device *dev) +nm_mem_check_group(struct netmap_mem_d *nmd, bus_dma_tag_t dev) { int err = 0, id; From owner-dev-commits-src-all@freebsd.org Sun Apr 11 21:38:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 45B565DFC25; Sun, 11 Apr 2021 21:38: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 4FJQH51WWXz4f0c; Sun, 11 Apr 2021 21:38: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 26E1C33AF; Sun, 11 Apr 2021 21:38: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 13BLcvSs054144; Sun, 11 Apr 2021 21:38:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BLcvud054143; Sun, 11 Apr 2021 21:38:57 GMT (envelope-from git) Date: Sun, 11 Apr 2021 21:38:57 GMT Message-Id: <202104112138.13BLcvud054143@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: 7763814fc9c2 - main - nfsv4 client: do the BindConnectionToSession as required 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: 7763814fc9c27a98fefcbf582d7a936ea43af23a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 21:38:57 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=7763814fc9c27a98fefcbf582d7a936ea43af23a commit 7763814fc9c27a98fefcbf582d7a936ea43af23a Author: Rick Macklem AuthorDate: 2021-04-11 21:34:57 +0000 Commit: Rick Macklem CommitDate: 2021-04-11 21:34:57 +0000 nfsv4 client: do the BindConnectionToSession as required During a recent testing event, it was reported that the NFSv4.1/4.2 server erroneously bound the back channel to a new TCP connection. RFC5661 specifies that the fore channel is implicitly bound to a new TCP connection when an RPC with Sequence (almost any of them) is done on it. For the back channel to be bound to the new TCP connection, an explicit BindConnectionToSession must be done as the first RPC on the new connection. Since new TCP connections are created by the "reconnect" layer (sys/rpc/clnt_rc.c) of the krpc, this patch adds an optional upcall done by the krpc whenever a new connection is created. The patch also adds the specific upcall function that does a BindConnectionToSession and configures the krpc to call it when required. This is necessary for correct interoperability with NFSv4.1/NFSv4.2 servers when the nfscbd daemon is running. If doing NFSv4.1/NFSv4.2 mounts without this patch, it is recommended that the nfscbd daemon not be running and that the "pnfs" mount option not be specified. PR: 254840 Comments by: asomers MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29475 --- sys/fs/nfs/nfs_commonsubs.c | 5 ++- sys/fs/nfs/nfs_var.h | 1 + sys/fs/nfs/nfscl.h | 5 +++ sys/fs/nfs/nfsport.h | 9 +++-- sys/fs/nfs/nfsproto.h | 5 ++- sys/fs/nfsclient/nfs_clrpcops.c | 90 +++++++++++++++++++++++++++++++++++++++++ sys/rpc/clnt.h | 6 +++ sys/rpc/clnt_rc.c | 15 +++++++ sys/rpc/krpc.h | 3 ++ 9 files changed, 133 insertions(+), 6 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 43bb396d9cfd..4afa4c2d9ab4 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -218,7 +218,7 @@ static struct nfsrv_lughash *nfsgroupnamehash; static int nfs_bigreply[NFSV42_NPROCS] = { 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 1 }; + 1, 0, 0, 1, 0 }; /* local functions */ static int nfsrv_skipace(struct nfsrv_descript *nd, int *acesizep); @@ -301,6 +301,7 @@ static struct { { NFSV4OP_SETXATTR, 2, "Setxattr", 8, }, { NFSV4OP_REMOVEXATTR, 2, "Rmxattr", 7, }, { NFSV4OP_LISTXATTRS, 2, "Listxattr", 9, }, + { NFSV4OP_BINDCONNTOSESS, 1, "BindConSess", 11, }, }; /* @@ -309,7 +310,7 @@ static struct { static int nfs_bigrequest[NFSV42_NPROCS] = { 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 + 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }; /* diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index aba5c5124e72..0297b52015f8 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -561,6 +561,7 @@ int nfsrpc_listextattr(vnode_t, uint64_t *, struct uio *, size_t *, bool *, struct nfsvattr *, int *, struct ucred *, NFSPROC_T *); int nfsrpc_rmextattr(vnode_t, const char *, struct nfsvattr *, int *, struct ucred *, NFSPROC_T *); +void nfsrpc_bindconnsess(CLIENT *, void *, struct ucred *); /* nfs_clstate.c */ int nfscl_open(vnode_t, u_int8_t *, int, u_int32_t, int, diff --git a/sys/fs/nfs/nfscl.h b/sys/fs/nfs/nfscl.h index 52da0af6fa51..3d7afaf68432 100644 --- a/sys/fs/nfs/nfscl.h +++ b/sys/fs/nfs/nfscl.h @@ -81,4 +81,9 @@ struct nfsv4node { printf(__VA_ARGS__); \ } while (0) +struct nfscl_reconarg { + int minorvers; + uint8_t sessionid[NFSX_V4SESSIONID]; +}; + #endif /* _NFS_NFSCL_H */ diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h index 255c9a47ebdf..6777dc72f6a3 100644 --- a/sys/fs/nfs/nfsport.h +++ b/sys/fs/nfs/nfsport.h @@ -412,10 +412,13 @@ #define NFSPROC_RMEXTATTR 63 #define NFSPROC_LISTEXTATTR 64 +/* BindConnectionToSession, done by the krpc for a new connection. */ +#define NFSPROC_BINDCONNTOSESS 65 + /* * Must be defined as one higher than the last NFSv4.2 Proc# above. */ -#define NFSV42_NPROCS 65 +#define NFSV42_NPROCS 66 #endif /* NFS_V3NPROCS */ @@ -444,7 +447,7 @@ struct nfsstatsv1 { uint64_t readlink_bios; uint64_t biocache_readdirs; uint64_t readdir_bios; - uint64_t rpccnt[NFSV42_NPROCS + 15]; + uint64_t rpccnt[NFSV42_NPROCS + 14]; uint64_t rpcretries; uint64_t srvrpccnt[NFSV42_NOPS + NFSV4OP_FAKENOPS + 15]; uint64_t reserved_0; @@ -509,7 +512,7 @@ struct nfsstatsov1 { uint64_t readlink_bios; uint64_t biocache_readdirs; uint64_t readdir_bios; - uint64_t rpccnt[NFSV42_NPROCS + 4]; + uint64_t rpccnt[NFSV42_NPROCS + 3]; uint64_t rpcretries; uint64_t srvrpccnt[NFSV42_PURENOPS + NFSV4OP_FAKENOPS]; uint64_t reserved_0; diff --git a/sys/fs/nfs/nfsproto.h b/sys/fs/nfs/nfsproto.h index c123152a7cb7..236d8c14ff24 100644 --- a/sys/fs/nfs/nfsproto.h +++ b/sys/fs/nfs/nfsproto.h @@ -394,10 +394,13 @@ #define NFSPROC_RMEXTATTR 63 #define NFSPROC_LISTEXTATTR 64 +/* BindConnectionToSession, done by the krpc for a new connection. */ +#define NFSPROC_BINDCONNTOSESS 65 + /* * Must be defined as one higher than the last NFSv4.2 Proc# above. */ -#define NFSV42_NPROCS 65 +#define NFSV42_NPROCS 66 #endif /* NFS_V3NPROCS */ diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 7cd793502476..ed95173b732b 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -946,6 +946,8 @@ nfsrpc_setclient(struct nfsmount *nmp, struct nfsclclient *clp, int reclaim, struct nfsclds *dsp, *odsp; struct in6_addr a6; struct nfsclsession *tsep; + struct rpc_reconupcall recon; + struct nfscl_reconarg *rcp; if (nfsboottime.tv_sec == 0) NFSSETBOOTTIME(nfsboottime); @@ -1019,6 +1021,23 @@ nfsrpc_setclient(struct nfsmount *nmp, struct nfsclclient *clp, int reclaim, NFSCL_DEBUG(1, "aft createsess=%d\n", error); } if (error == 0) { + /* + * If the session supports a backchannel, set up + * the BindConnectionToSession call in the krpc + * so that it is done on a reconnection. + */ + if (nfscl_enablecallb != 0 && nfs_numnfscbd > 0) { + rcp = mem_alloc(sizeof(*rcp)); + rcp->minorvers = nmp->nm_minorvers; + memcpy(rcp->sessionid, + dsp->nfsclds_sess.nfsess_sessionid, + NFSX_V4SESSIONID); + recon.call = nfsrpc_bindconnsess; + recon.arg = rcp; + CLNT_CONTROL(nmp->nm_client, CLSET_RECONUPCALL, + &recon); + } + NFSLOCKMNT(nmp); /* * The old sessions cannot be safely free'd @@ -8709,3 +8728,74 @@ nfsm_split(struct mbuf *mp, uint64_t xfer) m->m_next = NULL; return (m2); } + +/* + * Do the NFSv4.1 Bind Connection to Session. + * Called from the reconnect layer of the krpc (sys/rpc/clnt_rc.c). + */ +void +nfsrpc_bindconnsess(CLIENT *cl, void *arg, struct ucred *cr) +{ + struct nfscl_reconarg *rcp = (struct nfscl_reconarg *)arg; + uint32_t res, *tl; + struct nfsrv_descript nfsd; + struct nfsrv_descript *nd = &nfsd; + struct rpc_callextra ext; + struct timeval utimeout; + enum clnt_stat stat; + int error; + + nfscl_reqstart(nd, NFSPROC_BINDCONNTOSESS, NULL, NULL, 0, NULL, NULL, + NFS_VER4, rcp->minorvers); + NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 2 * NFSX_UNSIGNED); + memcpy(tl, rcp->sessionid, NFSX_V4SESSIONID); + tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; + *tl++ = txdr_unsigned(NFSCDFC4_FORE_OR_BOTH); + *tl = newnfs_false; + + memset(&ext, 0, sizeof(ext)); + utimeout.tv_sec = 30; + utimeout.tv_usec = 0; + ext.rc_auth = authunix_create(cr); + nd->nd_mrep = NULL; + stat = CLNT_CALL_MBUF(cl, &ext, NFSV4PROC_COMPOUND, nd->nd_mreq, + &nd->nd_mrep, utimeout); + AUTH_DESTROY(ext.rc_auth); + if (stat != RPC_SUCCESS) { + printf("nfsrpc_bindconnsess: call failed stat=%d\n", stat); + return; + } + if (nd->nd_mrep == NULL) { + printf("nfsrpc_bindconnsess: no reply args\n"); + return; + } + error = 0; + newnfs_realign(&nd->nd_mrep, M_WAITOK); + nd->nd_md = nd->nd_mrep; + nd->nd_dpos = mtod(nd->nd_md, char *); + NFSM_DISSECT(tl, uint32_t *, 2 * NFSX_UNSIGNED); + nd->nd_repstat = fxdr_unsigned(uint32_t, *tl++); + if (nd->nd_repstat == NFSERR_OK) { + res = fxdr_unsigned(uint32_t, *tl); + if (res > 0 && (error = nfsm_advance(nd, NFSM_RNDUP(res), + -1)) != 0) + goto nfsmout; + NFSM_DISSECT(tl, uint32_t *, NFSX_V4SESSIONID + + 4 * NFSX_UNSIGNED); + tl += 3; + if (!NFSBCMP(tl, rcp->sessionid, NFSX_V4SESSIONID)) { + tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; + res = fxdr_unsigned(uint32_t, *tl); + if (res != NFSCDFS4_BOTH) + printf("nfsrpc_bindconnsess: did not " + "return FS4_BOTH\n"); + } else + printf("nfsrpc_bindconnsess: not same " + "sessionid\n"); + } else if (nd->nd_repstat != NFSERR_BADSESSION) + printf("nfsrpc_bindconnsess: returned %d\n", nd->nd_repstat); +nfsmout: + if (error != 0) + printf("nfsrpc_bindconnsess: reply bad xdr\n"); + m_freem(nd->nd_mrep); +} diff --git a/sys/rpc/clnt.h b/sys/rpc/clnt.h index f4cc78b1c3b6..6f8f898ca918 100644 --- a/sys/rpc/clnt.h +++ b/sys/rpc/clnt.h @@ -360,6 +360,12 @@ enum clnt_stat clnt_call_private(CLIENT *, struct rpc_callextra *, rpcproc_t, #define CLSET_TLS 30 /* set TLS for socket */ #define CLSET_BLOCKRCV 31 /* Temporarily block reception */ #define CLSET_TLSCERTNAME 32 /* TLS certificate file name */ +/* Structure used as the argument for CLSET_RECONUPCALL. */ +struct rpc_reconupcall { + void (*call)(CLIENT *, void *, struct ucred *); + void *arg; +}; +#define CLSET_RECONUPCALL 33 /* Reconnect upcall */ #endif diff --git a/sys/rpc/clnt_rc.c b/sys/rpc/clnt_rc.c index 8c204989d0ea..ae3b2985a891 100644 --- a/sys/rpc/clnt_rc.c +++ b/sys/rpc/clnt_rc.c @@ -111,6 +111,8 @@ clnt_reconnect_create( rc->rc_client = NULL; rc->rc_tls = false; rc->rc_tlscertname = NULL; + rc->rc_reconcall = NULL; + rc->rc_reconarg = NULL; cl->cl_refs = 1; cl->cl_ops = &clnt_reconnect_ops; @@ -213,6 +215,9 @@ clnt_reconnect_connect(CLIENT *cl) goto out; } } + if (newclient != NULL && rc->rc_reconcall != NULL) + (*rc->rc_reconcall)(newclient, rc->rc_reconarg, + rc->rc_ucred); } td->td_ucred = oldcred; @@ -408,6 +413,7 @@ clnt_reconnect_control(CLIENT *cl, u_int request, void *info) struct rc_data *rc = (struct rc_data *)cl->cl_private; SVCXPRT *xprt; size_t slen; + struct rpc_reconupcall *upcp; if (info == NULL) { return (FALSE); @@ -513,6 +519,12 @@ clnt_reconnect_control(CLIENT *cl, u_int request, void *info) strlcpy(rc->rc_tlscertname, info, slen); break; + case CLSET_RECONUPCALL: + upcp = (struct rpc_reconupcall *)info; + rc->rc_reconcall = upcp->call; + rc->rc_reconarg = upcp->arg; + break; + default: return (FALSE); } @@ -555,12 +567,15 @@ clnt_reconnect_destroy(CLIENT *cl) CLNT_DESTROY(rc->rc_client); if (rc->rc_backchannel) { xprt = (SVCXPRT *)rc->rc_backchannel; + KASSERT(xprt->xp_socket == NULL, + ("clnt_reconnect_destroy: xp_socket not NULL")); xprt_unregister(xprt); SVC_RELEASE(xprt); } crfree(rc->rc_ucred); mtx_destroy(&rc->rc_lock); mem_free(rc->rc_tlscertname, 0); /* 0 ok, since arg. ignored. */ + mem_free(rc->rc_reconarg, 0); mem_free(rc, sizeof(*rc)); mem_free(cl, sizeof (CLIENT)); } diff --git a/sys/rpc/krpc.h b/sys/rpc/krpc.h index 77facdcf16cc..48df782e481c 100644 --- a/sys/rpc/krpc.h +++ b/sys/rpc/krpc.h @@ -81,6 +81,9 @@ struct rc_data { void *rc_backchannel; bool rc_tls; /* Enable TLS on connection */ char *rc_tlscertname; + void (*rc_reconcall)(CLIENT *, void *, + struct ucred *); /* reconection upcall */ + void *rc_reconarg; /* upcall arg */ }; /* Bits for ct_rcvstate. */ From owner-dev-commits-src-all@freebsd.org Sun Apr 11 21:49:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 796B95DFCD7; Sun, 11 Apr 2021 21:49: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 4FJQW22zjVz4fTM; Sun, 11 Apr 2021 21:49: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 592EA3755; Sun, 11 Apr 2021 21:49: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 13BLnIIZ067267; Sun, 11 Apr 2021 21:49:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BLnI0I067266; Sun, 11 Apr 2021 21:49:18 GMT (envelope-from git) Date: Sun, 11 Apr 2021 21:49:18 GMT Message-Id: <202104112149.13BLnI0I067266@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Yuri Pankov Subject: git: 0cb61a320a70 - main - ee: restore the stdin/stdout terminal check MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuripv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0cb61a320a7036f674f70e6487a5b0e44deb73b9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 21:49:18 -0000 The branch main has been updated by yuripv: URL: https://cgit.FreeBSD.org/src/commit/?id=0cb61a320a7036f674f70e6487a5b0e44deb73b9 commit 0cb61a320a7036f674f70e6487a5b0e44deb73b9 Author: Yuri Pankov AuthorDate: 2021-04-11 21:44:29 +0000 Commit: Yuri Pankov CommitDate: 2021-04-11 21:48:45 +0000 ee: restore the stdin/stdout terminal check This seems to have been lost during updates from upstream, and was reported (on IRC) as a nice feature to have (again). Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D28689 --- contrib/ee/ee.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/contrib/ee/ee.c b/contrib/ee/ee.c index 70a44076f882..5706dba1a20f 100644 --- a/contrib/ee/ee.c +++ b/contrib/ee/ee.c @@ -554,6 +554,13 @@ char *argv[]; for (counter = 1; counter < 24; counter++) signal(counter, SIG_IGN); + /* Always read from (and write to) a terminal. */ + if (!isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO)) { + fprintf(stderr, + "ee's standard input and output must be a terminal\n"); + exit(1); + } + signal(SIGCHLD, SIG_DFL); signal(SIGSEGV, SIG_DFL); signal(SIGINT, edit_abort); From owner-dev-commits-src-all@freebsd.org Sun Apr 11 21:49:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0E365DFD77; Sun, 11 Apr 2021 21:49: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 4FJQWm6YWWz4fTX; Sun, 11 Apr 2021 21:49: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 D3E1D3443; Sun, 11 Apr 2021 21:49: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 13BLnu3O067429; Sun, 11 Apr 2021 21:49:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BLnuiI067428; Sun, 11 Apr 2021 21:49:56 GMT (envelope-from git) Date: Sun, 11 Apr 2021 21:49:56 GMT Message-Id: <202104112149.13BLnuiI067428@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: fd140c52160a - stable/13 - epoll: Store epoll_event udata member in ext member of kevent. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: fd140c52160a8cc21d665d5bc6fa91d9d6ab8efe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 21:49:57 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=fd140c52160a8cc21d665d5bc6fa91d9d6ab8efe commit fd140c52160a8cc21d665d5bc6fa91d9d6ab8efe Author: Vladimir Kondratyev AuthorDate: 2021-02-07 23:46:14 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-04-11 21:47:39 +0000 epoll: Store epoll_event udata member in ext member of kevent. Current epoll implementation stores udata fields of epoll_event structure in special dynamically-sized table rather than in udata field of backing kevent structure because of 2 reasons: 1. Kevent's udata size is smaller than epoll's on 32-bit archs. 2. Kevent's udata can be clobbered on execution EPOLL_CTL_ADD as kqueue modifies existing event while epoll returns error in this case. After r320043 has introduced four new 64bit user data members (ext[]), we can store epoll udata in one of them and drop aforementioned table. According to kqueue_register() source code ext members are not updated when existing kevent is modified that fixes p.2. As a side effect the patch fixes PR/252582. Reviewed by: trasz MFC after: 1 month Differential revision: https://reviews.freebsd.org/D28169 (cherry picked from commit b3c6fe663bb90240f8bda6b5ba9c6a761f09f078) --- sys/compat/linux/linux_emul.c | 21 ---------- sys/compat/linux/linux_emul.h | 1 - sys/compat/linux/linux_event.c | 88 ++++++------------------------------------ 3 files changed, 11 insertions(+), 99 deletions(-) diff --git a/sys/compat/linux/linux_emul.c b/sys/compat/linux/linux_emul.c index 1dfbe239ccc4..499bebe8926a 100644 --- a/sys/compat/linux/linux_emul.c +++ b/sys/compat/linux/linux_emul.c @@ -143,7 +143,6 @@ linux_proc_init(struct thread *td, struct thread *newtd, int flags) { struct linux_emuldata *em; struct linux_pemuldata *pem; - struct epoll_emuldata *emd; struct proc *p; if (newtd != NULL) { @@ -185,15 +184,9 @@ linux_proc_init(struct thread *td, struct thread *newtd, int flags) em->child_clear_tid = NULL; em->child_set_tid = NULL; - /* epoll should be destroyed in a case of exec. */ pem = pem_find(p); KASSERT(pem != NULL, ("proc_exit: proc emuldata not found.\n")); pem->persona = 0; - if (pem->epoll != NULL) { - emd = pem->epoll; - pem->epoll = NULL; - free(emd, M_EPOLL); - } } } @@ -202,7 +195,6 @@ void linux_on_exit(struct proc *p) { struct linux_pemuldata *pem; - struct epoll_emuldata *emd; struct thread *td = curthread; MPASS(SV_CURPROC_ABI() == SV_ABI_LINUX); @@ -217,12 +209,6 @@ linux_on_exit(struct proc *p) p->p_emuldata = NULL; - if (pem->epoll != NULL) { - emd = pem->epoll; - pem->epoll = NULL; - free(emd, M_EPOLL); - } - sx_destroy(&pem->pem_sx); free(pem, M_LINUX); } @@ -267,7 +253,6 @@ int linux_common_execve(struct thread *td, struct image_args *eargs) { struct linux_pemuldata *pem; - struct epoll_emuldata *emd; struct vmspace *oldvmspace; struct linux_emuldata *em; struct proc *p; @@ -299,12 +284,6 @@ linux_common_execve(struct thread *td, struct image_args *eargs) p->p_emuldata = NULL; PROC_UNLOCK(p); - if (pem->epoll != NULL) { - emd = pem->epoll; - pem->epoll = NULL; - free(emd, M_EPOLL); - } - free(em, M_TEMP); free(pem, M_LINUX); } diff --git a/sys/compat/linux/linux_emul.h b/sys/compat/linux/linux_emul.h index 1bbc69ad98be..de66a7a4c82a 100644 --- a/sys/compat/linux/linux_emul.h +++ b/sys/compat/linux/linux_emul.h @@ -68,7 +68,6 @@ int linux_common_execve(struct thread *, struct image_args *); struct linux_pemuldata { uint32_t flags; /* process emuldata flags */ struct sx pem_sx; /* lock for this struct */ - void *epoll; /* epoll data */ uint32_t persona; /* process execution domain */ uint32_t ptrace_flags; /* used by ptrace(2) */ }; diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c index 54f6b083adf3..370bf4d6485f 100644 --- a/sys/compat/linux/linux_event.c +++ b/sys/compat/linux/linux_event.c @@ -71,25 +71,8 @@ __FBSDID("$FreeBSD$"); #include #include -/* - * epoll defines 'struct epoll_event' with the field 'data' as 64 bits - * on all architectures. But on 32 bit architectures BSD 'struct kevent' only - * has 32 bit opaque pointer as 'udata' field. So we can't pass epoll supplied - * data verbatuim. Therefore we allocate 64-bit memory block to pass - * user supplied data for every file descriptor. - */ - typedef uint64_t epoll_udata_t; -struct epoll_emuldata { - uint32_t fdc; /* epoll udata max index */ - epoll_udata_t udata[1]; /* epoll user data vector */ -}; - -#define EPOLL_DEF_SZ 16 -#define EPOLL_SIZE(fdn) \ - (sizeof(struct epoll_emuldata)+(fdn) * sizeof(epoll_udata_t)) - struct epoll_event { uint32_t events; epoll_udata_t data; @@ -101,7 +84,6 @@ __attribute__((packed)) #define LINUX_MAX_EVENTS (INT_MAX / sizeof(struct epoll_event)) -static void epoll_fd_install(struct thread *td, int fd, epoll_udata_t udata); static int epoll_to_kevent(struct thread *td, int fd, struct epoll_event *l_event, struct kevent *kevent, int *nkevents); @@ -175,47 +157,11 @@ struct timerfd { static void linux_timerfd_expire(void *); static void linux_timerfd_curval(struct timerfd *, struct itimerspec *); -static void -epoll_fd_install(struct thread *td, int fd, epoll_udata_t udata) -{ - struct linux_pemuldata *pem; - struct epoll_emuldata *emd; - struct proc *p; - - p = td->td_proc; - - pem = pem_find(p); - KASSERT(pem != NULL, ("epoll proc emuldata not found.\n")); - - LINUX_PEM_XLOCK(pem); - if (pem->epoll == NULL) { - emd = malloc(EPOLL_SIZE(fd), M_EPOLL, M_WAITOK); - emd->fdc = fd; - pem->epoll = emd; - } else { - emd = pem->epoll; - if (fd > emd->fdc) { - emd = realloc(emd, EPOLL_SIZE(fd), M_EPOLL, M_WAITOK); - emd->fdc = fd; - pem->epoll = emd; - } - } - emd->udata[fd] = udata; - LINUX_PEM_XUNLOCK(pem); -} - static int epoll_create_common(struct thread *td, int flags) { - int error; - - error = kern_kqueue(td, flags, NULL); - if (error != 0) - return (error); - - epoll_fd_install(td, EPOLL_DEF_SZ, 0); - return (0); + return (kern_kqueue(td, flags, NULL)); } #ifdef LINUX_LEGACY_SYSCALLS @@ -271,11 +217,15 @@ epoll_to_kevent(struct thread *td, int fd, struct epoll_event *l_event, /* flags related to what event is registered */ if ((levents & LINUX_EPOLL_EVRD) != 0) { - EV_SET(kevent++, fd, EVFILT_READ, kev_flags, 0, 0, 0); + EV_SET(kevent, fd, EVFILT_READ, kev_flags, 0, 0, 0); + kevent->ext[0] = l_event->data; + ++kevent; ++(*nkevents); } if ((levents & LINUX_EPOLL_EVWR) != 0) { - EV_SET(kevent++, fd, EVFILT_WRITE, kev_flags, 0, 0, 0); + EV_SET(kevent, fd, EVFILT_WRITE, kev_flags, 0, 0, 0); + kevent->ext[0] = l_event->data; + ++kevent; ++(*nkevents); } /* zero event mask is legal */ @@ -289,7 +239,6 @@ epoll_to_kevent(struct thread *td, int fd, struct epoll_event *l_event, pem = pem_find(p); KASSERT(pem != NULL, ("epoll proc emuldata not found.\n")); - KASSERT(pem->epoll != NULL, ("epoll proc epolldata not found.\n")); LINUX_PEM_XLOCK(pem); if ((pem->flags & LINUX_XUNSUP_EPOLL) == 0) { @@ -314,6 +263,8 @@ static void kevent_to_epoll(struct kevent *kevent, struct epoll_event *l_event) { + l_event->data = kevent->ext[0]; + if ((kevent->flags & EV_ERROR) != 0) { l_event->events = LINUX_EPOLLERR; return; @@ -342,30 +293,15 @@ static int epoll_kev_copyout(void *arg, struct kevent *kevp, int count) { struct epoll_copyout_args *args; - struct linux_pemuldata *pem; - struct epoll_emuldata *emd; struct epoll_event *eep; - int error, fd, i; + int error, i; args = (struct epoll_copyout_args*) arg; eep = malloc(sizeof(*eep) * count, M_EPOLL, M_WAITOK | M_ZERO); - pem = pem_find(args->p); - KASSERT(pem != NULL, ("epoll proc emuldata not found.\n")); - LINUX_PEM_SLOCK(pem); - emd = pem->epoll; - KASSERT(emd != NULL, ("epoll proc epolldata not found.\n")); - - for (i = 0; i < count; i++) { + for (i = 0; i < count; i++) kevent_to_epoll(&kevp[i], &eep[i]); - fd = kevp[i].ident; - KASSERT(fd <= emd->fdc, ("epoll user data vector" - " is too small.\n")); - eep[i].data = emd->udata[fd]; - } - LINUX_PEM_SUNLOCK(pem); - error = copyout(eep, args->leventlist, count * sizeof(*eep)); if (error == 0) { args->leventlist += count; @@ -473,8 +409,6 @@ linux_epoll_ctl(struct thread *td, struct linux_epoll_ctl_args *args) goto leave0; } - epoll_fd_install(td, args->fd, le.data); - error = kern_kevent_fp(td, epfp, nchanges, 0, &k_ops, NULL); leave0: From owner-dev-commits-src-all@freebsd.org Sun Apr 11 21:49:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3B0C35DFD7E; Sun, 11 Apr 2021 21:49: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 4FJQWp17JWz4f9H; Sun, 11 Apr 2021 21:49: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 090E933F1; Sun, 11 Apr 2021 21:49: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 13BLnvIn067450; Sun, 11 Apr 2021 21:49:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BLnvUH067449; Sun, 11 Apr 2021 21:49:57 GMT (envelope-from git) Date: Sun, 11 Apr 2021 21:49:57 GMT Message-Id: <202104112149.13BLnvUH067449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 09d2a7a67b54 - stable/13 - ig4: Add PCI IDs for Intel Gemini Lake I2C controller. 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 09d2a7a67b54eccccdc9ec97bbb7c918f0166ab8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 21:49:58 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=09d2a7a67b54eccccdc9ec97bbb7c918f0166ab8 commit 09d2a7a67b54eccccdc9ec97bbb7c918f0166ab8 Author: Vladimir Kondratyev AuthorDate: 2021-02-23 22:20:36 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-04-11 21:48:08 +0000 ig4: Add PCI IDs for Intel Gemini Lake I2C controller. Submitted by: Dmitry Luhtionov MFC after: 2 weeks (cherry picked from commit bbacb7ce72956a41c0daeefe875e5209d87c11ba) --- sys/dev/ichiic/ig4_iic.c | 6 ++++++ sys/dev/ichiic/ig4_pci.c | 16 ++++++++++++++++ sys/dev/ichiic/ig4_var.h | 3 ++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/sys/dev/ichiic/ig4_iic.c b/sys/dev/ichiic/ig4_iic.c index b684dc7d87cd..f24b26f53366 100644 --- a/sys/dev/ichiic/ig4_iic.c +++ b/sys/dev/ichiic/ig4_iic.c @@ -125,6 +125,12 @@ static const struct ig4_hw ig4iic_hw[] = { .scl_fall_time = 208, .sda_hold_time = 42, }, + [IG4_GEMINILAKE] = { + .ic_clock_rate = 133, + .sda_fall_time = 171, + .scl_fall_time = 290, + .sda_hold_time = 313, + }, }; static int ig4iic_set_config(ig4iic_softc_t *sc, bool reset); diff --git a/sys/dev/ichiic/ig4_pci.c b/sys/dev/ichiic/ig4_pci.c index 4667709e2fa2..2d80a8b1800a 100644 --- a/sys/dev/ichiic/ig4_pci.c +++ b/sys/dev/ichiic/ig4_pci.c @@ -136,6 +136,14 @@ static int ig4iic_pci_detach(device_t dev); #define PCI_CHIP_TIGERLAKE_LP_I2C_5 0xa0e98086 #define PCI_CHIP_TIGERLAKE_LP_I2C_6 0xa0ea8086 #define PCI_CHIP_TIGERLAKE_LP_I2C_7 0xa0eb8086 +#define PCI_CHIP_GEMINILAKE_I2C_0 0x31ac8086 +#define PCI_CHIP_GEMINILAKE_I2C_1 0x31ae8086 +#define PCI_CHIP_GEMINILAKE_I2C_2 0x31b08086 +#define PCI_CHIP_GEMINILAKE_I2C_3 0x31b28086 +#define PCI_CHIP_GEMINILAKE_I2C_4 0x31b48086 +#define PCI_CHIP_GEMINILAKE_I2C_5 0x31b68086 +#define PCI_CHIP_GEMINILAKE_I2C_6 0x31b88086 +#define PCI_CHIP_GEMINILAKE_I2C_7 0x31ba8086 struct ig4iic_pci_device { uint32_t devid; @@ -214,6 +222,14 @@ static struct ig4iic_pci_device ig4iic_pci_devices[] = { { PCI_CHIP_TIGERLAKE_LP_I2C_5, "Intel Tiger Lake-LP I2C Controller-5", IG4_SKYLAKE}, { PCI_CHIP_TIGERLAKE_LP_I2C_6, "Intel Tiger Lake-LP I2C Controller-6", IG4_SKYLAKE}, { PCI_CHIP_TIGERLAKE_LP_I2C_7, "Intel Tiger Lake-LP I2C Controller-7", IG4_SKYLAKE}, + { PCI_CHIP_GEMINILAKE_I2C_0, "Intel Gemini Lake I2C Controller-0", IG4_GEMINILAKE}, + { PCI_CHIP_GEMINILAKE_I2C_1, "Intel Gemini Lake I2C Controller-1", IG4_GEMINILAKE}, + { PCI_CHIP_GEMINILAKE_I2C_2, "Intel Gemini Lake I2C Controller-2", IG4_GEMINILAKE}, + { PCI_CHIP_GEMINILAKE_I2C_3, "Intel Gemini Lake I2C Controller-3", IG4_GEMINILAKE}, + { PCI_CHIP_GEMINILAKE_I2C_4, "Intel Gemini Lake I2C Controller-4", IG4_GEMINILAKE}, + { PCI_CHIP_GEMINILAKE_I2C_5, "Intel Gemini Lake I2C Controller-5", IG4_GEMINILAKE}, + { PCI_CHIP_GEMINILAKE_I2C_6, "Intel Gemini Lake I2C Controller-6", IG4_GEMINILAKE}, + { PCI_CHIP_GEMINILAKE_I2C_7, "Intel Gemini Lake I2C Controller-7", IG4_GEMINILAKE}, }; static int diff --git a/sys/dev/ichiic/ig4_var.h b/sys/dev/ichiic/ig4_var.h index 7a94e4f5cffd..da81980039f1 100644 --- a/sys/dev/ichiic/ig4_var.h +++ b/sys/dev/ichiic/ig4_var.h @@ -49,7 +49,8 @@ enum ig4_vers { IG4_SKYLAKE, IG4_APL, IG4_CANNONLAKE, - IG4_TIGERLAKE + IG4_TIGERLAKE, + IG4_GEMINILAKE }; /* Controller has additional registers */ From owner-dev-commits-src-all@freebsd.org Sun Apr 11 21:49:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E3BA5E003E; Sun, 11 Apr 2021 21:49: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 4FJQWq283Yz4fcC; Sun, 11 Apr 2021 21:49: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 2B2833894; Sun, 11 Apr 2021 21:49: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 13BLnx60067471; Sun, 11 Apr 2021 21:49:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BLnxi9067470; Sun, 11 Apr 2021 21:49:59 GMT (envelope-from git) Date: Sun, 11 Apr 2021 21:49:59 GMT Message-Id: <202104112149.13BLnxi9067470@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 99bc385243e8 - stable/13 - hid: add opt_hid.h to modules that use HID_DEBUG 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 99bc385243e80406ccb504384132738023be182a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 21:49:59 -0000 The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=99bc385243e80406ccb504384132738023be182a commit 99bc385243e80406ccb504384132738023be182a Author: Vladimir Kondratyev AuthorDate: 2021-03-03 22:21:15 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-04-11 21:48:51 +0000 hid: add opt_hid.h to modules that use HID_DEBUG Submitted by: Greg V Reviewed by: imp, wulf MFC after: 1 week Differential revision: https://reviews.freebsd.org/D28995 (cherry picked from commit 6241b57131a60bc2bd0eda41c145aa9659c2886b) --- sys/dev/hid/hconf.c | 2 ++ sys/dev/hid/hkbd.c | 1 + sys/modules/hid/hconf/Makefile | 1 + sys/modules/hid/hkbd/Makefile | 2 +- sys/modules/hid/ps4dshock/Makefile | 1 + 5 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/hid/hconf.c b/sys/dev/hid/hconf.c index cb0465e71b3e..90cd52d3116c 100644 --- a/sys/dev/hid/hconf.c +++ b/sys/dev/hid/hconf.c @@ -34,6 +34,8 @@ __FBSDID("$FreeBSD$"); * https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelines/windows-precision-touchpad-required-hid-top-level-collections */ +#include "opt_hid.h" + #include #include #include diff --git a/sys/dev/hid/hkbd.c b/sys/dev/hid/hkbd.c index 89325f9b2499..775ad677f4de 100644 --- a/sys/dev/hid/hkbd.c +++ b/sys/dev/hid/hkbd.c @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); * HID spec: http://www.usb.org/developers/devclass_docs/HID1_11.pdf */ +#include "opt_hid.h" #include "opt_kbd.h" #include "opt_hkbd.h" #include "opt_evdev.h" diff --git a/sys/modules/hid/hconf/Makefile b/sys/modules/hid/hconf/Makefile index 1e5c68fe1848..0ac8d969cd71 100644 --- a/sys/modules/hid/hconf/Makefile +++ b/sys/modules/hid/hconf/Makefile @@ -4,6 +4,7 @@ KMOD= hconf SRCS= hconf.c +SRCS+= opt_hid.h SRCS+= bus_if.h device_if.h .include diff --git a/sys/modules/hid/hkbd/Makefile b/sys/modules/hid/hkbd/Makefile index 38221227d1cd..8bb1c339ac6c 100644 --- a/sys/modules/hid/hkbd/Makefile +++ b/sys/modules/hid/hkbd/Makefile @@ -4,7 +4,7 @@ KMOD= hkbd SRCS= hkbd.c -SRCS+= opt_evdev.h opt_kbd.h opt_hkbd.h +SRCS+= opt_hid.h opt_evdev.h opt_kbd.h opt_hkbd.h SRCS+= bus_if.h device_if.h .include diff --git a/sys/modules/hid/ps4dshock/Makefile b/sys/modules/hid/ps4dshock/Makefile index 688494f33ac6..ab46ba3f2363 100644 --- a/sys/modules/hid/ps4dshock/Makefile +++ b/sys/modules/hid/ps4dshock/Makefile @@ -4,6 +4,7 @@ KMOD= ps4dshock SRCS= ps4dshock.c +SRCS+= opt_hid.h SRCS+= bus_if.h device_if.h usbdevs.h .include From owner-dev-commits-src-all@freebsd.org Sun Apr 11 21:53:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DB275E02AB; Sun, 11 Apr 2021 21:53: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 4FJQc00qg9z4fvQ; Sun, 11 Apr 2021 21:53: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 0FB583778; Sun, 11 Apr 2021 21:53: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 13BLraSj079912; Sun, 11 Apr 2021 21:53:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BLrZ6B079911; Sun, 11 Apr 2021 21:53:35 GMT (envelope-from git) Date: Sun, 11 Apr 2021 21:53:35 GMT Message-Id: <202104112153.13BLrZ6B079911@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: e152bbecb221 - main - param.h: bump __FreeBSD_version for commit 7763814fc9c2 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: e152bbecb221a592e7dbcabe3d1170a60f0d0dfe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 21:53:36 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=e152bbecb221a592e7dbcabe3d1170a60f0d0dfe commit e152bbecb221a592e7dbcabe3d1170a60f0d0dfe Author: Rick Macklem AuthorDate: 2021-04-11 21:47:36 +0000 Commit: Rick Macklem CommitDate: 2021-04-11 21:50:56 +0000 param.h: bump __FreeBSD_version for commit 7763814fc9c2 Commit 7763814fc9c2 changed the internal KAPI between the krpc and NFS. As such, the krpc, nfscommon and nfscl modules must all be rebuilt from sources. --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index e3230de27bb1..c17c750e2b51 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400007 /* Master, propagated to newvers */ +#define __FreeBSD_version 1400008 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-dev-commits-src-all@freebsd.org Sun Apr 11 21:54:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7E1FD5E0152; Sun, 11 Apr 2021 21:54: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 4FJQdS38XNz4g8r; Sun, 11 Apr 2021 21:54: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 5F08238C2; Sun, 11 Apr 2021 21:54: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 13BLsqkt080102; Sun, 11 Apr 2021 21:54:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BLsqTv080101; Sun, 11 Apr 2021 21:54:52 GMT (envelope-from git) Date: Sun, 11 Apr 2021 21:54:52 GMT Message-Id: <202104112154.13BLsqTv080101@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: 30b132ffe699 - stable/12 - ig4: Add PCI IDs for Intel Gemini Lake I2C controller. 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 30b132ffe6999013e8b1cf5d85ed645495ac36d0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 21:54:52 -0000 The branch stable/12 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=30b132ffe6999013e8b1cf5d85ed645495ac36d0 commit 30b132ffe6999013e8b1cf5d85ed645495ac36d0 Author: Vladimir Kondratyev AuthorDate: 2021-02-23 22:20:36 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-04-11 21:52:04 +0000 ig4: Add PCI IDs for Intel Gemini Lake I2C controller. Submitted by: Dmitry Luhtionov MFC after: 2 weeks --- sys/dev/ichiic/ig4_iic.c | 6 ++++++ sys/dev/ichiic/ig4_pci.c | 16 ++++++++++++++++ sys/dev/ichiic/ig4_var.h | 3 ++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/sys/dev/ichiic/ig4_iic.c b/sys/dev/ichiic/ig4_iic.c index b684dc7d87cd..f24b26f53366 100644 --- a/sys/dev/ichiic/ig4_iic.c +++ b/sys/dev/ichiic/ig4_iic.c @@ -125,6 +125,12 @@ static const struct ig4_hw ig4iic_hw[] = { .scl_fall_time = 208, .sda_hold_time = 42, }, + [IG4_GEMINILAKE] = { + .ic_clock_rate = 133, + .sda_fall_time = 171, + .scl_fall_time = 290, + .sda_hold_time = 313, + }, }; static int ig4iic_set_config(ig4iic_softc_t *sc, bool reset); diff --git a/sys/dev/ichiic/ig4_pci.c b/sys/dev/ichiic/ig4_pci.c index 4667709e2fa2..2d80a8b1800a 100644 --- a/sys/dev/ichiic/ig4_pci.c +++ b/sys/dev/ichiic/ig4_pci.c @@ -136,6 +136,14 @@ static int ig4iic_pci_detach(device_t dev); #define PCI_CHIP_TIGERLAKE_LP_I2C_5 0xa0e98086 #define PCI_CHIP_TIGERLAKE_LP_I2C_6 0xa0ea8086 #define PCI_CHIP_TIGERLAKE_LP_I2C_7 0xa0eb8086 +#define PCI_CHIP_GEMINILAKE_I2C_0 0x31ac8086 +#define PCI_CHIP_GEMINILAKE_I2C_1 0x31ae8086 +#define PCI_CHIP_GEMINILAKE_I2C_2 0x31b08086 +#define PCI_CHIP_GEMINILAKE_I2C_3 0x31b28086 +#define PCI_CHIP_GEMINILAKE_I2C_4 0x31b48086 +#define PCI_CHIP_GEMINILAKE_I2C_5 0x31b68086 +#define PCI_CHIP_GEMINILAKE_I2C_6 0x31b88086 +#define PCI_CHIP_GEMINILAKE_I2C_7 0x31ba8086 struct ig4iic_pci_device { uint32_t devid; @@ -214,6 +222,14 @@ static struct ig4iic_pci_device ig4iic_pci_devices[] = { { PCI_CHIP_TIGERLAKE_LP_I2C_5, "Intel Tiger Lake-LP I2C Controller-5", IG4_SKYLAKE}, { PCI_CHIP_TIGERLAKE_LP_I2C_6, "Intel Tiger Lake-LP I2C Controller-6", IG4_SKYLAKE}, { PCI_CHIP_TIGERLAKE_LP_I2C_7, "Intel Tiger Lake-LP I2C Controller-7", IG4_SKYLAKE}, + { PCI_CHIP_GEMINILAKE_I2C_0, "Intel Gemini Lake I2C Controller-0", IG4_GEMINILAKE}, + { PCI_CHIP_GEMINILAKE_I2C_1, "Intel Gemini Lake I2C Controller-1", IG4_GEMINILAKE}, + { PCI_CHIP_GEMINILAKE_I2C_2, "Intel Gemini Lake I2C Controller-2", IG4_GEMINILAKE}, + { PCI_CHIP_GEMINILAKE_I2C_3, "Intel Gemini Lake I2C Controller-3", IG4_GEMINILAKE}, + { PCI_CHIP_GEMINILAKE_I2C_4, "Intel Gemini Lake I2C Controller-4", IG4_GEMINILAKE}, + { PCI_CHIP_GEMINILAKE_I2C_5, "Intel Gemini Lake I2C Controller-5", IG4_GEMINILAKE}, + { PCI_CHIP_GEMINILAKE_I2C_6, "Intel Gemini Lake I2C Controller-6", IG4_GEMINILAKE}, + { PCI_CHIP_GEMINILAKE_I2C_7, "Intel Gemini Lake I2C Controller-7", IG4_GEMINILAKE}, }; static int diff --git a/sys/dev/ichiic/ig4_var.h b/sys/dev/ichiic/ig4_var.h index 7a94e4f5cffd..da81980039f1 100644 --- a/sys/dev/ichiic/ig4_var.h +++ b/sys/dev/ichiic/ig4_var.h @@ -49,7 +49,8 @@ enum ig4_vers { IG4_SKYLAKE, IG4_APL, IG4_CANNONLAKE, - IG4_TIGERLAKE + IG4_TIGERLAKE, + IG4_GEMINILAKE }; /* Controller has additional registers */ From owner-dev-commits-src-all@freebsd.org Sun Apr 11 22:01:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0A495E06BD; Sun, 11 Apr 2021 22: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 4FJQng64rfz4gFD; Sun, 11 Apr 2021 22: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 C3EE13940; Sun, 11 Apr 2021 22: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 13BM1xQ7092738; Sun, 11 Apr 2021 22: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 13BM1xjs092737; Sun, 11 Apr 2021 22:01:59 GMT (envelope-from git) Date: Sun, 11 Apr 2021 22:01:59 GMT Message-Id: <202104112201.13BM1xjs092737@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: 68b7d9b56bf3 - main - Add an UPDATING entry for commit 7763814fc9c2 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: 68b7d9b56bf38881d41f0fd00a7f7ced7844891e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 22:01:59 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=68b7d9b56bf38881d41f0fd00a7f7ced7844891e commit 68b7d9b56bf38881d41f0fd00a7f7ced7844891e Author: Rick Macklem AuthorDate: 2021-04-11 21:59:11 +0000 Commit: Rick Macklem CommitDate: 2021-04-11 21:59:11 +0000 Add an UPDATING entry for commit 7763814fc9c2 --- UPDATING | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UPDATING b/UPDATING index bf97bd1ed33b..17619ebcd638 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".) +20210411: + Commit 7763814fc9c2 changed the internal KAPI between + the krpc and NFS. As such, the krpc, nfscommon and + nfscl modules must all be rebuilt from sources. + 20210330: Commit 01ae8969a9ee fixed the NFSv4.1/4.2 server so that it handles binding of the back channel as required by RFC5661. From owner-dev-commits-src-all@freebsd.org Sun Apr 11 22:05:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0E1D5E07D1; Sun, 11 Apr 2021 22:05: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 4FJQsq5Zfjz4gZG; Sun, 11 Apr 2021 22:05: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 B2716347D; Sun, 11 Apr 2021 22:05: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 13BM5ZZG093961; Sun, 11 Apr 2021 22:05:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BM5Zb6093960; Sun, 11 Apr 2021 22:05:35 GMT (envelope-from git) Date: Sun, 11 Apr 2021 22:05:35 GMT Message-Id: <202104112205.13BM5Zb6093960@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Yuri Pankov Subject: git: eeaf9d562fe1 - main - setclassenvironment: trim leading spaces in variable names MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: yuripv X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eeaf9d562fe137e0c52b8c346742dccfc8bde015 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 22:05:35 -0000 The branch main has been updated by yuripv: URL: https://cgit.FreeBSD.org/src/commit/?id=eeaf9d562fe137e0c52b8c346742dccfc8bde015 commit eeaf9d562fe137e0c52b8c346742dccfc8bde015 Author: Yuri Pankov AuthorDate: 2021-04-11 22:02:12 +0000 Commit: Yuri Pankov CommitDate: 2021-04-11 22:05:10 +0000 setclassenvironment: trim leading spaces in variable names Trim leading spaces in variable names when the list is e.g. pretty-formatted in /etc/login.conf or ~/.login_conf. PR: 247947 Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D25649 --- lib/libutil/login_class.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c index fd0b232d0a43..38666bc8e3d3 100644 --- a/lib/libutil/login_class.c +++ b/lib/libutil/login_class.c @@ -231,12 +231,17 @@ setclassenvironment(login_cap_t *lc, const struct passwd * pwd, int paths) while (*set_env != NULL) { char *p = strchr(*set_env, '='); - if (p != NULL) { /* Discard invalid entries */ + if (p != NULL && p != *set_env) { /* Discard invalid entries */ + const char *ep; char *np; *p++ = '\0'; + /* Strip leading spaces from variable name */ + ep = *set_env; + while (*ep == ' ' || *ep == '\t') + ep++; if ((np = substvar(p, pwd, hlen, pch, nlen)) != NULL) { - setenv(*set_env, np, 1); + setenv(ep, np, 1); free(np); } } From owner-dev-commits-src-all@freebsd.org Sun Apr 11 22:10:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD9A25E0A7B; Sun, 11 Apr 2021 22:10:25 +0000 (UTC) (envelope-from purplefiasco@gmail.com) Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) (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 4FJQzP4vffz4gX6; Sun, 11 Apr 2021 22:10:25 +0000 (UTC) (envelope-from purplefiasco@gmail.com) Received: by mail-qv1-xf2d.google.com with SMTP id h3so5389485qvr.10; Sun, 11 Apr 2021 15:10:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:content-transfer-encoding:message-id:date:subject:from :in-reply-to:references:to; bh=TlT5ZUD8/huLcDK38chHsi88WG8hBkoU5bf0tj74vpM=; b=GmsJbm794EuSzDltvGJmkXv5gitlFQuiFMBW+lnT/eMM7PoFKrexSxEfRYVDGE7r5c GJabEPuiimy/kOLIee/LHlr2gMQxyCmYz1eRPrra6SwPFNluFG184yRXoRZXcZlEBMX0 L+Ex2GUB6vL6MYAb2IPjEVzTthAh68wre7b65wZuA/VgiE0QzpiZTKVeWSXSQI8rNlke lz9TBM0S/CXnatKhHV6OsPCtkidvuC/3wyUtx8rAInWRfFpVz9lZBXGfoimF7Fbi9/c8 iUSFZ8LFDAa174+SIwJbamHjvIYMcMknSR9ttZkcTzUQ3AXrmgLKwaED+0kQ+aTzTQw2 fjlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding :message-id:date:subject:from:in-reply-to:references:to; bh=TlT5ZUD8/huLcDK38chHsi88WG8hBkoU5bf0tj74vpM=; b=CBlP5br7WQCHzenD49o2SlcyjhxziNQJR9cyh5TuVoebsm/0+qityZgnPzOtrg/ub1 gab6XA2ge0T9uJ+LL9/R87LchwZUvN3igH5ps2DTwRrwKrzQ3fmyaqGjxi9MfozhwxWq v93naJ727bIIJy2caBRMIoktf6AoTXDFz9sJwgDLRmQsziRMaHK8tJJlVEYH03HDW8/o JL5Wm2bYA/RiAGrthEheI6Ajiq2HpjBhK7cHNgneSFQ8EqBxCJD0zXB9XPVPApc3kh5C VZiz87qwKHBHvtCPNx+kUmzAKR5bxagW5QU/amQrTdnndBmTx0GtwApwsf8ERFNmNsDC v9qA== X-Gm-Message-State: AOAM531pJAXYnV+pD8XIs7tCOGjM4e7JoDAMiR3o8DP4oKK8Hm9AfoeA pVjpOCaY/VAy61EfNuuIcWuV8PSl83E= X-Google-Smtp-Source: ABdhPJw+NO6rpuRXtXKzn2uxovEl7CghYD5AUwIBCB/+UYJAEgMTIyg4Bz/lda6pUM4iGOpx1/3elA== X-Received: by 2002:a0c:ff48:: with SMTP id y8mr25288518qvt.8.1618179024428; Sun, 11 Apr 2021 15:10:24 -0700 (PDT) Received: from [127.0.0.1] ([142.169.78.54]) by smtp.gmail.com with ESMTPSA id e8sm2800160qtg.14.2021.04.11.15.10.23 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Apr 2021 15:10:23 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: BlackBerry Email (10.3.3.3216) Message-ID: <20210411221023.7262287.95093.357@gmail.com> Date: Sun, 11 Apr 2021 18:10:23 -0400 Subject: Re: git: e152bbecb221 - main - param.h: bump __FreeBSD_version for commit 7763814fc9c2 From: =?utf-8?b?RnJhbsOnb2lzIEJyacOocmU=?= In-Reply-To: <202104112153.13BLrZ6B079911@gitrepo.freebsd.org> References: <202104112153.13BLrZ6B079911@gitrepo.freebsd.org> To: Rick Macklem , src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org X-Rspamd-Queue-Id: 4FJQzP4vffz4gX6 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-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 22:10:25 -0000 Envoy=C3=A9=C2=A0de=C2=A0mon=C2=A0smartphone=C2=A0BlackBerry=C2=A010=C2=A0s= ur=C2=A0le=C2=A0r=C3=A9seau=C2=A0Public=C2=A0mobile. =C2=A0 Message d'origine =C2=A0 De: Rick Macklem Envoy=C3=A9: dimanche 11 avril 2021 5:53 PM =C3=80: src-committers@FreeBSD.org; dev-commits-src-all@FreeBSD.org; dev-co= mmits-src-main@FreeBSD.org Objet: git: e152bbecb221 - main - param.h: bump __FreeBSD_version for commi= t 7763814fc9c2 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=3De152bbecb221a592e7dbcabe3d11= 70a60f0d0dfe commit e152bbecb221a592e7dbcabe3d1170a60f0d0dfe Author: Rick Macklem AuthorDate: 2021-04-11 21:47:36 +0000 Commit: Rick Macklem CommitDate: 2021-04-11 21:50:56 +0000 param.h: bump __FreeBSD_version for commit 7763814fc9c2 Commit 7763814fc9c2 changed the internal KAPI between the krpc and NFS. As such, the krpc, nfscommon and nfscl modules mus.=E2=80=8E all be rebuilt from sources. --- sys/sys/param.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/param.h b/sys/sys/param.h index e3230de27bb1..c17c750e2b51 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1400007 /* Master, propagated to newvers */ +#define __FreeBSD_version 1400008 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, _______________________________________________ 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@freebsd.= org" From owner-dev-commits-src-all@freebsd.org Sun Apr 11 22:18:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFF2A5E0C52; Sun, 11 Apr 2021 22:18: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 4FJR8c4cKGz4h1F; Sun, 11 Apr 2021 22:18: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 913ED4086; Sun, 11 Apr 2021 22:18: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 13BMIOiX007945; Sun, 11 Apr 2021 22:18:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BMIOCC007944; Sun, 11 Apr 2021 22:18:24 GMT (envelope-from git) Date: Sun, 11 Apr 2021 22:18:24 GMT Message-Id: <202104112218.13BMIOCC007944@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: d647d0d4f78f - main - Add a note to indicate "don't run the nfscbd(8) without this patch. 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: d647d0d4f78f6bd2e809e7cf37342ef67dbe9dce Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 22:18:24 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=d647d0d4f78f6bd2e809e7cf37342ef67dbe9dce commit d647d0d4f78f6bd2e809e7cf37342ef67dbe9dce Author: Rick Macklem AuthorDate: 2021-04-11 22:14:47 +0000 Commit: Rick Macklem CommitDate: 2021-04-11 22:14:47 +0000 Add a note to indicate "don't run the nfscbd(8) without this patch. --- UPDATING | 3 +++ 1 file changed, 3 insertions(+) diff --git a/UPDATING b/UPDATING index 17619ebcd638..9b9d8145e06a 100644 --- a/UPDATING +++ b/UPDATING @@ -31,6 +31,9 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW: Commit 7763814fc9c2 changed the internal KAPI between the krpc and NFS. As such, the krpc, nfscommon and nfscl modules must all be rebuilt from sources. + Without this patch, NFSv4.1/4.2 mounts should not + be done with the nfscbd(8) daemon running, to avoid + needing a working back channel for server->client RPCs. 20210330: Commit 01ae8969a9ee fixed the NFSv4.1/4.2 server so that it From owner-dev-commits-src-all@freebsd.org Sun Apr 11 22:26:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 061A95E1115; Sun, 11 Apr 2021 22:26: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 4FJRLM6mBVz4hQL; Sun, 11 Apr 2021 22:26: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 DAC523ACA; Sun, 11 Apr 2021 22:26: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 13BMQpOP020822; Sun, 11 Apr 2021 22:26:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BMQpkb020821; Sun, 11 Apr 2021 22:26:51 GMT (envelope-from git) Date: Sun, 11 Apr 2021 22:26:51 GMT Message-Id: <202104112226.13BMQpkb020821@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 431a136f423b - stable/13 - nfsv4 client: fix forced dismount when sleeping in the renew thread 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 431a136f423b7487fab33ea8d431af4f67b7e226 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 22:26:52 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=431a136f423b7487fab33ea8d431af4f67b7e226 commit 431a136f423b7487fab33ea8d431af4f67b7e226 Author: Rick Macklem AuthorDate: 2021-03-23 20:04:37 +0000 Commit: Rick Macklem CommitDate: 2021-04-11 22:23:23 +0000 nfsv4 client: fix forced dismount when sleeping in the renew thread During a recent NFSv4 testing event a test server caused a hang where "umount -N" failed. The renew thread was sleeping on "nfsv4lck" and the "umount" was sleeping, waiting for the renew thread to terminate. This is the second of two patches that is hoped to fix the renew thread so that it will terminate when "umount -N" is done on the mount. This patch adds a 5second timeout on the msleep()s and checks for the forced dismount flag so that the renew thread will wake up and see the forced dismount flag. Normally a wakeup() will occur in less than 5seconds, but if a premature return from msleep() does occur, it will simply loop around and msleep() again. The patch also adds the "mp" argument to nfsv4_lock() so that it will return when the forced dismount flag is set. While here, replace the nfsmsleep() wrapper that was used for portability with the actual msleep() call. (cherry picked from commit 82ee386c2afb42388804c1189751b83048953433) --- sys/fs/nfsclient/nfs_clstate.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 227d82a5f7f3..4e3abf82c96a 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -2550,10 +2550,12 @@ nfscl_renewthread(struct nfsclclient *clp, NFSPROC_T *p) struct nfsclrecalllayout *recallp; struct nfsclds *dsp; bool retok; + struct mount *mp; cred = newnfs_getcred(); NFSLOCKCLSTATE(); clp->nfsc_flags |= NFSCLFLAGS_HASTHREAD; + mp = clp->nfsc_nmp->nm_mountp; NFSUNLOCKCLSTATE(); for(;;) { newnfs_setroot(cred); @@ -2652,14 +2654,18 @@ tryagain: } dp->nfsdl_rwlock.nfslock_lock |= NFSV4LOCK_WANTED; - (void) nfsmsleep(&dp->nfsdl_rwlock, - NFSCLSTATEMUTEXPTR, PZERO, "nfscld", - NULL); + msleep(&dp->nfsdl_rwlock, + NFSCLSTATEMUTEXPTR, PVFS, "nfscld", + 5 * hz); + if (NFSCL_FORCEDISM(mp)) + goto terminate; goto tryagain; } while (!igotlock) { igotlock = nfsv4_lock(&clp->nfsc_lock, 1, - &islept, NFSCLSTATEMUTEXPTR, NULL); + &islept, NFSCLSTATEMUTEXPTR, mp); + if (igotlock == 0 && NFSCL_FORCEDISM(mp)) + goto terminate; if (islept) goto tryagain; } @@ -2739,9 +2745,11 @@ tryagain2: NFSV4LOCK_LOCK) != 0) { lyp->nfsly_lock.nfslock_lock |= NFSV4LOCK_WANTED; - nfsmsleep(&lyp->nfsly_lock.nfslock_lock, - NFSCLSTATEMUTEXPTR, PZERO, "nfslyp", - NULL); + msleep(&lyp->nfsly_lock.nfslock_lock, + NFSCLSTATEMUTEXPTR, PVFS, "nfslyp", + 5 * hz); + if (NFSCL_FORCEDISM(mp)) + goto terminate; goto tryagain2; } /* Move the layout to the recall list. */ @@ -2850,6 +2858,7 @@ tryagain2: if ((clp->nfsc_flags & NFSCLFLAGS_RECOVER) == 0) (void)mtx_sleep(clp, NFSCLSTATEMUTEXPTR, PWAIT, "nfscl", hz); +terminate: if (clp->nfsc_flags & NFSCLFLAGS_UMOUNT) { clp->nfsc_flags &= ~NFSCLFLAGS_HASTHREAD; NFSUNLOCKCLSTATE(); From owner-dev-commits-src-all@freebsd.org Sun Apr 11 22:29:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 276325E0AFC; Sun, 11 Apr 2021 22:29:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FJRPQ6Dvbz4hk4; Sun, 11 Apr 2021 22:29: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 C4DC3412B; Sun, 11 Apr 2021 22:29: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 13BMTUtr021107; Sun, 11 Apr 2021 22:29:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BMTUDa021106; Sun, 11 Apr 2021 22:29:30 GMT (envelope-from git) Date: Sun, 11 Apr 2021 22:29:30 GMT Message-Id: <202104112229.13BMTUDa021106@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 09d112c8a015 - stable/13 - nfsd: do not implicitly bind the back channel for NFSv4.1/4.2 mounts 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 09d112c8a015e41e728864b967c1666cc1c40c93 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 22:29:31 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=09d112c8a015e41e728864b967c1666cc1c40c93 commit 09d112c8a015e41e728864b967c1666cc1c40c93 Author: Rick Macklem AuthorDate: 2021-03-30 21:31:05 +0000 Commit: Rick Macklem CommitDate: 2021-04-11 22:26:14 +0000 nfsd: do not implicitly bind the back channel for NFSv4.1/4.2 mounts The NFSv4.1 (and 4.2 on 13) server incorrectly binds a new TCP connection to the back channel when first used by an RPC with a Sequence op in it (almost all of them). RFC5661 specifies that only the fore channel should be bound. This was done because early clients (including FreeBSD) did not do the required BindConnectionToSession RPC. Unfortunately, this breaks the Linux client when the "nconnects" mount option is used, since the server may do a callback on the incorrect TCP connection. This patch converts the server behaviour to that required by the RFC. It also makes the server test/indicate failure of the back channel more aggressively. Until this patch is applied to the server, the "nconnects" mount option is not recommended for a Linux NFSv4.1/4.2 client mount to the FreeBSD server. (cherry picked from commit 01ae8969a9eed652fbd894faa5b31b1593079ed8) --- sys/fs/nfsserver/nfs_nfsdstate.c | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 1f6e8b7ef526..5ac37ed07cae 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -6209,7 +6209,6 @@ nfsrv_checksequence(struct nfsrv_descript *nd, uint32_t sequenceid, struct nfsdsession *sep; struct nfssessionhash *shp; int error; - SVCXPRT *savxprt; shp = NFSSESSIONHASH(nd->nd_sessionid); NFSLOCKSESSION(shp); @@ -6235,36 +6234,11 @@ nfsrv_checksequence(struct nfsrv_descript *nd, uint32_t sequenceid, nd->nd_maxreq = sep->sess_maxreq; nd->nd_maxresp = sep->sess_maxresp; - /* - * If this session handles the backchannel, save the nd_xprt for this - * RPC, since this is the one being used. - * RFC-5661 specifies that the fore channel will be implicitly - * bound by a Sequence operation. However, since some NFSv4.1 clients - * erroneously assumed that the back channel would be implicitly - * bound as well, do the implicit binding unless a - * BindConnectiontoSession has already been done on the session. - */ - savxprt = NULL; - if (sep->sess_clp->lc_req.nr_client != NULL && - sep->sess_cbsess.nfsess_xprt != nd->nd_xprt && - (sep->sess_crflags & NFSV4CRSESS_CONNBACKCHAN) != 0 && - (sep->sess_clp->lc_flags & LCL_DONEBINDCONN) == 0) { - NFSD_DEBUG(2, - "nfsrv_checksequence: implicit back channel bind\n"); - savxprt = sep->sess_cbsess.nfsess_xprt; - SVC_ACQUIRE(nd->nd_xprt); - nd->nd_xprt->xp_p2 = - sep->sess_clp->lc_req.nr_client->cl_private; - nd->nd_xprt->xp_idletimeout = 0; /* Disable timeout. */ - sep->sess_cbsess.nfsess_xprt = nd->nd_xprt; - } - *sflagsp = 0; - if (sep->sess_clp->lc_req.nr_client == NULL) + if (sep->sess_clp->lc_req.nr_client == NULL || + (sep->sess_clp->lc_flags & LCL_CBDOWN) != 0) *sflagsp |= NFSV4SEQ_CBPATHDOWN; NFSUNLOCKSESSION(shp); - if (savxprt != NULL) - SVC_RELEASE(savxprt); if (error == NFSERR_EXPIRED) { *sflagsp |= NFSV4SEQ_EXPIREDALLSTATEREVOKED; error = 0; @@ -6464,7 +6438,8 @@ nfsrv_bindconnsess(struct nfsrv_descript *nd, uint8_t *sessionid, int *foreaftp) nd->nd_xprt->xp_idletimeout = 0; sep->sess_cbsess.nfsess_xprt = nd->nd_xprt; sep->sess_crflags |= NFSV4CRSESS_CONNBACKCHAN; - clp->lc_flags |= LCL_DONEBINDCONN; + clp->lc_flags |= LCL_DONEBINDCONN | + LCL_NEEDSCBNULL; if (*foreaftp == NFSCDFS4_BACK) *foreaftp = NFSCDFS4_BACK; else From owner-dev-commits-src-all@freebsd.org Sun Apr 11 22:38:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 684B15E1811; Sun, 11 Apr 2021 22:38: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 4FJRc72YVQz4hpr; Sun, 11 Apr 2021 22:38: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 4A86D4158; Sun, 11 Apr 2021 22:38: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 13BMclm2034089; Sun, 11 Apr 2021 22:38:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BMclhQ034088; Sun, 11 Apr 2021 22:38:47 GMT (envelope-from git) Date: Sun, 11 Apr 2021 22:38:47 GMT Message-Id: <202104112238.13BMclhQ034088@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: e18f9de06121 - stable/12 - nfsv4 client: fix forced dismount when sleeping in the renew thread 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/stable/12 X-Git-Reftype: branch X-Git-Commit: e18f9de0612137924951a0ec709eb36286bb3894 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 22:38:47 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=e18f9de0612137924951a0ec709eb36286bb3894 commit e18f9de0612137924951a0ec709eb36286bb3894 Author: Rick Macklem AuthorDate: 2021-03-23 20:04:37 +0000 Commit: Rick Macklem CommitDate: 2021-04-11 22:34:52 +0000 nfsv4 client: fix forced dismount when sleeping in the renew thread During a recent NFSv4 testing event a test server caused a hang where "umount -N" failed. The renew thread was sleeping on "nfsv4lck" and the "umount" was sleeping, waiting for the renew thread to terminate. This is the second of two patches that is hoped to fix the renew thread so that it will terminate when "umount -N" is done on the mount. This patch adds a 5second timeout on the msleep()s and checks for the forced dismount flag so that the renew thread will wake up and see the forced dismount flag. Normally a wakeup() will occur in less than 5seconds, but if a premature return from msleep() does occur, it will simply loop around and msleep() again. The patch also adds the "mp" argument to nfsv4_lock() so that it will return when the forced dismount flag is set. While here, replace the nfsmsleep() wrapper that was used for portability with the actual msleep() call. (cherry picked from commit 82ee386c2afb42388804c1189751b83048953433) --- sys/fs/nfsclient/nfs_clstate.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index 79a18a12f91f..0cade3e4178a 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -2531,10 +2531,12 @@ nfscl_renewthread(struct nfsclclient *clp, NFSPROC_T *p) struct nfscllayouthead rlh; struct nfsclrecalllayout *recallp; struct nfsclds *dsp; + struct mount *mp; cred = newnfs_getcred(); NFSLOCKCLSTATE(); clp->nfsc_flags |= NFSCLFLAGS_HASTHREAD; + mp = clp->nfsc_nmp->nm_mountp; NFSUNLOCKCLSTATE(); for(;;) { newnfs_setroot(cred); @@ -2631,14 +2633,18 @@ tryagain: } dp->nfsdl_rwlock.nfslock_lock |= NFSV4LOCK_WANTED; - (void) nfsmsleep(&dp->nfsdl_rwlock, - NFSCLSTATEMUTEXPTR, PZERO, "nfscld", - NULL); + msleep(&dp->nfsdl_rwlock, + NFSCLSTATEMUTEXPTR, PVFS, "nfscld", + 5 * hz); + if (NFSCL_FORCEDISM(mp)) + goto terminate; goto tryagain; } while (!igotlock) { igotlock = nfsv4_lock(&clp->nfsc_lock, 1, - &islept, NFSCLSTATEMUTEXPTR, NULL); + &islept, NFSCLSTATEMUTEXPTR, mp); + if (igotlock == 0 && NFSCL_FORCEDISM(mp)) + goto terminate; if (islept) goto tryagain; } @@ -2718,9 +2724,11 @@ tryagain2: NFSV4LOCK_LOCK) != 0) { lyp->nfsly_lock.nfslock_lock |= NFSV4LOCK_WANTED; - nfsmsleep(&lyp->nfsly_lock.nfslock_lock, - NFSCLSTATEMUTEXPTR, PZERO, "nfslyp", - NULL); + msleep(&lyp->nfsly_lock.nfslock_lock, + NFSCLSTATEMUTEXPTR, PVFS, "nfslyp", + 5 * hz); + if (NFSCL_FORCEDISM(mp)) + goto terminate; goto tryagain2; } /* Move the layout to the recall list. */ @@ -2829,6 +2837,7 @@ tryagain2: if ((clp->nfsc_flags & NFSCLFLAGS_RECOVER) == 0) (void)mtx_sleep(clp, NFSCLSTATEMUTEXPTR, PWAIT, "nfscl", hz); +terminate: if (clp->nfsc_flags & NFSCLFLAGS_UMOUNT) { clp->nfsc_flags &= ~NFSCLFLAGS_HASTHREAD; NFSUNLOCKCLSTATE(); From owner-dev-commits-src-all@freebsd.org Sun Apr 11 22:46:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE33F5E17E3; Sun, 11 Apr 2021 22:46: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 4FJRnF5z3Hz4jFr; Sun, 11 Apr 2021 22:46: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 BF71C3BB2; Sun, 11 Apr 2021 22:46: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 13BMkfb4047157; Sun, 11 Apr 2021 22:46:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BMkfFA047156; Sun, 11 Apr 2021 22:46:41 GMT (envelope-from git) Date: Sun, 11 Apr 2021 22:46:41 GMT Message-Id: <202104112246.13BMkfFA047156@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 5fb6cfadcd9d - stable/12 - nfsd: do not implicitly bind the back channel for NFSv4.1/4.2 mounts 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 5fb6cfadcd9dbc850a018a3690a2b775c01fff8f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 22:46:41 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=5fb6cfadcd9dbc850a018a3690a2b775c01fff8f commit 5fb6cfadcd9dbc850a018a3690a2b775c01fff8f Author: Rick Macklem AuthorDate: 2021-03-30 21:31:05 +0000 Commit: Rick Macklem CommitDate: 2021-04-11 22:43:20 +0000 nfsd: do not implicitly bind the back channel for NFSv4.1/4.2 mounts The NFSv4.1 (and 4.2 on 13) server incorrectly binds a new TCP connection to the back channel when first used by an RPC with a Sequence op in it (almost all of them). RFC5661 specifies that only the fore channel should be bound. This was done because early clients (including FreeBSD) did not do the required BindConnectionToSession RPC. Unfortunately, this breaks the Linux client when the "nconnects" mount option is used, since the server may do a callback on the incorrect TCP connection. This patch converts the server behaviour to that required by the RFC. It also makes the server test/indicate failure of the back channel more aggressively. Until this patch is applied to the server, the "nconnects" mount option is not recommended for a Linux NFSv4.1/4.2 client mount to the FreeBSD server. PR: 254560 (cherry picked from commit 01ae8969a9eed652fbd894faa5b31b1593079ed8) --- sys/fs/nfsserver/nfs_nfsdstate.c | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 5b92e7c297fa..d9fd1bbb588d 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -6189,7 +6189,6 @@ nfsrv_checksequence(struct nfsrv_descript *nd, uint32_t sequenceid, struct nfsdsession *sep; struct nfssessionhash *shp; int error; - SVCXPRT *savxprt; shp = NFSSESSIONHASH(nd->nd_sessionid); NFSLOCKSESSION(shp); @@ -6211,36 +6210,11 @@ nfsrv_checksequence(struct nfsrv_descript *nd, uint32_t sequenceid, nd->nd_clientid.qval = sep->sess_clp->lc_clientid.qval; nd->nd_flag |= ND_IMPLIEDCLID; - /* - * If this session handles the backchannel, save the nd_xprt for this - * RPC, since this is the one being used. - * RFC-5661 specifies that the fore channel will be implicitly - * bound by a Sequence operation. However, since some NFSv4.1 clients - * erroneously assumed that the back channel would be implicitly - * bound as well, do the implicit binding unless a - * BindConnectiontoSession has already been done on the session. - */ - savxprt = NULL; - if (sep->sess_clp->lc_req.nr_client != NULL && - sep->sess_cbsess.nfsess_xprt != nd->nd_xprt && - (sep->sess_crflags & NFSV4CRSESS_CONNBACKCHAN) != 0 && - (sep->sess_clp->lc_flags & LCL_DONEBINDCONN) == 0) { - NFSD_DEBUG(2, - "nfsrv_checksequence: implicit back channel bind\n"); - savxprt = sep->sess_cbsess.nfsess_xprt; - SVC_ACQUIRE(nd->nd_xprt); - nd->nd_xprt->xp_p2 = - sep->sess_clp->lc_req.nr_client->cl_private; - nd->nd_xprt->xp_idletimeout = 0; /* Disable timeout. */ - sep->sess_cbsess.nfsess_xprt = nd->nd_xprt; - } - *sflagsp = 0; - if (sep->sess_clp->lc_req.nr_client == NULL) + if (sep->sess_clp->lc_req.nr_client == NULL || + (sep->sess_clp->lc_flags & LCL_CBDOWN) != 0) *sflagsp |= NFSV4SEQ_CBPATHDOWN; NFSUNLOCKSESSION(shp); - if (savxprt != NULL) - SVC_RELEASE(savxprt); if (error == NFSERR_EXPIRED) { *sflagsp |= NFSV4SEQ_EXPIREDALLSTATEREVOKED; error = 0; @@ -6440,7 +6414,8 @@ nfsrv_bindconnsess(struct nfsrv_descript *nd, uint8_t *sessionid, int *foreaftp) nd->nd_xprt->xp_idletimeout = 0; sep->sess_cbsess.nfsess_xprt = nd->nd_xprt; sep->sess_crflags |= NFSV4CRSESS_CONNBACKCHAN; - clp->lc_flags |= LCL_DONEBINDCONN; + clp->lc_flags |= LCL_DONEBINDCONN | + LCL_NEEDSCBNULL; if (*foreaftp == NFSCDFS4_BACK) *foreaftp = NFSCDFS4_BACK; else From owner-dev-commits-src-all@freebsd.org Sun Apr 11 23:14:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC7DA5E2609; Sun, 11 Apr 2021 23:14: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 4FJSPb2mNbz4kfc; Sun, 11 Apr 2021 23:14: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 522CD4B34; Sun, 11 Apr 2021 23:14: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 13BNEhlk086900; Sun, 11 Apr 2021 23:14:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BNEhdw086899; Sun, 11 Apr 2021 23:14:43 GMT (envelope-from git) Date: Sun, 11 Apr 2021 23:14:43 GMT Message-Id: <202104112314.13BNEhdw086899@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: c2a159286c76 - main - hv_kbd: Add evdev protocol support for gen 2 VMs 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: c2a159286c7694306fde8c161af47a220e1a76f2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 23:14:44 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=c2a159286c7694306fde8c161af47a220e1a76f2 commit c2a159286c7694306fde8c161af47a220e1a76f2 Author: Vladimir Kondratyev AuthorDate: 2021-04-11 23:07:35 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-04-11 23:14:12 +0000 hv_kbd: Add evdev protocol support for gen 2 VMs Reviewed by: whu MFC after: 1 month Differential revision: https://reviews.freebsd.org/D28170 --- sys/dev/hyperv/input/hv_kbd.c | 82 ++++++++++++++++++++++++++++++++++++++++++ sys/dev/hyperv/input/hv_kbdc.h | 13 ++++++- 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/sys/dev/hyperv/input/hv_kbd.c b/sys/dev/hyperv/input/hv_kbd.c index 3be18da0efef..b1b0760ba13c 100644 --- a/sys/dev/hyperv/input/hv_kbd.c +++ b/sys/dev/hyperv/input/hv_kbd.c @@ -27,6 +27,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_evdev.h" + #include #include #include @@ -56,6 +58,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef EVDEV_SUPPORT +#include +#include +#endif + #include "dev/hyperv/input/hv_kbdc.h" #define HVKBD_MTX_LOCK(_m) do { \ @@ -76,6 +83,14 @@ __FBSDID("$FreeBSD$"); #define HVKBD_FLAG_POLLING 0x00000002 +#ifdef EVDEV_SUPPORT +static evdev_event_t hvkbd_ev_event; + +static const struct evdev_methods hvkbd_evdev_methods = { + .ev_event = hvkbd_ev_event, +}; +#endif + /* early keyboard probe, not supported */ static int hvkbd_configure(int flags) @@ -249,6 +264,9 @@ hvkbd_read_char_locked(keyboard_t *kbd, int wait) uint32_t scancode = NOKEY; keystroke ks; hv_kbd_sc *sc = kbd->kb_data; +#ifdef EVDEV_SUPPORT + int keycode; +#endif HVKBD_LOCK_ASSERT(); if (!KBD_IS_ACTIVE(kbd) || !hv_kbd_prod_is_ready(sc)) @@ -293,6 +311,20 @@ hvkbd_read_char_locked(keyboard_t *kbd, int wait) } hv_kbd_remove_top(sc); } +#ifdef EVDEV_SUPPORT + /* push evdev event */ + if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && + sc->ks_evdev != NULL) { + keycode = evdev_scancode2key(&sc->ks_evdev_state, + scancode); + + if (keycode != KEY_RESERVED) { + evdev_push_event(sc->ks_evdev, EV_KEY, + (uint16_t)keycode, scancode & 0x80 ? 0 : 1); + evdev_sync(sc->ks_evdev); + } + } +#endif } else { if (bootverbose) device_printf(sc->dev, "Unsupported mode: %d\n", sc->sc_mode); @@ -413,6 +445,12 @@ hvkbd_ioctl_locked(keyboard_t *kbd, u_long cmd, caddr_t arg) DEBUG_HVSC(sc, "setled 0x%x\n", *(int *)arg); } +#ifdef EVDEV_SUPPORT + /* push LED states to evdev */ + if (sc->ks_evdev != NULL && + evdev_rcpt_mask & EVDEV_RCPT_HW_KBD) + evdev_push_leds(sc->ks_evdev, *(int *)arg); +#endif KBD_LED_VAL(kbd) = *(int *)arg; break; default: @@ -445,6 +483,22 @@ hvkbd_read(keyboard_t *kbd, int wait) return hvkbd_read_char_locked(kbd, wait); } +#ifdef EVDEV_SUPPORT +static void +hvkbd_ev_event(struct evdev_dev *evdev, uint16_t type, uint16_t code, + int32_t value) +{ + keyboard_t *kbd = evdev_get_softc(evdev); + + if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && + (type == EV_LED || type == EV_REP)) { + mtx_lock(&Giant); + kbd_ev_event(kbd, type, code, value); + mtx_unlock(&Giant); + } +} +#endif + static keyboard_switch_t hvkbdsw = { .probe = hvkbd_probe, /* not used */ .init = hvkbd_init, @@ -508,6 +562,10 @@ hv_kbd_drv_attach(device_t dev) int unit = device_get_unit(dev); keyboard_t *kbd = &sc->sc_kbd; keyboard_switch_t *sw; +#ifdef EVDEV_SUPPORT + struct evdev_dev *evdev; +#endif + sw = kbd_get_switch(HVKBD_DRIVER_NAME); if (sw == NULL) { return (ENXIO); @@ -523,6 +581,27 @@ hv_kbd_drv_attach(device_t dev) sc->sc_mode = K_RAW; (*sw->enable)(kbd); +#ifdef EVDEV_SUPPORT + evdev = evdev_alloc(); + evdev_set_name(evdev, "Hyper-V keyboard"); + evdev_set_phys(evdev, device_get_nameunit(dev)); + evdev_set_id(evdev, BUS_VIRTUAL, 0, 0, 0); + evdev_set_methods(evdev, kbd, &hvkbd_evdev_methods); + evdev_support_event(evdev, EV_SYN); + evdev_support_event(evdev, EV_KEY); + evdev_support_event(evdev, EV_LED); + evdev_support_event(evdev, EV_REP); + evdev_support_all_known_keys(evdev); + evdev_support_led(evdev, LED_NUML); + evdev_support_led(evdev, LED_CAPSL); + evdev_support_led(evdev, LED_SCROLLL); + if (evdev_register_mtx(evdev, &Giant)) + evdev_free(evdev); + else + sc->ks_evdev = evdev; + sc->ks_evdev_state = 0; +#endif + if (kbd_register(kbd) < 0) { goto detach; } @@ -547,6 +626,9 @@ hv_kbd_drv_detach(device_t dev) int error = 0; hv_kbd_sc *sc = device_get_softc(dev); hvkbd_disable(&sc->sc_kbd); +#ifdef EVDEV_SUPPORT + evdev_free(sc->ks_evdev); +#endif if (KBD_IS_CONFIGURED(&sc->sc_kbd)) { error = kbd_unregister(&sc->sc_kbd); if (error) { diff --git a/sys/dev/hyperv/input/hv_kbdc.h b/sys/dev/hyperv/input/hv_kbdc.h index 3c7bd2a69de7..562009df9a94 100644 --- a/sys/dev/hyperv/input/hv_kbdc.h +++ b/sys/dev/hyperv/input/hv_kbdc.h @@ -23,7 +23,7 @@ * (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$ + * $FreeBSD: head/sys/dev/hyperv/input/hv_kbdc.h 316515 2017-04-05 05:01:23Z sephe $ */ #ifndef _HV_KBD_H @@ -36,6 +36,12 @@ #include +#include "opt_evdev.h" +#ifdef EVDEV_SUPPORT +#include +#include +#endif + #define HVKBD_DRIVER_NAME "hvkbd" #define IS_UNICODE (1) #define IS_BREAK (2) @@ -87,6 +93,11 @@ typedef struct hv_kbd_sc_t { int sc_polling; /* polling recursion count */ uint32_t sc_flags; int debug; + +#ifdef EVDEV_SUPPORT + struct evdev_dev *ks_evdev; + int ks_evdev_state; +#endif } hv_kbd_sc; int hv_kbd_produce_ks(hv_kbd_sc *sc, const keystroke *ks); From owner-dev-commits-src-all@freebsd.org Sun Apr 11 23:14:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E2D75E23CE; Sun, 11 Apr 2021 23:14: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 4FJSPc3mmgz4kj7; Sun, 11 Apr 2021 23:14: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 7401A48F2; Sun, 11 Apr 2021 23:14: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 13BNEi7j086921; Sun, 11 Apr 2021 23:14:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BNEiQd086920; Sun, 11 Apr 2021 23:14:44 GMT (envelope-from git) Date: Sun, 11 Apr 2021 23:14:44 GMT Message-Id: <202104112314.13BNEiQd086920@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: e4643aa4c4ff - main - hv_kbd: Add support for K_XLATE and K_CODE modes for gen 2 VMs 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: e4643aa4c4ffd385a5be635a488cf10fb6d6cf68 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 23:14:45 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=e4643aa4c4ffd385a5be635a488cf10fb6d6cf68 commit e4643aa4c4ffd385a5be635a488cf10fb6d6cf68 Author: Vladimir Kondratyev AuthorDate: 2021-04-11 23:08:36 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-04-11 23:14:12 +0000 hv_kbd: Add support for K_XLATE and K_CODE modes for gen 2 VMs That fixes disabled keyboard input after Xorg server has been stopped. Reviewed by: whu MFC after: 1 month Differential revision: https://reviews.freebsd.org/D28171 --- sys/dev/hyperv/input/hv_kbd.c | 326 ++++++++++++++++++++++++++++++++++------- sys/dev/hyperv/input/hv_kbdc.h | 3 + 2 files changed, 273 insertions(+), 56 deletions(-) diff --git a/sys/dev/hyperv/input/hv_kbd.c b/sys/dev/hyperv/input/hv_kbd.c index b1b0760ba13c..52ce621b2a89 100644 --- a/sys/dev/hyperv/input/hv_kbd.c +++ b/sys/dev/hyperv/input/hv_kbd.c @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -81,6 +82,7 @@ __FBSDID("$FreeBSD$"); #define HVKBD_UNLOCK() HVKBD_MTX_UNLOCK(&Giant) #define HVKBD_LOCK_ASSERT() HVKBD_MTX_ASSERT(&Giant, MA_OWNED) +#define HVKBD_FLAG_COMPOSE 0x00000001 /* compose char flag */ #define HVKBD_FLAG_POLLING 0x00000002 #ifdef EVDEV_SUPPORT @@ -237,6 +239,8 @@ hvkbd_check_char_locked(keyboard_t *kbd) return (FALSE); hv_kbd_sc *sc = kbd->kb_data; + if (!(sc->sc_flags & HVKBD_FLAG_COMPOSE) && sc->sc_composed_char != 0) + return (TRUE); if (sc->sc_flags & HVKBD_FLAG_POLLING) hvkbd_do_poll(sc, 0); if (hv_kbd_prod_is_ready(sc)) { @@ -262,6 +266,7 @@ static uint32_t hvkbd_read_char_locked(keyboard_t *kbd, int wait) { uint32_t scancode = NOKEY; + uint32_t action; keystroke ks; hv_kbd_sc *sc = kbd->kb_data; #ifdef EVDEV_SUPPORT @@ -271,67 +276,268 @@ hvkbd_read_char_locked(keyboard_t *kbd, int wait) if (!KBD_IS_ACTIVE(kbd) || !hv_kbd_prod_is_ready(sc)) return (NOKEY); - if (sc->sc_mode == K_RAW) { - if (hv_kbd_fetch_top(sc, &ks)) { - return (NOKEY); + +next_code: + + /* do we have a composed char to return? */ + if (!(sc->sc_flags & HVKBD_FLAG_COMPOSE) && sc->sc_composed_char > 0) { + action = sc->sc_composed_char; + sc->sc_composed_char = 0; + if (action > UCHAR_MAX) { + return (ERRKEY); } - if ((ks.info & IS_E0) || (ks.info & IS_E1)) { - /** - * Emulate the generation of E0 or E1 scancode, - * the real scancode will be consumed next time. - */ - if (ks.info & IS_E0) { - scancode = XTKBD_EMUL0; - ks.info &= ~IS_E0; - } else if (ks.info & IS_E1) { - scancode = XTKBD_EMUL1; - ks.info &= ~IS_E1; - } - /** - * Change the top item to avoid encountering - * E0 or E1 twice. - */ - hv_kbd_modify_top(sc, &ks); - } else if (ks.info & IS_UNICODE) { - /** - * XXX: Hyperv host send unicode to VM through - * 'Type clipboard text', the mapping from - * unicode to scancode depends on the keymap. - * It is so complicated that we do not plan to - * support it yet. - */ - if (bootverbose) - device_printf(sc->dev, "Unsupported unicode\n"); - hv_kbd_remove_top(sc); - return (NOKEY); - } else { - scancode = ks.makecode; - if (ks.info & IS_BREAK) { - scancode |= XTKBD_RELEASE; - } - hv_kbd_remove_top(sc); + return (action); + } + + if (hv_kbd_fetch_top(sc, &ks)) { + return (NOKEY); + } + if ((ks.info & IS_E0) || (ks.info & IS_E1)) { + /** + * Emulate the generation of E0 or E1 scancode, + * the real scancode will be consumed next time. + */ + if (ks.info & IS_E0) { + scancode = XTKBD_EMUL0; + ks.info &= ~IS_E0; + } else if (ks.info & IS_E1) { + scancode = XTKBD_EMUL1; + ks.info &= ~IS_E1; } + /** + * Change the top item to avoid encountering + * E0 or E1 twice. + */ + hv_kbd_modify_top(sc, &ks); + } else if (ks.info & IS_UNICODE) { + /** + * XXX: Hyperv host send unicode to VM through + * 'Type clipboard text', the mapping from + * unicode to scancode depends on the keymap. + * It is so complicated that we do not plan to + * support it yet. + */ + if (bootverbose) + device_printf(sc->dev, "Unsupported unicode\n"); + hv_kbd_remove_top(sc); + return (NOKEY); + } else { + scancode = ks.makecode; + if (ks.info & IS_BREAK) { + scancode |= XTKBD_RELEASE; + } + hv_kbd_remove_top(sc); + } #ifdef EVDEV_SUPPORT - /* push evdev event */ - if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && - sc->ks_evdev != NULL) { - keycode = evdev_scancode2key(&sc->ks_evdev_state, - scancode); - - if (keycode != KEY_RESERVED) { - evdev_push_event(sc->ks_evdev, EV_KEY, - (uint16_t)keycode, scancode & 0x80 ? 0 : 1); - evdev_sync(sc->ks_evdev); - } + /* push evdev event */ + if (evdev_rcpt_mask & EVDEV_RCPT_HW_KBD && + sc->ks_evdev != NULL) { + keycode = evdev_scancode2key(&sc->ks_evdev_state, + scancode); + + if (keycode != KEY_RESERVED) { + evdev_push_event(sc->ks_evdev, EV_KEY, + (uint16_t)keycode, scancode & 0x80 ? 0 : 1); + evdev_sync(sc->ks_evdev); } -#endif - } else { - if (bootverbose) - device_printf(sc->dev, "Unsupported mode: %d\n", sc->sc_mode); } +#endif ++kbd->kb_count; DEBUG_HVKBD(kbd, "read scan: 0x%x\n", scancode); - return scancode; + + /* return the byte as is for the K_RAW mode */ + if (sc->sc_mode == K_RAW) + return scancode; + + /* translate the scan code into a keycode */ + keycode = scancode & 0x7F; + switch (sc->sc_prefix) { + case 0x00: /* normal scancode */ + switch(scancode) { + case 0xB8: /* left alt (compose key) released */ + if (sc->sc_flags & HVKBD_FLAG_COMPOSE) { + sc->sc_flags &= ~HVKBD_FLAG_COMPOSE; + if (sc->sc_composed_char > UCHAR_MAX) + sc->sc_composed_char = 0; + } + break; + case 0x38: /* left alt (compose key) pressed */ + if (!(sc->sc_flags & HVKBD_FLAG_COMPOSE)) { + sc->sc_flags |= HVKBD_FLAG_COMPOSE; + sc->sc_composed_char = 0; + } + break; + case 0xE0: + case 0xE1: + sc->sc_prefix = scancode; + goto next_code; + } + break; + case 0xE0: /* 0xE0 prefix */ + sc->sc_prefix = 0; + switch (keycode) { + case 0x1C: /* right enter key */ + keycode = 0x59; + break; + case 0x1D: /* right ctrl key */ + keycode = 0x5A; + break; + case 0x35: /* keypad divide key */ + keycode = 0x5B; + break; + case 0x37: /* print scrn key */ + keycode = 0x5C; + break; + case 0x38: /* right alt key (alt gr) */ + keycode = 0x5D; + break; + case 0x46: /* ctrl-pause/break on AT 101 (see below) */ + keycode = 0x68; + break; + case 0x47: /* grey home key */ + keycode = 0x5E; + break; + case 0x48: /* grey up arrow key */ + keycode = 0x5F; + break; + case 0x49: /* grey page up key */ + keycode = 0x60; + break; + case 0x4B: /* grey left arrow key */ + keycode = 0x61; + break; + case 0x4D: /* grey right arrow key */ + keycode = 0x62; + break; + case 0x4F: /* grey end key */ + keycode = 0x63; + break; + case 0x50: /* grey down arrow key */ + keycode = 0x64; + break; + case 0x51: /* grey page down key */ + keycode = 0x65; + break; + case 0x52: /* grey insert key */ + keycode = 0x66; + break; + case 0x53: /* grey delete key */ + keycode = 0x67; + break; + /* the following 3 are only used on the MS "Natural" keyboard */ + case 0x5b: /* left Window key */ + keycode = 0x69; + break; + case 0x5c: /* right Window key */ + keycode = 0x6a; + break; + case 0x5d: /* menu key */ + keycode = 0x6b; + break; + case 0x5e: /* power key */ + keycode = 0x6d; + break; + case 0x5f: /* sleep key */ + keycode = 0x6e; + break; + case 0x63: /* wake key */ + keycode = 0x6f; + break; + default: /* ignore everything else */ + goto next_code; + } + break; + case 0xE1: /* 0xE1 prefix */ + /* + * The pause/break key on the 101 keyboard produces: + * E1-1D-45 E1-9D-C5 + * Ctrl-pause/break produces: + * E0-46 E0-C6 (See above.) + */ + sc->sc_prefix = 0; + if (keycode == 0x1D) + sc->sc_prefix = 0x1D; + goto next_code; + /* NOT REACHED */ + case 0x1D: /* pause / break */ + sc->sc_prefix = 0; + if (keycode != 0x45) + goto next_code; + keycode = 0x68; + break; + } + + /* XXX assume 101/102 keys AT keyboard */ + switch (keycode) { + case 0x5c: /* print screen */ + if (sc->sc_flags & ALTS) + keycode = 0x54; /* sysrq */ + break; + case 0x68: /* pause/break */ + if (sc->sc_flags & CTLS) + keycode = 0x6c; /* break */ + break; + } + + /* return the key code in the K_CODE mode */ + if (sc->sc_mode == K_CODE) + return (keycode | (scancode & 0x80)); + + /* compose a character code */ + if (sc->sc_flags & HVKBD_FLAG_COMPOSE) { + switch (keycode | (scancode & 0x80)) { + /* key pressed, process it */ + case 0x47: case 0x48: case 0x49: /* keypad 7,8,9 */ + sc->sc_composed_char *= 10; + sc->sc_composed_char += keycode - 0x40; + if (sc->sc_composed_char > UCHAR_MAX) + return ERRKEY; + goto next_code; + case 0x4B: case 0x4C: case 0x4D: /* keypad 4,5,6 */ + sc->sc_composed_char *= 10; + sc->sc_composed_char += keycode - 0x47; + if (sc->sc_composed_char > UCHAR_MAX) + return ERRKEY; + goto next_code; + case 0x4F: case 0x50: case 0x51: /* keypad 1,2,3 */ + sc->sc_composed_char *= 10; + sc->sc_composed_char += keycode - 0x4E; + if (sc->sc_composed_char > UCHAR_MAX) + return ERRKEY; + goto next_code; + case 0x52: /* keypad 0 */ + sc->sc_composed_char *= 10; + if (sc->sc_composed_char > UCHAR_MAX) + return ERRKEY; + goto next_code; + + /* key released, no interest here */ + case 0xC7: case 0xC8: case 0xC9: /* keypad 7,8,9 */ + case 0xCB: case 0xCC: case 0xCD: /* keypad 4,5,6 */ + case 0xCF: case 0xD0: case 0xD1: /* keypad 1,2,3 */ + case 0xD2: /* keypad 0 */ + goto next_code; + + case 0x38: /* left alt key */ + break; + + default: + if (sc->sc_composed_char > 0) { + sc->sc_flags &= ~HVKBD_FLAG_COMPOSE; + sc->sc_composed_char = 0; + return (ERRKEY); + } + break; + } + } + + /* keycode to key action */ + action = genkbd_keyaction(kbd, keycode, scancode & 0x80, + &sc->sc_state, &sc->sc_accents); + if (action == NOKEY) + goto next_code; + else + return (action); } /* Currently wait is always false. */ @@ -353,7 +559,9 @@ hvkbd_clear_state(keyboard_t *kbd) { hv_kbd_sc *sc = kbd->kb_data; sc->sc_state &= LOCK_MASK; /* preserve locking key state */ - sc->sc_flags &= ~HVKBD_FLAG_POLLING; + sc->sc_flags &= ~(HVKBD_FLAG_POLLING | HVKBD_FLAG_COMPOSE); + sc->sc_accents = 0; + sc->sc_composed_char = 0; } static int @@ -453,6 +661,12 @@ hvkbd_ioctl_locked(keyboard_t *kbd, u_long cmd, caddr_t arg) #endif KBD_LED_VAL(kbd) = *(int *)arg; break; + case PIO_KEYMAP: /* set keyboard translation table */ + case OPIO_KEYMAP: /* set keyboard translation table (compat) */ + case PIO_KEYMAPENT: /* set keyboard translation table entry */ + case PIO_DEADKEYMAP: /* set accent key translation table */ + sc->sc_accents = 0; + /* FALLTHROUGH */ default: return (genkbd_commonioctl(kbd, cmd, arg)); } @@ -578,7 +792,7 @@ hv_kbd_drv_attach(device_t dev) hvkbd_clear_state(kbd); KBD_PROBE_DONE(kbd); KBD_INIT_DONE(kbd); - sc->sc_mode = K_RAW; + sc->sc_mode = K_XLATE; (*sw->enable)(kbd); #ifdef EVDEV_SUPPORT diff --git a/sys/dev/hyperv/input/hv_kbdc.h b/sys/dev/hyperv/input/hv_kbdc.h index 562009df9a94..7effa6b8a49b 100644 --- a/sys/dev/hyperv/input/hv_kbdc.h +++ b/sys/dev/hyperv/input/hv_kbdc.h @@ -90,6 +90,9 @@ typedef struct hv_kbd_sc_t { keyboard_t sc_kbd; int sc_mode; int sc_state; + uint32_t sc_accents; /* accent key index (> 0) */ + uint32_t sc_composed_char; /* composed char code */ + uint8_t sc_prefix; /* AT scan code prefix */ int sc_polling; /* polling recursion count */ uint32_t sc_flags; int debug; From owner-dev-commits-src-all@freebsd.org Sun Apr 11 23:20:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE89E5E2818; Sun, 11 Apr 2021 23:20: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 4FJSWy5LhKz4l24; Sun, 11 Apr 2021 23:20: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 AAB3B4D14; Sun, 11 Apr 2021 23:20: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 13BNKEOI092341; Sun, 11 Apr 2021 23:20:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BNKEhT092338; Sun, 11 Apr 2021 23:20:14 GMT (envelope-from git) Date: Sun, 11 Apr 2021 23:20:14 GMT Message-Id: <202104112320.13BNKEhT092338@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: 774cbf9b64c2 - main - hv_kbd: Fix leaked $FreeBSD$ expansion 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: 774cbf9b64c25c93a93677bad22ab8fc57db75b2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 23:20:14 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=774cbf9b64c25c93a93677bad22ab8fc57db75b2 commit 774cbf9b64c25c93a93677bad22ab8fc57db75b2 Author: Vladimir Kondratyev AuthorDate: 2021-04-11 23:16:22 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-04-11 23:16:22 +0000 hv_kbd: Fix leaked $FreeBSD$ expansion MFC with: c2a159286c76 --- sys/dev/hyperv/input/hv_kbdc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/hyperv/input/hv_kbdc.h b/sys/dev/hyperv/input/hv_kbdc.h index 7effa6b8a49b..f6f76035e8c3 100644 --- a/sys/dev/hyperv/input/hv_kbdc.h +++ b/sys/dev/hyperv/input/hv_kbdc.h @@ -23,7 +23,7 @@ * (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: head/sys/dev/hyperv/input/hv_kbdc.h 316515 2017-04-05 05:01:23Z sephe $ + * $FreeBSD$ */ #ifndef _HV_KBD_H From owner-dev-commits-src-all@freebsd.org Sun Apr 11 23:54:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AEEB5E3494; Sun, 11 Apr 2021 23:54: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 4FJTHk3zJ5z4mZ6; Sun, 11 Apr 2021 23:54: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 7B4EC55EF; Sun, 11 Apr 2021 23:54: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 13BNsgV1039211; Sun, 11 Apr 2021 23:54:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13BNsgPU039210; Sun, 11 Apr 2021 23:54:42 GMT (envelope-from git) Date: Sun, 11 Apr 2021 23:54:42 GMT Message-Id: <202104112354.13BNsgPU039210@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: 9edaceca8165 - main - nfsd: cut the Linux NFSv4.1/4.2 some slack w.r.t. RFC5661 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: 9edaceca8165e2864267547311daf145bb520270 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 23:54:42 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=9edaceca8165e2864267547311daf145bb520270 commit 9edaceca8165e2864267547311daf145bb520270 Author: Rick Macklem AuthorDate: 2021-04-11 23:51:25 +0000 Commit: Rick Macklem CommitDate: 2021-04-11 23:51:25 +0000 nfsd: cut the Linux NFSv4.1/4.2 some slack w.r.t. RFC5661 Recent testing of network partitioning a FreeBSD NFSv4.1 server from a Linux NFSv4.1 client identified problems with both the FreeBSD server and Linux client. Sometimes, after some Linux NFSv4.1/4.2 clients establish a new TCP connection, they will advance the sequence number for a session slot by 2 instead of 1. RFC5661 specifies that a server should reply NFS4ERR_SEQ_MISORDERED for this case. This might result in a system call error in the client and seems to disable future use of the slot by the client. Since advancing the sequence number by 2 seems harmless, allow this case if vfs.nfs.linuxseqsesshack is non-zero. Note that, if the order of RPCs is actually reversed, a subsequent RPC with a smaller sequence number value for the slot will be received. This will result in a NFS4ERR_SEQ_MISORDERED reply. This has not been observed during testing. Setting vfs.nfs.linuxseqsesshack to 0 will provide RFC5661 compliant behaviour. This fix affects the fairly rare case where a NFSv4 Linux client does a TCP reconnect and then apparently erroneously increments the sequence number for the session slot twice during the reconnect cycle. PR: 254816 MFC after: 2 weeks --- sys/fs/nfs/nfs_commonsubs.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index 4afa4c2d9ab4..d7009b1e0ca4 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -98,6 +98,11 @@ int nfs_maxcopyrange = 10 * 1024 * 1024; SYSCTL_INT(_vfs_nfs, OID_AUTO, maxcopyrange, CTLFLAG_RW, &nfs_maxcopyrange, 0, "Max size of a Copy so RPC times reasonable"); +static int nfs_allowskip_sessionseq = 1; +SYSCTL_INT(_vfs_nfs, OID_AUTO, linuxseqsesshack, CTLFLAG_RW, + &nfs_allowskip_sessionseq, 0, "Allow client to skip ahead one seq# for" + " session slot"); + /* * This array of structures indicates, for V4: * retfh - which of 3 types of calling args are used @@ -4614,7 +4619,7 @@ nfsmout: * Handle an NFSv4.1 Sequence request for the session. * If reply != NULL, use it to return the cached reply, as required. * The client gets a cached reply via this call for callbacks, however the - * server gets a cached reply via the nfsv4_seqsess_cachereply() call. + * server gets a cached reply via the nfsv4_seqsess_cacherep() call. */ int nfsv4_seqsession(uint32_t seqid, uint32_t slotid, uint32_t highslot, @@ -4648,12 +4653,24 @@ nfsv4_seqsession(uint32_t seqid, uint32_t slotid, uint32_t highslot, } else /* No reply cached, so just do it. */ slots[slotid].nfssl_inprog = 1; - } else if ((slots[slotid].nfssl_seq + 1) == seqid) { + } else if (slots[slotid].nfssl_seq + 1 == seqid || + (slots[slotid].nfssl_seq + 2 == seqid && + nfs_allowskip_sessionseq != 0)) { + /* + * Allowing the seqid to be ahead by 2 is technically + * a violation of RFC5661, but it seems harmless to do + * and avoids returning NFSERR_SEQMISORDERED to a + * slightly broken Linux NFSv4.1/4.2 client. + * If the RPCs are really out of order, one with a + * lower seqid will be subsequently received and that + * one will get a NFSERR_SEQMISORDERED reply. + * Can be disabled by setting vfs.nfs.linuxseqsesshack to 0. + */ if (slots[slotid].nfssl_reply != NULL) m_freem(slots[slotid].nfssl_reply); slots[slotid].nfssl_reply = NULL; slots[slotid].nfssl_inprog = 1; - slots[slotid].nfssl_seq++; + slots[slotid].nfssl_seq = seqid; } else error = NFSERR_SEQMISORDERED; return (error);