From owner-dev-commits-src-main@freebsd.org Mon Apr 5 01:10:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 01:19:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 08:02:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 11:44:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 11:44:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 14:24:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 14:24:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 14:40:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 15:35:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 15:42:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 16:30:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 17:10:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 17:16:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 17:27:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 18:21:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 20:30:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Mon Apr 5 20:30:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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-main@freebsd.org Tue Apr 6 00:01:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 00:37:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 00:38:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 00:38:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 00:38:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 00:38:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 00:38:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 00:43:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 02:33:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 02:33:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 06:01:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 07:09:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 09:05:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 09:59:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 10:56:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 11:41:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 12:34:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 15:16:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 15:16:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 16:57:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 17:14:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 17:45:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 18:36:00 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 18:47:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 19:18:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 19:18:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 20:28:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2021 20:28:11 -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-main@freebsd.org Tue Apr 6 20:39:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 21:28:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 21:28:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 23:27:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Tue Apr 6 23:33:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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-main@freebsd.org Wed Apr 7 08:20:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 08:37:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 08:56:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 10:35:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 10:35:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 11:13:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 13:08:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 13:33:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 15:03:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 15:03:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 15:03:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 15:39:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 16:18:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 16:24:47 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 18:33:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 18:33:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 18:41:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 18:59:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 19:10:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 19:18:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 19:42:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 19:53:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 20:08:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 21:42:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 21:46:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A15FF5C59E4 for ; Wed, 7 Apr 2021 21:46:25 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x735.google.com (mail-qk1-x735.google.com [IPv6:2607:f8b0:4864:20::735]) (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 4FFydY3h5bz4qtT for ; Wed, 7 Apr 2021 21:46:24 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x735.google.com with SMTP id q3so134719qkq.12 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=NPkm2tc0PpnRyQTJBc1swubP7Aew9uB8Rr+Q/AilCFECYFBXyCLMWIZP457jqg3wG4 TT0cXZt6siwh3dRznd8WxoQh6N4PjZ07lgFUOwox1+YjGM4PSWjQyGmNnE118TEXlr+V mrO5BnLlWUdhH6AzY4pMWLjLUY9kiUOfuPmmWH5oDWBZo4RBxLfomOt0ayE/J8aVL0eZ h1RfnyF+gFL78wQXwSh672acmOsjGjIIIphlSTXbx2XYIxfpvkq7XV+hgP2K7As+oqFV b1eoJGg5x54hyczbu3wVhkDr41LF6i8L8QAImSeSRhlt9ocw7tu0uesDJ3TVJs/lgS0N HL7w== X-Gm-Message-State: AOAM531aPWknT1YfewQlJP5Loc5mup0kxScoNXji+AQR7OdDrEPEaNFN sSksaPUGJEZi0OnKP8pzPBwEOw== 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: 4FFydY3h5bz4qtT X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 21:58:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 22:07:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E5B695C665B 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 4FFz5x5v59z4sG1 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 30so9868939qva.9 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=LCHwer0dyeWGkRVmnr8vH3MZ84zh6yrnn4EXiawxQl6go2DOUyjWSnoEPGwMzV3qJx w6LSZuSi3WP/kIKrZElkjINOnogxGcgDW1VBHOv2oaTMj7NFxcmxTo0S6XH8IodmVbar hzWelxc2QxtvYUtBfZtJ8p32c9jylxFdHrc+n/Uml4KLaiwATd1kB52CqLDH2gl86S39 +E1QiLsKl35Ppq34botiljhTFOUPvUgYFQywLWjOcGuKDdXaPmk2732DOWeFwCHLn344 KUxX8RrsG0j993BQLj3KSkfpfVWTy8kHG8Z56wziC1SNuKfYa/8hN+yvPLJR0DkZU29k DIQg== X-Gm-Message-State: AOAM532T3lnPBnJFB9qUPhNi7K2Tb0ym1Ki5FDxa9Vzfd5eFx44PkjPg NipLXLBjFbNSZohDLwglDiWCjw== 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: 4FFz5x5v59z4sG1 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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-main@freebsd.org Wed Apr 7 22:14:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Apr 2021 22:14:11 -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-main@freebsd.org Thu Apr 8 03:23:52 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 07:40:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 10:18:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 10:18:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 10:18:08 -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-main@freebsd.org Thu Apr 8 10:18:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 11:16:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 11:31:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 12:43:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 12:51:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 13:26:26 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 14:46:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 16:31:58 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 17:17:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 17:36:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 17:48:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 17:59:01 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 17:59:02 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 17:59:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 17:59:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Apr 2021 17:59:09 -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-main@freebsd.org Thu Apr 8 18:02:04 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 18:39:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 19:08:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 19:12:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 19:20:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 19:26:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 19:45:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 20:24:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 21:08:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Thu Apr 8 22:06:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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-main@freebsd.org Fri Apr 9 00:27:30 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 00:27:32 -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-main@freebsd.org Fri Apr 9 07:39:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 07:44:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 09:23:53 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 09:30:38 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 14:23:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 15:34:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 19:33:48 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 19:29:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:39:50 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:44:33 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:44:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:44:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:44:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:47:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:47:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:47:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:47:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:08 -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-main@freebsd.org Fri Apr 9 20:47:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:47:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:47:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:47:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:15 -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-main@freebsd.org Fri Apr 9 20:47:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:47:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 20:47:16 -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-main@freebsd.org Fri Apr 9 20:47:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:47:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:47:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:57:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 442045BCF6E for ; Fri, 9 Apr 2021 20:57:12 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.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 4FH9Rr1JnDz4cSS for ; Fri, 9 Apr 2021 20:57:11 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f44.google.com with SMTP id g66-20020a1c39450000b0290125d187ba22so3108029wma.2 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=L2Pvdc1EhaCgAZ+8bRmRrzg3phPUUWYrUD3098xSlz6Vjuzxqbc/ZBkNABLaU0QMO1 t2ksaOsf0LYGSWkn8glFuDR1Q1xnzbK2ZZ5cnEmuhF7JAWK2BH5lf4yzZhtI/mM+d4lv 1INUrzdBikk/Tj1FamHZnTi0wFqEwI4EQjmJKiPXY83cZso+H0qRhKaVxbjsTeoYSnUx OFKLTtMzqyhV8xbYze/3/wXWLBTHw/bF7VjuZRkjHNIMmLgmfBAzX7cajvJt6U6Qtkln WtmBD+agqNX/1qj4U9I/UxfqHDiOCHGEhgiQX3TjU1uI70ICmxw4bFsZfhNRUTBs164F RI3Q== X-Gm-Message-State: AOAM5320qswUe05VIw1ZLMM/IyQnzvV7RWBCD3L0Q3JogxTmvzh88f8w MGI2ue029/z0BI+gOWZ10xd8AGkv6eq0t7g6 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: 4FH9Rr1JnDz4cSS X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 20:57:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 70E415BD30B for ; Fri, 9 Apr 2021 20:57:57 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FH9Sj2PWfz4cYP for ; Fri, 9 Apr 2021 20:57:57 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f46.google.com with SMTP id e12so6837435wro.11 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=jAzJsiHNDgEcuWXfjF0XeEgdr69OSitCOg1Z8U+gXLvuId5MOSnV0a3W0Jb5NUaimY 9Lw7TlHcx3evKOEnfIKzyfh+PlQ8iC7kFm8OUwVvVnXnToDaw+u0z1DeLVLUMF2/Glew m5Qf7jq1B5yTZVqh/u6EOb/zp6de/b2VfswhN6fgJ/gQ9NTj6h3v8tlgkRNxuQfEDwqk VKLjPtGFqB5Iu4W2v3XjPJ2fo0FuSf8/85HE2vjkxL7kno11BGW1F2MrmLSyrKGGI/lq 9hSKY7dkQaMzRfV6dYkvSKCp4V7PeV3N49iRQBHHM2D7fvu42nqTL1ZhhPPoLYEWeAVp BhvA== X-Gm-Message-State: AOAM533OS5GoILOjLp/DAGZJ1enrpvKROuHaTxuK5azcSsij2O/89ASO 7SlqExtJkGgzRwxNpcCI58JZT5WSRfCPn7xa 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: 4FH9Sj2PWfz4cYP X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 21:21:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 21:21:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 21:21:08 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 21:21:10 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 22:38:39 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 22:38:40 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 22:38:41 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 23:11:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Fri Apr 9 23:11:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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-main@freebsd.org Sat Apr 10 01:25:11 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 01:25:12 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 01:25:13 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 01:25:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 01:25:15 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 01:33:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 02:24:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 02:24:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 08:32:44 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 09:14:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 09:16:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 09:16:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 09:16:20 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 09:16:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 09:16:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 09:16:23 -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-main@freebsd.org Sat Apr 10 09:16:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 09:16:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 09:16:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 09:16:27 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Apr 2021 09:16:27 -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-main@freebsd.org Sat Apr 10 09:16:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 09:16:31 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 11:53:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 12:02:17 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 13:43:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 13:47:54 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 13:47:55 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 13:50:19 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 14:04:16 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 14:23:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 14:25:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 14:35:22 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 14:35:23 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 14:35:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 15:18:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0D925CF25D for ; Sat, 10 Apr 2021 15:18:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x734.google.com (mail-qk1-x734.google.com [IPv6:2607:f8b0:4864:20::734]) (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 4FHdtY5JG3z3h3D for ; Sat, 10 Apr 2021 15:18:29 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x734.google.com with SMTP id y5so8918994qkl.9 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=oZy77Q7PXvpnWoNsRyAqv6K3ulRGmX8ejUTBfHJC3gTUQXmHGOxWXnxui6IZeQhguE HfRVC7fwcU8NPGgYC8gUM0xpBeaXRH21WXFnh6rtFzs5tT98JLbwNvR2rvO9jisZia1g wDTpg8uP1l9SJoX81XLd99qkpZ+QAo6gyzpX0OEzZEQb5LBFiJ8phhZ7mNLx6xzgngBI 8NLBr6YtSe9lx5Bu4UKE8s9tAynNUpIiKgD6KM+oQa8b8BEcHHcrxH3Fa4rYNHJui9z+ 240eEyGJoCIF64y5qjYRsmuxG2fupCjQq9EA9VCZUyW7GDLkDAy21fTGnSHG4D7okmpC ifIw== X-Gm-Message-State: AOAM533oW7nH+CZnPxw+sBPg7E1R/4VducrGhAzoPd13skMRaTM6Gf+m yQcHE/IXK6nkfP+5bHdQp9Ai39lb8oCbeDKoVrXZhA== 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: 4FHdtY5JG3z3h3D 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 15:27:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CF835CFA26 for ; Sat, 10 Apr 2021 15:27:57 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) (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 4FHf5T3K61z3hnT for ; Sat, 10 Apr 2021 15:27:57 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qk1-x72f.google.com with SMTP id o5so9010918qkb.0 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=RTOTbawHNyvD2+R03xB4or2pJ2/cYj4N4vexQwBmNiHM8NTvTN1U5s42DfGW3yKrWT iFpOiqvvIOmufWa0kdSZW+OsvDZ6MEb06ESd1t9SooaKW6juo+LEIiZfzWCxKcH5FJq6 IGX+HMT1u7SNP40Jnxt2dwystSuk4vkMIK8F9kysV6TpoPh6YU8vU3YnwXt1HFRtnGXV NqQQXuGJnJKSM/CYFXscE6mml0mdhvDEzG/qhSYiqFE47NrWAduOXt5W2jqpcU3YV4qY z5Fzo01ojut1N63rT0vKyZu5WxeamYFpficdgHeAG3HGh5l0i68kyxMJcvS70KNplURw xMlg== X-Gm-Message-State: AOAM530r/RVXpS6DW0266wMGreK8CqvIsm6qdAMnYeeoIb3hz9JNvGx5 nIGgIERcdg4mX0w4xnGrMpEDu5mWbDLEm0V+ 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: 4FHf5T3K61z3hnT X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 15:53:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 16:20:21 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 16:58:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 20:35:03 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sat Apr 10 22:53:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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-main@freebsd.org Sun Apr 11 04:59:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 06:43:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 06:47:56 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 07:25:32 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 08:16:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 08:37:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 09:18:09 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 11:44:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 11:44:46 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 12:25:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC5DC5CD167 for ; Sun, 11 Apr 2021 12:25:14 +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 4FJB0B4sDjz3Pxg for ; Sun, 11 Apr 2021 12:25:14 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wm1-f50.google.com with SMTP id 5-20020a05600c0245b029011a8273f85eso5313352wmj.1 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=BV/gJeWM68kzx64m1w8NpVEZnNq1x442L3KoTixo5ao4RuV9JXv3sNYIiFHCBbHhId /KpNjJH8q2lMYlS3gFviLZp1ylRsozhnYP9PCyPFUgl/+2geNkaDoC1fhAR1NnuqwAvT CfZ4/cqbJQBlNmHBZyXFaQVpzXaeSlrr+zqHl/7nFlOfPwqZD1sVMozwVP+7zo7vJY3w bUZwKgAML5C5LtpFXUWDAR9TsPKgknsDsPRLzT6VjxrNAUmZobt0aggG/OmPwA+ZnpSB QXzPLhkuS5lQ+oyD50zN5YtmTeI9QN+u6BjkSm4BsaA5eSZoL1ddF5WfwFqqkf2ca8nm At5g== X-Gm-Message-State: AOAM532V61jlSTAIRvbxCFFN3gLLhFGOLemYI/oZA4uernOKOntXv2Ed 3OmpIp73/ox0ouF4DhmYddcbwA== 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: 4FJB0B4sDjz3Pxg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 13:23:51 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 14:21:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 14:24:28 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 16:48:29 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 17:13:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 18:27:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 20:19:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 21:06:37 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 21:13:07 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 21:38:57 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 21:49:18 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 21:53:36 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 22:01:59 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 22:05:35 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 22:10:25 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 22:18:24 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 23:14:43 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 23:14:45 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 23:20:14 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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-main@freebsd.org Sun Apr 11 23:54:42 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 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-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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);