From owner-dev-commits-src-all@freebsd.org Mon Mar 15 00:10:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CFCA65B7A97; Mon, 15 Mar 2021 00:10: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 4DzGzP5Zgmz3DHw; Mon, 15 Mar 2021 00:10: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 AE8B7269B1; Mon, 15 Mar 2021 00:10: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 12F0Avkc071477; Mon, 15 Mar 2021 00:10:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F0Av0h071476; Mon, 15 Mar 2021 00:10:57 GMT (envelope-from git) Date: Mon, 15 Mar 2021 00:10:57 GMT Message-Id: <202103150010.12F0Av0h071476@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Juraj Lutter Subject: git: 78619cc2ff1b - stable/13 - newsyslog(8): Implement a new 'E' flag to not rotate empty log files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: otis X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 78619cc2ff1baa097251d826f339d7fa3e6301e2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 00:10:57 -0000 The branch stable/13 has been updated by otis (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=78619cc2ff1baa097251d826f339d7fa3e6301e2 commit 78619cc2ff1baa097251d826f339d7fa3e6301e2 Author: Juraj Lutter AuthorDate: 2021-02-28 22:07:14 +0000 Commit: Juraj Lutter CommitDate: 2021-03-15 00:08:23 +0000 newsyslog(8): Implement a new 'E' flag to not rotate empty log files Based on an idea from dvl's coworker, László DANIELISZ, implement a new flag, 'E', that prevents newsyslog(8) from rotating the empty log files. This 'E' flag ist mostly usable in conjunction with 'B' flag that instructs newsyslog(8) to not insert an informational message into the log file after rotation, keeping it still empty. Reviewed by: markj, ian, manpages (rpokala) Approved by: markj, ian, manpages (rpokala) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28940 (cherry picked from commit c7d27b225df8d7fb36a31a21737d4309593c4604) --- usr.sbin/newsyslog/newsyslog.c | 11 ++++++++++- usr.sbin/newsyslog/newsyslog.conf.5 | 14 +++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c index dc3ea51c8032..8f8bb54e9b46 100644 --- a/usr.sbin/newsyslog/newsyslog.c +++ b/usr.sbin/newsyslog/newsyslog.c @@ -114,7 +114,8 @@ __FBSDID("$FreeBSD$"); #define CE_PID2CMD 0x0400 /* Replace PID file with a shell command.*/ #define CE_PLAIN0 0x0800 /* Do not compress zero'th history file */ #define CE_RFC5424 0x1000 /* Use RFC5424 format rotation message */ - +#define CE_NOEMPTY 0x2000 /* Do not rotate the file when its size */ + /* is zero */ #define MIN_PID 5 /* Don't touch pids lower than this */ #define MAX_PID 99999 /* was lower, see /usr/include/sys/proc.h */ @@ -531,6 +532,11 @@ do_entry(struct conf_entry * ent) printf("does not exist, skipped%s.\n", temp_reason); } } else { + if (ent->flags & CE_NOEMPTY && ent->fsize == 0) { + if (verbose) + printf("--> Not rotating empty file\n"); + return (free_or_keep); + } if (ent->flags & CE_TRIMAT && !force && !rotatereq && !oversized) { diffsecs = ptimeget_diff(timenow, ent->trim_at); @@ -1291,6 +1297,9 @@ no_trimat: case 'd': working->flags |= CE_NODUMP; break; + case 'e': + working->flags |= CE_NOEMPTY; + break; case 'g': working->flags |= CE_GLOB; break; diff --git a/usr.sbin/newsyslog/newsyslog.conf.5 b/usr.sbin/newsyslog/newsyslog.conf.5 index d6b1191aa8b2..b897389b99dd 100644 --- a/usr.sbin/newsyslog/newsyslog.conf.5 +++ b/usr.sbin/newsyslog/newsyslog.conf.5 @@ -21,7 +21,7 @@ .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" -.Dd August 21, 2018 +.Dd February 26, 2021 .Dt NEWSYSLOG.CONF 5 .Os .Sh NAME @@ -286,6 +286,18 @@ this log file. This option would affect how the .Xr dump 8 command treats the log file when making a file system backup. +.It Cm E +indicates that the log file should not be rotated when its +size is zero. +The +.Cm E +flag is mostly useful in conjunction with +.Cm B +flag to prevent +.Xr newsyslog 8 +from inserting an informational +.Tn ASCII +message into the new file. .It Cm G indicates that the specified .Ar logfile_name From owner-dev-commits-src-all@freebsd.org Mon Mar 15 02:32:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E908956AEB6; Mon, 15 Mar 2021 02:32: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 4DzL746G2Dz3LpJ; Mon, 15 Mar 2021 02:32: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 C99AEBED; Mon, 15 Mar 2021 02:32:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12F2Wm4X060471; Mon, 15 Mar 2021 02:32:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F2WmaK060470; Mon, 15 Mar 2021 02:32:48 GMT (envelope-from git) Date: Mon, 15 Mar 2021 02:32:48 GMT Message-Id: <202103150232.12F2WmaK060470@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 90ac5cb75e9f - stable/13 - Move XPT_IMMEDIATE_NOTIFY handling out of periph lock. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 90ac5cb75e9fc89b431f304be35ab081e13825ad Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 02:32:49 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=90ac5cb75e9fc89b431f304be35ab081e13825ad commit 90ac5cb75e9fc89b431f304be35ab081e13825ad Author: Alexander Motin AuthorDate: 2021-02-18 21:22:01 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:32:42 +0000 Move XPT_IMMEDIATE_NOTIFY handling out of periph lock. It is a rare, but still better to not have lock dependencies. MFC after: 1 month (cherry picked from commit c67a2909a629db138227993e1093e66bb6c00af5) --- sys/cam/ctl/scsi_ctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index 074ac4cd1894..34c3ce7ad923 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -1491,6 +1491,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) ctlfe_free_ccb(periph, done_ccb); goto out; } + mtx_unlock(mtx); if (send_ctl_io != 0) { ctl_queue(io); } else { @@ -1498,7 +1499,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) done_ccb->ccb_h.func_code = XPT_NOTIFY_ACKNOWLEDGE; xpt_action(done_ccb); } - break; + return; } case XPT_NOTIFY_ACKNOWLEDGE: /* Queue this back down to the SIM as an immediate notify. */ From owner-dev-commits-src-all@freebsd.org Mon Mar 15 02:39:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01EFA56B18C; Mon, 15 Mar 2021 02: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 4DzLH36gh8z3MF7; Mon, 15 Mar 2021 02:39: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 D7F7286C; Mon, 15 Mar 2021 02:39: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 12F2dhbN061546; Mon, 15 Mar 2021 02:39:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F2dhgh061545; Mon, 15 Mar 2021 02:39:43 GMT (envelope-from git) Date: Mon, 15 Mar 2021 02:39:43 GMT Message-Id: <202103150239.12F2dhgh061545@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 6fb753b9fa19 - stable/13 - Save context switch per I/O for iSCSI and IOCTL frontends. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6fb753b9fa19838208d0bada1de87afe1f0dd887 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 02:39:44 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=6fb753b9fa19838208d0bada1de87afe1f0dd887 commit 6fb753b9fa19838208d0bada1de87afe1f0dd887 Author: Alexander Motin AuthorDate: 2021-02-19 03:07:32 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:33:10 +0000 Save context switch per I/O for iSCSI and IOCTL frontends. Introduce new CTL core KPI ctl_run(), preprocessing I/Os in the caller context instead of scheduling another thread just for that. This call may sleep, that is not acceptable for some frontends like the original CAM/FC one, but iSCSI already has separate sleepable per-connection RX threads, and another thread scheduling is mostly just a waste of time. IOCTL frontend actually waits for the I/O completion in the caller thread, so the use of another thread for this has even less sense. With this change I can measure ~5% IOPS improvement on 4KB iSCSI I/Os to ZFS. MFC after: 1 month (cherry picked from commit 812c9f48a2b7bccc31b2a6077b299822357832e4) --- sys/cam/ctl/README.ctl.txt | 2 +- sys/cam/ctl/ctl.c | 65 ++++++++++++++++++++++++++++++---------- sys/cam/ctl/ctl_frontend.h | 7 +++++ sys/cam/ctl/ctl_frontend_ioctl.c | 2 +- sys/cam/ctl/ctl_frontend_iscsi.c | 12 ++++---- sys/cam/ctl/ctl_tpc.c | 2 +- 6 files changed, 65 insertions(+), 25 deletions(-) diff --git a/sys/cam/ctl/README.ctl.txt b/sys/cam/ctl/README.ctl.txt index 27ebe49aec56..db8666ea99db 100644 --- a/sys/cam/ctl/README.ctl.txt +++ b/sys/cam/ctl/README.ctl.txt @@ -258,7 +258,7 @@ point. Here is a roadmap of some of the primary functions in ctl.c. Starting here and following the various leaf functions will show the command flow. -ctl_queue() This is where commands from the frontend ports come +ctl_queue() / ctl_run() This is where commands from the frontend ports come in. ctl_queue_sense() This is only used for non-packetized SCSI. i.e. diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index bb8fbf910857..ee36e6b01f52 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -513,8 +513,7 @@ static int ctl_scsiio_lun_check(struct ctl_lun *lun, const struct ctl_cmd_entry *entry, struct ctl_scsiio *ctsio); static void ctl_failover_lun(union ctl_io *io); -static int ctl_scsiio_precheck(struct ctl_softc *ctl_softc, - struct ctl_scsiio *ctsio); +static void ctl_scsiio_precheck(struct ctl_scsiio *ctsio); static int ctl_scsiio(struct ctl_scsiio *ctsio); static int ctl_target_reset(union ctl_io *io); @@ -11435,14 +11434,14 @@ ctl_failover_lun(union ctl_io *rio) mtx_unlock(&lun->lun_lock); } -static int -ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) +static void +ctl_scsiio_precheck(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); struct ctl_lun *lun; const struct ctl_cmd_entry *entry; union ctl_io *bio; uint32_t initidx, targ_lun; - int retval = 0; lun = NULL; targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; @@ -11480,7 +11479,7 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) if (entry == NULL) { if (lun) mtx_unlock(&lun->lun_lock); - return (retval); + return; } ctsio->io_hdr.flags &= ~CTL_FLAG_DATA_MASK; @@ -11497,13 +11496,13 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) if (entry->flags & CTL_CMD_FLAG_OK_ON_NO_LUN) { ctsio->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; ctl_enqueue_rtr((union ctl_io *)ctsio); - return (retval); + return; } ctl_set_unsupported_lun(ctsio); ctl_done((union ctl_io *)ctsio); CTL_DEBUG_PRINT(("ctl_scsiio_precheck: bailing out due to invalid LUN\n")); - return (retval); + return; } else { /* * Make sure we support this particular command on this LUN. @@ -11513,7 +11512,7 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) mtx_unlock(&lun->lun_lock); ctl_set_invalid_opcode(ctsio); ctl_done((union ctl_io *)ctsio); - return (retval); + return; } } @@ -11567,14 +11566,14 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) ctsio->io_hdr.status = CTL_SCSI_ERROR | CTL_AUTOSENSE; ctsio->sense_len = sense_len; ctl_done((union ctl_io *)ctsio); - return (retval); + return; } } if (ctl_scsiio_lun_check(lun, entry, ctsio) != 0) { mtx_unlock(&lun->lun_lock); ctl_done((union ctl_io *)ctsio); - return (retval); + return; } /* @@ -11611,9 +11610,9 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) M_WAITOK)) > CTL_HA_STATUS_SUCCESS) { ctl_set_busy(ctsio); ctl_done((union ctl_io *)ctsio); - return (retval); + return; } - return (retval); + return; } bio = (union ctl_io *)TAILQ_PREV(&ctsio->io_hdr, ctl_ooaq, ooa_links); @@ -11623,7 +11622,7 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) TAILQ_INSERT_TAIL(&bio->io_hdr.blocked_queue, &ctsio->io_hdr, blocked_links); mtx_unlock(&lun->lun_lock); - return (retval); + break; case CTL_ACTION_PASS: case CTL_ACTION_SKIP: ctsio->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; @@ -11649,7 +11648,6 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) ctl_done((union ctl_io *)ctsio); break; } - return (retval); } const struct ctl_cmd_entry * @@ -13251,6 +13249,41 @@ ctl_queue(union ctl_io *io) return (CTL_RETVAL_COMPLETE); } +int +ctl_run(union ctl_io *io) +{ + struct ctl_port *port = CTL_PORT(io); + + CTL_DEBUG_PRINT(("ctl_run cdb[0]=%02X\n", io->scsiio.cdb[0])); + +#ifdef CTL_TIME_IO + io->io_hdr.start_time = time_uptime; + getbinuptime(&io->io_hdr.start_bt); +#endif /* CTL_TIME_IO */ + + /* Map FE-specific LUN ID into global one. */ + io->io_hdr.nexus.targ_mapped_lun = + ctl_lun_map_from_port(port, io->io_hdr.nexus.targ_lun); + + switch (io->io_hdr.io_type) { + case CTL_IO_SCSI: + if (ctl_debug & CTL_DEBUG_CDB) + ctl_io_print(io); + ctl_scsiio_precheck(&io->scsiio); + break; + case CTL_IO_TASK: + if (ctl_debug & CTL_DEBUG_CDB) + ctl_io_print(io); + ctl_run_task(io); + break; + default: + printf("ctl_run: unknown I/O type %d\n", io->io_hdr.io_type); + return (EINVAL); + } + + return (CTL_RETVAL_COMPLETE); +} + #ifdef CTL_IO_DELAY static void ctl_done_timer_wakeup(void *arg) @@ -13381,7 +13414,7 @@ ctl_work_thread(void *arg) if (io->io_hdr.io_type == CTL_IO_TASK) ctl_run_task(io); else - ctl_scsiio_precheck(softc, &io->scsiio); + ctl_scsiio_precheck(&io->scsiio); continue; } io = (union ctl_io *)STAILQ_FIRST(&thr->rtr_queue); diff --git a/sys/cam/ctl/ctl_frontend.h b/sys/cam/ctl/ctl_frontend.h index bdcb7a2e1abd..c9ab255cdde4 100644 --- a/sys/cam/ctl/ctl_frontend.h +++ b/sys/cam/ctl/ctl_frontend.h @@ -310,6 +310,13 @@ void ctl_port_offline(struct ctl_port *fe); */ int ctl_queue(union ctl_io *io); +/* + * This routine starts execution of I/O and task management requests from + * the FETD to the CTL layer. May sleep. Returns 0 for success, non-zero + * for failure. + */ +int ctl_run(union ctl_io *io); + /* * This routine is used if the front end interface doesn't support * autosense (e.g. non-packetized parallel SCSI). This will queue the diff --git a/sys/cam/ctl/ctl_frontend_ioctl.c b/sys/cam/ctl/ctl_frontend_ioctl.c index 370e553042c5..ef5e2bd22a86 100644 --- a/sys/cam/ctl/ctl_frontend_ioctl.c +++ b/sys/cam/ctl/ctl_frontend_ioctl.c @@ -524,7 +524,7 @@ cfi_submit_wait(union ctl_io *io) CTL_DEBUG_PRINT(("cfi_submit_wait\n")); /* This shouldn't happen */ - if ((retval = ctl_queue(io)) != CTL_RETVAL_COMPLETE) + if ((retval = ctl_run(io)) != CTL_RETVAL_COMPLETE) return (retval); done = 0; diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index 8b0effcaf393..73483fb155cc 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -557,9 +557,9 @@ cfiscsi_pdu_handle_scsi_command(struct icl_pdu *request) io->scsiio.cdb_len = sizeof(bhssc->bhssc_cdb); /* Which is 16. */ memcpy(io->scsiio.cdb, bhssc->bhssc_cdb, sizeof(bhssc->bhssc_cdb)); refcount_acquire(&cs->cs_outstanding_ctl_pdus); - error = ctl_queue(io); + error = ctl_run(io); if (error != CTL_RETVAL_COMPLETE) { - CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d; " + CFISCSI_SESSION_WARN(cs, "ctl_run() failed; error %d; " "dropping connection", error); ctl_free_io(io); refcount_release(&cs->cs_outstanding_ctl_pdus); @@ -679,9 +679,9 @@ cfiscsi_pdu_handle_task_request(struct icl_pdu *request) } refcount_acquire(&cs->cs_outstanding_ctl_pdus); - error = ctl_queue(io); + error = ctl_run(io); if (error != CTL_RETVAL_COMPLETE) { - CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d; " + CFISCSI_SESSION_WARN(cs, "ctl_run() failed; error %d; " "dropping connection", error); ctl_free_io(io); refcount_release(&cs->cs_outstanding_ctl_pdus); @@ -1128,9 +1128,9 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) io->taskio.task_action = CTL_TASK_I_T_NEXUS_RESET; wait = cs->cs_outstanding_ctl_pdus; refcount_acquire(&cs->cs_outstanding_ctl_pdus); - error = ctl_queue(io); + error = ctl_run(io); if (error != CTL_RETVAL_COMPLETE) { - CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d", error); + CFISCSI_SESSION_WARN(cs, "ctl_run() failed; error %d", error); refcount_release(&cs->cs_outstanding_ctl_pdus); ctl_free_io(io); } diff --git a/sys/cam/ctl/ctl_tpc.c b/sys/cam/ctl/ctl_tpc.c index d63435b38762..de9e97b87a3e 100644 --- a/sys/cam/ctl/ctl_tpc.c +++ b/sys/cam/ctl/ctl_tpc.c @@ -1628,7 +1628,7 @@ tpc_done(union ctl_io *io) io->io_hdr.flags &= ~CTL_FLAG_ABORT; io->io_hdr.flags &= ~CTL_FLAG_SENT_2OTHER_SC; if (tpcl_queue(io, tio->lun) != CTL_RETVAL_COMPLETE) { - printf("%s: error returned from ctl_queue()!\n", + printf("%s: error returned from tpcl_queue()!\n", __func__); io->io_hdr.status = old_status; } else From owner-dev-commits-src-all@freebsd.org Mon Mar 15 02:39:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 124D856B0AD; Mon, 15 Mar 2021 02:39: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 4DzLH502Lwz3Lxy; Mon, 15 Mar 2021 02:39: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 E840876D; Mon, 15 Mar 2021 02: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 12F2dihN061568; Mon, 15 Mar 2021 02: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 12F2dijW061567; Mon, 15 Mar 2021 02:39:44 GMT (envelope-from git) Date: Mon, 15 Mar 2021 02:39:44 GMT Message-Id: <202103150239.12F2dijW061567@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: d0b1f461e248 - stable/13 - Microoptimize CTL I/O queues. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d0b1f461e248e31ac27cabebd54d97dac5d99c1c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 02:39:45 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=d0b1f461e248e31ac27cabebd54d97dac5d99c1c commit d0b1f461e248e31ac27cabebd54d97dac5d99c1c Author: Alexander Motin AuthorDate: 2021-02-19 20:42:57 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:33:57 +0000 Microoptimize CTL I/O queues. Switch OOA queue from TAILQ to LIST and change its direction, so that we traverse it forward, not backward. There is only one place where we really need other direction, and it is not critical. Use STAILQ_REMOVE_HEAD() instead of STAILQ_REMOVE() in backends. Replace few impossible conditions with assertions. MFC after: 1 month (cherry picked from commit 05d882b780f5be2da6f3d3bfef9160aacc4888d6) --- sys/cam/ctl/ctl.c | 133 ++++++++++++++++++++------------------ sys/cam/ctl/ctl_backend_block.c | 19 ++---- sys/cam/ctl/ctl_backend_ramdisk.c | 3 +- sys/cam/ctl/ctl_io.h | 2 +- sys/cam/ctl/ctl_private.h | 2 +- sys/cam/ctl/scsi_ctl.c | 2 +- 6 files changed, 81 insertions(+), 80 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index ee36e6b01f52..7172f8ead309 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -2326,12 +2326,12 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) * particular LUN, and stays there until completion. */ #ifdef CTL_TIME_IO - if (TAILQ_EMPTY(&lun->ooa_queue)) + if (LIST_EMPTY(&lun->ooa_queue)) lun->idle_time += getsbinuptime() - lun->last_busy; #endif - TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_INSERT_HEAD(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); - bio = (union ctl_io *)TAILQ_PREV(&ctsio->io_hdr, ctl_ooaq, ooa_links); + bio = (union ctl_io *)LIST_NEXT(&ctsio->io_hdr, ooa_links); switch (ctl_check_ooa(lun, (union ctl_io *)ctsio, &bio)) { case CTL_ACTION_BLOCK: ctsio->io_hdr.blocker = bio; @@ -2358,18 +2358,18 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) } break; case CTL_ACTION_OVERLAP: - TAILQ_REMOVE(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_REMOVE(&ctsio->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); ctl_set_overlapped_cmd(ctsio); goto badjuju; case CTL_ACTION_OVERLAP_TAG: - TAILQ_REMOVE(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_REMOVE(&ctsio->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); ctl_set_overlapped_tag(ctsio, ctsio->tag_num); goto badjuju; case CTL_ACTION_ERROR: default: - TAILQ_REMOVE(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_REMOVE(&ctsio->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); ctl_set_internal_failure(ctsio, /*sks_valid*/ 0, @@ -2393,20 +2393,28 @@ static void ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, struct ctl_ooa *ooa_hdr, struct ctl_ooa_entry *kern_entries) { - union ctl_io *io; + struct ctl_io_hdr *ioh; mtx_lock(&lun->lun_lock); - for (io = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); (io != NULL); - (*cur_fill_num)++, io = (union ctl_io *)TAILQ_NEXT(&io->io_hdr, - ooa_links)) { + ioh = LIST_FIRST(&lun->ooa_queue); + if (ioh == NULL) { + mtx_unlock(&lun->lun_lock); + return; + } + while (LIST_NEXT(ioh, ooa_links) != NULL) + ioh = LIST_NEXT(ioh, ooa_links); + for ( ; ioh; ioh = LIST_PREV(ioh, &lun->ooa_queue, ctl_io_hdr, ooa_links)) { + union ctl_io *io = (union ctl_io *)ioh; struct ctl_ooa_entry *entry; /* * If we've got more than we can fit, just count the * remaining entries. */ - if (*cur_fill_num >= ooa_hdr->alloc_num) + if (*cur_fill_num >= ooa_hdr->alloc_num) { + (*cur_fill_num)++; continue; + } entry = &kern_entries[*cur_fill_num]; @@ -2437,6 +2445,7 @@ ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, if (io->io_hdr.flags & CTL_FLAG_STATUS_SENT) entry->cmd_flags |= CTL_OOACMD_FLAG_STATUS_SENT; + (*cur_fill_num)++; } mtx_unlock(&lun->lun_lock); } @@ -4670,7 +4679,7 @@ fail: #ifdef CTL_TIME_IO lun->last_busy = getsbinuptime(); #endif - TAILQ_INIT(&lun->ooa_queue); + LIST_INIT(&lun->ooa_queue); STAILQ_INIT(&lun->error_list); lun->ie_reported = 1; callout_init_mtx(&lun->ie_callout, &lun->lun_lock, 0); @@ -4733,7 +4742,7 @@ ctl_free_lun(struct ctl_lun *lun) struct ctl_lun *nlun; int i; - KASSERT(TAILQ_EMPTY(&lun->ooa_queue), + KASSERT(LIST_EMPTY(&lun->ooa_queue), ("Freeing a LUN %p with outstanding I/O!\n", lun)); mtx_lock(&softc->ctl_lock); @@ -4980,7 +4989,7 @@ ctl_remove_lun(struct ctl_be_lun *be_lun) * If we have something in the OOA queue, we'll free it when the * last I/O completes. */ - if (TAILQ_EMPTY(&lun->ooa_queue)) { + if (LIST_EMPTY(&lun->ooa_queue)) { mtx_unlock(&lun->lun_lock); ctl_free_lun(lun); } else @@ -5025,7 +5034,7 @@ ctl_config_move_done(union ctl_io *io) CTL_DEBUG_PRINT(("ctl_config_move_done\n")); KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, - ("Config I/O type isn't CTL_IO_SCSI (%d)!", io->io_hdr.io_type)); + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); if ((io->io_hdr.port_status != 0) && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || @@ -10671,8 +10680,9 @@ ctl_read_toc(struct ctl_scsiio *ctsio) static int ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint64_t *len) { - if (io->io_hdr.io_type != CTL_IO_SCSI) - return (1); + + KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); switch (io->scsiio.cdb[0]) { case COMPARE_AND_WRITE: { @@ -10851,9 +10861,11 @@ ctl_extent_check_unmap(union ctl_io *io, uint64_t lba2, uint64_t len2) uint64_t lba; uint32_t len; + KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); + /* If not UNMAP -- go other way. */ - if (io->io_hdr.io_type != CTL_IO_SCSI || - io->scsiio.cdb[0] != UNMAP) + if (io->scsiio.cdb[0] != UNMAP) return (CTL_ACTION_ERROR); /* If UNMAP without data -- block and wait for data. */ @@ -11073,8 +11085,7 @@ ctl_check_ooa(struct ctl_lun *lun, union ctl_io *pending_io, * CTL_ACTION_PASS. */ for (ooa_io = *starting_io; ooa_io != NULL; - ooa_io = (union ctl_io *)TAILQ_PREV(&ooa_io->io_hdr, ctl_ooaq, - ooa_links)){ + ooa_io = (union ctl_io *)LIST_NEXT(&ooa_io->io_hdr, ooa_links)) { action = ctl_check_for_blockage(lun, pending_io, ooa_io); if (action != CTL_ACTION_PASS) { *starting_io = ooa_io; @@ -11109,8 +11120,7 @@ ctl_try_unblock_io(struct ctl_lun *lun, union ctl_io *io, bool skip) obio = bio = io->io_hdr.blocker; if (skip) - bio = (union ctl_io *)TAILQ_PREV(&bio->io_hdr, ctl_ooaq, - ooa_links); + bio = (union ctl_io *)LIST_NEXT(&bio->io_hdr, ooa_links); action = ctl_check_ooa(lun, io, &bio); if (action == CTL_ACTION_BLOCK) { /* Still blocked, but may be by different I/O now. */ @@ -11176,7 +11186,7 @@ error: if ((io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) && (softc->ha_mode != CTL_HA_MODE_XFER)) { ctl_try_unblock_others(lun, io, TRUE); - TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); + LIST_REMOVE(&io->io_hdr, ooa_links); ctl_copy_sense_data_back(io, &msg_info); msg_info.hdr.original_sc = io->io_hdr.remote_io; @@ -11378,7 +11388,7 @@ ctl_failover_lun(union ctl_io *rio) } if (softc->ha_mode == CTL_HA_MODE_XFER) { - TAILQ_FOREACH_SAFE(io, &lun->ooa_queue, ooa_links, next_io) { + LIST_FOREACH_SAFE(io, &lun->ooa_queue, ooa_links, next_io) { /* We are master */ if (io->flags & CTL_FLAG_FROM_OTHER_SC) { if (io->flags & CTL_FLAG_IO_ACTIVE) { @@ -11407,7 +11417,7 @@ ctl_failover_lun(union ctl_io *rio) } } } else { /* SERIALIZE modes */ - TAILQ_FOREACH_SAFE(io, &lun->ooa_queue, ooa_links, next_io) { + LIST_FOREACH_SAFE(io, &lun->ooa_queue, ooa_links, next_io) { /* We are master */ if (io->flags & CTL_FLAG_FROM_OTHER_SC) { if (io->blocker != NULL) { @@ -11417,7 +11427,7 @@ ctl_failover_lun(union ctl_io *rio) } ctl_try_unblock_others(lun, (union ctl_io *)io, TRUE); - TAILQ_REMOVE(&lun->ooa_queue, io, ooa_links); + LIST_REMOVE(io, ooa_links); ctl_free_io((union ctl_io *)io); } else /* We are slave */ @@ -11468,10 +11478,10 @@ ctl_scsiio_precheck(struct ctl_scsiio *ctsio) * and stays there until completion. */ #ifdef CTL_TIME_IO - if (TAILQ_EMPTY(&lun->ooa_queue)) + if (LIST_EMPTY(&lun->ooa_queue)) lun->idle_time += getsbinuptime() - lun->last_busy; #endif - TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_INSERT_HEAD(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); } /* Get command entry and return error if it is unsuppotyed. */ @@ -11615,7 +11625,7 @@ ctl_scsiio_precheck(struct ctl_scsiio *ctsio) return; } - bio = (union ctl_io *)TAILQ_PREV(&ctsio->io_hdr, ctl_ooaq, ooa_links); + bio = (union ctl_io *)LIST_NEXT(&ctsio->io_hdr, ooa_links); switch (ctl_check_ooa(lun, (union ctl_io *)ctsio, &bio)) { case CTL_ACTION_BLOCK: ctsio->io_hdr.blocker = bio; @@ -11823,15 +11833,14 @@ ctl_target_reset(union ctl_io *io) static void ctl_do_lun_reset(struct ctl_lun *lun, uint32_t initidx, ctl_ua_type ua_type) { - union ctl_io *xio; + struct ctl_io_hdr *xioh; int i; mtx_lock(&lun->lun_lock); /* Abort tasks. */ - for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; - xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { - xio->io_hdr.flags |= CTL_FLAG_ABORT | CTL_FLAG_ABORT_STATUS; - ctl_try_unblock_io(lun, xio, FALSE); + LIST_FOREACH(xioh, &lun->ooa_queue, ooa_links) { + xioh->flags |= CTL_FLAG_ABORT | CTL_FLAG_ABORT_STATUS; + ctl_try_unblock_io(lun, (union ctl_io *)xioh, FALSE); } /* Clear CA. */ for (i = 0; i < ctl_max_ports; i++) { @@ -11895,7 +11904,7 @@ static void ctl_abort_tasks_lun(struct ctl_lun *lun, uint32_t targ_port, uint32_t init_id, int other_sc) { - union ctl_io *xio; + struct ctl_io_hdr *xioh; mtx_assert(&lun->lun_lock, MA_OWNED); @@ -11906,20 +11915,20 @@ ctl_abort_tasks_lun(struct ctl_lun *lun, uint32_t targ_port, uint32_t init_id, * untagged command to abort, simply abort the first untagged command * we come to. We only allow one untagged command at a time of course. */ - for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; - xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { + LIST_FOREACH(xioh, &lun->ooa_queue, ooa_links) { + union ctl_io *xio = (union ctl_io *)xioh; if ((targ_port == UINT32_MAX || - targ_port == xio->io_hdr.nexus.targ_port) && + targ_port == xioh->nexus.targ_port) && (init_id == UINT32_MAX || - init_id == xio->io_hdr.nexus.initid)) { - if (targ_port != xio->io_hdr.nexus.targ_port || - init_id != xio->io_hdr.nexus.initid) - xio->io_hdr.flags |= CTL_FLAG_ABORT_STATUS; - xio->io_hdr.flags |= CTL_FLAG_ABORT; + init_id == xioh->nexus.initid)) { + if (targ_port != xioh->nexus.targ_port || + init_id != xioh->nexus.initid) + xioh->flags |= CTL_FLAG_ABORT_STATUS; + xioh->flags |= CTL_FLAG_ABORT; if (!other_sc && !(lun->flags & CTL_LUN_PRIMARY_SC)) { union ctl_ha_msg msg_info; - msg_info.hdr.nexus = xio->io_hdr.nexus; + msg_info.hdr.nexus = xioh->nexus; msg_info.task.task_action = CTL_TASK_ABORT_TASK; msg_info.task.tag_num = xio->scsiio.tag_num; msg_info.task.tag_type = xio->scsiio.tag_type; @@ -12032,7 +12041,7 @@ static int ctl_abort_task(union ctl_io *io) { struct ctl_softc *softc = CTL_SOFTC(io); - union ctl_io *xio; + struct ctl_io_hdr *xioh; struct ctl_lun *lun; uint32_t targ_lun; @@ -12057,11 +12066,11 @@ ctl_abort_task(union ctl_io *io) * untagged command to abort, simply abort the first untagged command * we come to. We only allow one untagged command at a time of course. */ - for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; - xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { - if ((xio->io_hdr.nexus.targ_port != io->io_hdr.nexus.targ_port) - || (xio->io_hdr.nexus.initid != io->io_hdr.nexus.initid) - || (xio->io_hdr.flags & CTL_FLAG_ABORT)) + LIST_FOREACH(xioh, &lun->ooa_queue, ooa_links) { + union ctl_io *xio = (union ctl_io *)xioh; + if ((xioh->nexus.targ_port != io->io_hdr.nexus.targ_port) + || (xioh->nexus.initid != io->io_hdr.nexus.initid) + || (xioh->flags & CTL_FLAG_ABORT)) continue; /* @@ -12086,7 +12095,7 @@ ctl_abort_task(union ctl_io *io) */ if (xio->scsiio.tag_num == io->taskio.tag_num) { #endif - xio->io_hdr.flags |= CTL_FLAG_ABORT; + xioh->flags |= CTL_FLAG_ABORT; if ((io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) == 0 && !(lun->flags & CTL_LUN_PRIMARY_SC)) { union ctl_ha_msg msg_info; @@ -12113,7 +12122,7 @@ static int ctl_query_task(union ctl_io *io, int task_set) { struct ctl_softc *softc = CTL_SOFTC(io); - union ctl_io *xio; + struct ctl_io_hdr *xioh; struct ctl_lun *lun; int found = 0; uint32_t targ_lun; @@ -12128,11 +12137,11 @@ ctl_query_task(union ctl_io *io, int task_set) } mtx_lock(&lun->lun_lock); mtx_unlock(&softc->ctl_lock); - for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; - xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { - if ((xio->io_hdr.nexus.targ_port != io->io_hdr.nexus.targ_port) - || (xio->io_hdr.nexus.initid != io->io_hdr.nexus.initid) - || (xio->io_hdr.flags & CTL_FLAG_ABORT)) + LIST_FOREACH(xioh, &lun->ooa_queue, ooa_links) { + union ctl_io *xio = (union ctl_io *)xioh; + if ((xioh->nexus.targ_port != io->io_hdr.nexus.targ_port) + || (xioh->nexus.initid != io->io_hdr.nexus.initid) + || (xioh->flags & CTL_FLAG_ABORT)) continue; if (task_set || xio->scsiio.tag_num == io->taskio.tag_num) { @@ -12277,7 +12286,7 @@ ctl_handle_isc(union ctl_io *io) } mtx_lock(&lun->lun_lock); ctl_try_unblock_others(lun, io, TRUE); - TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); + LIST_REMOVE(&io->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); ctl_free_io(io); break; @@ -13109,9 +13118,9 @@ ctl_process_done(union ctl_io *io) /* * Remove this from the OOA queue. */ - TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); + LIST_REMOVE(&io->io_hdr, ooa_links); #ifdef CTL_TIME_IO - if (TAILQ_EMPTY(&lun->ooa_queue)) + if (LIST_EMPTY(&lun->ooa_queue)) lun->last_busy = getsbinuptime(); #endif @@ -13120,7 +13129,7 @@ ctl_process_done(union ctl_io *io) * left on its OOA queue. */ if ((lun->flags & CTL_LUN_INVALID) - && TAILQ_EMPTY(&lun->ooa_queue)) { + && LIST_EMPTY(&lun->ooa_queue)) { mtx_unlock(&lun->lun_lock); ctl_free_lun(lun); } else diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 26fb13080171..0fbe0949f893 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -1698,8 +1698,7 @@ ctl_be_block_worker(void *context, int pending) io = (union ctl_io *)STAILQ_FIRST(&be_lun->datamove_queue); if (io != NULL) { DPRINTF("datamove queue\n"); - STAILQ_REMOVE(&be_lun->datamove_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->datamove_queue, links); mtx_unlock(&be_lun->queue_lock); beio = (struct ctl_be_block_io *)PRIV(io)->ptr; if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { @@ -1713,8 +1712,7 @@ ctl_be_block_worker(void *context, int pending) io = (union ctl_io *)STAILQ_FIRST(&be_lun->config_write_queue); if (io != NULL) { DPRINTF("config write queue\n"); - STAILQ_REMOVE(&be_lun->config_write_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->config_write_queue, links); mtx_unlock(&be_lun->queue_lock); if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); @@ -1727,8 +1725,7 @@ ctl_be_block_worker(void *context, int pending) io = (union ctl_io *)STAILQ_FIRST(&be_lun->config_read_queue); if (io != NULL) { DPRINTF("config read queue\n"); - STAILQ_REMOVE(&be_lun->config_read_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->config_read_queue, links); mtx_unlock(&be_lun->queue_lock); if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); @@ -1741,8 +1738,7 @@ ctl_be_block_worker(void *context, int pending) io = (union ctl_io *)STAILQ_FIRST(&be_lun->input_queue); if (io != NULL) { DPRINTF("input queue\n"); - STAILQ_REMOVE(&be_lun->input_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->input_queue, links); mtx_unlock(&be_lun->queue_lock); if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); @@ -1776,11 +1772,8 @@ ctl_be_block_submit(union ctl_io *io) be_lun = (struct ctl_be_block_lun *)CTL_BACKEND_LUN(io); - /* - * Make sure we only get SCSI I/O. - */ - KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, ("Non-SCSI I/O (type " - "%#x) encountered", io->io_hdr.io_type)); + KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); PRIV(io)->len = 0; diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c index 1f1ca00ff562..2595aa0be00e 100644 --- a/sys/cam/ctl/ctl_backend_ramdisk.c +++ b/sys/cam/ctl/ctl_backend_ramdisk.c @@ -569,8 +569,7 @@ ctl_backend_ramdisk_worker(void *context, int pending) for (;;) { io = (union ctl_io *)STAILQ_FIRST(&be_lun->cont_queue); if (io != NULL) { - STAILQ_REMOVE(&be_lun->cont_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->cont_queue, links); mtx_unlock(&be_lun->queue_lock); if (ARGS(io)->flags & CTL_LLF_COMPARE) ctl_backend_ramdisk_compare(io); diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h index 2ad499f7f147..52ba98f3a9bd 100644 --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -242,7 +242,7 @@ struct ctl_io_hdr { union ctl_priv ctl_private[CTL_NUM_PRIV];/* CTL private area */ TAILQ_HEAD(, ctl_io_hdr) blocked_queue; /* I/Os blocked by this one */ STAILQ_ENTRY(ctl_io_hdr) links; /* linked list pointer */ - TAILQ_ENTRY(ctl_io_hdr) ooa_links; /* ooa_queue links */ + LIST_ENTRY(ctl_io_hdr) ooa_links; /* ooa_queue links */ TAILQ_ENTRY(ctl_io_hdr) blocked_links; /* blocked_queue links */ }; diff --git a/sys/cam/ctl/ctl_private.h b/sys/cam/ctl/ctl_private.h index cf67deb13ef7..8940babd4904 100644 --- a/sys/cam/ctl/ctl_private.h +++ b/sys/cam/ctl/ctl_private.h @@ -391,7 +391,7 @@ struct ctl_lun { sbintime_t idle_time; sbintime_t last_busy; #endif - TAILQ_HEAD(ctl_ooaq, ctl_io_hdr) ooa_queue; + LIST_HEAD(ctl_ooaq, ctl_io_hdr) ooa_queue; STAILQ_ENTRY(ctl_lun) links; struct scsi_sense_data **pending_sense; ctl_ua_type **pending_ua; diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index 34c3ce7ad923..646b3fe07053 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -1910,7 +1910,7 @@ ctlfe_datamove(union ctl_io *io) struct ctlfe_lun_softc *softc; KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, - ("Unexpected io_type (%d) in ctlfe_datamove", io->io_hdr.io_type)); + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); io->scsiio.ext_data_filled = 0; ccb = PRIV_CCB(io); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 02:39:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29FB856B199; Mon, 15 Mar 2021 02:39: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 4DzLH65VYrz3Ly0; Mon, 15 Mar 2021 02:39: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 3D6A495B; Mon, 15 Mar 2021 02:39: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 12F2dkJ5061590; Mon, 15 Mar 2021 02:39:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F2dkHx061589; Mon, 15 Mar 2021 02:39:46 GMT (envelope-from git) Date: Mon, 15 Mar 2021 02:39:46 GMT Message-Id: <202103150239.12F2dkHx061589@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: a4bea2f2a65c - stable/13 - Refactor CTL datamove KPI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a4bea2f2a65cc8a3f93272323065f51043c22937 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 02:39:47 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=a4bea2f2a65cc8a3f93272323065f51043c22937 commit a4bea2f2a65cc8a3f93272323065f51043c22937 Author: Alexander Motin AuthorDate: 2021-02-21 21:45:14 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:34:08 +0000 Refactor CTL datamove KPI. - Make frontends call unified CTL core method ctl_datamove_done() to report move completion. It allows to reduce code duplication in differerent backends by accounting DMA time in common code. - Add to ctl_datamove_done() and be_move_done() callback samethr argument, reporting whether the callback is called in the same context as ctl_datamove(). It allows for some cases like iSCSI write with immediate data or camsim frontend write save one context switch, since we know that the context is sleepable. - Remove data_move_done() methods from struct ctl_backend_driver, unused since forever. MFC after: 1 month (cherry picked from commit 2c7dc6bae9fd5c2fa0a65768df8e4e99c2f159f1) --- sys/cam/ctl/ctl.c | 112 +++++++++++++++++-------------------- sys/cam/ctl/ctl.h | 3 +- sys/cam/ctl/ctl_backend.h | 1 - sys/cam/ctl/ctl_backend_block.c | 64 ++++++--------------- sys/cam/ctl/ctl_backend_ramdisk.c | 36 ++---------- sys/cam/ctl/ctl_frontend_cam_sim.c | 2 +- sys/cam/ctl/ctl_frontend_ioctl.c | 2 +- sys/cam/ctl/ctl_frontend_iscsi.c | 23 ++++---- sys/cam/ctl/ctl_io.h | 2 +- sys/cam/ctl/ctl_tpc_local.c | 2 +- sys/cam/ctl/scsi_ctl.c | 3 +- sys/dev/usb/storage/cfumass.c | 6 +- 12 files changed, 94 insertions(+), 162 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 7172f8ead309..18a82ca72d76 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -535,9 +535,9 @@ static void ctl_done_timer_wakeup(void *arg); static void ctl_send_datamove_done(union ctl_io *io, int have_lock); static void ctl_datamove_remote_write_cb(struct ctl_ha_dt_req *rq); -static int ctl_datamove_remote_dm_write_cb(union ctl_io *io); +static int ctl_datamove_remote_dm_write_cb(union ctl_io *io, bool samethr); static void ctl_datamove_remote_write(union ctl_io *io); -static int ctl_datamove_remote_dm_read_cb(union ctl_io *io); +static int ctl_datamove_remote_dm_read_cb(union ctl_io *io, bool samethr); static void ctl_datamove_remote_read_cb(struct ctl_ha_dt_req *rq); static int ctl_datamove_remote_sgl_setup(union ctl_io *io); static int ctl_datamove_remote_xfer(union ctl_io *io, unsigned command, @@ -736,7 +736,7 @@ ctl_ha_datamove(union ctl_io *io) sizeof(struct ctl_sg_entry) * msg.dt.cur_sg_entries, M_WAITOK) > CTL_HA_STATUS_SUCCESS) { io->io_hdr.port_status = 31341; - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } msg.dt.sent_sg_entries = sg_entries_sent; @@ -753,7 +753,7 @@ ctl_ha_datamove(union ctl_io *io) if (lun) mtx_unlock(&lun->lun_lock); io->io_hdr.port_status = 31342; - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } io->io_hdr.flags &= ~CTL_FLAG_IO_ACTIVE; @@ -5028,7 +5028,7 @@ ctl_lun_capacity_changed(struct ctl_be_lun *be_lun) * make it down to say RAIDCore's configuration code. */ int -ctl_config_move_done(union ctl_io *io) +ctl_config_move_done(union ctl_io *io, bool samethr) { int retval; @@ -5036,18 +5036,6 @@ ctl_config_move_done(union ctl_io *io) KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); - if ((io->io_hdr.port_status != 0) && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, - /*retry_count*/ io->io_hdr.port_status); - } else if (io->scsiio.kern_data_resid != 0 && - (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_invalid_field_ciu(&io->scsiio); - } - if (ctl_debug & CTL_DEBUG_CDB_DATA) ctl_data_print(io); if (((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) || @@ -12301,7 +12289,7 @@ ctl_handle_isc(union ctl_io *io) ctl_datamove_remote(io); break; case CTL_MSG_DATAMOVE_DONE: /* Only used in XFER mode */ - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); break; case CTL_MSG_FAILOVER: ctl_failover_lun(io); @@ -12460,6 +12448,45 @@ ctl_datamove_timer_wakeup(void *arg) } #endif /* CTL_IO_DELAY */ +static void +ctl_datamove_done_process(union ctl_io *io) +{ +#ifdef CTL_TIME_IO + struct bintime cur_bt; +#endif + + KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); + +#ifdef CTL_TIME_IO + getbinuptime(&cur_bt); + bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt); + bintime_add(&io->io_hdr.dma_bt, &cur_bt); +#endif + io->io_hdr.num_dmas++; + + if ((io->io_hdr.port_status != 0) && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { + ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, + /*retry_count*/ io->io_hdr.port_status); + } else if (io->scsiio.kern_data_resid != 0 && + (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { + ctl_set_invalid_field_ciu(&io->scsiio); + } else if (ctl_debug & CTL_DEBUG_CDB_DATA) + ctl_data_print(io); +} + +void +ctl_datamove_done(union ctl_io *io, bool samethr) +{ + + ctl_datamove_done_process(io); + io->scsiio.be_move_done(io, samethr); +} + void ctl_datamove(union ctl_io *io) { @@ -12473,39 +12500,7 @@ ctl_datamove(union ctl_io *io) io->scsiio.kern_data_resid = io->scsiio.kern_data_len; #ifdef CTL_TIME_IO - if ((time_uptime - io->io_hdr.start_time) > ctl_time_io_secs) { - char str[256]; - char path_str[64]; - struct sbuf sb; - - ctl_scsi_path_string(io, path_str, sizeof(path_str)); - sbuf_new(&sb, str, sizeof(str), SBUF_FIXEDLEN); - - sbuf_cat(&sb, path_str); - switch (io->io_hdr.io_type) { - case CTL_IO_SCSI: - ctl_scsi_command_string(&io->scsiio, NULL, &sb); - sbuf_printf(&sb, "\n"); - sbuf_cat(&sb, path_str); - sbuf_printf(&sb, "Tag: 0x%04x/%d, Prio: %d\n", - io->scsiio.tag_num, io->scsiio.tag_type, - io->scsiio.priority); - break; - case CTL_IO_TASK: - sbuf_printf(&sb, "Task Action: %d Tag: 0x%04x/%d\n", - io->taskio.task_action, - io->taskio.tag_num, io->taskio.tag_type); - break; - default: - panic("%s: Invalid CTL I/O type %d\n", - __func__, io->io_hdr.io_type); - } - sbuf_cat(&sb, path_str); - sbuf_printf(&sb, "ctl_datamove: %jd seconds\n", - (intmax_t)time_uptime - io->io_hdr.start_time); - sbuf_finish(&sb); - printf("%s", sbuf_data(&sb)); - } + getbinuptime(&io->io_hdr.dma_start_bt); #endif /* CTL_TIME_IO */ #ifdef CTL_IO_DELAY @@ -12540,18 +12535,15 @@ ctl_datamove(union ctl_io *io) io->io_hdr.nexus.targ_port, io->io_hdr.nexus.targ_lun); io->io_hdr.port_status = 31337; - /* - * Note that the backend, in this case, will get the - * callback in its context. In other cases it may get - * called in the frontend's interrupt thread context. - */ - io->scsiio.be_move_done(io); + ctl_datamove_done_process(io); + io->scsiio.be_move_done(io, true); return; } /* Don't confuse frontend with zero length data move. */ if (io->scsiio.kern_data_len == 0) { - io->scsiio.be_move_done(io); + ctl_datamove_done_process(io); + io->scsiio.be_move_done(io, true); return; } @@ -12638,7 +12630,7 @@ ctl_datamove_remote_write_cb(struct ctl_ha_dt_req *rq) * need to push it over to the remote controller's memory. */ static int -ctl_datamove_remote_dm_write_cb(union ctl_io *io) +ctl_datamove_remote_dm_write_cb(union ctl_io *io, bool samethr) { int retval; @@ -12677,7 +12669,7 @@ ctl_datamove_remote_write(union ctl_io *io) } static int -ctl_datamove_remote_dm_read_cb(union ctl_io *io) +ctl_datamove_remote_dm_read_cb(union ctl_io *io, bool samethr) { uint32_t i; diff --git a/sys/cam/ctl/ctl.h b/sys/cam/ctl/ctl.h index 56dd5313b4cb..be3e4a37b157 100644 --- a/sys/cam/ctl/ctl.h +++ b/sys/cam/ctl/ctl.h @@ -170,7 +170,8 @@ int ctl_sap_log_sense_handler(struct ctl_scsiio *ctsio, int ctl_ie_log_sense_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, int pc); -int ctl_config_move_done(union ctl_io *io); +int ctl_config_move_done(union ctl_io *io, bool samethr); +void ctl_datamove_done(union ctl_io *io, bool samethr); void ctl_datamove(union ctl_io *io); void ctl_serseq_done(union ctl_io *io); void ctl_done(union ctl_io *io); diff --git a/sys/cam/ctl/ctl_backend.h b/sys/cam/ctl/ctl_backend.h index be8ab4d1706b..05e65abe41f8 100644 --- a/sys/cam/ctl/ctl_backend.h +++ b/sys/cam/ctl/ctl_backend.h @@ -186,7 +186,6 @@ struct ctl_backend_driver { be_init_t init; /* passed to CTL */ be_shutdown_t shutdown; /* passed to CTL */ be_func_t data_submit; /* passed to CTL */ - be_func_t data_move_done; /* passed to CTL */ be_func_t config_read; /* passed to CTL */ be_func_t config_write; /* passed to CTL */ be_ioctl_t ioctl; /* passed to CTL */ diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 0fbe0949f893..17a336ebe872 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -235,7 +235,7 @@ SYSCTL_INT(_kern_cam_ctl_block, OID_AUTO, num_threads, CTLFLAG_RWTUN, static struct ctl_be_block_io *ctl_alloc_beio(struct ctl_be_block_softc *softc); static void ctl_free_beio(struct ctl_be_block_io *beio); static void ctl_complete_beio(struct ctl_be_block_io *beio); -static int ctl_be_block_move_done(union ctl_io *io); +static int ctl_be_block_move_done(union ctl_io *io, bool samethr); static void ctl_be_block_biodone(struct bio *bio); static void ctl_be_block_flush_file(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio); @@ -291,7 +291,6 @@ static struct ctl_backend_driver ctl_be_block_driver = .init = ctl_be_block_init, .shutdown = ctl_be_block_shutdown, .data_submit = ctl_be_block_submit, - .data_move_done = ctl_be_block_move_done, .config_read = ctl_be_block_config_read, .config_write = ctl_be_block_config_write, .ioctl = ctl_be_block_ioctl, @@ -432,46 +431,23 @@ ctl_be_block_compare(union ctl_io *io) } static int -ctl_be_block_move_done(union ctl_io *io) +ctl_be_block_move_done(union ctl_io *io, bool samethr) { struct ctl_be_block_io *beio; struct ctl_be_block_lun *be_lun; struct ctl_lba_len_flags *lbalen; -#ifdef CTL_TIME_IO - struct bintime cur_bt; -#endif beio = (struct ctl_be_block_io *)PRIV(io)->ptr; be_lun = beio->lun; DPRINTF("entered\n"); - -#ifdef CTL_TIME_IO - getbinuptime(&cur_bt); - bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt); - bintime_add(&io->io_hdr.dma_bt, &cur_bt); -#endif - io->io_hdr.num_dmas++; io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; /* - * We set status at this point for read commands, and write - * commands with errors. + * We set status at this point for read and compare commands. */ - if (io->io_hdr.flags & CTL_FLAG_ABORT) { - ; - } else if ((io->io_hdr.port_status != 0) && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, - /*retry_count*/ io->io_hdr.port_status); - } else if (io->scsiio.kern_data_resid != 0 && - (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_invalid_field_ciu(&io->scsiio); - } else if ((io->io_hdr.port_status == 0) && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { + if ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0 && + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE) { lbalen = ARGS(beio->io); if (lbalen->flags & CTL_LLF_READ) { ctl_set_success(&io->scsiio); @@ -492,18 +468,22 @@ ctl_be_block_move_done(union ctl_io *io) } /* - * At this point, we have a write and the DMA completed - * successfully. We now have to queue it to the task queue to + * At this point, we have a write and the DMA completed successfully. + * If we were called synchronously in the original thread then just + * dispatch, otherwise we now have to queue it to the task queue to * execute the backend I/O. That is because we do blocking * memory allocations, and in the file backing case, blocking I/O. * This move done routine is generally called in the SIM's * interrupt context, and therefore we cannot block. */ - mtx_lock(&be_lun->queue_lock); - STAILQ_INSERT_TAIL(&be_lun->datamove_queue, &io->io_hdr, links); - mtx_unlock(&be_lun->queue_lock); - taskqueue_enqueue(be_lun->io_taskqueue, &be_lun->io_task); - + if (samethr) { + be_lun->dispatch(be_lun, beio); + } else { + mtx_lock(&be_lun->queue_lock); + STAILQ_INSERT_TAIL(&be_lun->datamove_queue, &io->io_hdr, links); + mtx_unlock(&be_lun->queue_lock); + taskqueue_enqueue(be_lun->io_taskqueue, &be_lun->io_task); + } return (0); } @@ -598,9 +578,6 @@ ctl_be_block_biodone(struct bio *bio) ctl_set_success(&io->scsiio); ctl_serseq_done(io); } -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } } @@ -811,9 +788,6 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, ctl_set_success(&io->scsiio); ctl_serseq_done(io); } -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } } @@ -980,9 +954,6 @@ ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun, ctl_set_success(&io->scsiio); ctl_serseq_done(io); } -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } } @@ -1672,9 +1643,6 @@ ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun, be_lun->dispatch(be_lun, beio); } else { SDT_PROBE0(cbb, , write, alloc_done); -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } } diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c index 2595aa0be00e..e67d699bda70 100644 --- a/sys/cam/ctl/ctl_backend_ramdisk.c +++ b/sys/cam/ctl/ctl_backend_ramdisk.c @@ -139,7 +139,7 @@ extern struct ctl_softc *control_softc; static int ctl_backend_ramdisk_init(void); static int ctl_backend_ramdisk_shutdown(void); -static int ctl_backend_ramdisk_move_done(union ctl_io *io); +static int ctl_backend_ramdisk_move_done(union ctl_io *io, bool samethr); static void ctl_backend_ramdisk_compare(union ctl_io *io); static void ctl_backend_ramdisk_rw(union ctl_io *io); static int ctl_backend_ramdisk_submit(union ctl_io *io); @@ -164,7 +164,6 @@ static struct ctl_backend_driver ctl_be_ramdisk_driver = .init = ctl_backend_ramdisk_init, .shutdown = ctl_backend_ramdisk_shutdown, .data_submit = ctl_backend_ramdisk_submit, - .data_move_done = ctl_backend_ramdisk_move_done, .config_read = ctl_backend_ramdisk_config_read, .config_write = ctl_backend_ramdisk_config_write, .ioctl = ctl_backend_ramdisk_ioctl, @@ -402,38 +401,17 @@ ctl_backend_ramdisk_cmp(union ctl_io *io) } static int -ctl_backend_ramdisk_move_done(union ctl_io *io) +ctl_backend_ramdisk_move_done(union ctl_io *io, bool samethr) { struct ctl_be_ramdisk_lun *be_lun = (struct ctl_be_ramdisk_lun *)CTL_BACKEND_LUN(io); -#ifdef CTL_TIME_IO - struct bintime cur_bt; -#endif CTL_DEBUG_PRINT(("ctl_backend_ramdisk_move_done\n")); -#ifdef CTL_TIME_IO - getbinuptime(&cur_bt); - bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt); - bintime_add(&io->io_hdr.dma_bt, &cur_bt); -#endif - io->io_hdr.num_dmas++; if (io->scsiio.kern_sg_entries > 0) free(io->scsiio.kern_data_ptr, M_RAMDISK); io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; - if (io->io_hdr.flags & CTL_FLAG_ABORT) { - ; - } else if (io->io_hdr.port_status != 0 && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, - /*retry_count*/ io->io_hdr.port_status); - } else if (io->scsiio.kern_data_resid != 0 && - (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_invalid_field_ciu(&io->scsiio); - } else if ((io->io_hdr.port_status == 0) && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { + if ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0 && + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE) { if (ARGS(io)->flags & CTL_LLF_COMPARE) { /* We have data block ready for comparison. */ if (ctl_backend_ramdisk_cmp(io)) @@ -471,9 +449,6 @@ ctl_backend_ramdisk_compare(union ctl_io *io) io->scsiio.kern_sg_entries = 0; io->io_hdr.flags |= CTL_FLAG_ALLOCATED; PRIV(io)->len += lbas; -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } @@ -534,9 +509,6 @@ nospc: ctl_set_success(&io->scsiio); ctl_serseq_done(io); } -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } diff --git a/sys/cam/ctl/ctl_frontend_cam_sim.c b/sys/cam/ctl/ctl_frontend_cam_sim.c index fdcccee2f569..0e61a80e452c 100644 --- a/sys/cam/ctl/ctl_frontend_cam_sim.c +++ b/sys/cam/ctl/ctl_frontend_cam_sim.c @@ -415,7 +415,7 @@ cfcs_datamove(union ctl_io *io) xpt_done(ccb); } - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); } static void diff --git a/sys/cam/ctl/ctl_frontend_ioctl.c b/sys/cam/ctl/ctl_frontend_ioctl.c index ef5e2bd22a86..f326100cb013 100644 --- a/sys/cam/ctl/ctl_frontend_ioctl.c +++ b/sys/cam/ctl/ctl_frontend_ioctl.c @@ -566,7 +566,7 @@ cfi_submit_wait(union ctl_io *io) * will immediately call back and wake us up, * probably using our own context. */ - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); break; case CTL_IOCTL_DONE: mtx_unlock(¶ms.ioctl_mtx); diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index 73483fb155cc..fdbc06150f93 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -933,7 +933,7 @@ cfiscsi_pdu_handle_data_out(struct icl_pdu *request) cfiscsi_data_wait_free(cs, cdw); io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; if (done) - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); else cfiscsi_datamove_out(io); } @@ -1146,7 +1146,7 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) */ cdw->cdw_ctl_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; cdw->cdw_ctl_io->scsiio.io_hdr.port_status = 42; - cdw->cdw_ctl_io->scsiio.be_move_done(cdw->cdw_ctl_io); + ctl_datamove_done(cdw->cdw_ctl_io, false); cfiscsi_data_wait_free(cs, cdw); CFISCSI_SESSION_LOCK(cs); } @@ -2487,7 +2487,7 @@ cfiscsi_datamove_in(union ctl_io *io) CFISCSI_SESSION_DEBUG(cs, "buffer_offset = %zd, " "already sent the expected len", buffer_offset); #endif - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } @@ -2508,7 +2508,7 @@ cfiscsi_datamove_in(union ctl_io *io) CFISCSI_SESSION_WARN(cs, "failed to " "allocate memory; dropping connection"); ctl_set_busy(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); cfiscsi_session_terminate(cs); return; } @@ -2566,7 +2566,7 @@ cfiscsi_datamove_in(union ctl_io *io) "allocate memory; dropping connection"); icl_pdu_free(response); ctl_set_busy(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); cfiscsi_session_terminate(cs); return; } @@ -2656,7 +2656,7 @@ cfiscsi_datamove_in(union ctl_io *io) cfiscsi_pdu_queue_cb(response, cb); } - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); } static void @@ -2685,9 +2685,10 @@ cfiscsi_datamove_out(union ctl_io *io) */ expected_len = ntohl(bhssc->bhssc_expected_data_transfer_length); if (io->scsiio.kern_rel_offset >= expected_len) { - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } + datamove_len = MIN(io->scsiio.kern_data_len, expected_len - io->scsiio.kern_rel_offset); @@ -2703,7 +2704,7 @@ cfiscsi_datamove_out(union ctl_io *io) CFISCSI_SESSION_WARN(cs, "failed to " "allocate memory; dropping connection"); ctl_set_busy(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); cfiscsi_session_terminate(cs); return; } @@ -2750,7 +2751,7 @@ cfiscsi_datamove_out(union ctl_io *io) done = cfiscsi_handle_data_segment(request, cdw); if (done) { cfiscsi_data_wait_free(cs, cdw); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } } @@ -2773,7 +2774,7 @@ cfiscsi_datamove_out(union ctl_io *io) CFISCSI_SESSION_WARN(cs, "failed to " "allocate memory; dropping connection"); ctl_set_busy(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); cfiscsi_session_terminate(cs); return; } @@ -2954,7 +2955,7 @@ cfiscsi_task_management_done(union ctl_io *io) cdw, cdw_next); io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; cdw->cdw_ctl_io->scsiio.io_hdr.port_status = 43; - cdw->cdw_ctl_io->scsiio.be_move_done(cdw->cdw_ctl_io); + ctl_datamove_done(cdw->cdw_ctl_io, false); cfiscsi_data_wait_free(cs, cdw); } CFISCSI_SESSION_UNLOCK(cs); diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h index 52ba98f3a9bd..60f8aef82d02 100644 --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -329,7 +329,7 @@ struct ctl_scsiio { ctl_tag_type tag_type; /* simple, ordered, head of queue,etc.*/ uint8_t cdb_len; /* CDB length */ uint8_t cdb[CTL_MAX_CDBLEN]; /* CDB */ - int (*be_move_done)(union ctl_io *io); /* called by fe */ + int (*be_move_done)(union ctl_io *io, bool samethr); /* called by fe */ int (*io_cont)(union ctl_io *io); /* to continue processing */ ctl_ref kern_data_ref; /* Method to reference/release data */ void *kern_data_arg; /* Opaque argument for kern_data_ref() */ diff --git a/sys/cam/ctl/ctl_tpc_local.c b/sys/cam/ctl/ctl_tpc_local.c index c2d628033037..ba6deada86a3 100644 --- a/sys/cam/ctl/ctl_tpc_local.c +++ b/sys/cam/ctl/ctl_tpc_local.c @@ -254,7 +254,7 @@ tpcl_datamove(union ctl_io *io) __func__, ctsio->ext_data_len, ctsio->kern_data_len)); bailout: - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); } static void diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index 646b3fe07053..d3023f9a6c8c 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -1394,8 +1394,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) xpt_release_ccb(done_ccb); mtx_unlock(mtx); - /* Call the backend move done callback */ - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); } return; } diff --git a/sys/dev/usb/storage/cfumass.c b/sys/dev/usb/storage/cfumass.c index 59d744bd62d0..88b5a6156704 100644 --- a/sys/dev/usb/storage/cfumass.c +++ b/sys/dev/usb/storage/cfumass.c @@ -475,7 +475,7 @@ cfumass_terminate(struct cfumass_softc *sc) if (sc->sc_ctl_io != NULL) { CFUMASS_DEBUG(sc, "terminating CTL transfer"); ctl_set_data_phase_error(&sc->sc_ctl_io->scsiio); - sc->sc_ctl_io->scsiio.be_move_done(sc->sc_ctl_io); + ctl_datamove_done(sc->sc_ctl_io, false); sc->sc_ctl_io = NULL; } @@ -730,7 +730,7 @@ cfumass_t_data_callback(struct usb_xfer *xfer, usb_error_t usb_error) sc->sc_current_residue == 0 || io->scsiio.kern_data_resid == 0) { sc->sc_ctl_io = NULL; - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); break; } /* FALLTHROUGH */ @@ -887,7 +887,7 @@ cfumass_datamove(union ctl_io *io) fail: ctl_set_data_phase_error(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); sc->sc_ctl_io = NULL; } From owner-dev-commits-src-all@freebsd.org Mon Mar 15 02:39:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 75DFF56ACCA; Mon, 15 Mar 2021 02:39: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 4DzLH75l5Cz3MHG; Mon, 15 Mar 2021 02:39: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 30DD395C; Mon, 15 Mar 2021 02:39: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 12F2dlW7061608; Mon, 15 Mar 2021 02:39:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F2dllX061607; Mon, 15 Mar 2021 02:39:47 GMT (envelope-from git) Date: Mon, 15 Mar 2021 02:39:47 GMT Message-Id: <202103150239.12F2dllX061607@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 26953f59a1a3 - stable/13 - Fix build after 2c7dc6bae9fd. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 26953f59a1a3cde4df525f88b5be13ea0e80e102 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 02:39:49 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=26953f59a1a3cde4df525f88b5be13ea0e80e102 commit 26953f59a1a3cde4df525f88b5be13ea0e80e102 Author: Alexander Motin AuthorDate: 2021-02-21 22:21:14 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:34:19 +0000 Fix build after 2c7dc6bae9fd. MFC after: 1 month (cherry picked from commit c02a28754bc229c05e8baf9b6632cbd59bc73e48) --- sys/cam/ctl/ctl_io.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h index 60f8aef82d02..349cb02820d9 100644 --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -42,6 +42,10 @@ #ifndef _CTL_IO_H_ #define _CTL_IO_H_ +#ifndef _KERNEL +#include +#endif + #define CTL_MAX_CDBLEN 32 /* * Uncomment this next line to enable printing out times for I/Os From owner-dev-commits-src-all@freebsd.org Mon Mar 15 02:39:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B49C556B20E; Mon, 15 Mar 2021 02:39: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 4DzLH90w7Lz3MHL; Mon, 15 Mar 2021 02:39: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 5E61776E; Mon, 15 Mar 2021 02:39:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12F2dmPe061630; Mon, 15 Mar 2021 02:39:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F2dmDB061629; Mon, 15 Mar 2021 02:39:48 GMT (envelope-from git) Date: Mon, 15 Mar 2021 02:39:48 GMT Message-Id: <202103150239.12F2dmDB061629@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 31d41a6a9b65 - stable/13 - Coalesce socket reads in software iSCSI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 31d41a6a9b65e1ff1f71250fd900ab2d451902f0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 02:39:50 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=31d41a6a9b65e1ff1f71250fd900ab2d451902f0 commit 31d41a6a9b65e1ff1f71250fd900ab2d451902f0 Author: Alexander Motin AuthorDate: 2021-02-22 17:23:35 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:34:28 +0000 Coalesce socket reads in software iSCSI. Instead of 2-4 socket reads per PDU this can do as low as one read per megabyte, dramatically reducing TCP overhead and lock contention. With this on iSCSI target I can write more than 4GB/s through a single connection. MFC after: 1 month (cherry picked from commit 6895f89fe54e0858aea70d2bd2a9651f45d7998e) --- sys/dev/iscsi/icl_soft.c | 258 ++++++++++++++++------------------------------- 1 file changed, 89 insertions(+), 169 deletions(-) diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index a8986b3d4253..a5696647169a 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -165,68 +165,6 @@ icl_conn_fail(struct icl_conn *ic) (ic->ic_error)(ic); } -static struct mbuf * -icl_conn_receive(struct icl_conn *ic, size_t len) -{ - struct uio uio; - struct socket *so; - struct mbuf *m; - int error, flags; - - so = ic->ic_socket; - - memset(&uio, 0, sizeof(uio)); - uio.uio_resid = len; - - flags = MSG_DONTWAIT; - error = soreceive(so, NULL, &uio, &m, NULL, &flags); - if (error != 0) { - ICL_DEBUG("soreceive error %d", error); - return (NULL); - } - if (uio.uio_resid != 0) { - m_freem(m); - ICL_DEBUG("short read"); - return (NULL); - } - - return (m); -} - -static int -icl_conn_receive_buf(struct icl_conn *ic, void *buf, size_t len) -{ - struct iovec iov[1]; - struct uio uio; - struct socket *so; - int error, flags; - - so = ic->ic_socket; - - memset(&uio, 0, sizeof(uio)); - iov[0].iov_base = buf; - iov[0].iov_len = len; - uio.uio_iov = iov; - uio.uio_iovcnt = 1; - uio.uio_offset = 0; - uio.uio_resid = len; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_rw = UIO_READ; - - flags = MSG_DONTWAIT; - error = soreceive(so, NULL, &uio, NULL, NULL, &flags); - if (error != 0) { - ICL_DEBUG("soreceive error %d", error); - return (-1); - } - if (uio.uio_resid != 0) { - ICL_DEBUG("short read"); - return (-1); - } - - return (0); -} - static void icl_soft_conn_pdu_free(struct icl_conn *ic, struct icl_pdu *ip) { @@ -384,37 +322,28 @@ icl_pdu_size(const struct icl_pdu *response) return (len); } -static int -icl_pdu_receive_bhs(struct icl_pdu *request, size_t *availablep) +static void +icl_soft_receive_buf(struct mbuf **r, size_t *rs, void *buf, size_t s) { - if (icl_conn_receive_buf(request->ip_conn, - request->ip_bhs, sizeof(struct iscsi_bhs))) { - ICL_DEBUG("failed to receive BHS"); - return (-1); - } - - *availablep -= sizeof(struct iscsi_bhs); - return (0); + m_copydata(*r, 0, s, buf); + m_adj(*r, s); + while ((*r) != NULL && (*r)->m_len == 0) + *r = m_free(*r); + *rs -= s; } -static int -icl_pdu_receive_ahs(struct icl_pdu *request, size_t *availablep) +static void +icl_pdu_receive_ahs(struct icl_pdu *request, struct mbuf **r, size_t *rs) { request->ip_ahs_len = icl_pdu_ahs_length(request); if (request->ip_ahs_len == 0) - return (0); - - request->ip_ahs_mbuf = icl_conn_receive(request->ip_conn, - request->ip_ahs_len); - if (request->ip_ahs_mbuf == NULL) { - ICL_DEBUG("failed to receive AHS"); - return (-1); - } + return; - *availablep -= request->ip_ahs_len; - return (0); + request->ip_ahs_mbuf = *r; + *r = m_split(request->ip_ahs_mbuf, request->ip_ahs_len, M_WAITOK); + *rs -= request->ip_ahs_len; } static uint32_t @@ -433,7 +362,7 @@ icl_mbuf_to_crc32c(const struct mbuf *m0) } static int -icl_pdu_check_header_digest(struct icl_pdu *request, size_t *availablep) +icl_pdu_check_header_digest(struct icl_pdu *request, struct mbuf **r, size_t *rs) { uint32_t received_digest, valid_digest; @@ -441,12 +370,7 @@ icl_pdu_check_header_digest(struct icl_pdu *request, size_t *availablep) return (0); CTASSERT(sizeof(received_digest) == ISCSI_HEADER_DIGEST_SIZE); - if (icl_conn_receive_buf(request->ip_conn, - &received_digest, ISCSI_HEADER_DIGEST_SIZE)) { - ICL_DEBUG("failed to receive header digest"); - return (-1); - } - *availablep -= ISCSI_HEADER_DIGEST_SIZE; + icl_soft_receive_buf(r, rs, &received_digest, ISCSI_HEADER_DIGEST_SIZE); /* Temporary attach AHS to BHS to calculate header digest. */ request->ip_bhs_mbuf->m_next = request->ip_ahs_mbuf; @@ -514,8 +438,8 @@ icl_pdu_data_segment_receive_len(const struct icl_pdu *request) } static int -icl_pdu_receive_data_segment(struct icl_pdu *request, - size_t *availablep, bool *more_neededp) +icl_pdu_receive_data_segment(struct icl_pdu *request, struct mbuf **r, + size_t *rs, bool *more_neededp) { struct icl_conn *ic; size_t len, padding = 0; @@ -539,7 +463,7 @@ icl_pdu_receive_data_segment(struct icl_pdu *request, KASSERT(len > request->ip_data_len, ("len <= request->ip_data_len")); len -= request->ip_data_len; - if (len + padding > *availablep) { + if (len + padding > *rs) { /* * Not enough data in the socket buffer. Receive as much * as we can. Don't receive padding, since, obviously, it's @@ -547,9 +471,9 @@ icl_pdu_receive_data_segment(struct icl_pdu *request, */ #if 0 ICL_DEBUG("limited from %zd to %zd", - len + padding, *availablep - padding)); + len + padding, *rs - padding)); #endif - len = *availablep - padding; + len = *rs - padding; *more_neededp = true; padding = 0; } @@ -559,11 +483,9 @@ icl_pdu_receive_data_segment(struct icl_pdu *request, * of actual data segment. */ if (len > 0) { - m = icl_conn_receive(request->ip_conn, len + padding); - if (m == NULL) { - ICL_DEBUG("failed to receive data segment"); - return (-1); - } + m = *r; + *r = m_split(m, len + padding, M_WAITOK); + *rs -= len + padding; if (request->ip_data_mbuf == NULL) request->ip_data_mbuf = m; @@ -571,7 +493,6 @@ icl_pdu_receive_data_segment(struct icl_pdu *request, m_cat(request->ip_data_mbuf, m); request->ip_data_len += len; - *availablep -= len + padding; } else ICL_DEBUG("len 0"); @@ -583,7 +504,7 @@ icl_pdu_receive_data_segment(struct icl_pdu *request, } static int -icl_pdu_check_data_digest(struct icl_pdu *request, size_t *availablep) +icl_pdu_check_data_digest(struct icl_pdu *request, struct mbuf **r, size_t *rs) { uint32_t received_digest, valid_digest; @@ -594,12 +515,7 @@ icl_pdu_check_data_digest(struct icl_pdu *request, size_t *availablep) return (0); CTASSERT(sizeof(received_digest) == ISCSI_DATA_DIGEST_SIZE); - if (icl_conn_receive_buf(request->ip_conn, - &received_digest, ISCSI_DATA_DIGEST_SIZE)) { - ICL_DEBUG("failed to receive data digest"); - return (-1); - } - *availablep -= ISCSI_DATA_DIGEST_SIZE; + icl_soft_receive_buf(r, rs, &received_digest, ISCSI_DATA_DIGEST_SIZE); /* * Note that ip_data_mbuf also contains padding; since digest @@ -621,16 +537,13 @@ icl_pdu_check_data_digest(struct icl_pdu *request, size_t *availablep) * "part" of PDU at a time; call it repeatedly until it returns non-NULL. */ static struct icl_pdu * -icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep) +icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) { struct icl_pdu *request; - struct socket *so; size_t len; - int error; + int error = 0; bool more_needed; - so = ic->ic_socket; - if (ic->ic_receive_state == ICL_CONN_STATE_BHS) { KASSERT(ic->ic_receive_pdu == NULL, ("ic->ic_receive_pdu != NULL")); @@ -648,23 +561,11 @@ icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep) request = ic->ic_receive_pdu; } - if (*availablep < ic->ic_receive_len) { -#if 0 - ICL_DEBUG("not enough data; need %zd, " - "have %zd", ic->ic_receive_len, *availablep); -#endif - return (NULL); - } - switch (ic->ic_receive_state) { case ICL_CONN_STATE_BHS: //ICL_DEBUG("receiving BHS"); - error = icl_pdu_receive_bhs(request, availablep); - if (error != 0) { - ICL_DEBUG("failed to receive BHS; " - "dropping connection"); - break; - } + icl_soft_receive_buf(r, rs, request->ip_bhs, + sizeof(struct iscsi_bhs)); /* * We don't enforce any limit for AHS length; @@ -686,12 +587,7 @@ icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep) case ICL_CONN_STATE_AHS: //ICL_DEBUG("receiving AHS"); - error = icl_pdu_receive_ahs(request, availablep); - if (error != 0) { - ICL_DEBUG("failed to receive AHS; " - "dropping connection"); - break; - } + icl_pdu_receive_ahs(request, r, rs); ic->ic_receive_state = ICL_CONN_STATE_HEADER_DIGEST; if (ic->ic_header_crc32c == false) ic->ic_receive_len = 0; @@ -701,7 +597,7 @@ icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep) case ICL_CONN_STATE_HEADER_DIGEST: //ICL_DEBUG("receiving header digest"); - error = icl_pdu_check_header_digest(request, availablep); + error = icl_pdu_check_header_digest(request, r, rs); if (error != 0) { ICL_DEBUG("header digest failed; " "dropping connection"); @@ -715,7 +611,7 @@ icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep) case ICL_CONN_STATE_DATA: //ICL_DEBUG("receiving data segment"); - error = icl_pdu_receive_data_segment(request, availablep, + error = icl_pdu_receive_data_segment(request, r, rs, &more_needed); if (error != 0) { ICL_DEBUG("failed to receive data segment;" @@ -735,7 +631,7 @@ icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep) case ICL_CONN_STATE_DATA_DIGEST: //ICL_DEBUG("receiving data digest"); - error = icl_pdu_check_data_digest(request, availablep); + error = icl_pdu_check_data_digest(request, r, rs); if (error != 0) { ICL_DEBUG("data digest failed; " "dropping connection"); @@ -767,44 +663,27 @@ icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep) } static void -icl_conn_receive_pdus(struct icl_conn *ic, size_t available) +icl_conn_receive_pdus(struct icl_conn *ic, struct mbuf **r, size_t *rs) { struct icl_pdu *response; - struct socket *so; - - so = ic->ic_socket; - - /* - * This can never happen; we're careful to only mess with ic->ic_socket - * pointer when the send/receive threads are not running. - */ - KASSERT(so != NULL, ("NULL socket")); for (;;) { if (ic->ic_disconnecting) return; - if (so->so_error != 0) { - ICL_DEBUG("connection error %d; " - "dropping connection", so->so_error); - icl_conn_fail(ic); - return; - } - /* * Loop until we have a complete PDU or there is not enough * data in the socket buffer. */ - if (available < ic->ic_receive_len) { + if (*rs < ic->ic_receive_len) { #if 0 - ICL_DEBUG("not enough data; have %zd, " - "need %zd", available, - ic->ic_receive_len); + ICL_DEBUG("not enough data; have %zd, need %zd", + *rs, ic->ic_receive_len); #endif return; } - response = icl_conn_receive_pdu(ic, &available); + response = icl_conn_receive_pdu(ic, r, rs); if (response == NULL) continue; @@ -825,15 +704,19 @@ static void icl_receive_thread(void *arg) { struct icl_conn *ic; - size_t available; + size_t available, read = 0; struct socket *so; + struct mbuf *m, *r = NULL; + struct uio uio; + int error, flags; ic = arg; so = ic->ic_socket; for (;;) { + SOCKBUF_LOCK(&so->so_rcv); if (ic->ic_disconnecting) { - //ICL_DEBUG("terminating"); + SOCKBUF_UNLOCK(&so->so_rcv); break; } @@ -843,18 +726,50 @@ icl_receive_thread(void *arg) * to avoid unnecessary wakeups until there * is enough data received to read the PDU. */ - SOCKBUF_LOCK(&so->so_rcv); available = sbavail(&so->so_rcv); - if (available < ic->ic_receive_len) { - so->so_rcv.sb_lowat = ic->ic_receive_len; + if (read + available < ic->ic_receive_len) { + so->so_rcv.sb_lowat = ic->ic_receive_len - read; cv_wait(&ic->ic_receive_cv, &so->so_rcv.sb_mtx); - } else so->so_rcv.sb_lowat = so->so_rcv.sb_hiwat + 1; + available = sbavail(&so->so_rcv); + } SOCKBUF_UNLOCK(&so->so_rcv); - icl_conn_receive_pdus(ic, available); + if (available == 0) { + if (so->so_error != 0) { + ICL_DEBUG("connection error %d; " + "dropping connection", so->so_error); + icl_conn_fail(ic); + break; + } + continue; + } + + memset(&uio, 0, sizeof(uio)); + uio.uio_resid = available; + flags = MSG_DONTWAIT; + error = soreceive(so, NULL, &uio, &m, NULL, &flags); + if (error != 0) { + ICL_DEBUG("soreceive error %d", error); + break; + } + if (uio.uio_resid != 0) { + m_freem(m); + ICL_DEBUG("short read"); + break; + } + if (r) + m_cat(r, m); + else + r = m; + read += available; + + icl_conn_receive_pdus(ic, &r, &read); } + if (r) + m_freem(r); + ICL_CONN_LOCK(ic); ic->ic_receive_running = false; cv_signal(&ic->ic_send_cv); @@ -1440,12 +1355,17 @@ icl_soft_conn_close(struct icl_conn *ic) struct icl_pdu *pdu; struct socket *so; - ICL_CONN_LOCK(ic); - /* * Wake up the threads, so they can properly terminate. + * Receive thread sleeps on so->so_rcv lock, send on ic->ic_lock. */ - ic->ic_disconnecting = true; + ICL_CONN_LOCK(ic); + if (!ic->ic_disconnecting) { + so = ic->ic_socket; + SOCKBUF_LOCK(&so->so_rcv); + ic->ic_disconnecting = true; + SOCKBUF_UNLOCK(&so->so_rcv); + } while (ic->ic_receive_running || ic->ic_send_running) { cv_signal(&ic->ic_receive_cv); cv_signal(&ic->ic_send_cv); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 02:39:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FD8E56B0CB; Mon, 15 Mar 2021 02:39: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 4DzLHC1j3rz3MKs; Mon, 15 Mar 2021 02:39: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 6FD53A13; Mon, 15 Mar 2021 02:39: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 12F2dnlA061652; Mon, 15 Mar 2021 02: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 12F2dnPm061651; Mon, 15 Mar 2021 02:39:49 GMT (envelope-from git) Date: Mon, 15 Mar 2021 02:39:49 GMT Message-Id: <202103150239.12F2dnPm061651@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 8db80adb47e3 - stable/13 - Micro-optimize OOA queue processing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8db80adb47e327a388de742a3b2427efa2ac2674 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 02:39:52 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=8db80adb47e327a388de742a3b2427efa2ac2674 commit 8db80adb47e327a388de742a3b2427efa2ac2674 Author: Alexander Motin AuthorDate: 2021-02-27 15:14:05 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:35:04 +0000 Micro-optimize OOA queue processing. - Move ctl_get_cmd_entry() calls from every OOA traversal to when the requests first inserted, storing seridx in struct ctl_scsiio. - Move some checks out of the loop in ctl_check_ooa(). - Replace checks for errors that can not happen with asserts. - Transpose ctl_serialize_table, so that any OOA traversal accessed only one row (cache line). Compact it from enum to uint8_t. - Optimize static branch predictions in hottest places. Due to O(n) nature on deep LUN queues this can be the hottest code path in CTL, and additional 20% of IOPS I see in some 4KB I/O tests are good to have in reserve. About 50% of CPU time here according to the profiles is now spent in two memory accesses per traversed request in OOA. Sponsored by: iXsystems, Inc. MFC after: 2 weeks (cherry picked from commit 9d9fd8b79f0ebe59f791c8225fa01ab59858b7b5) --- sys/cam/ctl/ctl.c | 238 ++++++++++++++++++++------------------------ sys/cam/ctl/ctl_io.h | 2 +- sys/cam/ctl/ctl_private.h | 18 ++-- sys/cam/ctl/ctl_ser_table.c | 41 ++++---- 4 files changed, 135 insertions(+), 164 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 18a82ca72d76..cae6dd4aa101 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -500,9 +500,10 @@ static int ctl_inquiry_std(struct ctl_scsiio *ctsio); static int ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint64_t *len); static ctl_action ctl_extent_check(union ctl_io *io1, union ctl_io *io2, bool seq); -static ctl_action ctl_extent_check_seq(union ctl_io *io1, union ctl_io *io2); +static ctl_action ctl_seq_check(union ctl_io *io1, union ctl_io *io2); static ctl_action ctl_check_for_blockage(struct ctl_lun *lun, - union ctl_io *pending_io, union ctl_io *ooa_io); + union ctl_io *pending_io, const uint8_t *serialize_row, + union ctl_io *ooa_io); static ctl_action ctl_check_ooa(struct ctl_lun *lun, union ctl_io *pending_io, union ctl_io **starting_io); static void ctl_try_unblock_io(struct ctl_lun *lun, union ctl_io *io, @@ -2313,6 +2314,7 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) } entry = ctl_get_cmd_entry(ctsio, NULL); + ctsio->seridx = entry->seridx; if (ctl_scsiio_lun_check(lun, entry, ctsio) != 0) { mtx_unlock(&lun->lun_lock); goto badjuju; @@ -2333,12 +2335,6 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) bio = (union ctl_io *)LIST_NEXT(&ctsio->io_hdr, ooa_links); switch (ctl_check_ooa(lun, (union ctl_io *)ctsio, &bio)) { - case CTL_ACTION_BLOCK: - ctsio->io_hdr.blocker = bio; - TAILQ_INSERT_TAIL(&bio->io_hdr.blocked_queue, &ctsio->io_hdr, - blocked_links); - mtx_unlock(&lun->lun_lock); - break; case CTL_ACTION_PASS: case CTL_ACTION_SKIP: if (softc->ha_mode == CTL_HA_MODE_XFER) { @@ -2357,6 +2353,12 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) sizeof(msg_info.hdr), M_WAITOK); } break; + case CTL_ACTION_BLOCK: + ctsio->io_hdr.blocker = bio; + TAILQ_INSERT_TAIL(&bio->io_hdr.blocked_queue, &ctsio->io_hdr, + blocked_links); + mtx_unlock(&lun->lun_lock); + break; case CTL_ACTION_OVERLAP: LIST_REMOVE(&ctsio->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); @@ -2366,14 +2368,6 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) LIST_REMOVE(&ctsio->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); ctl_set_overlapped_tag(ctsio, ctsio->tag_num); - goto badjuju; - case CTL_ACTION_ERROR: - default: - LIST_REMOVE(&ctsio->io_hdr, ooa_links); - mtx_unlock(&lun->lun_lock); - - ctl_set_internal_failure(ctsio, /*sks_valid*/ 0, - /*retry_count*/ 0); badjuju: ctl_copy_sense_data_back((union ctl_io *)ctsio, &msg_info); msg_info.hdr.original_sc = ctsio->io_hdr.remote_io; @@ -2383,6 +2377,8 @@ badjuju: sizeof(msg_info.scsi), M_WAITOK); ctl_free_io((union ctl_io *)ctsio); break; + default: + __assert_unreachable(); } } @@ -10819,8 +10815,9 @@ ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint64_t *len) break; } default: + *lba = 0; + *len = UINT64_MAX; return (1); - break; /* NOTREACHED */ } return (0); @@ -10854,7 +10851,7 @@ ctl_extent_check_unmap(union ctl_io *io, uint64_t lba2, uint64_t len2) /* If not UNMAP -- go other way. */ if (io->scsiio.cdb[0] != UNMAP) - return (CTL_ACTION_ERROR); + return (CTL_ACTION_SKIP); /* If UNMAP without data -- block and wait for data. */ ptrlen = (struct ctl_ptr_len_flags *) @@ -10882,33 +10879,34 @@ ctl_extent_check(union ctl_io *io1, union ctl_io *io2, bool seq) uint64_t len1, len2; int retval; - if (ctl_get_lba_len(io2, &lba2, &len2) != 0) - return (CTL_ACTION_ERROR); + retval = ctl_get_lba_len(io2, &lba2, &len2); + KASSERT(retval == 0, ("ctl_get_lba_len() error")); retval = ctl_extent_check_unmap(io1, lba2, len2); - if (retval != CTL_ACTION_ERROR) + if (retval != CTL_ACTION_SKIP) return (retval); - if (ctl_get_lba_len(io1, &lba1, &len1) != 0) - return (CTL_ACTION_ERROR); + retval = ctl_get_lba_len(io1, &lba1, &len1); + KASSERT(retval == 0, ("ctl_get_lba_len() error")); - if (io1->io_hdr.flags & CTL_FLAG_SERSEQ_DONE) + if (seq && (io1->io_hdr.flags & CTL_FLAG_SERSEQ_DONE)) seq = FALSE; return (ctl_extent_check_lba(lba1, len1, lba2, len2, seq)); } static ctl_action -ctl_extent_check_seq(union ctl_io *io1, union ctl_io *io2) +ctl_seq_check(union ctl_io *io1, union ctl_io *io2) { uint64_t lba1, lba2; uint64_t len1, len2; + int retval; if (io1->io_hdr.flags & CTL_FLAG_SERSEQ_DONE) return (CTL_ACTION_PASS); - if (ctl_get_lba_len(io1, &lba1, &len1) != 0) - return (CTL_ACTION_ERROR); - if (ctl_get_lba_len(io2, &lba2, &len2) != 0) - return (CTL_ACTION_ERROR); + retval = ctl_get_lba_len(io1, &lba1, &len1); + KASSERT(retval == 0, ("ctl_get_lba_len() error")); + retval = ctl_get_lba_len(io2, &lba2, &len2); + KASSERT(retval == 0, ("ctl_get_lba_len() error")); if (lba1 + len1 == lba2) return (CTL_ACTION_BLOCK); @@ -10917,25 +10915,15 @@ ctl_extent_check_seq(union ctl_io *io1, union ctl_io *io2) static ctl_action ctl_check_for_blockage(struct ctl_lun *lun, union ctl_io *pending_io, - union ctl_io *ooa_io) + const uint8_t *serialize_row, union ctl_io *ooa_io) { - const struct ctl_cmd_entry *pending_entry, *ooa_entry; - const ctl_serialize_action *serialize_row; - - /* - * Aborted commands are not going to be executed and may even - * not report completion, so we don't care about their order. - * Let them complete ASAP to clean the OOA queue. - */ - if (pending_io->io_hdr.flags & CTL_FLAG_ABORT) - return (CTL_ACTION_SKIP); /* * The initiator attempted multiple untagged commands at the same * time. Can't do that. */ - if ((pending_io->scsiio.tag_type == CTL_TAG_UNTAGGED) - && (ooa_io->scsiio.tag_type == CTL_TAG_UNTAGGED) + if (__predict_false(pending_io->scsiio.tag_type == CTL_TAG_UNTAGGED) + && __predict_false(ooa_io->scsiio.tag_type == CTL_TAG_UNTAGGED) && ((pending_io->io_hdr.nexus.targ_port == ooa_io->io_hdr.nexus.targ_port) && (pending_io->io_hdr.nexus.initid == @@ -10955,9 +10943,9 @@ ctl_check_for_blockage(struct ctl_lun *lun, union ctl_io *pending_io, * command with the same tag number as long as the previous * instance of this tag number has been aborted somehow. */ - if ((pending_io->scsiio.tag_type != CTL_TAG_UNTAGGED) - && (ooa_io->scsiio.tag_type != CTL_TAG_UNTAGGED) - && (pending_io->scsiio.tag_num == ooa_io->scsiio.tag_num) + if (__predict_true(pending_io->scsiio.tag_type != CTL_TAG_UNTAGGED) + && __predict_true(ooa_io->scsiio.tag_type != CTL_TAG_UNTAGGED) + && __predict_false(pending_io->scsiio.tag_num == ooa_io->scsiio.tag_num) && ((pending_io->io_hdr.nexus.targ_port == ooa_io->io_hdr.nexus.targ_port) && (pending_io->io_hdr.nexus.initid == @@ -10980,75 +10968,47 @@ ctl_check_for_blockage(struct ctl_lun *lun, union ctl_io *pending_io, * * XXX KDM check for other types of blockage first?? */ - if (pending_io->scsiio.tag_type == CTL_TAG_HEAD_OF_QUEUE) + if (__predict_false(pending_io->scsiio.tag_type == CTL_TAG_HEAD_OF_QUEUE)) return (CTL_ACTION_PASS); - /* - * Ordered tags have to block until all items ahead of them - * have completed. If we get called with an ordered tag, we always - * block, if something else is ahead of us in the queue. - */ - if (pending_io->scsiio.tag_type == CTL_TAG_ORDERED) - return (CTL_ACTION_BLOCK); - /* * Simple tags get blocked until all head of queue and ordered tags * ahead of them have completed. I'm lumping untagged commands in * with simple tags here. XXX KDM is that the right thing to do? */ - if (((pending_io->scsiio.tag_type == CTL_TAG_UNTAGGED) - || (pending_io->scsiio.tag_type == CTL_TAG_SIMPLE)) - && ((ooa_io->scsiio.tag_type == CTL_TAG_HEAD_OF_QUEUE) - || (ooa_io->scsiio.tag_type == CTL_TAG_ORDERED))) + if (__predict_false(ooa_io->scsiio.tag_type == CTL_TAG_ORDERED) || + __predict_false(ooa_io->scsiio.tag_type == CTL_TAG_HEAD_OF_QUEUE)) return (CTL_ACTION_BLOCK); - pending_entry = ctl_get_cmd_entry(&pending_io->scsiio, NULL); - KASSERT(pending_entry->seridx < CTL_SERIDX_COUNT, - ("%s: Invalid seridx %d for pending CDB %02x %02x @ %p", - __func__, pending_entry->seridx, pending_io->scsiio.cdb[0], - pending_io->scsiio.cdb[1], pending_io)); - ooa_entry = ctl_get_cmd_entry(&ooa_io->scsiio, NULL); - if (ooa_entry->seridx == CTL_SERIDX_INVLD) - return (CTL_ACTION_PASS); /* Unsupported command in OOA queue */ - KASSERT(ooa_entry->seridx < CTL_SERIDX_COUNT, - ("%s: Invalid seridx %d for ooa CDB %02x %02x @ %p", - __func__, ooa_entry->seridx, ooa_io->scsiio.cdb[0], - ooa_io->scsiio.cdb[1], ooa_io)); - - serialize_row = ctl_serialize_table[ooa_entry->seridx]; - - switch (serialize_row[pending_entry->seridx]) { - case CTL_SER_BLOCK: - return (CTL_ACTION_BLOCK); - case CTL_SER_EXTENT: - return (ctl_extent_check(ooa_io, pending_io, - (lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); - case CTL_SER_EXTENTOPT: - if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) != - SCP_QUEUE_ALG_UNRESTRICTED) - return (ctl_extent_check(ooa_io, pending_io, - (lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); + /* Unsupported command in OOA queue. */ + if (__predict_false(ooa_io->scsiio.seridx == CTL_SERIDX_INVLD)) return (CTL_ACTION_PASS); - case CTL_SER_EXTENTSEQ: + + switch (serialize_row[ooa_io->scsiio.seridx]) { + case CTL_SER_SEQ: if (lun->be_lun->serseq != CTL_LUN_SERSEQ_OFF) - return (ctl_extent_check_seq(ooa_io, pending_io)); - return (CTL_ACTION_PASS); + return (ctl_seq_check(ooa_io, pending_io)); + /* FALLTHROUGH */ case CTL_SER_PASS: return (CTL_ACTION_PASS); + case CTL_SER_EXTENTOPT: + if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) == + SCP_QUEUE_ALG_UNRESTRICTED) + return (CTL_ACTION_PASS); + /* FALLTHROUGH */ + case CTL_SER_EXTENT: + return (ctl_extent_check(ooa_io, pending_io, + (lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); case CTL_SER_BLOCKOPT: - if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) != + if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) == SCP_QUEUE_ALG_UNRESTRICTED) - return (CTL_ACTION_BLOCK); - return (CTL_ACTION_PASS); - case CTL_SER_SKIP: - return (CTL_ACTION_SKIP); + return (CTL_ACTION_PASS); + /* FALLTHROUGH */ + case CTL_SER_BLOCK: + return (CTL_ACTION_BLOCK); default: - panic("%s: Invalid serialization value %d for %d => %d", - __func__, serialize_row[pending_entry->seridx], - pending_entry->seridx, ooa_entry->seridx); + __assert_unreachable(); } - - return (CTL_ACTION_ERROR); } /* @@ -11061,20 +11021,41 @@ static ctl_action ctl_check_ooa(struct ctl_lun *lun, union ctl_io *pending_io, union ctl_io **starting_io) { - union ctl_io *ooa_io; + union ctl_io *ooa_io = *starting_io; + const uint8_t *serialize_row; ctl_action action; mtx_assert(&lun->lun_lock, MA_OWNED); + /* + * Aborted commands are not going to be executed and may even + * not report completion, so we don't care about their order. + * Let them complete ASAP to clean the OOA queue. + */ + if (__predict_false(pending_io->io_hdr.flags & CTL_FLAG_ABORT)) + return (CTL_ACTION_SKIP); + + /* + * Ordered tags have to block until all items ahead of them have + * completed. If we get called with an ordered tag, we always + * block, if something else is ahead of us in the queue. + */ + if ((pending_io->scsiio.tag_type == CTL_TAG_ORDERED) && + (ooa_io != NULL)) + return (CTL_ACTION_BLOCK); + + serialize_row = ctl_serialize_table[pending_io->scsiio.seridx]; + /* * Run back along the OOA queue, starting with the current * blocked I/O and going through every I/O before it on the * queue. If starting_io is NULL, we'll just end up returning * CTL_ACTION_PASS. */ - for (ooa_io = *starting_io; ooa_io != NULL; + for (; ooa_io != NULL; ooa_io = (union ctl_io *)LIST_NEXT(&ooa_io->io_hdr, ooa_links)) { - action = ctl_check_for_blockage(lun, pending_io, ooa_io); + action = ctl_check_for_blockage(lun, pending_io, serialize_row, + ooa_io); if (action != CTL_ACTION_PASS) { *starting_io = ooa_io; return (action); @@ -11127,13 +11108,6 @@ ctl_try_unblock_io(struct ctl_lun *lun, union ctl_io *io, bool skip) io->io_hdr.blocker = NULL; switch (action) { - case CTL_ACTION_OVERLAP: - ctl_set_overlapped_cmd(&io->scsiio); - goto error; - case CTL_ACTION_OVERLAP_TAG: - ctl_set_overlapped_tag(&io->scsiio, - io->scsiio.tag_num & 0xff); - goto error; case CTL_ACTION_PASS: case CTL_ACTION_SKIP: @@ -11163,12 +11137,14 @@ ctl_try_unblock_io(struct ctl_lun *lun, union ctl_io *io, bool skip) io->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; ctl_enqueue_rtr(io); break; - case CTL_ACTION_ERROR: default: - ctl_set_internal_failure(&io->scsiio, - /*sks_valid*/ 0, - /*retry_count*/ 0); - + __assert_unreachable(); + case CTL_ACTION_OVERLAP: + ctl_set_overlapped_cmd(&io->scsiio); + goto error; + case CTL_ACTION_OVERLAP_TAG: + ctl_set_overlapped_tag(&io->scsiio, + io->scsiio.tag_num & 0xff); error: /* Serializing commands from the other SC are done here. */ if ((io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) && @@ -11380,8 +11356,8 @@ ctl_failover_lun(union ctl_io *rio) /* We are master */ if (io->flags & CTL_FLAG_FROM_OTHER_SC) { if (io->flags & CTL_FLAG_IO_ACTIVE) { - io->flags |= CTL_FLAG_ABORT; - io->flags |= CTL_FLAG_FAILOVER; + io->flags |= CTL_FLAG_ABORT | + CTL_FLAG_FAILOVER; ctl_try_unblock_io(lun, (union ctl_io *)io, FALSE); } else { /* This can be only due to DATAMOVE */ @@ -11615,18 +11591,18 @@ ctl_scsiio_precheck(struct ctl_scsiio *ctsio) bio = (union ctl_io *)LIST_NEXT(&ctsio->io_hdr, ooa_links); switch (ctl_check_ooa(lun, (union ctl_io *)ctsio, &bio)) { - case CTL_ACTION_BLOCK: - ctsio->io_hdr.blocker = bio; - TAILQ_INSERT_TAIL(&bio->io_hdr.blocked_queue, &ctsio->io_hdr, - blocked_links); - mtx_unlock(&lun->lun_lock); - break; case CTL_ACTION_PASS: case CTL_ACTION_SKIP: ctsio->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; mtx_unlock(&lun->lun_lock); ctl_enqueue_rtr((union ctl_io *)ctsio); break; + case CTL_ACTION_BLOCK: + ctsio->io_hdr.blocker = bio; + TAILQ_INSERT_TAIL(&bio->io_hdr.blocked_queue, &ctsio->io_hdr, + blocked_links); + mtx_unlock(&lun->lun_lock); + break; case CTL_ACTION_OVERLAP: mtx_unlock(&lun->lun_lock); ctl_set_overlapped_cmd(ctsio); @@ -11637,14 +11613,8 @@ ctl_scsiio_precheck(struct ctl_scsiio *ctsio) ctl_set_overlapped_tag(ctsio, ctsio->tag_num & 0xff); ctl_done((union ctl_io *)ctsio); break; - case CTL_ACTION_ERROR: default: - mtx_unlock(&lun->lun_lock); - ctl_set_internal_failure(ctsio, - /*sks_valid*/ 0, - /*retry_count*/ 0); - ctl_done((union ctl_io *)ctsio); - break; + __assert_unreachable(); } } @@ -11673,6 +11643,7 @@ ctl_validate_command(struct ctl_scsiio *ctsio) uint8_t diff; entry = ctl_get_cmd_entry(ctsio, &sa); + ctsio->seridx = entry->seridx; if (entry->execute == NULL) { if (sa) ctl_set_invalid_field(ctsio, @@ -13303,10 +13274,15 @@ ctl_serseq_done(union ctl_io *io) if (lun->be_lun->serseq == CTL_LUN_SERSEQ_OFF) return; - mtx_lock(&lun->lun_lock); - io->io_hdr.flags |= CTL_FLAG_SERSEQ_DONE; - ctl_try_unblock_others(lun, io, FALSE); - mtx_unlock(&lun->lun_lock); + + /* This is racy, but should not be a problem. */ + if (!TAILQ_EMPTY(&io->io_hdr.blocked_queue)) { + mtx_lock(&lun->lun_lock); + io->io_hdr.flags |= CTL_FLAG_SERSEQ_DONE; + ctl_try_unblock_others(lun, io, FALSE); + mtx_unlock(&lun->lun_lock); + } else + io->io_hdr.flags |= CTL_FLAG_SERSEQ_DONE; } void diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h index 349cb02820d9..de312608da8e 100644 --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -326,7 +326,7 @@ struct ctl_scsiio { struct scsi_sense_data sense_data; /* sense data */ uint8_t sense_len; /* Returned sense length */ uint8_t scsi_status; /* SCSI status byte */ - uint8_t sense_residual; /* Unused. */ + uint8_t seridx; /* Serialization index. */ uint8_t priority; /* Command priority */ uint32_t residual; /* Unused */ uint32_t tag_num; /* tag number */ diff --git a/sys/cam/ctl/ctl_private.h b/sys/cam/ctl/ctl_private.h index 8940babd4904..a891041e8f50 100644 --- a/sys/cam/ctl/ctl_private.h +++ b/sys/cam/ctl/ctl_private.h @@ -65,22 +65,20 @@ struct ctl_io_pool { }; typedef enum { - CTL_SER_BLOCK, - CTL_SER_BLOCKOPT, - CTL_SER_EXTENT, - CTL_SER_EXTENTOPT, - CTL_SER_EXTENTSEQ, + CTL_SER_SEQ, CTL_SER_PASS, - CTL_SER_SKIP + CTL_SER_EXTENTOPT, + CTL_SER_EXTENT, + CTL_SER_BLOCKOPT, + CTL_SER_BLOCK, } ctl_serialize_action; typedef enum { - CTL_ACTION_BLOCK, - CTL_ACTION_OVERLAP, - CTL_ACTION_OVERLAP_TAG, CTL_ACTION_PASS, CTL_ACTION_SKIP, - CTL_ACTION_ERROR + CTL_ACTION_BLOCK, + CTL_ACTION_OVERLAP, + CTL_ACTION_OVERLAP_TAG } ctl_action; /* diff --git a/sys/cam/ctl/ctl_ser_table.c b/sys/cam/ctl/ctl_ser_table.c index 5499e63534fa..be9ca6b34631 100644 --- a/sys/cam/ctl/ctl_ser_table.c +++ b/sys/cam/ctl/ctl_ser_table.c @@ -43,11 +43,8 @@ /* TABLE ctlSerTbl */ /* */ /* The matrix which drives the serialization algorithm. The major index */ -/* (the first) into this table is the command being checked and the minor */ -/* index is the command against which the first command is being checked. */ -/* i.e., the major index (row) command is ahead of the minor index command */ -/* (column) in the queue. This allows the code to optimize by capturing */ -/* the result of the first indexing operation into a pointer. */ +/* (the first, row) into this table is the new command. The minor index */ +/* (column) is the older, possibly already running, command. */ /* */ /* Whenever a new value is added to the IDX_T type, this matrix must be */ /* expanded by one row AND one column -- Because of this, some effort */ @@ -55,29 +52,29 @@ /* */ /****************************************************************************/ -#define sK CTL_SER_SKIP /* Skip */ #define pS CTL_SER_PASS /* Pass */ #define bK CTL_SER_BLOCK /* Blocked */ #define bO CTL_SER_BLOCKOPT /* Optional block */ #define xT CTL_SER_EXTENT /* Extent check */ #define xO CTL_SER_EXTENTOPT /* Optional extent check */ -#define xS CTL_SER_EXTENTSEQ /* Sequential extent check */ +#define xS CTL_SER_SEQ /* Sequential check */ -const static ctl_serialize_action +const static uint8_t ctl_serialize_table[CTL_SERIDX_COUNT][CTL_SERIDX_COUNT] = { /**>IDX_ :: 2nd:TUR RD WRT UNM SYN MDSN MDSL RQSN INQ RDCP RES LSNS FMT STR*/ -/*TUR */{ pS, pS, pS, pS, pS, bK, bK, bK, pS, pS, bK, pS, bK, bK}, -/*READ */{ pS, xS, xT, bO, pS, bK, bK, bK, pS, pS, bK, pS, bK, bK}, -/*WRITE */{ pS, xT, xT, bO, bO, bK, bK, bK, pS, pS, bK, pS, bK, bK}, -/*UNMAP */{ pS, xO, xO, pS, pS, bK, bK, bK, pS, pS, bK, pS, bK, bK}, -/*SYNC */{ pS, pS, pS, pS, pS, bK, bK, bK, pS, pS, bK, pS, bK, bK}, -/*MD_SNS */{ bK, bK, bK, bK, bK, pS, bK, bK, pS, pS, bK, pS, bK, bK}, -/*MD_SEL */{ bK, bK, bK, bK, bK, bK, bK, bK, pS, pS, bK, pS, bK, bK}, -/*RQ_SNS */{ pS, pS, pS, pS, pS, pS, pS, bK, pS, pS, bK, pS, bK, bK}, -/*INQ */{ pS, pS, pS, pS, pS, pS, pS, bK, pS, pS, pS, pS, bK, bK}, -/*RD_CAP */{ pS, pS, pS, pS, pS, pS, pS, bK, pS, pS, pS, pS, bK, pS}, -/*RES */{ bK, bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK, bK}, -/*LOG_SNS */{ pS, pS, pS, pS, pS, pS, bK, bK, pS, pS, bK, pS, bK, bK}, -/*FORMAT */{ pS, bK, bK, bK, bK, bK, bK, pS, pS, bK, bK, bK, bK, bK}, -/*START */{ bK, bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK, bK}, +/*TUR */{ pS, pS, pS, pS, pS, bK, bK, pS, pS, pS, bK, pS, pS, bK}, +/*READ */{ pS, xS, xT, xO, pS, bK, bK, pS, pS, pS, bK, pS, bK, bK}, +/*WRITE */{ pS, xT, xT, xO, pS, bK, bK, pS, pS, pS, bK, pS, bK, bK}, +/*UNMAP */{ pS, bO, bO, pS, pS, bK, bK, pS, pS, pS, bK, pS, bK, bK}, +/*SYNC */{ pS, pS, bO, pS, pS, bK, bK, pS, pS, pS, bK, pS, bK, bK}, +/*MD_SNS */{ bK, bK, bK, bK, bK, pS, bK, pS, pS, pS, bK, pS, bK, bK}, +/*MD_SEL */{ bK, bK, bK, bK, bK, bK, bK, pS, pS, pS, bK, bK, bK, bK}, +/*RQ_SNS */{ bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, pS, bK}, +/*INQ */{ pS, pS, pS, pS, pS, pS, pS, pS, pS, pS, pS, pS, pS, pS}, +/*RD_CAP */{ pS, pS, pS, pS, pS, pS, pS, pS, pS, pS, bK, pS, bK, bK}, +/*RES */{ bK, bK, bK, bK, bK, bK, bK, bK, pS, pS, bK, bK, bK, bK}, +/*LOG_SNS */{ pS, pS, pS, pS, pS, pS, pS, pS, pS, pS, bK, pS, bK, bK}, +/*FORMAT */{ bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK}, +/*START */{ bK, bK, bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK}, }; + From owner-dev-commits-src-all@freebsd.org Mon Mar 15 02:39:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EDADE56B0DD; Mon, 15 Mar 2021 02:39: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 4DzLHH5cpSz3M9K; Mon, 15 Mar 2021 02:39: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 DB6D3A90; Mon, 15 Mar 2021 02:39: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 12F2dqde061714; Mon, 15 Mar 2021 02:39:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F2dqdV061713; Mon, 15 Mar 2021 02:39:52 GMT (envelope-from git) Date: Mon, 15 Mar 2021 02:39:52 GMT Message-Id: <202103150239.12F2dqdV061713@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: fb419e0ffb28 - stable/13 - Fix initiator panic after 6895f89fe54e. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: fb419e0ffb282ea79c28621769ade3f85424bfaa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 02:39:57 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=fb419e0ffb282ea79c28621769ade3f85424bfaa commit fb419e0ffb282ea79c28621769ade3f85424bfaa Author: Alexander Motin AuthorDate: 2021-03-02 21:07:22 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:35:47 +0000 Fix initiator panic after 6895f89fe54e. There are sessions without socket that are not disconnecting yet. MFC after: 3 weeks (cherry picked from commit 06e9c710998b83a3be21f7f264187fff5d590bc3) --- sys/dev/iscsi/icl_soft.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index c66d8ccdb5fd..c64f0cfde71b 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -1364,9 +1364,11 @@ icl_soft_conn_close(struct icl_conn *ic) ICL_CONN_LOCK(ic); if (!ic->ic_disconnecting) { so = ic->ic_socket; - SOCKBUF_LOCK(&so->so_rcv); + if (so) + SOCKBUF_LOCK(&so->so_rcv); ic->ic_disconnecting = true; - SOCKBUF_UNLOCK(&so->so_rcv); + if (so) + SOCKBUF_UNLOCK(&so->so_rcv); } while (ic->ic_receive_running || ic->ic_send_running) { cv_signal(&ic->ic_receive_cv); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 02:40:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0079256B0E0; Mon, 15 Mar 2021 02:39:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzLHL73FZz3MG1; Mon, 15 Mar 2021 02:39:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5298B95D; Mon, 15 Mar 2021 02:39: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 12F2duXu061776; Mon, 15 Mar 2021 02:39:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F2duG9061775; Mon, 15 Mar 2021 02:39:56 GMT (envelope-from git) Date: Mon, 15 Mar 2021 02:39:56 GMT Message-Id: <202103150239.12F2duG9061775@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: aae8e02dfcb2 - stable/13 - Move ic_check_send_space clear to the actual check. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: aae8e02dfcb2cd198e93b3b4e2c69b17c7525ae6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 02:40:00 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=aae8e02dfcb2cd198e93b3b4e2c69b17c7525ae6 commit aae8e02dfcb2cd198e93b3b4e2c69b17c7525ae6 Author: Alexander Motin AuthorDate: 2021-03-03 20:21:26 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:36:21 +0000 Move ic_check_send_space clear to the actual check. It closes tiny race when the flag could be set between being cleared and the space is checked, that would create us some more work. The flag setting is protected by both locks, so we can clear it in either place, but in between both locks are dropped. MFC after: 1 week (cherry picked from commit afc3e54eeee635a525c88e4678cc38e3219302c3) --- sys/dev/iscsi/icl_soft.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index 57ab24defabb..9cede6b44311 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -866,6 +866,7 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) * of error. */ available = sbspace(&so->so_snd); + ic->ic_check_send_space = false; /* * Notify the socket upcall that we don't need wakeups @@ -978,7 +979,6 @@ icl_send_thread(void *arg) if (STAILQ_EMPTY(&queue) || ic->ic_check_send_space) STAILQ_CONCAT(&queue, &ic->ic_to_send); - ic->ic_check_send_space = false; ICL_CONN_UNLOCK(ic); icl_conn_send_pdus(ic, &queue); ICL_CONN_LOCK(ic); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 02:39:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DAF856B2A8; Mon, 15 Mar 2021 02:39: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 4DzLHF1j1cz3MHZ; Mon, 15 Mar 2021 02:39: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 9029686D; Mon, 15 Mar 2021 02: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 12F2doPM061670; Mon, 15 Mar 2021 02:39:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F2do2e061669; Mon, 15 Mar 2021 02:39:50 GMT (envelope-from git) Date: Mon, 15 Mar 2021 02:39:50 GMT Message-Id: <202103150239.12F2do2e061669@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 76d8d700f26c - stable/13 - Optimize out few extra memory accesses. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 76d8d700f26c66ea045c46239f02cb83c6fbe6cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 02:39:54 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=76d8d700f26c66ea045c46239f02cb83c6fbe6cc commit 76d8d700f26c66ea045c46239f02cb83c6fbe6cc Author: Alexander Motin AuthorDate: 2021-03-01 23:35:45 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:35:28 +0000 Optimize out few extra memory accesses. MFC after: 1 week (cherry picked from commit a59e2982fe3e6339629cc77fe9d349d60e03a05e) --- sys/cam/ctl/ctl_backend_block.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 17a336ebe872..9f96c157d5ae 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -438,7 +438,6 @@ ctl_be_block_move_done(union ctl_io *io, bool samethr) struct ctl_lba_len_flags *lbalen; beio = (struct ctl_be_block_io *)PRIV(io)->ptr; - be_lun = beio->lun; DPRINTF("entered\n"); io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; @@ -448,7 +447,7 @@ ctl_be_block_move_done(union ctl_io *io, bool samethr) */ if ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0 && (io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE) { - lbalen = ARGS(beio->io); + lbalen = ARGS(io); if (lbalen->flags & CTL_LLF_READ) { ctl_set_success(&io->scsiio); } else if (lbalen->flags & CTL_LLF_COMPARE) { @@ -476,6 +475,7 @@ ctl_be_block_move_done(union ctl_io *io, bool samethr) * This move done routine is generally called in the SIM's * interrupt context, and therefore we cannot block. */ + be_lun = (struct ctl_be_block_lun *)CTL_BACKEND_LUN(io); if (samethr) { be_lun->dispatch(be_lun, beio); } else { @@ -1280,7 +1280,7 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun, DPRINTF("entered\n"); beio = (struct ctl_be_block_io *)PRIV(io)->ptr; - lbalen = ARGS(beio->io); + lbalen = ARGS(io); if (lbalen->flags & ~(SWS_LBDATA | SWS_UNMAP | SWS_ANCHOR | SWS_NDOB) || (lbalen->flags & (SWS_UNMAP | SWS_ANCHOR) && be_lun->unmap == NULL)) { From owner-dev-commits-src-all@freebsd.org Mon Mar 15 02:39:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C670656ADD9; Mon, 15 Mar 2021 02:39: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 4DzLHG6mFDz3M6L; Mon, 15 Mar 2021 02:39: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 AED56A14; Mon, 15 Mar 2021 02:39: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 12F2dpX1061692; Mon, 15 Mar 2021 02:39:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F2dpvb061691; Mon, 15 Mar 2021 02:39:51 GMT (envelope-from git) Date: Mon, 15 Mar 2021 02:39:51 GMT Message-Id: <202103150239.12F2dpvb061691@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 6b409a8b32e0 - stable/13 - Optimize TX coalescing by keeping pointer to last mbuf. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6b409a8b32e056e2a5d7b886ce4210bba81a019a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 02:39:56 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=6b409a8b32e056e2a5d7b886ce4210bba81a019a commit 6b409a8b32e056e2a5d7b886ce4210bba81a019a Author: Alexander Motin AuthorDate: 2021-03-02 04:31:34 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:35:37 +0000 Optimize TX coalescing by keeping pointer to last mbuf. Before m_cat() each time traversed through all the coalesced chain. MFC after: 1 week (cherry picked from commit b85a67f54a40053e75658a17c620b89bafaba67f) --- sys/dev/iscsi/icl_soft.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index a5696647169a..c66d8ccdb5fd 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -849,6 +849,7 @@ static void icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) { struct icl_pdu *request, *request2; + struct mbuf *m; struct socket *so; long available, size, size2; int coalesced, error; @@ -908,8 +909,8 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) return; } if (coalesce) { - coalesced = 1; - for (;;) { + m = request->ip_bhs_mbuf; + for (coalesced = 1; ; coalesced++) { request2 = STAILQ_FIRST(queue); if (request2 == NULL) break; @@ -926,13 +927,14 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) icl_conn_fail(ic); return; } - m_cat(request->ip_bhs_mbuf, request2->ip_bhs_mbuf); + while (m->m_next) + m = m->m_next; + m_cat(m, request2->ip_bhs_mbuf); request2->ip_bhs_mbuf = NULL; request->ip_bhs_mbuf->m_pkthdr.len += size2; size += size2; STAILQ_REMOVE_AFTER(queue, request, ip_next); icl_soft_pdu_done(request2, 0); - coalesced++; } #if 0 if (coalesced > 1) { From owner-dev-commits-src-all@freebsd.org Mon Mar 15 02:39:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2D03956B1CD; Mon, 15 Mar 2021 02:39:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzLHL3NC3z3MCN; Mon, 15 Mar 2021 02:39:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 27F7976F; Mon, 15 Mar 2021 02:39: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 12F2dtCa061754; Mon, 15 Mar 2021 02:39:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F2dt1G061753; Mon, 15 Mar 2021 02:39:55 GMT (envelope-from git) Date: Mon, 15 Mar 2021 02:39:55 GMT Message-Id: <202103150239.12F2dt1G061753@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 8b0101da803d - stable/13 - Restore condition removed in df3747c6607b. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8b0101da803da44e51697d5076c4782919068de7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 02:39:59 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=8b0101da803da44e51697d5076c4782919068de7 commit 8b0101da803da44e51697d5076c4782919068de7 Author: Alexander Motin AuthorDate: 2021-03-03 16:58:04 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:36:13 +0000 Restore condition removed in df3747c6607b. I think it allowed to avoid some TX thread wakeups while the socket buffer is full. But add there another options if ic_check_send_space is set, which means socket just reported that new space appeared, so it may have sense to pull more data from ic_to_send for better TX coalescing. MFC after: 1 week (cherry picked from commit aff9b9ee894e3e6b6d8c7e4182d6b973804df853) --- sys/dev/iscsi/icl_soft.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index d579c034e63f..57ab24defabb 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -975,7 +975,8 @@ icl_send_thread(void *arg) * This way the icl_conn_send_pdus() can go through * all the queued PDUs without holding any locks. */ - STAILQ_CONCAT(&queue, &ic->ic_to_send); + if (STAILQ_EMPTY(&queue) || ic->ic_check_send_space) + STAILQ_CONCAT(&queue, &ic->ic_to_send); ic->ic_check_send_space = false; ICL_CONN_UNLOCK(ic); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 02:39:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F07356ACE4; Mon, 15 Mar 2021 02:39: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 4DzLHK1HFtz3MHv; Mon, 15 Mar 2021 02:39: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 039EB86E; Mon, 15 Mar 2021 02:39: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 12F2dr0l061732; Mon, 15 Mar 2021 02:39:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F2drwQ061731; Mon, 15 Mar 2021 02:39:53 GMT (envelope-from git) Date: Mon, 15 Mar 2021 02:39:53 GMT Message-Id: <202103150239.12F2drwQ061731@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 2f77e2810a9d - stable/13 - Replace STAILQ_SWAP() with simpler STAILQ_CONCAT(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2f77e2810a9df87da7c6947ce2b1007d08da131a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 02:39:58 -0000 The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=2f77e2810a9df87da7c6947ce2b1007d08da131a commit 2f77e2810a9df87da7c6947ce2b1007d08da131a Author: Alexander Motin AuthorDate: 2021-03-02 23:39:44 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:36:04 +0000 Replace STAILQ_SWAP() with simpler STAILQ_CONCAT(). Also remove stray STAILQ_REMOVE_AFTER(), not causing problems only because STAILQ_SWAP() fixed corrupted stqh_last. MFC after: 1 week (cherry picked from commit df3747c6607be12d48db825653e6adfc3041e97f) --- sys/dev/iscsi/icl_soft.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index c64f0cfde71b..d579c034e63f 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -933,7 +933,6 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) request2->ip_bhs_mbuf = NULL; request->ip_bhs_mbuf->m_pkthdr.len += size2; size += size2; - STAILQ_REMOVE_AFTER(queue, request, ip_next); icl_soft_pdu_done(request2, 0); } #if 0 @@ -972,13 +971,11 @@ icl_send_thread(void *arg) for (;;) { for (;;) { /* - * If the local queue is empty, populate it from - * the main one. This way the icl_conn_send_pdus() - * can go through all the queued PDUs without holding - * any locks. + * Populate the local queue from the main one. + * This way the icl_conn_send_pdus() can go through + * all the queued PDUs without holding any locks. */ - if (STAILQ_EMPTY(&queue)) - STAILQ_SWAP(&ic->ic_to_send, &queue, icl_pdu); + STAILQ_CONCAT(&queue, &ic->ic_to_send); ic->ic_check_send_space = false; ICL_CONN_UNLOCK(ic); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 03:01:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85BEC56CB74; Mon, 15 Mar 2021 03:01:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzLm12vwDz3QTH; Mon, 15 Mar 2021 03: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 570FC10CB; Mon, 15 Mar 2021 03:01: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 12F31L9q097881; Mon, 15 Mar 2021 03:01:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F31Lr9097880; Mon, 15 Mar 2021 03:01:21 GMT (envelope-from git) Date: Mon, 15 Mar 2021 03:01:21 GMT Message-Id: <202103150301.12F31Lr9097880@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: cfd358d99732 - stable/12 - Save context switch per I/O for iSCSI and IOCTL frontends. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: cfd358d99732463a9ec2ed3d81374dae9f12b112 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 03:01:21 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=cfd358d99732463a9ec2ed3d81374dae9f12b112 commit cfd358d99732463a9ec2ed3d81374dae9f12b112 Author: Alexander Motin AuthorDate: 2021-02-19 03:07:32 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:42:02 +0000 Save context switch per I/O for iSCSI and IOCTL frontends. Introduce new CTL core KPI ctl_run(), preprocessing I/Os in the caller context instead of scheduling another thread just for that. This call may sleep, that is not acceptable for some frontends like the original CAM/FC one, but iSCSI already has separate sleepable per-connection RX threads, and another thread scheduling is mostly just a waste of time. IOCTL frontend actually waits for the I/O completion in the caller thread, so the use of another thread for this has even less sense. With this change I can measure ~5% IOPS improvement on 4KB iSCSI I/Os to ZFS. MFC after: 1 month (cherry picked from commit 812c9f48a2b7bccc31b2a6077b299822357832e4) --- sys/cam/ctl/README.ctl.txt | 2 +- sys/cam/ctl/ctl.c | 65 ++++++++++++++++++++++++++++++---------- sys/cam/ctl/ctl_frontend.h | 7 +++++ sys/cam/ctl/ctl_frontend_ioctl.c | 2 +- sys/cam/ctl/ctl_frontend_iscsi.c | 12 ++++---- sys/cam/ctl/ctl_tpc.c | 2 +- 6 files changed, 65 insertions(+), 25 deletions(-) diff --git a/sys/cam/ctl/README.ctl.txt b/sys/cam/ctl/README.ctl.txt index 89030e20298a..c96da88d84cb 100644 --- a/sys/cam/ctl/README.ctl.txt +++ b/sys/cam/ctl/README.ctl.txt @@ -259,7 +259,7 @@ point. Here is a roadmap of some of the primary functions in ctl.c. Starting here and following the various leaf functions will show the command flow. -ctl_queue() This is where commands from the frontend ports come +ctl_queue() / ctl_run() This is where commands from the frontend ports come in. ctl_queue_sense() This is only used for non-packetized SCSI. i.e. diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 5ee6810f960a..002d43303b79 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -512,8 +512,7 @@ static int ctl_scsiio_lun_check(struct ctl_lun *lun, const struct ctl_cmd_entry *entry, struct ctl_scsiio *ctsio); static void ctl_failover_lun(union ctl_io *io); -static int ctl_scsiio_precheck(struct ctl_softc *ctl_softc, - struct ctl_scsiio *ctsio); +static void ctl_scsiio_precheck(struct ctl_scsiio *ctsio); static int ctl_scsiio(struct ctl_scsiio *ctsio); static int ctl_target_reset(union ctl_io *io); @@ -11447,14 +11446,14 @@ ctl_failover_lun(union ctl_io *rio) mtx_unlock(&lun->lun_lock); } -static int -ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) +static void +ctl_scsiio_precheck(struct ctl_scsiio *ctsio) { + struct ctl_softc *softc = CTL_SOFTC(ctsio); struct ctl_lun *lun; const struct ctl_cmd_entry *entry; union ctl_io *bio; uint32_t initidx, targ_lun; - int retval = 0; lun = NULL; targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; @@ -11492,7 +11491,7 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) if (entry == NULL) { if (lun) mtx_unlock(&lun->lun_lock); - return (retval); + return; } ctsio->io_hdr.flags &= ~CTL_FLAG_DATA_MASK; @@ -11509,13 +11508,13 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) if (entry->flags & CTL_CMD_FLAG_OK_ON_NO_LUN) { ctsio->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; ctl_enqueue_rtr((union ctl_io *)ctsio); - return (retval); + return; } ctl_set_unsupported_lun(ctsio); ctl_done((union ctl_io *)ctsio); CTL_DEBUG_PRINT(("ctl_scsiio_precheck: bailing out due to invalid LUN\n")); - return (retval); + return; } else { /* * Make sure we support this particular command on this LUN. @@ -11525,7 +11524,7 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) mtx_unlock(&lun->lun_lock); ctl_set_invalid_opcode(ctsio); ctl_done((union ctl_io *)ctsio); - return (retval); + return; } } @@ -11579,7 +11578,7 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) ctsio->io_hdr.status = CTL_SCSI_ERROR | CTL_AUTOSENSE; ctsio->sense_len = sense_len; ctl_done((union ctl_io *)ctsio); - return (retval); + return; } } @@ -11587,7 +11586,7 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) if (ctl_scsiio_lun_check(lun, entry, ctsio) != 0) { mtx_unlock(&lun->lun_lock); ctl_done((union ctl_io *)ctsio); - return (retval); + return; } /* @@ -11624,9 +11623,9 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) M_WAITOK)) > CTL_HA_STATUS_SUCCESS) { ctl_set_busy(ctsio); ctl_done((union ctl_io *)ctsio); - return (retval); + return; } - return (retval); + return; } bio = (union ctl_io *)TAILQ_PREV(&ctsio->io_hdr, ctl_ooaq, ooa_links); @@ -11636,7 +11635,7 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) TAILQ_INSERT_TAIL(&bio->io_hdr.blocked_queue, &ctsio->io_hdr, blocked_links); mtx_unlock(&lun->lun_lock); - return (retval); + break; case CTL_ACTION_PASS: case CTL_ACTION_SKIP: ctsio->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; @@ -11662,7 +11661,6 @@ ctl_scsiio_precheck(struct ctl_softc *softc, struct ctl_scsiio *ctsio) ctl_done((union ctl_io *)ctsio); break; } - return (retval); } const struct ctl_cmd_entry * @@ -13270,6 +13268,41 @@ ctl_queue(union ctl_io *io) return (CTL_RETVAL_COMPLETE); } +int +ctl_run(union ctl_io *io) +{ + struct ctl_port *port = CTL_PORT(io); + + CTL_DEBUG_PRINT(("ctl_run cdb[0]=%02X\n", io->scsiio.cdb[0])); + +#ifdef CTL_TIME_IO + io->io_hdr.start_time = time_uptime; + getbinuptime(&io->io_hdr.start_bt); +#endif /* CTL_TIME_IO */ + + /* Map FE-specific LUN ID into global one. */ + io->io_hdr.nexus.targ_mapped_lun = + ctl_lun_map_from_port(port, io->io_hdr.nexus.targ_lun); + + switch (io->io_hdr.io_type) { + case CTL_IO_SCSI: + if (ctl_debug & CTL_DEBUG_CDB) + ctl_io_print(io); + ctl_scsiio_precheck(&io->scsiio); + break; + case CTL_IO_TASK: + if (ctl_debug & CTL_DEBUG_CDB) + ctl_io_print(io); + ctl_run_task(io); + break; + default: + printf("ctl_run: unknown I/O type %d\n", io->io_hdr.io_type); + return (EINVAL); + } + + return (CTL_RETVAL_COMPLETE); +} + #ifdef CTL_IO_DELAY static void ctl_done_timer_wakeup(void *arg) @@ -13401,7 +13434,7 @@ ctl_work_thread(void *arg) if (io->io_hdr.io_type == CTL_IO_TASK) ctl_run_task(io); else - ctl_scsiio_precheck(softc, &io->scsiio); + ctl_scsiio_precheck(&io->scsiio); continue; } io = (union ctl_io *)STAILQ_FIRST(&thr->rtr_queue); diff --git a/sys/cam/ctl/ctl_frontend.h b/sys/cam/ctl/ctl_frontend.h index bdcb7a2e1abd..c9ab255cdde4 100644 --- a/sys/cam/ctl/ctl_frontend.h +++ b/sys/cam/ctl/ctl_frontend.h @@ -310,6 +310,13 @@ void ctl_port_offline(struct ctl_port *fe); */ int ctl_queue(union ctl_io *io); +/* + * This routine starts execution of I/O and task management requests from + * the FETD to the CTL layer. May sleep. Returns 0 for success, non-zero + * for failure. + */ +int ctl_run(union ctl_io *io); + /* * This routine is used if the front end interface doesn't support * autosense (e.g. non-packetized parallel SCSI). This will queue the diff --git a/sys/cam/ctl/ctl_frontend_ioctl.c b/sys/cam/ctl/ctl_frontend_ioctl.c index 0280391242d2..b0298728e8db 100644 --- a/sys/cam/ctl/ctl_frontend_ioctl.c +++ b/sys/cam/ctl/ctl_frontend_ioctl.c @@ -526,7 +526,7 @@ cfi_submit_wait(union ctl_io *io) CTL_DEBUG_PRINT(("cfi_submit_wait\n")); /* This shouldn't happen */ - if ((retval = ctl_queue(io)) != CTL_RETVAL_COMPLETE) + if ((retval = ctl_run(io)) != CTL_RETVAL_COMPLETE) return (retval); done = 0; diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index 9b55574590ff..4ad238ea6909 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -547,9 +547,9 @@ cfiscsi_pdu_handle_scsi_command(struct icl_pdu *request) io->scsiio.cdb_len = sizeof(bhssc->bhssc_cdb); /* Which is 16. */ memcpy(io->scsiio.cdb, bhssc->bhssc_cdb, sizeof(bhssc->bhssc_cdb)); refcount_acquire(&cs->cs_outstanding_ctl_pdus); - error = ctl_queue(io); + error = ctl_run(io); if (error != CTL_RETVAL_COMPLETE) { - CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d; " + CFISCSI_SESSION_WARN(cs, "ctl_run() failed; error %d; " "dropping connection", error); ctl_free_io(io); refcount_release(&cs->cs_outstanding_ctl_pdus); @@ -669,9 +669,9 @@ cfiscsi_pdu_handle_task_request(struct icl_pdu *request) } refcount_acquire(&cs->cs_outstanding_ctl_pdus); - error = ctl_queue(io); + error = ctl_run(io); if (error != CTL_RETVAL_COMPLETE) { - CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d; " + CFISCSI_SESSION_WARN(cs, "ctl_run() failed; error %d; " "dropping connection", error); ctl_free_io(io); refcount_release(&cs->cs_outstanding_ctl_pdus); @@ -1118,9 +1118,9 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) io->taskio.task_action = CTL_TASK_I_T_NEXUS_RESET; wait = cs->cs_outstanding_ctl_pdus; refcount_acquire(&cs->cs_outstanding_ctl_pdus); - error = ctl_queue(io); + error = ctl_run(io); if (error != CTL_RETVAL_COMPLETE) { - CFISCSI_SESSION_WARN(cs, "ctl_queue() failed; error %d", error); + CFISCSI_SESSION_WARN(cs, "ctl_run() failed; error %d", error); refcount_release(&cs->cs_outstanding_ctl_pdus); ctl_free_io(io); } diff --git a/sys/cam/ctl/ctl_tpc.c b/sys/cam/ctl/ctl_tpc.c index fb9cce5de258..75e90d69b77f 100644 --- a/sys/cam/ctl/ctl_tpc.c +++ b/sys/cam/ctl/ctl_tpc.c @@ -1628,7 +1628,7 @@ tpc_done(union ctl_io *io) io->io_hdr.flags &= ~CTL_FLAG_ABORT; io->io_hdr.flags &= ~CTL_FLAG_SENT_2OTHER_SC; if (tpcl_queue(io, tio->lun) != CTL_RETVAL_COMPLETE) { - printf("%s: error returned from ctl_queue()!\n", + printf("%s: error returned from tpcl_queue()!\n", __func__); io->io_hdr.status = old_status; } else From owner-dev-commits-src-all@freebsd.org Mon Mar 15 03:01:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A5EE56C8D0; Mon, 15 Mar 2021 03:01: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 4DzLm029q6z3QCV; Mon, 15 Mar 2021 03:01: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 3D3F91192; Mon, 15 Mar 2021 03: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 12F31KAi097861; Mon, 15 Mar 2021 03: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 12F31Kus097860; Mon, 15 Mar 2021 03:01:20 GMT (envelope-from git) Date: Mon, 15 Mar 2021 03:01:20 GMT Message-Id: <202103150301.12F31Kus097860@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 15fe13c887d6 - stable/12 - Move XPT_IMMEDIATE_NOTIFY handling out of periph lock. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 15fe13c887d6133b4b6d91c780a91c67fdb6b063 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 03:01:20 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=15fe13c887d6133b4b6d91c780a91c67fdb6b063 commit 15fe13c887d6133b4b6d91c780a91c67fdb6b063 Author: Alexander Motin AuthorDate: 2021-02-18 21:22:01 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:41:53 +0000 Move XPT_IMMEDIATE_NOTIFY handling out of periph lock. It is a rare, but still better to not have lock dependencies. MFC after: 1 month (cherry picked from commit c67a2909a629db138227993e1093e66bb6c00af5) --- sys/cam/ctl/scsi_ctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index e22b3a95095f..0bbbe3cb6e2a 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -1493,6 +1493,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) ctlfe_free_ccb(periph, done_ccb); goto out; } + mtx_unlock(mtx); if (send_ctl_io != 0) { ctl_queue(io); } else { @@ -1500,7 +1501,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) done_ccb->ccb_h.func_code = XPT_NOTIFY_ACKNOWLEDGE; xpt_action(done_ccb); } - break; + return; } case XPT_NOTIFY_ACKNOWLEDGE: /* Queue this back down to the SIM as an immediate notify. */ From owner-dev-commits-src-all@freebsd.org Mon Mar 15 03:01:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0150A56C8D7; Mon, 15 Mar 2021 03:01: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 4DzLm35BD9z3QCb; Mon, 15 Mar 2021 03:01: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 9A1F6E44; Mon, 15 Mar 2021 03:01: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 12F31NM3097917; Mon, 15 Mar 2021 03:01:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F31Ncc097916; Mon, 15 Mar 2021 03:01:23 GMT (envelope-from git) Date: Mon, 15 Mar 2021 03:01:23 GMT Message-Id: <202103150301.12F31Ncc097916@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: c4a81e647599 - stable/12 - Refactor CTL datamove KPI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c4a81e647599fa8acc5ba1b4dbe34f357d8219bc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 03:01:24 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=c4a81e647599fa8acc5ba1b4dbe34f357d8219bc commit c4a81e647599fa8acc5ba1b4dbe34f357d8219bc Author: Alexander Motin AuthorDate: 2021-02-21 21:45:14 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:45:05 +0000 Refactor CTL datamove KPI. - Make frontends call unified CTL core method ctl_datamove_done() to report move completion. It allows to reduce code duplication in differerent backends by accounting DMA time in common code. - Add to ctl_datamove_done() and be_move_done() callback samethr argument, reporting whether the callback is called in the same context as ctl_datamove(). It allows for some cases like iSCSI write with immediate data or camsim frontend write save one context switch, since we know that the context is sleepable. - Remove data_move_done() methods from struct ctl_backend_driver, unused since forever. MFC after: 1 month (cherry picked from commit 2c7dc6bae9fd5c2fa0a65768df8e4e99c2f159f1) --- sys/cam/ctl/ctl.c | 112 +++++++++++++++++-------------------- sys/cam/ctl/ctl.h | 3 +- sys/cam/ctl/ctl_backend.h | 1 - sys/cam/ctl/ctl_backend_block.c | 64 ++++++--------------- sys/cam/ctl/ctl_backend_ramdisk.c | 36 ++---------- sys/cam/ctl/ctl_frontend_cam_sim.c | 2 +- sys/cam/ctl/ctl_frontend_ioctl.c | 2 +- sys/cam/ctl/ctl_frontend_iscsi.c | 23 ++++---- sys/cam/ctl/ctl_io.h | 2 +- sys/cam/ctl/ctl_tpc_local.c | 2 +- sys/cam/ctl/scsi_ctl.c | 3 +- sys/dev/usb/storage/cfumass.c | 6 +- 12 files changed, 94 insertions(+), 162 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index b9d13a2e8c5d..07331091fc54 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -534,9 +534,9 @@ static void ctl_done_timer_wakeup(void *arg); static void ctl_send_datamove_done(union ctl_io *io, int have_lock); static void ctl_datamove_remote_write_cb(struct ctl_ha_dt_req *rq); -static int ctl_datamove_remote_dm_write_cb(union ctl_io *io); +static int ctl_datamove_remote_dm_write_cb(union ctl_io *io, bool samethr); static void ctl_datamove_remote_write(union ctl_io *io); -static int ctl_datamove_remote_dm_read_cb(union ctl_io *io); +static int ctl_datamove_remote_dm_read_cb(union ctl_io *io, bool samethr); static void ctl_datamove_remote_read_cb(struct ctl_ha_dt_req *rq); static int ctl_datamove_remote_sgl_setup(union ctl_io *io); static int ctl_datamove_remote_xfer(union ctl_io *io, unsigned command, @@ -736,7 +736,7 @@ ctl_ha_datamove(union ctl_io *io) sizeof(struct ctl_sg_entry) * msg.dt.cur_sg_entries, M_WAITOK) > CTL_HA_STATUS_SUCCESS) { io->io_hdr.port_status = 31341; - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } msg.dt.sent_sg_entries = sg_entries_sent; @@ -753,7 +753,7 @@ ctl_ha_datamove(union ctl_io *io) if (lun) mtx_unlock(&lun->lun_lock); io->io_hdr.port_status = 31342; - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } io->io_hdr.flags &= ~CTL_FLAG_IO_ACTIVE; @@ -5032,7 +5032,7 @@ ctl_lun_capacity_changed(struct ctl_be_lun *be_lun) * make it down to say RAIDCore's configuration code. */ int -ctl_config_move_done(union ctl_io *io) +ctl_config_move_done(union ctl_io *io, bool samethr) { int retval; @@ -5040,18 +5040,6 @@ ctl_config_move_done(union ctl_io *io) KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); - if ((io->io_hdr.port_status != 0) && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, - /*retry_count*/ io->io_hdr.port_status); - } else if (io->scsiio.kern_data_resid != 0 && - (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_invalid_field_ciu(&io->scsiio); - } - if (ctl_debug & CTL_DEBUG_CDB_DATA) ctl_data_print(io); if (((io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN) || @@ -12314,7 +12302,7 @@ ctl_handle_isc(union ctl_io *io) ctl_datamove_remote(io); break; case CTL_MSG_DATAMOVE_DONE: /* Only used in XFER mode */ - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); break; case CTL_MSG_FAILOVER: ctl_failover_lun(io); @@ -12474,6 +12462,45 @@ ctl_datamove_timer_wakeup(void *arg) } #endif /* CTL_IO_DELAY */ +static void +ctl_datamove_done_process(union ctl_io *io) +{ +#ifdef CTL_TIME_IO + struct bintime cur_bt; +#endif + + KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); + +#ifdef CTL_TIME_IO + getbinuptime(&cur_bt); + bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt); + bintime_add(&io->io_hdr.dma_bt, &cur_bt); +#endif + io->io_hdr.num_dmas++; + + if ((io->io_hdr.port_status != 0) && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { + ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, + /*retry_count*/ io->io_hdr.port_status); + } else if (io->scsiio.kern_data_resid != 0 && + (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && + ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { + ctl_set_invalid_field_ciu(&io->scsiio); + } else if (ctl_debug & CTL_DEBUG_CDB_DATA) + ctl_data_print(io); +} + +void +ctl_datamove_done(union ctl_io *io, bool samethr) +{ + + ctl_datamove_done_process(io); + io->scsiio.be_move_done(io, samethr); +} + void ctl_datamove(union ctl_io *io) { @@ -12487,39 +12514,7 @@ ctl_datamove(union ctl_io *io) io->scsiio.kern_data_resid = io->scsiio.kern_data_len; #ifdef CTL_TIME_IO - if ((time_uptime - io->io_hdr.start_time) > ctl_time_io_secs) { - char str[256]; - char path_str[64]; - struct sbuf sb; - - ctl_scsi_path_string(io, path_str, sizeof(path_str)); - sbuf_new(&sb, str, sizeof(str), SBUF_FIXEDLEN); - - sbuf_cat(&sb, path_str); - switch (io->io_hdr.io_type) { - case CTL_IO_SCSI: - ctl_scsi_command_string(&io->scsiio, NULL, &sb); - sbuf_printf(&sb, "\n"); - sbuf_cat(&sb, path_str); - sbuf_printf(&sb, "Tag: 0x%04x/%d, Prio: %d\n", - io->scsiio.tag_num, io->scsiio.tag_type, - io->scsiio.priority); - break; - case CTL_IO_TASK: - sbuf_printf(&sb, "Task Action: %d Tag: 0x%04x/%d\n", - io->taskio.task_action, - io->taskio.tag_num, io->taskio.tag_type); - break; - default: - panic("%s: Invalid CTL I/O type %d\n", - __func__, io->io_hdr.io_type); - } - sbuf_cat(&sb, path_str); - sbuf_printf(&sb, "ctl_datamove: %jd seconds\n", - (intmax_t)time_uptime - io->io_hdr.start_time); - sbuf_finish(&sb); - printf("%s", sbuf_data(&sb)); - } + getbinuptime(&io->io_hdr.dma_start_bt); #endif /* CTL_TIME_IO */ #ifdef CTL_IO_DELAY @@ -12555,18 +12550,15 @@ ctl_datamove(union ctl_io *io) io->io_hdr.nexus.targ_port, io->io_hdr.nexus.targ_lun); io->io_hdr.port_status = 31337; - /* - * Note that the backend, in this case, will get the - * callback in its context. In other cases it may get - * called in the frontend's interrupt thread context. - */ - io->scsiio.be_move_done(io); + ctl_datamove_done_process(io); + io->scsiio.be_move_done(io, true); return; } /* Don't confuse frontend with zero length data move. */ if (io->scsiio.kern_data_len == 0) { - io->scsiio.be_move_done(io); + ctl_datamove_done_process(io); + io->scsiio.be_move_done(io, true); return; } @@ -12653,7 +12645,7 @@ ctl_datamove_remote_write_cb(struct ctl_ha_dt_req *rq) * need to push it over to the remote controller's memory. */ static int -ctl_datamove_remote_dm_write_cb(union ctl_io *io) +ctl_datamove_remote_dm_write_cb(union ctl_io *io, bool samethr) { int retval; @@ -12692,7 +12684,7 @@ ctl_datamove_remote_write(union ctl_io *io) } static int -ctl_datamove_remote_dm_read_cb(union ctl_io *io) +ctl_datamove_remote_dm_read_cb(union ctl_io *io, bool samethr) { uint32_t i; diff --git a/sys/cam/ctl/ctl.h b/sys/cam/ctl/ctl.h index 56dd5313b4cb..be3e4a37b157 100644 --- a/sys/cam/ctl/ctl.h +++ b/sys/cam/ctl/ctl.h @@ -170,7 +170,8 @@ int ctl_sap_log_sense_handler(struct ctl_scsiio *ctsio, int ctl_ie_log_sense_handler(struct ctl_scsiio *ctsio, struct ctl_page_index *page_index, int pc); -int ctl_config_move_done(union ctl_io *io); +int ctl_config_move_done(union ctl_io *io, bool samethr); +void ctl_datamove_done(union ctl_io *io, bool samethr); void ctl_datamove(union ctl_io *io); void ctl_serseq_done(union ctl_io *io); void ctl_done(union ctl_io *io); diff --git a/sys/cam/ctl/ctl_backend.h b/sys/cam/ctl/ctl_backend.h index 4d75a20f3559..35113f4750d8 100644 --- a/sys/cam/ctl/ctl_backend.h +++ b/sys/cam/ctl/ctl_backend.h @@ -187,7 +187,6 @@ struct ctl_backend_driver { be_init_t init; /* passed to CTL */ be_shutdown_t shutdown; /* passed to CTL */ be_func_t data_submit; /* passed to CTL */ - be_func_t data_move_done; /* passed to CTL */ be_func_t config_read; /* passed to CTL */ be_func_t config_write; /* passed to CTL */ be_ioctl_t ioctl; /* passed to CTL */ diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index 2ed3cf32abe9..abcd8d6e6fae 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -234,7 +234,7 @@ SYSCTL_INT(_kern_cam_ctl_block, OID_AUTO, num_threads, CTLFLAG_RWTUN, static struct ctl_be_block_io *ctl_alloc_beio(struct ctl_be_block_softc *softc); static void ctl_free_beio(struct ctl_be_block_io *beio); static void ctl_complete_beio(struct ctl_be_block_io *beio); -static int ctl_be_block_move_done(union ctl_io *io); +static int ctl_be_block_move_done(union ctl_io *io, bool samethr); static void ctl_be_block_biodone(struct bio *bio); static void ctl_be_block_flush_file(struct ctl_be_block_lun *be_lun, struct ctl_be_block_io *beio); @@ -290,7 +290,6 @@ static struct ctl_backend_driver ctl_be_block_driver = .init = ctl_be_block_init, .shutdown = ctl_be_block_shutdown, .data_submit = ctl_be_block_submit, - .data_move_done = ctl_be_block_move_done, .config_read = ctl_be_block_config_read, .config_write = ctl_be_block_config_write, .ioctl = ctl_be_block_ioctl, @@ -412,46 +411,23 @@ ctl_be_block_compare(union ctl_io *io) } static int -ctl_be_block_move_done(union ctl_io *io) +ctl_be_block_move_done(union ctl_io *io, bool samethr) { struct ctl_be_block_io *beio; struct ctl_be_block_lun *be_lun; struct ctl_lba_len_flags *lbalen; -#ifdef CTL_TIME_IO - struct bintime cur_bt; -#endif beio = (struct ctl_be_block_io *)PRIV(io)->ptr; be_lun = beio->lun; DPRINTF("entered\n"); - -#ifdef CTL_TIME_IO - getbinuptime(&cur_bt); - bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt); - bintime_add(&io->io_hdr.dma_bt, &cur_bt); -#endif - io->io_hdr.num_dmas++; io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; /* - * We set status at this point for read commands, and write - * commands with errors. + * We set status at this point for read and compare commands. */ - if (io->io_hdr.flags & CTL_FLAG_ABORT) { - ; - } else if ((io->io_hdr.port_status != 0) && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, - /*retry_count*/ io->io_hdr.port_status); - } else if (io->scsiio.kern_data_resid != 0 && - (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_invalid_field_ciu(&io->scsiio); - } else if ((io->io_hdr.port_status == 0) && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { + if ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0 && + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE) { lbalen = ARGS(beio->io); if (lbalen->flags & CTL_LLF_READ) { ctl_set_success(&io->scsiio); @@ -472,18 +448,22 @@ ctl_be_block_move_done(union ctl_io *io) } /* - * At this point, we have a write and the DMA completed - * successfully. We now have to queue it to the task queue to + * At this point, we have a write and the DMA completed successfully. + * If we were called synchronously in the original thread then just + * dispatch, otherwise we now have to queue it to the task queue to * execute the backend I/O. That is because we do blocking * memory allocations, and in the file backing case, blocking I/O. * This move done routine is generally called in the SIM's * interrupt context, and therefore we cannot block. */ - mtx_lock(&be_lun->queue_lock); - STAILQ_INSERT_TAIL(&be_lun->datamove_queue, &io->io_hdr, links); - mtx_unlock(&be_lun->queue_lock); - taskqueue_enqueue(be_lun->io_taskqueue, &be_lun->io_task); - + if (samethr) { + be_lun->dispatch(be_lun, beio); + } else { + mtx_lock(&be_lun->queue_lock); + STAILQ_INSERT_TAIL(&be_lun->datamove_queue, &io->io_hdr, links); + mtx_unlock(&be_lun->queue_lock); + taskqueue_enqueue(be_lun->io_taskqueue, &be_lun->io_task); + } return (0); } @@ -578,9 +558,6 @@ ctl_be_block_biodone(struct bio *bio) ctl_set_success(&io->scsiio); ctl_serseq_done(io); } -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } } @@ -795,9 +772,6 @@ ctl_be_block_dispatch_file(struct ctl_be_block_lun *be_lun, ctl_set_success(&io->scsiio); ctl_serseq_done(io); } -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } } @@ -966,9 +940,6 @@ ctl_be_block_dispatch_zvol(struct ctl_be_block_lun *be_lun, ctl_set_success(&io->scsiio); ctl_serseq_done(io); } -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } } @@ -1663,9 +1634,6 @@ ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun, be_lun->dispatch(be_lun, beio); } else { SDT_PROBE0(cbb, , write, alloc_done); -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } } diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c index 2595aa0be00e..e67d699bda70 100644 --- a/sys/cam/ctl/ctl_backend_ramdisk.c +++ b/sys/cam/ctl/ctl_backend_ramdisk.c @@ -139,7 +139,7 @@ extern struct ctl_softc *control_softc; static int ctl_backend_ramdisk_init(void); static int ctl_backend_ramdisk_shutdown(void); -static int ctl_backend_ramdisk_move_done(union ctl_io *io); +static int ctl_backend_ramdisk_move_done(union ctl_io *io, bool samethr); static void ctl_backend_ramdisk_compare(union ctl_io *io); static void ctl_backend_ramdisk_rw(union ctl_io *io); static int ctl_backend_ramdisk_submit(union ctl_io *io); @@ -164,7 +164,6 @@ static struct ctl_backend_driver ctl_be_ramdisk_driver = .init = ctl_backend_ramdisk_init, .shutdown = ctl_backend_ramdisk_shutdown, .data_submit = ctl_backend_ramdisk_submit, - .data_move_done = ctl_backend_ramdisk_move_done, .config_read = ctl_backend_ramdisk_config_read, .config_write = ctl_backend_ramdisk_config_write, .ioctl = ctl_backend_ramdisk_ioctl, @@ -402,38 +401,17 @@ ctl_backend_ramdisk_cmp(union ctl_io *io) } static int -ctl_backend_ramdisk_move_done(union ctl_io *io) +ctl_backend_ramdisk_move_done(union ctl_io *io, bool samethr) { struct ctl_be_ramdisk_lun *be_lun = (struct ctl_be_ramdisk_lun *)CTL_BACKEND_LUN(io); -#ifdef CTL_TIME_IO - struct bintime cur_bt; -#endif CTL_DEBUG_PRINT(("ctl_backend_ramdisk_move_done\n")); -#ifdef CTL_TIME_IO - getbinuptime(&cur_bt); - bintime_sub(&cur_bt, &io->io_hdr.dma_start_bt); - bintime_add(&io->io_hdr.dma_bt, &cur_bt); -#endif - io->io_hdr.num_dmas++; if (io->scsiio.kern_sg_entries > 0) free(io->scsiio.kern_data_ptr, M_RAMDISK); io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; - if (io->io_hdr.flags & CTL_FLAG_ABORT) { - ; - } else if (io->io_hdr.port_status != 0 && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_internal_failure(&io->scsiio, /*sks_valid*/ 1, - /*retry_count*/ io->io_hdr.port_status); - } else if (io->scsiio.kern_data_resid != 0 && - (io->io_hdr.flags & CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_OUT && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || - (io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS)) { - ctl_set_invalid_field_ciu(&io->scsiio); - } else if ((io->io_hdr.port_status == 0) && - ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE)) { + if ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0 && + (io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE) { if (ARGS(io)->flags & CTL_LLF_COMPARE) { /* We have data block ready for comparison. */ if (ctl_backend_ramdisk_cmp(io)) @@ -471,9 +449,6 @@ ctl_backend_ramdisk_compare(union ctl_io *io) io->scsiio.kern_sg_entries = 0; io->io_hdr.flags |= CTL_FLAG_ALLOCATED; PRIV(io)->len += lbas; -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } @@ -534,9 +509,6 @@ nospc: ctl_set_success(&io->scsiio); ctl_serseq_done(io); } -#ifdef CTL_TIME_IO - getbinuptime(&io->io_hdr.dma_start_bt); -#endif ctl_datamove(io); } diff --git a/sys/cam/ctl/ctl_frontend_cam_sim.c b/sys/cam/ctl/ctl_frontend_cam_sim.c index 0f40760f1dc1..3afe68cc7bde 100644 --- a/sys/cam/ctl/ctl_frontend_cam_sim.c +++ b/sys/cam/ctl/ctl_frontend_cam_sim.c @@ -416,7 +416,7 @@ cfcs_datamove(union ctl_io *io) xpt_done(ccb); } - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); } static void diff --git a/sys/cam/ctl/ctl_frontend_ioctl.c b/sys/cam/ctl/ctl_frontend_ioctl.c index b0298728e8db..f2403353a060 100644 --- a/sys/cam/ctl/ctl_frontend_ioctl.c +++ b/sys/cam/ctl/ctl_frontend_ioctl.c @@ -568,7 +568,7 @@ cfi_submit_wait(union ctl_io *io) * will immediately call back and wake us up, * probably using our own context. */ - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); break; case CTL_IOCTL_DONE: mtx_unlock(¶ms.ioctl_mtx); diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c index 4ad238ea6909..82ab2fc3b8c6 100644 --- a/sys/cam/ctl/ctl_frontend_iscsi.c +++ b/sys/cam/ctl/ctl_frontend_iscsi.c @@ -923,7 +923,7 @@ cfiscsi_pdu_handle_data_out(struct icl_pdu *request) cfiscsi_data_wait_free(cs, cdw); io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; if (done) - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); else cfiscsi_datamove_out(io); } @@ -1136,7 +1136,7 @@ cfiscsi_session_terminate_tasks(struct cfiscsi_session *cs) */ cdw->cdw_ctl_io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; cdw->cdw_ctl_io->scsiio.io_hdr.port_status = 42; - cdw->cdw_ctl_io->scsiio.be_move_done(cdw->cdw_ctl_io); + ctl_datamove_done(cdw->cdw_ctl_io, false); cfiscsi_data_wait_free(cs, cdw); CFISCSI_SESSION_LOCK(cs); } @@ -2469,7 +2469,7 @@ cfiscsi_datamove_in(union ctl_io *io) CFISCSI_SESSION_DEBUG(cs, "buffer_offset = %zd, " "already sent the expected len", buffer_offset); #endif - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } @@ -2485,7 +2485,7 @@ cfiscsi_datamove_in(union ctl_io *io) CFISCSI_SESSION_WARN(cs, "failed to " "allocate memory; dropping connection"); ctl_set_busy(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); cfiscsi_session_terminate(cs); return; } @@ -2542,7 +2542,7 @@ cfiscsi_datamove_in(union ctl_io *io) "allocate memory; dropping connection"); icl_pdu_free(response); ctl_set_busy(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); cfiscsi_session_terminate(cs); return; } @@ -2622,7 +2622,7 @@ cfiscsi_datamove_in(union ctl_io *io) cfiscsi_pdu_queue(response); } - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); } static void @@ -2651,9 +2651,10 @@ cfiscsi_datamove_out(union ctl_io *io) */ expected_len = ntohl(bhssc->bhssc_expected_data_transfer_length); if (io->scsiio.kern_rel_offset >= expected_len) { - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } + datamove_len = MIN(io->scsiio.kern_data_len, expected_len - io->scsiio.kern_rel_offset); @@ -2669,7 +2670,7 @@ cfiscsi_datamove_out(union ctl_io *io) CFISCSI_SESSION_WARN(cs, "failed to " "allocate memory; dropping connection"); ctl_set_busy(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); cfiscsi_session_terminate(cs); return; } @@ -2716,7 +2717,7 @@ cfiscsi_datamove_out(union ctl_io *io) done = cfiscsi_handle_data_segment(request, cdw); if (done) { cfiscsi_data_wait_free(cs, cdw); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); return; } } @@ -2739,7 +2740,7 @@ cfiscsi_datamove_out(union ctl_io *io) CFISCSI_SESSION_WARN(cs, "failed to " "allocate memory; dropping connection"); ctl_set_busy(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); cfiscsi_session_terminate(cs); return; } @@ -2920,7 +2921,7 @@ cfiscsi_task_management_done(union ctl_io *io) cdw, cdw_next); io->io_hdr.flags &= ~CTL_FLAG_DMA_INPROG; cdw->cdw_ctl_io->scsiio.io_hdr.port_status = 43; - cdw->cdw_ctl_io->scsiio.be_move_done(cdw->cdw_ctl_io); + ctl_datamove_done(cdw->cdw_ctl_io, false); cfiscsi_data_wait_free(cs, cdw); } CFISCSI_SESSION_UNLOCK(cs); diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h index eb63e5be1874..01887c20a822 100644 --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -328,7 +328,7 @@ struct ctl_scsiio { ctl_tag_type tag_type; /* simple, ordered, head of queue,etc.*/ uint8_t cdb_len; /* CDB length */ uint8_t cdb[CTL_MAX_CDBLEN]; /* CDB */ - int (*be_move_done)(union ctl_io *io); /* called by fe */ + int (*be_move_done)(union ctl_io *io, bool samethr); /* called by fe */ int (*io_cont)(union ctl_io *io); /* to continue processing */ }; diff --git a/sys/cam/ctl/ctl_tpc_local.c b/sys/cam/ctl/ctl_tpc_local.c index 60a8630218af..3a5e08f0a6ce 100644 --- a/sys/cam/ctl/ctl_tpc_local.c +++ b/sys/cam/ctl/ctl_tpc_local.c @@ -255,7 +255,7 @@ tpcl_datamove(union ctl_io *io) __func__, ctsio->ext_data_len, ctsio->kern_data_len)); bailout: - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); } static void diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index fc611fa641fa..dc0828e9911b 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -1396,8 +1396,7 @@ ctlfedone(struct cam_periph *periph, union ccb *done_ccb) xpt_release_ccb(done_ccb); mtx_unlock(mtx); - /* Call the backend move done callback */ - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); } return; } diff --git a/sys/dev/usb/storage/cfumass.c b/sys/dev/usb/storage/cfumass.c index f424c977ce78..ff64440ac1eb 100644 --- a/sys/dev/usb/storage/cfumass.c +++ b/sys/dev/usb/storage/cfumass.c @@ -478,7 +478,7 @@ cfumass_terminate(struct cfumass_softc *sc) if (sc->sc_ctl_io != NULL) { CFUMASS_DEBUG(sc, "terminating CTL transfer"); ctl_set_data_phase_error(&sc->sc_ctl_io->scsiio); - sc->sc_ctl_io->scsiio.be_move_done(sc->sc_ctl_io); + ctl_datamove_done(sc->sc_ctl_io, false); sc->sc_ctl_io = NULL; } @@ -733,7 +733,7 @@ cfumass_t_data_callback(struct usb_xfer *xfer, usb_error_t usb_error) sc->sc_current_residue == 0 || io->scsiio.kern_data_resid == 0) { sc->sc_ctl_io = NULL; - io->scsiio.be_move_done(io); + ctl_datamove_done(io, false); break; } /* FALLTHROUGH */ @@ -890,7 +890,7 @@ cfumass_datamove(union ctl_io *io) fail: ctl_set_data_phase_error(&io->scsiio); - io->scsiio.be_move_done(io); + ctl_datamove_done(io, true); sc->sc_ctl_io = NULL; } From owner-dev-commits-src-all@freebsd.org Mon Mar 15 03:01:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A95C156CA2D; Mon, 15 Mar 2021 03:01: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 4DzLm241CKz3QLd; Mon, 15 Mar 2021 03:01: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 7B291FFF; Mon, 15 Mar 2021 03:01: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 12F31MmY097899; Mon, 15 Mar 2021 03:01:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F31MHE097898; Mon, 15 Mar 2021 03:01:22 GMT (envelope-from git) Date: Mon, 15 Mar 2021 03:01:22 GMT Message-Id: <202103150301.12F31MHE097898@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 2a99726fdc54 - stable/12 - Microoptimize CTL I/O queues. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2a99726fdc5424599cd987aa87689a3e75fa734e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 03:01:22 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=2a99726fdc5424599cd987aa87689a3e75fa734e commit 2a99726fdc5424599cd987aa87689a3e75fa734e Author: Alexander Motin AuthorDate: 2021-02-19 20:42:57 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:44:47 +0000 Microoptimize CTL I/O queues. Switch OOA queue from TAILQ to LIST and change its direction, so that we traverse it forward, not backward. There is only one place where we really need other direction, and it is not critical. Use STAILQ_REMOVE_HEAD() instead of STAILQ_REMOVE() in backends. Replace few impossible conditions with assertions. MFC after: 1 month (cherry picked from commit 05d882b780f5be2da6f3d3bfef9160aacc4888d6) --- sys/cam/ctl/ctl.c | 136 ++++++++++++++++++++------------------ sys/cam/ctl/ctl_backend_block.c | 19 ++---- sys/cam/ctl/ctl_backend_ramdisk.c | 3 +- sys/cam/ctl/ctl_io.h | 2 +- sys/cam/ctl/ctl_private.h | 2 +- sys/cam/ctl/scsi_ctl.c | 2 +- 6 files changed, 81 insertions(+), 83 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 002d43303b79..b9d13a2e8c5d 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -2326,12 +2326,12 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) * particular LUN, and stays there until completion. */ #ifdef CTL_TIME_IO - if (TAILQ_EMPTY(&lun->ooa_queue)) + if (LIST_EMPTY(&lun->ooa_queue)) lun->idle_time += getsbinuptime() - lun->last_busy; #endif - TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_INSERT_HEAD(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); - bio = (union ctl_io *)TAILQ_PREV(&ctsio->io_hdr, ctl_ooaq, ooa_links); + bio = (union ctl_io *)LIST_NEXT(&ctsio->io_hdr, ooa_links); switch (ctl_check_ooa(lun, (union ctl_io *)ctsio, &bio)) { case CTL_ACTION_BLOCK: ctsio->io_hdr.blocker = bio; @@ -2358,18 +2358,18 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) } break; case CTL_ACTION_OVERLAP: - TAILQ_REMOVE(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_REMOVE(&ctsio->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); ctl_set_overlapped_cmd(ctsio); goto badjuju; case CTL_ACTION_OVERLAP_TAG: - TAILQ_REMOVE(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_REMOVE(&ctsio->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); ctl_set_overlapped_tag(ctsio, ctsio->tag_num); goto badjuju; case CTL_ACTION_ERROR: default: - TAILQ_REMOVE(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_REMOVE(&ctsio->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); ctl_set_internal_failure(ctsio, /*sks_valid*/ 0, @@ -2393,20 +2393,28 @@ static void ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, struct ctl_ooa *ooa_hdr, struct ctl_ooa_entry *kern_entries) { - union ctl_io *io; + struct ctl_io_hdr *ioh; mtx_lock(&lun->lun_lock); - for (io = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); (io != NULL); - (*cur_fill_num)++, io = (union ctl_io *)TAILQ_NEXT(&io->io_hdr, - ooa_links)) { + ioh = LIST_FIRST(&lun->ooa_queue); + if (ioh == NULL) { + mtx_unlock(&lun->lun_lock); + return; + } + while (LIST_NEXT(ioh, ooa_links) != NULL) + ioh = LIST_NEXT(ioh, ooa_links); + for ( ; ioh; ioh = LIST_PREV(ioh, &lun->ooa_queue, ctl_io_hdr, ooa_links)) { + union ctl_io *io = (union ctl_io *)ioh; struct ctl_ooa_entry *entry; /* * If we've got more than we can fit, just count the * remaining entries. */ - if (*cur_fill_num >= ooa_hdr->alloc_num) + if (*cur_fill_num >= ooa_hdr->alloc_num) { + (*cur_fill_num)++; continue; + } entry = &kern_entries[*cur_fill_num]; @@ -2437,6 +2445,7 @@ ctl_ioctl_fill_ooa(struct ctl_lun *lun, uint32_t *cur_fill_num, if (io->io_hdr.flags & CTL_FLAG_STATUS_SENT) entry->cmd_flags |= CTL_OOACMD_FLAG_STATUS_SENT; + (*cur_fill_num)++; } mtx_unlock(&lun->lun_lock); } @@ -4674,7 +4683,7 @@ fail: #ifdef CTL_TIME_IO lun->last_busy = getsbinuptime(); #endif - TAILQ_INIT(&lun->ooa_queue); + LIST_INIT(&lun->ooa_queue); STAILQ_INIT(&lun->error_list); lun->ie_reported = 1; callout_init_mtx(&lun->ie_callout, &lun->lun_lock, 0); @@ -4737,7 +4746,7 @@ ctl_free_lun(struct ctl_lun *lun) struct ctl_lun *nlun; int i; - KASSERT(TAILQ_EMPTY(&lun->ooa_queue), + KASSERT(LIST_EMPTY(&lun->ooa_queue), ("Freeing a LUN %p with outstanding I/O!\n", lun)); mtx_lock(&softc->ctl_lock); @@ -4984,7 +4993,7 @@ ctl_remove_lun(struct ctl_be_lun *be_lun) * If we have something in the OOA queue, we'll free it when the * last I/O completes. */ - if (TAILQ_EMPTY(&lun->ooa_queue)) { + if (LIST_EMPTY(&lun->ooa_queue)) { mtx_unlock(&lun->lun_lock); ctl_free_lun(lun); } else @@ -5029,7 +5038,7 @@ ctl_config_move_done(union ctl_io *io) CTL_DEBUG_PRINT(("ctl_config_move_done\n")); KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, - ("Config I/O type isn't CTL_IO_SCSI (%d)!", io->io_hdr.io_type)); + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); if ((io->io_hdr.port_status != 0) && ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE || @@ -10683,8 +10692,9 @@ ctl_read_toc(struct ctl_scsiio *ctsio) static int ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint64_t *len) { - if (io->io_hdr.io_type != CTL_IO_SCSI) - return (1); + + KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); switch (io->scsiio.cdb[0]) { case COMPARE_AND_WRITE: { @@ -10863,9 +10873,11 @@ ctl_extent_check_unmap(union ctl_io *io, uint64_t lba2, uint64_t len2) uint64_t lba; uint32_t len; + KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); + /* If not UNMAP -- go other way. */ - if (io->io_hdr.io_type != CTL_IO_SCSI || - io->scsiio.cdb[0] != UNMAP) + if (io->scsiio.cdb[0] != UNMAP) return (CTL_ACTION_ERROR); /* If UNMAP without data -- block and wait for data. */ @@ -11085,8 +11097,7 @@ ctl_check_ooa(struct ctl_lun *lun, union ctl_io *pending_io, * CTL_ACTION_PASS. */ for (ooa_io = *starting_io; ooa_io != NULL; - ooa_io = (union ctl_io *)TAILQ_PREV(&ooa_io->io_hdr, ctl_ooaq, - ooa_links)){ + ooa_io = (union ctl_io *)LIST_NEXT(&ooa_io->io_hdr, ooa_links)) { action = ctl_check_for_blockage(lun, pending_io, ooa_io); if (action != CTL_ACTION_PASS) { *starting_io = ooa_io; @@ -11121,8 +11132,7 @@ ctl_try_unblock_io(struct ctl_lun *lun, union ctl_io *io, bool skip) obio = bio = io->io_hdr.blocker; if (skip) - bio = (union ctl_io *)TAILQ_PREV(&bio->io_hdr, ctl_ooaq, - ooa_links); + bio = (union ctl_io *)LIST_NEXT(&bio->io_hdr, ooa_links); action = ctl_check_ooa(lun, io, &bio); if (action == CTL_ACTION_BLOCK) { /* Still blocked, but may be by different I/O now. */ @@ -11188,7 +11198,7 @@ error: if ((io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) && (softc->ha_mode != CTL_HA_MODE_XFER)) { ctl_try_unblock_others(lun, io, TRUE); - TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); + LIST_REMOVE(&io->io_hdr, ooa_links); ctl_copy_sense_data_back(io, &msg_info); msg_info.hdr.original_sc = io->io_hdr.remote_io; @@ -11390,7 +11400,7 @@ ctl_failover_lun(union ctl_io *rio) } if (softc->ha_mode == CTL_HA_MODE_XFER) { - TAILQ_FOREACH_SAFE(io, &lun->ooa_queue, ooa_links, next_io) { + LIST_FOREACH_SAFE(io, &lun->ooa_queue, ooa_links, next_io) { /* We are master */ if (io->flags & CTL_FLAG_FROM_OTHER_SC) { if (io->flags & CTL_FLAG_IO_ACTIVE) { @@ -11419,7 +11429,7 @@ ctl_failover_lun(union ctl_io *rio) } } } else { /* SERIALIZE modes */ - TAILQ_FOREACH_SAFE(io, &lun->ooa_queue, ooa_links, next_io) { + LIST_FOREACH_SAFE(io, &lun->ooa_queue, ooa_links, next_io) { /* We are master */ if (io->flags & CTL_FLAG_FROM_OTHER_SC) { if (io->blocker != NULL) { @@ -11429,7 +11439,7 @@ ctl_failover_lun(union ctl_io *rio) } ctl_try_unblock_others(lun, (union ctl_io *)io, TRUE); - TAILQ_REMOVE(&lun->ooa_queue, io, ooa_links); + LIST_REMOVE(io, ooa_links); ctl_free_io((union ctl_io *)io); } else /* We are slave */ @@ -11480,10 +11490,10 @@ ctl_scsiio_precheck(struct ctl_scsiio *ctsio) * and stays there until completion. */ #ifdef CTL_TIME_IO - if (TAILQ_EMPTY(&lun->ooa_queue)) + if (LIST_EMPTY(&lun->ooa_queue)) lun->idle_time += getsbinuptime() - lun->last_busy; #endif - TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); + LIST_INSERT_HEAD(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); } /* Get command entry and return error if it is unsuppotyed. */ @@ -11628,7 +11638,7 @@ ctl_scsiio_precheck(struct ctl_scsiio *ctsio) return; } - bio = (union ctl_io *)TAILQ_PREV(&ctsio->io_hdr, ctl_ooaq, ooa_links); + bio = (union ctl_io *)LIST_NEXT(&ctsio->io_hdr, ooa_links); switch (ctl_check_ooa(lun, (union ctl_io *)ctsio, &bio)) { case CTL_ACTION_BLOCK: ctsio->io_hdr.blocker = bio; @@ -11836,15 +11846,14 @@ ctl_target_reset(union ctl_io *io) static void ctl_do_lun_reset(struct ctl_lun *lun, uint32_t initidx, ctl_ua_type ua_type) { - union ctl_io *xio; + struct ctl_io_hdr *xioh; int i; mtx_lock(&lun->lun_lock); /* Abort tasks. */ - for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; - xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { - xio->io_hdr.flags |= CTL_FLAG_ABORT | CTL_FLAG_ABORT_STATUS; - ctl_try_unblock_io(lun, xio, FALSE); + LIST_FOREACH(xioh, &lun->ooa_queue, ooa_links) { + xioh->flags |= CTL_FLAG_ABORT | CTL_FLAG_ABORT_STATUS; + ctl_try_unblock_io(lun, (union ctl_io *)xioh, FALSE); } /* Clear CA. */ for (i = 0; i < ctl_max_ports; i++) { @@ -11908,7 +11917,7 @@ static void ctl_abort_tasks_lun(struct ctl_lun *lun, uint32_t targ_port, uint32_t init_id, int other_sc) { - union ctl_io *xio; + struct ctl_io_hdr *xioh; mtx_assert(&lun->lun_lock, MA_OWNED); @@ -11919,21 +11928,20 @@ ctl_abort_tasks_lun(struct ctl_lun *lun, uint32_t targ_port, uint32_t init_id, * untagged command to abort, simply abort the first untagged command * we come to. We only allow one untagged command at a time of course. */ - for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; - xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { - + LIST_FOREACH(xioh, &lun->ooa_queue, ooa_links) { + union ctl_io *xio = (union ctl_io *)xioh; if ((targ_port == UINT32_MAX || - targ_port == xio->io_hdr.nexus.targ_port) && + targ_port == xioh->nexus.targ_port) && (init_id == UINT32_MAX || - init_id == xio->io_hdr.nexus.initid)) { - if (targ_port != xio->io_hdr.nexus.targ_port || - init_id != xio->io_hdr.nexus.initid) - xio->io_hdr.flags |= CTL_FLAG_ABORT_STATUS; - xio->io_hdr.flags |= CTL_FLAG_ABORT; + init_id == xioh->nexus.initid)) { + if (targ_port != xioh->nexus.targ_port || + init_id != xioh->nexus.initid) + xioh->flags |= CTL_FLAG_ABORT_STATUS; + xioh->flags |= CTL_FLAG_ABORT; if (!other_sc && !(lun->flags & CTL_LUN_PRIMARY_SC)) { union ctl_ha_msg msg_info; - msg_info.hdr.nexus = xio->io_hdr.nexus; + msg_info.hdr.nexus = xioh->nexus; msg_info.task.task_action = CTL_TASK_ABORT_TASK; msg_info.task.tag_num = xio->scsiio.tag_num; msg_info.task.tag_type = xio->scsiio.tag_type; @@ -12046,7 +12054,7 @@ static int ctl_abort_task(union ctl_io *io) { struct ctl_softc *softc = CTL_SOFTC(io); - union ctl_io *xio; + struct ctl_io_hdr *xioh; struct ctl_lun *lun; uint32_t targ_lun; @@ -12071,12 +12079,11 @@ ctl_abort_task(union ctl_io *io) * untagged command to abort, simply abort the first untagged command * we come to. We only allow one untagged command at a time of course. */ - for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; - xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { - - if ((xio->io_hdr.nexus.targ_port != io->io_hdr.nexus.targ_port) - || (xio->io_hdr.nexus.initid != io->io_hdr.nexus.initid) - || (xio->io_hdr.flags & CTL_FLAG_ABORT)) + LIST_FOREACH(xioh, &lun->ooa_queue, ooa_links) { + union ctl_io *xio = (union ctl_io *)xioh; + if ((xioh->nexus.targ_port != io->io_hdr.nexus.targ_port) + || (xioh->nexus.initid != io->io_hdr.nexus.initid) + || (xioh->flags & CTL_FLAG_ABORT)) continue; /* @@ -12101,7 +12108,7 @@ ctl_abort_task(union ctl_io *io) */ if (xio->scsiio.tag_num == io->taskio.tag_num) { #endif - xio->io_hdr.flags |= CTL_FLAG_ABORT; + xioh->flags |= CTL_FLAG_ABORT; if ((io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) == 0 && !(lun->flags & CTL_LUN_PRIMARY_SC)) { union ctl_ha_msg msg_info; @@ -12128,7 +12135,7 @@ static int ctl_query_task(union ctl_io *io, int task_set) { struct ctl_softc *softc = CTL_SOFTC(io); - union ctl_io *xio; + struct ctl_io_hdr *xioh; struct ctl_lun *lun; int found = 0; uint32_t targ_lun; @@ -12143,12 +12150,11 @@ ctl_query_task(union ctl_io *io, int task_set) } mtx_lock(&lun->lun_lock); mtx_unlock(&softc->ctl_lock); - for (xio = (union ctl_io *)TAILQ_FIRST(&lun->ooa_queue); xio != NULL; - xio = (union ctl_io *)TAILQ_NEXT(&xio->io_hdr, ooa_links)) { - - if ((xio->io_hdr.nexus.targ_port != io->io_hdr.nexus.targ_port) - || (xio->io_hdr.nexus.initid != io->io_hdr.nexus.initid) - || (xio->io_hdr.flags & CTL_FLAG_ABORT)) + LIST_FOREACH(xioh, &lun->ooa_queue, ooa_links) { + union ctl_io *xio = (union ctl_io *)xioh; + if ((xioh->nexus.targ_port != io->io_hdr.nexus.targ_port) + || (xioh->nexus.initid != io->io_hdr.nexus.initid) + || (xioh->flags & CTL_FLAG_ABORT)) continue; if (task_set || xio->scsiio.tag_num == io->taskio.tag_num) { @@ -12293,7 +12299,7 @@ ctl_handle_isc(union ctl_io *io) } mtx_lock(&lun->lun_lock); ctl_try_unblock_others(lun, io, TRUE); - TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); + LIST_REMOVE(&io->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); ctl_free_io(io); break; @@ -13128,9 +13134,9 @@ ctl_process_done(union ctl_io *io) /* * Remove this from the OOA queue. */ - TAILQ_REMOVE(&lun->ooa_queue, &io->io_hdr, ooa_links); + LIST_REMOVE(&io->io_hdr, ooa_links); #ifdef CTL_TIME_IO - if (TAILQ_EMPTY(&lun->ooa_queue)) + if (LIST_EMPTY(&lun->ooa_queue)) lun->last_busy = getsbinuptime(); #endif @@ -13139,7 +13145,7 @@ ctl_process_done(union ctl_io *io) * left on its OOA queue. */ if ((lun->flags & CTL_LUN_INVALID) - && TAILQ_EMPTY(&lun->ooa_queue)) { + && LIST_EMPTY(&lun->ooa_queue)) { mtx_unlock(&lun->lun_lock); ctl_free_lun(lun); } else diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index d876691a9fa1..2ed3cf32abe9 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -1689,8 +1689,7 @@ ctl_be_block_worker(void *context, int pending) io = (union ctl_io *)STAILQ_FIRST(&be_lun->datamove_queue); if (io != NULL) { DPRINTF("datamove queue\n"); - STAILQ_REMOVE(&be_lun->datamove_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->datamove_queue, links); mtx_unlock(&be_lun->queue_lock); beio = (struct ctl_be_block_io *)PRIV(io)->ptr; if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { @@ -1704,8 +1703,7 @@ ctl_be_block_worker(void *context, int pending) io = (union ctl_io *)STAILQ_FIRST(&be_lun->config_write_queue); if (io != NULL) { DPRINTF("config write queue\n"); - STAILQ_REMOVE(&be_lun->config_write_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->config_write_queue, links); mtx_unlock(&be_lun->queue_lock); if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); @@ -1718,8 +1716,7 @@ ctl_be_block_worker(void *context, int pending) io = (union ctl_io *)STAILQ_FIRST(&be_lun->config_read_queue); if (io != NULL) { DPRINTF("config read queue\n"); - STAILQ_REMOVE(&be_lun->config_read_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->config_read_queue, links); mtx_unlock(&be_lun->queue_lock); if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); @@ -1732,8 +1729,7 @@ ctl_be_block_worker(void *context, int pending) io = (union ctl_io *)STAILQ_FIRST(&be_lun->input_queue); if (io != NULL) { DPRINTF("input queue\n"); - STAILQ_REMOVE(&be_lun->input_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->input_queue, links); mtx_unlock(&be_lun->queue_lock); if (cbe_lun->flags & CTL_LUN_FLAG_NO_MEDIA) { ctl_set_busy(&io->scsiio); @@ -1767,11 +1763,8 @@ ctl_be_block_submit(union ctl_io *io) be_lun = (struct ctl_be_block_lun *)CTL_BACKEND_LUN(io); - /* - * Make sure we only get SCSI I/O. - */ - KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, ("Non-SCSI I/O (type " - "%#x) encountered", io->io_hdr.io_type)); + KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); PRIV(io)->len = 0; diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c index 1f1ca00ff562..2595aa0be00e 100644 --- a/sys/cam/ctl/ctl_backend_ramdisk.c +++ b/sys/cam/ctl/ctl_backend_ramdisk.c @@ -569,8 +569,7 @@ ctl_backend_ramdisk_worker(void *context, int pending) for (;;) { io = (union ctl_io *)STAILQ_FIRST(&be_lun->cont_queue); if (io != NULL) { - STAILQ_REMOVE(&be_lun->cont_queue, &io->io_hdr, - ctl_io_hdr, links); + STAILQ_REMOVE_HEAD(&be_lun->cont_queue, links); mtx_unlock(&be_lun->queue_lock); if (ARGS(io)->flags & CTL_LLF_COMPARE) ctl_backend_ramdisk_compare(io); diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h index 50d76293dc7c..eb63e5be1874 100644 --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -243,7 +243,7 @@ struct ctl_io_hdr { union ctl_priv ctl_private[CTL_NUM_PRIV];/* CTL private area */ TAILQ_HEAD(, ctl_io_hdr) blocked_queue; /* I/Os blocked by this one */ STAILQ_ENTRY(ctl_io_hdr) links; /* linked list pointer */ - TAILQ_ENTRY(ctl_io_hdr) ooa_links; /* ooa_queue links */ + LIST_ENTRY(ctl_io_hdr) ooa_links; /* ooa_queue links */ TAILQ_ENTRY(ctl_io_hdr) blocked_links; /* blocked_queue links */ }; diff --git a/sys/cam/ctl/ctl_private.h b/sys/cam/ctl/ctl_private.h index cf67deb13ef7..8940babd4904 100644 --- a/sys/cam/ctl/ctl_private.h +++ b/sys/cam/ctl/ctl_private.h @@ -391,7 +391,7 @@ struct ctl_lun { sbintime_t idle_time; sbintime_t last_busy; #endif - TAILQ_HEAD(ctl_ooaq, ctl_io_hdr) ooa_queue; + LIST_HEAD(ctl_ooaq, ctl_io_hdr) ooa_queue; STAILQ_ENTRY(ctl_lun) links; struct scsi_sense_data **pending_sense; ctl_ua_type **pending_ua; diff --git a/sys/cam/ctl/scsi_ctl.c b/sys/cam/ctl/scsi_ctl.c index 0bbbe3cb6e2a..fc611fa641fa 100644 --- a/sys/cam/ctl/scsi_ctl.c +++ b/sys/cam/ctl/scsi_ctl.c @@ -1912,7 +1912,7 @@ ctlfe_datamove(union ctl_io *io) struct ctlfe_lun_softc *softc; KASSERT(io->io_hdr.io_type == CTL_IO_SCSI, - ("Unexpected io_type (%d) in ctlfe_datamove", io->io_hdr.io_type)); + ("%s: unexpected I/O type %x", __func__, io->io_hdr.io_type)); io->scsiio.ext_data_filled = 0; ccb = PRIV_CCB(io); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 03:01:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E8B356C8DB; Mon, 15 Mar 2021 03:01: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 4DzLm61p16z3QK5; Mon, 15 Mar 2021 03:01: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 D81DD1201; Mon, 15 Mar 2021 03:01: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 12F31PN9097953; Mon, 15 Mar 2021 03:01:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F31Pt1097952; Mon, 15 Mar 2021 03:01:25 GMT (envelope-from git) Date: Mon, 15 Mar 2021 03:01:25 GMT Message-Id: <202103150301.12F31Pt1097952@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 6469aab051de - stable/12 - Coalesce socket reads in software iSCSI. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6469aab051dee71c88e27aa906c18efa09e77189 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 03:01:27 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=6469aab051dee71c88e27aa906c18efa09e77189 commit 6469aab051dee71c88e27aa906c18efa09e77189 Author: Alexander Motin AuthorDate: 2021-02-22 17:23:35 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:45:25 +0000 Coalesce socket reads in software iSCSI. Instead of 2-4 socket reads per PDU this can do as low as one read per megabyte, dramatically reducing TCP overhead and lock contention. With this on iSCSI target I can write more than 4GB/s through a single connection. MFC after: 1 month (cherry picked from commit 6895f89fe54e0858aea70d2bd2a9651f45d7998e) --- sys/dev/iscsi/icl_soft.c | 258 ++++++++++++++++------------------------------- 1 file changed, 89 insertions(+), 169 deletions(-) diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index dd9210642ffa..caeddc9247ba 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -143,68 +143,6 @@ icl_conn_fail(struct icl_conn *ic) (ic->ic_error)(ic); } -static struct mbuf * -icl_conn_receive(struct icl_conn *ic, size_t len) -{ - struct uio uio; - struct socket *so; - struct mbuf *m; - int error, flags; - - so = ic->ic_socket; - - memset(&uio, 0, sizeof(uio)); - uio.uio_resid = len; - - flags = MSG_DONTWAIT; - error = soreceive(so, NULL, &uio, &m, NULL, &flags); - if (error != 0) { - ICL_DEBUG("soreceive error %d", error); - return (NULL); - } - if (uio.uio_resid != 0) { - m_freem(m); - ICL_DEBUG("short read"); - return (NULL); - } - - return (m); -} - -static int -icl_conn_receive_buf(struct icl_conn *ic, void *buf, size_t len) -{ - struct iovec iov[1]; - struct uio uio; - struct socket *so; - int error, flags; - - so = ic->ic_socket; - - memset(&uio, 0, sizeof(uio)); - iov[0].iov_base = buf; - iov[0].iov_len = len; - uio.uio_iov = iov; - uio.uio_iovcnt = 1; - uio.uio_offset = 0; - uio.uio_resid = len; - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_rw = UIO_READ; - - flags = MSG_DONTWAIT; - error = soreceive(so, NULL, &uio, NULL, NULL, &flags); - if (error != 0) { - ICL_DEBUG("soreceive error %d", error); - return (-1); - } - if (uio.uio_resid != 0) { - ICL_DEBUG("short read"); - return (-1); - } - - return (0); -} - static void icl_soft_conn_pdu_free(struct icl_conn *ic, struct icl_pdu *ip) { @@ -318,37 +256,28 @@ icl_pdu_size(const struct icl_pdu *response) return (len); } -static int -icl_pdu_receive_bhs(struct icl_pdu *request, size_t *availablep) +static void +icl_soft_receive_buf(struct mbuf **r, size_t *rs, void *buf, size_t s) { - if (icl_conn_receive_buf(request->ip_conn, - request->ip_bhs, sizeof(struct iscsi_bhs))) { - ICL_DEBUG("failed to receive BHS"); - return (-1); - } - - *availablep -= sizeof(struct iscsi_bhs); - return (0); + m_copydata(*r, 0, s, buf); + m_adj(*r, s); + while ((*r) != NULL && (*r)->m_len == 0) + *r = m_free(*r); + *rs -= s; } -static int -icl_pdu_receive_ahs(struct icl_pdu *request, size_t *availablep) +static void +icl_pdu_receive_ahs(struct icl_pdu *request, struct mbuf **r, size_t *rs) { request->ip_ahs_len = icl_pdu_ahs_length(request); if (request->ip_ahs_len == 0) - return (0); - - request->ip_ahs_mbuf = icl_conn_receive(request->ip_conn, - request->ip_ahs_len); - if (request->ip_ahs_mbuf == NULL) { - ICL_DEBUG("failed to receive AHS"); - return (-1); - } + return; - *availablep -= request->ip_ahs_len; - return (0); + request->ip_ahs_mbuf = *r; + *r = m_split(request->ip_ahs_mbuf, request->ip_ahs_len, M_WAITOK); + *rs -= request->ip_ahs_len; } static uint32_t @@ -367,7 +296,7 @@ icl_mbuf_to_crc32c(const struct mbuf *m0) } static int -icl_pdu_check_header_digest(struct icl_pdu *request, size_t *availablep) +icl_pdu_check_header_digest(struct icl_pdu *request, struct mbuf **r, size_t *rs) { uint32_t received_digest, valid_digest; @@ -375,12 +304,7 @@ icl_pdu_check_header_digest(struct icl_pdu *request, size_t *availablep) return (0); CTASSERT(sizeof(received_digest) == ISCSI_HEADER_DIGEST_SIZE); - if (icl_conn_receive_buf(request->ip_conn, - &received_digest, ISCSI_HEADER_DIGEST_SIZE)) { - ICL_DEBUG("failed to receive header digest"); - return (-1); - } - *availablep -= ISCSI_HEADER_DIGEST_SIZE; + icl_soft_receive_buf(r, rs, &received_digest, ISCSI_HEADER_DIGEST_SIZE); /* Temporary attach AHS to BHS to calculate header digest. */ request->ip_bhs_mbuf->m_next = request->ip_ahs_mbuf; @@ -448,8 +372,8 @@ icl_pdu_data_segment_receive_len(const struct icl_pdu *request) } static int -icl_pdu_receive_data_segment(struct icl_pdu *request, - size_t *availablep, bool *more_neededp) +icl_pdu_receive_data_segment(struct icl_pdu *request, struct mbuf **r, + size_t *rs, bool *more_neededp) { struct icl_conn *ic; size_t len, padding = 0; @@ -473,7 +397,7 @@ icl_pdu_receive_data_segment(struct icl_pdu *request, KASSERT(len > request->ip_data_len, ("len <= request->ip_data_len")); len -= request->ip_data_len; - if (len + padding > *availablep) { + if (len + padding > *rs) { /* * Not enough data in the socket buffer. Receive as much * as we can. Don't receive padding, since, obviously, it's @@ -481,9 +405,9 @@ icl_pdu_receive_data_segment(struct icl_pdu *request, */ #if 0 ICL_DEBUG("limited from %zd to %zd", - len + padding, *availablep - padding)); + len + padding, *rs - padding)); #endif - len = *availablep - padding; + len = *rs - padding; *more_neededp = true; padding = 0; } @@ -493,11 +417,9 @@ icl_pdu_receive_data_segment(struct icl_pdu *request, * of actual data segment. */ if (len > 0) { - m = icl_conn_receive(request->ip_conn, len + padding); - if (m == NULL) { - ICL_DEBUG("failed to receive data segment"); - return (-1); - } + m = *r; + *r = m_split(m, len + padding, M_WAITOK); + *rs -= len + padding; if (request->ip_data_mbuf == NULL) request->ip_data_mbuf = m; @@ -505,7 +427,6 @@ icl_pdu_receive_data_segment(struct icl_pdu *request, m_cat(request->ip_data_mbuf, m); request->ip_data_len += len; - *availablep -= len + padding; } else ICL_DEBUG("len 0"); @@ -517,7 +438,7 @@ icl_pdu_receive_data_segment(struct icl_pdu *request, } static int -icl_pdu_check_data_digest(struct icl_pdu *request, size_t *availablep) +icl_pdu_check_data_digest(struct icl_pdu *request, struct mbuf **r, size_t *rs) { uint32_t received_digest, valid_digest; @@ -528,12 +449,7 @@ icl_pdu_check_data_digest(struct icl_pdu *request, size_t *availablep) return (0); CTASSERT(sizeof(received_digest) == ISCSI_DATA_DIGEST_SIZE); - if (icl_conn_receive_buf(request->ip_conn, - &received_digest, ISCSI_DATA_DIGEST_SIZE)) { - ICL_DEBUG("failed to receive data digest"); - return (-1); - } - *availablep -= ISCSI_DATA_DIGEST_SIZE; + icl_soft_receive_buf(r, rs, &received_digest, ISCSI_DATA_DIGEST_SIZE); /* * Note that ip_data_mbuf also contains padding; since digest @@ -555,16 +471,13 @@ icl_pdu_check_data_digest(struct icl_pdu *request, size_t *availablep) * "part" of PDU at a time; call it repeatedly until it returns non-NULL. */ static struct icl_pdu * -icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep) +icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) { struct icl_pdu *request; - struct socket *so; size_t len; - int error; + int error = 0; bool more_needed; - so = ic->ic_socket; - if (ic->ic_receive_state == ICL_CONN_STATE_BHS) { KASSERT(ic->ic_receive_pdu == NULL, ("ic->ic_receive_pdu != NULL")); @@ -582,23 +495,11 @@ icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep) request = ic->ic_receive_pdu; } - if (*availablep < ic->ic_receive_len) { -#if 0 - ICL_DEBUG("not enough data; need %zd, " - "have %zd", ic->ic_receive_len, *availablep); -#endif - return (NULL); - } - switch (ic->ic_receive_state) { case ICL_CONN_STATE_BHS: //ICL_DEBUG("receiving BHS"); - error = icl_pdu_receive_bhs(request, availablep); - if (error != 0) { - ICL_DEBUG("failed to receive BHS; " - "dropping connection"); - break; - } + icl_soft_receive_buf(r, rs, request->ip_bhs, + sizeof(struct iscsi_bhs)); /* * We don't enforce any limit for AHS length; @@ -622,12 +523,7 @@ icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep) case ICL_CONN_STATE_AHS: //ICL_DEBUG("receiving AHS"); - error = icl_pdu_receive_ahs(request, availablep); - if (error != 0) { - ICL_DEBUG("failed to receive AHS; " - "dropping connection"); - break; - } + icl_pdu_receive_ahs(request, r, rs); ic->ic_receive_state = ICL_CONN_STATE_HEADER_DIGEST; if (ic->ic_header_crc32c == false) ic->ic_receive_len = 0; @@ -637,7 +533,7 @@ icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep) case ICL_CONN_STATE_HEADER_DIGEST: //ICL_DEBUG("receiving header digest"); - error = icl_pdu_check_header_digest(request, availablep); + error = icl_pdu_check_header_digest(request, r, rs); if (error != 0) { ICL_DEBUG("header digest failed; " "dropping connection"); @@ -651,7 +547,7 @@ icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep) case ICL_CONN_STATE_DATA: //ICL_DEBUG("receiving data segment"); - error = icl_pdu_receive_data_segment(request, availablep, + error = icl_pdu_receive_data_segment(request, r, rs, &more_needed); if (error != 0) { ICL_DEBUG("failed to receive data segment;" @@ -671,7 +567,7 @@ icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep) case ICL_CONN_STATE_DATA_DIGEST: //ICL_DEBUG("receiving data digest"); - error = icl_pdu_check_data_digest(request, availablep); + error = icl_pdu_check_data_digest(request, r, rs); if (error != 0) { ICL_DEBUG("data digest failed; " "dropping connection"); @@ -703,44 +599,27 @@ icl_conn_receive_pdu(struct icl_conn *ic, size_t *availablep) } static void -icl_conn_receive_pdus(struct icl_conn *ic, size_t available) +icl_conn_receive_pdus(struct icl_conn *ic, struct mbuf **r, size_t *rs) { struct icl_pdu *response; - struct socket *so; - - so = ic->ic_socket; - - /* - * This can never happen; we're careful to only mess with ic->ic_socket - * pointer when the send/receive threads are not running. - */ - KASSERT(so != NULL, ("NULL socket")); for (;;) { if (ic->ic_disconnecting) return; - if (so->so_error != 0) { - ICL_DEBUG("connection error %d; " - "dropping connection", so->so_error); - icl_conn_fail(ic); - return; - } - /* * Loop until we have a complete PDU or there is not enough * data in the socket buffer. */ - if (available < ic->ic_receive_len) { + if (*rs < ic->ic_receive_len) { #if 0 - ICL_DEBUG("not enough data; have %zd, " - "need %zd", available, - ic->ic_receive_len); + ICL_DEBUG("not enough data; have %zd, need %zd", + *rs, ic->ic_receive_len); #endif return; } - response = icl_conn_receive_pdu(ic, &available); + response = icl_conn_receive_pdu(ic, r, rs); if (response == NULL) continue; @@ -761,15 +640,19 @@ static void icl_receive_thread(void *arg) { struct icl_conn *ic; - size_t available; + size_t available, read = 0; struct socket *so; + struct mbuf *m, *r = NULL; + struct uio uio; + int error, flags; ic = arg; so = ic->ic_socket; for (;;) { + SOCKBUF_LOCK(&so->so_rcv); if (ic->ic_disconnecting) { - //ICL_DEBUG("terminating"); + SOCKBUF_UNLOCK(&so->so_rcv); break; } @@ -779,18 +662,50 @@ icl_receive_thread(void *arg) * to avoid unnecessary wakeups until there * is enough data received to read the PDU. */ - SOCKBUF_LOCK(&so->so_rcv); available = sbavail(&so->so_rcv); - if (available < ic->ic_receive_len) { - so->so_rcv.sb_lowat = ic->ic_receive_len; + if (read + available < ic->ic_receive_len) { + so->so_rcv.sb_lowat = ic->ic_receive_len - read; cv_wait(&ic->ic_receive_cv, &so->so_rcv.sb_mtx); - } else so->so_rcv.sb_lowat = so->so_rcv.sb_hiwat + 1; + available = sbavail(&so->so_rcv); + } SOCKBUF_UNLOCK(&so->so_rcv); - icl_conn_receive_pdus(ic, available); + if (available == 0) { + if (so->so_error != 0) { + ICL_DEBUG("connection error %d; " + "dropping connection", so->so_error); + icl_conn_fail(ic); + break; + } + continue; + } + + memset(&uio, 0, sizeof(uio)); + uio.uio_resid = available; + flags = MSG_DONTWAIT; + error = soreceive(so, NULL, &uio, &m, NULL, &flags); + if (error != 0) { + ICL_DEBUG("soreceive error %d", error); + break; + } + if (uio.uio_resid != 0) { + m_freem(m); + ICL_DEBUG("short read"); + break; + } + if (r) + m_cat(r, m); + else + r = m; + read += available; + + icl_conn_receive_pdus(ic, &r, &read); } + if (r) + m_freem(r); + ICL_CONN_LOCK(ic); ic->ic_receive_running = false; cv_signal(&ic->ic_send_cv); @@ -1366,12 +1281,17 @@ icl_soft_conn_close(struct icl_conn *ic) struct icl_pdu *pdu; struct socket *so; - ICL_CONN_LOCK(ic); - /* * Wake up the threads, so they can properly terminate. + * Receive thread sleeps on so->so_rcv lock, send on ic->ic_lock. */ - ic->ic_disconnecting = true; + ICL_CONN_LOCK(ic); + if (!ic->ic_disconnecting) { + so = ic->ic_socket; + SOCKBUF_LOCK(&so->so_rcv); + ic->ic_disconnecting = true; + SOCKBUF_UNLOCK(&so->so_rcv); + } while (ic->ic_receive_running || ic->ic_send_running) { cv_signal(&ic->ic_receive_cv); cv_signal(&ic->ic_send_cv); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 03:01:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3DA9C56CA35; Mon, 15 Mar 2021 03:01: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 4DzLm76yvGz3QCm; Mon, 15 Mar 2021 03:01: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 0557F1194; Mon, 15 Mar 2021 03:01: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 12F31Q9v097971; Mon, 15 Mar 2021 03:01:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F31QEn097970; Mon, 15 Mar 2021 03:01:26 GMT (envelope-from git) Date: Mon, 15 Mar 2021 03:01:26 GMT Message-Id: <202103150301.12F31QEn097970@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 7b4859b4a26a - stable/12 - Micro-optimize OOA queue processing. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7b4859b4a26a1725f8e09bc6b8ae45007a8c43b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 03:01:29 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=7b4859b4a26a1725f8e09bc6b8ae45007a8c43b4 commit 7b4859b4a26a1725f8e09bc6b8ae45007a8c43b4 Author: Alexander Motin AuthorDate: 2021-02-27 15:14:05 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:46:00 +0000 Micro-optimize OOA queue processing. - Move ctl_get_cmd_entry() calls from every OOA traversal to when the requests first inserted, storing seridx in struct ctl_scsiio. - Move some checks out of the loop in ctl_check_ooa(). - Replace checks for errors that can not happen with asserts. - Transpose ctl_serialize_table, so that any OOA traversal accessed only one row (cache line). Compact it from enum to uint8_t. - Optimize static branch predictions in hottest places. Due to O(n) nature on deep LUN queues this can be the hottest code path in CTL, and additional 20% of IOPS I see in some 4KB I/O tests are good to have in reserve. About 50% of CPU time here according to the profiles is now spent in two memory accesses per traversed request in OOA. Sponsored by: iXsystems, Inc. MFC after: 2 weeks (cherry picked from commit 9d9fd8b79f0ebe59f791c8225fa01ab59858b7b5) --- sys/cam/ctl/ctl.c | 238 ++++++++++++++++++++------------------------ sys/cam/ctl/ctl_io.h | 2 +- sys/cam/ctl/ctl_private.h | 18 ++-- sys/cam/ctl/ctl_ser_table.c | 40 ++++---- 4 files changed, 134 insertions(+), 164 deletions(-) diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 07331091fc54..46f044814d3a 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -499,9 +499,10 @@ static int ctl_inquiry_std(struct ctl_scsiio *ctsio); static int ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint64_t *len); static ctl_action ctl_extent_check(union ctl_io *io1, union ctl_io *io2, bool seq); -static ctl_action ctl_extent_check_seq(union ctl_io *io1, union ctl_io *io2); +static ctl_action ctl_seq_check(union ctl_io *io1, union ctl_io *io2); static ctl_action ctl_check_for_blockage(struct ctl_lun *lun, - union ctl_io *pending_io, union ctl_io *ooa_io); + union ctl_io *pending_io, const uint8_t *serialize_row, + union ctl_io *ooa_io); static ctl_action ctl_check_ooa(struct ctl_lun *lun, union ctl_io *pending_io, union ctl_io **starting_io); static void ctl_try_unblock_io(struct ctl_lun *lun, union ctl_io *io, @@ -2313,6 +2314,7 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) } entry = ctl_get_cmd_entry(ctsio, NULL); + ctsio->seridx = entry->seridx; if (ctl_scsiio_lun_check(lun, entry, ctsio) != 0) { mtx_unlock(&lun->lun_lock); goto badjuju; @@ -2333,12 +2335,6 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) bio = (union ctl_io *)LIST_NEXT(&ctsio->io_hdr, ooa_links); switch (ctl_check_ooa(lun, (union ctl_io *)ctsio, &bio)) { - case CTL_ACTION_BLOCK: - ctsio->io_hdr.blocker = bio; - TAILQ_INSERT_TAIL(&bio->io_hdr.blocked_queue, &ctsio->io_hdr, - blocked_links); - mtx_unlock(&lun->lun_lock); - break; case CTL_ACTION_PASS: case CTL_ACTION_SKIP: if (softc->ha_mode == CTL_HA_MODE_XFER) { @@ -2357,6 +2353,12 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) sizeof(msg_info.hdr), M_WAITOK); } break; + case CTL_ACTION_BLOCK: + ctsio->io_hdr.blocker = bio; + TAILQ_INSERT_TAIL(&bio->io_hdr.blocked_queue, &ctsio->io_hdr, + blocked_links); + mtx_unlock(&lun->lun_lock); + break; case CTL_ACTION_OVERLAP: LIST_REMOVE(&ctsio->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); @@ -2366,14 +2368,6 @@ ctl_serialize_other_sc_cmd(struct ctl_scsiio *ctsio) LIST_REMOVE(&ctsio->io_hdr, ooa_links); mtx_unlock(&lun->lun_lock); ctl_set_overlapped_tag(ctsio, ctsio->tag_num); - goto badjuju; - case CTL_ACTION_ERROR: - default: - LIST_REMOVE(&ctsio->io_hdr, ooa_links); - mtx_unlock(&lun->lun_lock); - - ctl_set_internal_failure(ctsio, /*sks_valid*/ 0, - /*retry_count*/ 0); badjuju: ctl_copy_sense_data_back((union ctl_io *)ctsio, &msg_info); msg_info.hdr.original_sc = ctsio->io_hdr.remote_io; @@ -2383,6 +2377,8 @@ badjuju: sizeof(msg_info.scsi), M_WAITOK); ctl_free_io((union ctl_io *)ctsio); break; + default: + __assert_unreachable(); } } @@ -10831,8 +10827,9 @@ ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint64_t *len) break; } default: + *lba = 0; + *len = UINT64_MAX; return (1); - break; /* NOTREACHED */ } return (0); @@ -10866,7 +10863,7 @@ ctl_extent_check_unmap(union ctl_io *io, uint64_t lba2, uint64_t len2) /* If not UNMAP -- go other way. */ if (io->scsiio.cdb[0] != UNMAP) - return (CTL_ACTION_ERROR); + return (CTL_ACTION_SKIP); /* If UNMAP without data -- block and wait for data. */ ptrlen = (struct ctl_ptr_len_flags *) @@ -10894,33 +10891,34 @@ ctl_extent_check(union ctl_io *io1, union ctl_io *io2, bool seq) uint64_t len1, len2; int retval; - if (ctl_get_lba_len(io2, &lba2, &len2) != 0) - return (CTL_ACTION_ERROR); + retval = ctl_get_lba_len(io2, &lba2, &len2); + KASSERT(retval == 0, ("ctl_get_lba_len() error")); retval = ctl_extent_check_unmap(io1, lba2, len2); - if (retval != CTL_ACTION_ERROR) + if (retval != CTL_ACTION_SKIP) return (retval); - if (ctl_get_lba_len(io1, &lba1, &len1) != 0) - return (CTL_ACTION_ERROR); + retval = ctl_get_lba_len(io1, &lba1, &len1); + KASSERT(retval == 0, ("ctl_get_lba_len() error")); - if (io1->io_hdr.flags & CTL_FLAG_SERSEQ_DONE) + if (seq && (io1->io_hdr.flags & CTL_FLAG_SERSEQ_DONE)) seq = FALSE; return (ctl_extent_check_lba(lba1, len1, lba2, len2, seq)); } static ctl_action -ctl_extent_check_seq(union ctl_io *io1, union ctl_io *io2) +ctl_seq_check(union ctl_io *io1, union ctl_io *io2) { uint64_t lba1, lba2; uint64_t len1, len2; + int retval; if (io1->io_hdr.flags & CTL_FLAG_SERSEQ_DONE) return (CTL_ACTION_PASS); - if (ctl_get_lba_len(io1, &lba1, &len1) != 0) - return (CTL_ACTION_ERROR); - if (ctl_get_lba_len(io2, &lba2, &len2) != 0) - return (CTL_ACTION_ERROR); + retval = ctl_get_lba_len(io1, &lba1, &len1); + KASSERT(retval == 0, ("ctl_get_lba_len() error")); + retval = ctl_get_lba_len(io2, &lba2, &len2); + KASSERT(retval == 0, ("ctl_get_lba_len() error")); if (lba1 + len1 == lba2) return (CTL_ACTION_BLOCK); @@ -10929,25 +10927,15 @@ ctl_extent_check_seq(union ctl_io *io1, union ctl_io *io2) static ctl_action ctl_check_for_blockage(struct ctl_lun *lun, union ctl_io *pending_io, - union ctl_io *ooa_io) + const uint8_t *serialize_row, union ctl_io *ooa_io) { - const struct ctl_cmd_entry *pending_entry, *ooa_entry; - const ctl_serialize_action *serialize_row; - - /* - * Aborted commands are not going to be executed and may even - * not report completion, so we don't care about their order. - * Let them complete ASAP to clean the OOA queue. - */ - if (pending_io->io_hdr.flags & CTL_FLAG_ABORT) - return (CTL_ACTION_SKIP); /* * The initiator attempted multiple untagged commands at the same * time. Can't do that. */ - if ((pending_io->scsiio.tag_type == CTL_TAG_UNTAGGED) - && (ooa_io->scsiio.tag_type == CTL_TAG_UNTAGGED) + if (__predict_false(pending_io->scsiio.tag_type == CTL_TAG_UNTAGGED) + && __predict_false(ooa_io->scsiio.tag_type == CTL_TAG_UNTAGGED) && ((pending_io->io_hdr.nexus.targ_port == ooa_io->io_hdr.nexus.targ_port) && (pending_io->io_hdr.nexus.initid == @@ -10967,9 +10955,9 @@ ctl_check_for_blockage(struct ctl_lun *lun, union ctl_io *pending_io, * command with the same tag number as long as the previous * instance of this tag number has been aborted somehow. */ - if ((pending_io->scsiio.tag_type != CTL_TAG_UNTAGGED) - && (ooa_io->scsiio.tag_type != CTL_TAG_UNTAGGED) - && (pending_io->scsiio.tag_num == ooa_io->scsiio.tag_num) + if (__predict_true(pending_io->scsiio.tag_type != CTL_TAG_UNTAGGED) + && __predict_true(ooa_io->scsiio.tag_type != CTL_TAG_UNTAGGED) + && __predict_false(pending_io->scsiio.tag_num == ooa_io->scsiio.tag_num) && ((pending_io->io_hdr.nexus.targ_port == ooa_io->io_hdr.nexus.targ_port) && (pending_io->io_hdr.nexus.initid == @@ -10992,75 +10980,47 @@ ctl_check_for_blockage(struct ctl_lun *lun, union ctl_io *pending_io, * * XXX KDM check for other types of blockage first?? */ - if (pending_io->scsiio.tag_type == CTL_TAG_HEAD_OF_QUEUE) + if (__predict_false(pending_io->scsiio.tag_type == CTL_TAG_HEAD_OF_QUEUE)) return (CTL_ACTION_PASS); - /* - * Ordered tags have to block until all items ahead of them - * have completed. If we get called with an ordered tag, we always - * block, if something else is ahead of us in the queue. - */ - if (pending_io->scsiio.tag_type == CTL_TAG_ORDERED) - return (CTL_ACTION_BLOCK); - /* * Simple tags get blocked until all head of queue and ordered tags * ahead of them have completed. I'm lumping untagged commands in * with simple tags here. XXX KDM is that the right thing to do? */ - if (((pending_io->scsiio.tag_type == CTL_TAG_UNTAGGED) - || (pending_io->scsiio.tag_type == CTL_TAG_SIMPLE)) - && ((ooa_io->scsiio.tag_type == CTL_TAG_HEAD_OF_QUEUE) - || (ooa_io->scsiio.tag_type == CTL_TAG_ORDERED))) + if (__predict_false(ooa_io->scsiio.tag_type == CTL_TAG_ORDERED) || + __predict_false(ooa_io->scsiio.tag_type == CTL_TAG_HEAD_OF_QUEUE)) return (CTL_ACTION_BLOCK); - pending_entry = ctl_get_cmd_entry(&pending_io->scsiio, NULL); - KASSERT(pending_entry->seridx < CTL_SERIDX_COUNT, - ("%s: Invalid seridx %d for pending CDB %02x %02x @ %p", - __func__, pending_entry->seridx, pending_io->scsiio.cdb[0], - pending_io->scsiio.cdb[1], pending_io)); - ooa_entry = ctl_get_cmd_entry(&ooa_io->scsiio, NULL); - if (ooa_entry->seridx == CTL_SERIDX_INVLD) - return (CTL_ACTION_PASS); /* Unsupported command in OOA queue */ - KASSERT(ooa_entry->seridx < CTL_SERIDX_COUNT, - ("%s: Invalid seridx %d for ooa CDB %02x %02x @ %p", - __func__, ooa_entry->seridx, ooa_io->scsiio.cdb[0], - ooa_io->scsiio.cdb[1], ooa_io)); - - serialize_row = ctl_serialize_table[ooa_entry->seridx]; - - switch (serialize_row[pending_entry->seridx]) { - case CTL_SER_BLOCK: - return (CTL_ACTION_BLOCK); - case CTL_SER_EXTENT: - return (ctl_extent_check(ooa_io, pending_io, - (lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); - case CTL_SER_EXTENTOPT: - if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) != - SCP_QUEUE_ALG_UNRESTRICTED) - return (ctl_extent_check(ooa_io, pending_io, - (lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); + /* Unsupported command in OOA queue. */ + if (__predict_false(ooa_io->scsiio.seridx == CTL_SERIDX_INVLD)) return (CTL_ACTION_PASS); - case CTL_SER_EXTENTSEQ: + + switch (serialize_row[ooa_io->scsiio.seridx]) { + case CTL_SER_SEQ: if (lun->be_lun->serseq != CTL_LUN_SERSEQ_OFF) - return (ctl_extent_check_seq(ooa_io, pending_io)); - return (CTL_ACTION_PASS); + return (ctl_seq_check(ooa_io, pending_io)); + /* FALLTHROUGH */ case CTL_SER_PASS: return (CTL_ACTION_PASS); + case CTL_SER_EXTENTOPT: + if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) == + SCP_QUEUE_ALG_UNRESTRICTED) + return (CTL_ACTION_PASS); + /* FALLTHROUGH */ + case CTL_SER_EXTENT: + return (ctl_extent_check(ooa_io, pending_io, + (lun->be_lun->serseq == CTL_LUN_SERSEQ_ON))); case CTL_SER_BLOCKOPT: - if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) != + if ((lun->MODE_CTRL.queue_flags & SCP_QUEUE_ALG_MASK) == SCP_QUEUE_ALG_UNRESTRICTED) - return (CTL_ACTION_BLOCK); - return (CTL_ACTION_PASS); - case CTL_SER_SKIP: - return (CTL_ACTION_SKIP); + return (CTL_ACTION_PASS); + /* FALLTHROUGH */ + case CTL_SER_BLOCK: + return (CTL_ACTION_BLOCK); default: - panic("%s: Invalid serialization value %d for %d => %d", - __func__, serialize_row[pending_entry->seridx], - pending_entry->seridx, ooa_entry->seridx); + __assert_unreachable(); } - - return (CTL_ACTION_ERROR); } /* @@ -11073,20 +11033,41 @@ static ctl_action ctl_check_ooa(struct ctl_lun *lun, union ctl_io *pending_io, union ctl_io **starting_io) { - union ctl_io *ooa_io; + union ctl_io *ooa_io = *starting_io; + const uint8_t *serialize_row; ctl_action action; mtx_assert(&lun->lun_lock, MA_OWNED); + /* + * Aborted commands are not going to be executed and may even + * not report completion, so we don't care about their order. + * Let them complete ASAP to clean the OOA queue. + */ + if (__predict_false(pending_io->io_hdr.flags & CTL_FLAG_ABORT)) + return (CTL_ACTION_SKIP); + + /* + * Ordered tags have to block until all items ahead of them have + * completed. If we get called with an ordered tag, we always + * block, if something else is ahead of us in the queue. + */ + if ((pending_io->scsiio.tag_type == CTL_TAG_ORDERED) && + (ooa_io != NULL)) + return (CTL_ACTION_BLOCK); + + serialize_row = ctl_serialize_table[pending_io->scsiio.seridx]; + /* * Run back along the OOA queue, starting with the current * blocked I/O and going through every I/O before it on the * queue. If starting_io is NULL, we'll just end up returning * CTL_ACTION_PASS. */ - for (ooa_io = *starting_io; ooa_io != NULL; + for (; ooa_io != NULL; ooa_io = (union ctl_io *)LIST_NEXT(&ooa_io->io_hdr, ooa_links)) { - action = ctl_check_for_blockage(lun, pending_io, ooa_io); + action = ctl_check_for_blockage(lun, pending_io, serialize_row, + ooa_io); if (action != CTL_ACTION_PASS) { *starting_io = ooa_io; return (action); @@ -11139,13 +11120,6 @@ ctl_try_unblock_io(struct ctl_lun *lun, union ctl_io *io, bool skip) io->io_hdr.blocker = NULL; switch (action) { - case CTL_ACTION_OVERLAP: - ctl_set_overlapped_cmd(&io->scsiio); - goto error; - case CTL_ACTION_OVERLAP_TAG: - ctl_set_overlapped_tag(&io->scsiio, - io->scsiio.tag_num & 0xff); - goto error; case CTL_ACTION_PASS: case CTL_ACTION_SKIP: @@ -11175,12 +11149,14 @@ ctl_try_unblock_io(struct ctl_lun *lun, union ctl_io *io, bool skip) io->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; ctl_enqueue_rtr(io); break; - case CTL_ACTION_ERROR: default: - ctl_set_internal_failure(&io->scsiio, - /*sks_valid*/ 0, - /*retry_count*/ 0); - + __assert_unreachable(); + case CTL_ACTION_OVERLAP: + ctl_set_overlapped_cmd(&io->scsiio); + goto error; + case CTL_ACTION_OVERLAP_TAG: + ctl_set_overlapped_tag(&io->scsiio, + io->scsiio.tag_num & 0xff); error: /* Serializing commands from the other SC are done here. */ if ((io->io_hdr.flags & CTL_FLAG_FROM_OTHER_SC) && @@ -11392,8 +11368,8 @@ ctl_failover_lun(union ctl_io *rio) /* We are master */ if (io->flags & CTL_FLAG_FROM_OTHER_SC) { if (io->flags & CTL_FLAG_IO_ACTIVE) { - io->flags |= CTL_FLAG_ABORT; - io->flags |= CTL_FLAG_FAILOVER; + io->flags |= CTL_FLAG_ABORT | + CTL_FLAG_FAILOVER; ctl_try_unblock_io(lun, (union ctl_io *)io, FALSE); } else { /* This can be only due to DATAMOVE */ @@ -11628,18 +11604,18 @@ ctl_scsiio_precheck(struct ctl_scsiio *ctsio) bio = (union ctl_io *)LIST_NEXT(&ctsio->io_hdr, ooa_links); switch (ctl_check_ooa(lun, (union ctl_io *)ctsio, &bio)) { - case CTL_ACTION_BLOCK: - ctsio->io_hdr.blocker = bio; - TAILQ_INSERT_TAIL(&bio->io_hdr.blocked_queue, &ctsio->io_hdr, - blocked_links); - mtx_unlock(&lun->lun_lock); - break; case CTL_ACTION_PASS: case CTL_ACTION_SKIP: ctsio->io_hdr.flags |= CTL_FLAG_IS_WAS_ON_RTR; mtx_unlock(&lun->lun_lock); ctl_enqueue_rtr((union ctl_io *)ctsio); break; + case CTL_ACTION_BLOCK: + ctsio->io_hdr.blocker = bio; + TAILQ_INSERT_TAIL(&bio->io_hdr.blocked_queue, &ctsio->io_hdr, + blocked_links); + mtx_unlock(&lun->lun_lock); + break; case CTL_ACTION_OVERLAP: mtx_unlock(&lun->lun_lock); ctl_set_overlapped_cmd(ctsio); @@ -11650,14 +11626,8 @@ ctl_scsiio_precheck(struct ctl_scsiio *ctsio) ctl_set_overlapped_tag(ctsio, ctsio->tag_num & 0xff); ctl_done((union ctl_io *)ctsio); break; - case CTL_ACTION_ERROR: default: - mtx_unlock(&lun->lun_lock); - ctl_set_internal_failure(ctsio, - /*sks_valid*/ 0, - /*retry_count*/ 0); - ctl_done((union ctl_io *)ctsio); - break; + __assert_unreachable(); } } @@ -11686,6 +11656,7 @@ ctl_validate_command(struct ctl_scsiio *ctsio) uint8_t diff; entry = ctl_get_cmd_entry(ctsio, &sa); + ctsio->seridx = entry->seridx; if (entry->execute == NULL) { if (sa) ctl_set_invalid_field(ctsio, @@ -13319,10 +13290,15 @@ ctl_serseq_done(union ctl_io *io) if (lun->be_lun->serseq == CTL_LUN_SERSEQ_OFF) return; - mtx_lock(&lun->lun_lock); - io->io_hdr.flags |= CTL_FLAG_SERSEQ_DONE; - ctl_try_unblock_others(lun, io, FALSE); - mtx_unlock(&lun->lun_lock); + + /* This is racy, but should not be a problem. */ + if (!TAILQ_EMPTY(&io->io_hdr.blocked_queue)) { + mtx_lock(&lun->lun_lock); + io->io_hdr.flags |= CTL_FLAG_SERSEQ_DONE; + ctl_try_unblock_others(lun, io, FALSE); + mtx_unlock(&lun->lun_lock); + } else + io->io_hdr.flags |= CTL_FLAG_SERSEQ_DONE; } void diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h index b275d80ad4a0..714ce12da95a 100644 --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -325,7 +325,7 @@ struct ctl_scsiio { struct scsi_sense_data sense_data; /* sense data */ uint8_t sense_len; /* Returned sense length */ uint8_t scsi_status; /* SCSI status byte */ - uint8_t sense_residual; /* Unused. */ + uint8_t seridx; /* Serialization index. */ uint8_t priority; /* Command priority */ uint32_t residual; /* Unused */ uint32_t tag_num; /* tag number */ diff --git a/sys/cam/ctl/ctl_private.h b/sys/cam/ctl/ctl_private.h index 8940babd4904..a891041e8f50 100644 --- a/sys/cam/ctl/ctl_private.h +++ b/sys/cam/ctl/ctl_private.h @@ -65,22 +65,20 @@ struct ctl_io_pool { }; typedef enum { - CTL_SER_BLOCK, - CTL_SER_BLOCKOPT, - CTL_SER_EXTENT, - CTL_SER_EXTENTOPT, - CTL_SER_EXTENTSEQ, + CTL_SER_SEQ, CTL_SER_PASS, - CTL_SER_SKIP + CTL_SER_EXTENTOPT, + CTL_SER_EXTENT, + CTL_SER_BLOCKOPT, + CTL_SER_BLOCK, } ctl_serialize_action; typedef enum { - CTL_ACTION_BLOCK, - CTL_ACTION_OVERLAP, - CTL_ACTION_OVERLAP_TAG, CTL_ACTION_PASS, CTL_ACTION_SKIP, - CTL_ACTION_ERROR + CTL_ACTION_BLOCK, + CTL_ACTION_OVERLAP, + CTL_ACTION_OVERLAP_TAG } ctl_action; /* diff --git a/sys/cam/ctl/ctl_ser_table.c b/sys/cam/ctl/ctl_ser_table.c index 2793bfa1e281..be9ca6b34631 100644 --- a/sys/cam/ctl/ctl_ser_table.c +++ b/sys/cam/ctl/ctl_ser_table.c @@ -43,11 +43,8 @@ /* TABLE ctlSerTbl */ /* */ /* The matrix which drives the serialization algorithm. The major index */ -/* (the first) into this table is the command being checked and the minor */ -/* index is the command against which the first command is being checked. */ -/* i.e., the major index (row) command is ahead of the minor index command */ -/* (column) in the queue. This allows the code to optimize by capturing */ -/* the result of the first indexing operation into a pointer. */ +/* (the first, row) into this table is the new command. The minor index */ +/* (column) is the older, possibly already running, command. */ /* */ /* Whenever a new value is added to the IDX_T type, this matrix must be */ /* expanded by one row AND one column -- Because of this, some effort */ @@ -55,30 +52,29 @@ /* */ /****************************************************************************/ -#define sK CTL_SER_SKIP /* Skip */ #define pS CTL_SER_PASS /* Pass */ #define bK CTL_SER_BLOCK /* Blocked */ #define bO CTL_SER_BLOCKOPT /* Optional block */ #define xT CTL_SER_EXTENT /* Extent check */ #define xO CTL_SER_EXTENTOPT /* Optional extent check */ -#define xS CTL_SER_EXTENTSEQ /* Sequential extent check */ +#define xS CTL_SER_SEQ /* Sequential check */ -const static ctl_serialize_action +const static uint8_t ctl_serialize_table[CTL_SERIDX_COUNT][CTL_SERIDX_COUNT] = { /**>IDX_ :: 2nd:TUR RD WRT UNM SYN MDSN MDSL RQSN INQ RDCP RES LSNS FMT STR*/ -/*TUR */{ pS, pS, pS, pS, pS, bK, bK, bK, pS, pS, bK, pS, bK, bK}, -/*READ */{ pS, xS, xT, bO, pS, bK, bK, bK, pS, pS, bK, pS, bK, bK}, -/*WRITE */{ pS, xT, xT, bO, bO, bK, bK, bK, pS, pS, bK, pS, bK, bK}, -/*UNMAP */{ pS, xO, xO, pS, pS, bK, bK, bK, pS, pS, bK, pS, bK, bK}, -/*SYNC */{ pS, pS, pS, pS, pS, bK, bK, bK, pS, pS, bK, pS, bK, bK}, -/*MD_SNS */{ bK, bK, bK, bK, bK, pS, bK, bK, pS, pS, bK, pS, bK, bK}, -/*MD_SEL */{ bK, bK, bK, bK, bK, bK, bK, bK, pS, pS, bK, pS, bK, bK}, -/*RQ_SNS */{ pS, pS, pS, pS, pS, pS, pS, bK, pS, pS, bK, pS, bK, bK}, -/*INQ */{ pS, pS, pS, pS, pS, pS, pS, bK, pS, pS, pS, pS, bK, bK}, -/*RD_CAP */{ pS, pS, pS, pS, pS, pS, pS, bK, pS, pS, pS, pS, bK, pS}, -/*RES */{ bK, bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK, bK}, -/*LOG_SNS */{ pS, pS, pS, pS, pS, pS, bK, bK, pS, pS, bK, pS, bK, bK}, -/*FORMAT */{ pS, bK, bK, bK, bK, bK, bK, pS, pS, bK, bK, bK, bK, bK}, -/*START */{ bK, bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK, bK}, +/*TUR */{ pS, pS, pS, pS, pS, bK, bK, pS, pS, pS, bK, pS, pS, bK}, +/*READ */{ pS, xS, xT, xO, pS, bK, bK, pS, pS, pS, bK, pS, bK, bK}, +/*WRITE */{ pS, xT, xT, xO, pS, bK, bK, pS, pS, pS, bK, pS, bK, bK}, +/*UNMAP */{ pS, bO, bO, pS, pS, bK, bK, pS, pS, pS, bK, pS, bK, bK}, +/*SYNC */{ pS, pS, bO, pS, pS, bK, bK, pS, pS, pS, bK, pS, bK, bK}, +/*MD_SNS */{ bK, bK, bK, bK, bK, pS, bK, pS, pS, pS, bK, pS, bK, bK}, +/*MD_SEL */{ bK, bK, bK, bK, bK, bK, bK, pS, pS, pS, bK, bK, bK, bK}, +/*RQ_SNS */{ bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, pS, bK}, +/*INQ */{ pS, pS, pS, pS, pS, pS, pS, pS, pS, pS, pS, pS, pS, pS}, +/*RD_CAP */{ pS, pS, pS, pS, pS, pS, pS, pS, pS, pS, bK, pS, bK, bK}, +/*RES */{ bK, bK, bK, bK, bK, bK, bK, bK, pS, pS, bK, bK, bK, bK}, +/*LOG_SNS */{ pS, pS, pS, pS, pS, pS, pS, pS, pS, pS, bK, pS, bK, bK}, +/*FORMAT */{ bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK, bK}, +/*START */{ bK, bK, bK, bK, bK, bK, bK, bK, bK, pS, bK, bK, bK, bK}, }; From owner-dev-commits-src-all@freebsd.org Mon Mar 15 03:01:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A81A356CB7C; Mon, 15 Mar 2021 03:01: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 4DzLm96WfYz3Q4h; Mon, 15 Mar 2021 03:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23BC010CD; Mon, 15 Mar 2021 03:01:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12F31SQQ097989; Mon, 15 Mar 2021 03:01:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F31Sr8097988; Mon, 15 Mar 2021 03:01:28 GMT (envelope-from git) Date: Mon, 15 Mar 2021 03:01:28 GMT Message-Id: <202103150301.12F31Sr8097988@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 748feb192e2a - stable/12 - Optimize out few extra memory accesses. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 748feb192e2a36a9479a9f363d0b621bae614597 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 03:01:30 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=748feb192e2a36a9479a9f363d0b621bae614597 commit 748feb192e2a36a9479a9f363d0b621bae614597 Author: Alexander Motin AuthorDate: 2021-03-01 23:35:45 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:46:11 +0000 Optimize out few extra memory accesses. MFC after: 1 week (cherry picked from commit a59e2982fe3e6339629cc77fe9d349d60e03a05e) --- sys/cam/ctl/ctl_backend_block.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index abcd8d6e6fae..54026844f695 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -418,7 +418,6 @@ ctl_be_block_move_done(union ctl_io *io, bool samethr) struct ctl_lba_len_flags *lbalen; beio = (struct ctl_be_block_io *)PRIV(io)->ptr; - be_lun = beio->lun; DPRINTF("entered\n"); io->scsiio.kern_rel_offset += io->scsiio.kern_data_len; @@ -428,7 +427,7 @@ ctl_be_block_move_done(union ctl_io *io, bool samethr) */ if ((io->io_hdr.flags & CTL_FLAG_ABORT) == 0 && (io->io_hdr.status & CTL_STATUS_MASK) == CTL_STATUS_NONE) { - lbalen = ARGS(beio->io); + lbalen = ARGS(io); if (lbalen->flags & CTL_LLF_READ) { ctl_set_success(&io->scsiio); } else if (lbalen->flags & CTL_LLF_COMPARE) { @@ -456,6 +455,7 @@ ctl_be_block_move_done(union ctl_io *io, bool samethr) * This move done routine is generally called in the SIM's * interrupt context, and therefore we cannot block. */ + be_lun = (struct ctl_be_block_lun *)CTL_BACKEND_LUN(io); if (samethr) { be_lun->dispatch(be_lun, beio); } else { @@ -1272,7 +1272,7 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun, DPRINTF("entered\n"); beio = (struct ctl_be_block_io *)PRIV(io)->ptr; - lbalen = ARGS(beio->io); + lbalen = ARGS(io); if (lbalen->flags & ~(SWS_LBDATA | SWS_UNMAP | SWS_ANCHOR | SWS_NDOB) || (lbalen->flags & (SWS_UNMAP | SWS_ANCHOR) && be_lun->unmap == NULL)) { From owner-dev-commits-src-all@freebsd.org Mon Mar 15 03:01:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 158AD56C9B9; Mon, 15 Mar 2021 03:01: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 4DzLm50CWLz3QP2; Mon, 15 Mar 2021 03:01:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B967FEFD; Mon, 15 Mar 2021 03:01:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12F31OL1097935; Mon, 15 Mar 2021 03:01:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F31OBH097934; Mon, 15 Mar 2021 03:01:24 GMT (envelope-from git) Date: Mon, 15 Mar 2021 03:01:24 GMT Message-Id: <202103150301.12F31OBH097934@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 4d5d50edc5ff - stable/12 - Fix build after 2c7dc6bae9fd. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 4d5d50edc5ff6ab07aaee129c6f3d1ab7a385976 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 03:01:27 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4d5d50edc5ff6ab07aaee129c6f3d1ab7a385976 commit 4d5d50edc5ff6ab07aaee129c6f3d1ab7a385976 Author: Alexander Motin AuthorDate: 2021-02-21 22:21:14 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:45:16 +0000 Fix build after 2c7dc6bae9fd. MFC after: 1 month (cherry picked from commit c02a28754bc229c05e8baf9b6632cbd59bc73e48) --- sys/cam/ctl/ctl_io.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/cam/ctl/ctl_io.h b/sys/cam/ctl/ctl_io.h index 01887c20a822..b275d80ad4a0 100644 --- a/sys/cam/ctl/ctl_io.h +++ b/sys/cam/ctl/ctl_io.h @@ -42,6 +42,10 @@ #ifndef _CTL_IO_H_ #define _CTL_IO_H_ +#ifndef _KERNEL +#include +#endif + #define CTL_MAX_CDBLEN 32 /* * Uncomment this next line to enable printing out times for I/Os From owner-dev-commits-src-all@freebsd.org Mon Mar 15 03:01:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F248656CD0C; Mon, 15 Mar 2021 03:01: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 4DzLmC1jN7z3QKM; Mon, 15 Mar 2021 03:01: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 4067A112C; Mon, 15 Mar 2021 03:01: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 12F31TbB098007; Mon, 15 Mar 2021 03:01:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F31TFJ098006; Mon, 15 Mar 2021 03:01:29 GMT (envelope-from git) Date: Mon, 15 Mar 2021 03:01:29 GMT Message-Id: <202103150301.12F31TFJ098006@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 3034c0dab755 - stable/12 - Optimize TX coalescing by keeping pointer to last mbuf. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3034c0dab755d29eb24d0187cfc00501b660a9c1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 03:01:32 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=3034c0dab755d29eb24d0187cfc00501b660a9c1 commit 3034c0dab755d29eb24d0187cfc00501b660a9c1 Author: Alexander Motin AuthorDate: 2021-03-02 04:31:34 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:52:57 +0000 Optimize TX coalescing by keeping pointer to last mbuf. Before m_cat() each time traversed through all the coalesced chain. MFC after: 1 week (cherry picked from commit b85a67f54a40053e75658a17c620b89bafaba67f) --- sys/dev/iscsi/icl_soft.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index caeddc9247ba..7c8ca11f4ae3 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -785,6 +785,7 @@ static void icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) { struct icl_pdu *request, *request2; + struct mbuf *m; struct socket *so; long available, size, size2; int coalesced, error; @@ -845,8 +846,8 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) return; } if (coalesce) { - coalesced = 1; - for (;;) { + m = request->ip_bhs_mbuf; + for (coalesced = 1; ; coalesced++) { request2 = STAILQ_FIRST(queue); if (request2 == NULL) break; @@ -863,13 +864,14 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) icl_conn_fail(ic); return; } - m_cat(request->ip_bhs_mbuf, request2->ip_bhs_mbuf); + while (m->m_next) + m = m->m_next; + m_cat(m, request2->ip_bhs_mbuf); request2->ip_bhs_mbuf = NULL; request->ip_bhs_mbuf->m_pkthdr.len += size2; size += size2; STAILQ_REMOVE_AFTER(queue, request, ip_next); icl_soft_conn_pdu_free(ic, request2); - coalesced++; } #if 0 if (coalesced > 1) { From owner-dev-commits-src-all@freebsd.org Mon Mar 15 03:01:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5271B56CC3A; Mon, 15 Mar 2021 03:01: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 4DzLmC4Prwz3QPW; Mon, 15 Mar 2021 03:01: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 5AA121195; Mon, 15 Mar 2021 03:01:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12F31UYk098025; Mon, 15 Mar 2021 03:01:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F31UBC098024; Mon, 15 Mar 2021 03:01:30 GMT (envelope-from git) Date: Mon, 15 Mar 2021 03:01:30 GMT Message-Id: <202103150301.12F31UBC098024@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: cb89ac5a1daa - stable/12 - Fix initiator panic after 6895f89fe54e. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: cb89ac5a1daa7dd8d2306460ecbf5d8dac90b9a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 03:01:34 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=cb89ac5a1daa7dd8d2306460ecbf5d8dac90b9a2 commit cb89ac5a1daa7dd8d2306460ecbf5d8dac90b9a2 Author: Alexander Motin AuthorDate: 2021-03-02 21:07:22 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:53:14 +0000 Fix initiator panic after 6895f89fe54e. There are sessions without socket that are not disconnecting yet. MFC after: 3 weeks (cherry picked from commit 06e9c710998b83a3be21f7f264187fff5d590bc3) --- sys/dev/iscsi/icl_soft.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index 7c8ca11f4ae3..ce0bb3bd4d2d 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -1290,9 +1290,11 @@ icl_soft_conn_close(struct icl_conn *ic) ICL_CONN_LOCK(ic); if (!ic->ic_disconnecting) { so = ic->ic_socket; - SOCKBUF_LOCK(&so->so_rcv); + if (so) + SOCKBUF_LOCK(&so->so_rcv); ic->ic_disconnecting = true; - SOCKBUF_UNLOCK(&so->so_rcv); + if (so) + SOCKBUF_UNLOCK(&so->so_rcv); } while (ic->ic_receive_running || ic->ic_send_running) { cv_signal(&ic->ic_receive_cv); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 03:01:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2E8E56C7ED; Mon, 15 Mar 2021 03:01: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 4DzLmH1pkLz3QDM; Mon, 15 Mar 2021 03:01: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 9212B9DC; Mon, 15 Mar 2021 03:01: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 12F31V8W098047; Mon, 15 Mar 2021 03:01:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F31Vc0098046; Mon, 15 Mar 2021 03:01:31 GMT (envelope-from git) Date: Mon, 15 Mar 2021 03:01:31 GMT Message-Id: <202103150301.12F31Vc0098046@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: cec95c506540 - stable/12 - Replace STAILQ_SWAP() with simpler STAILQ_CONCAT(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: cec95c50654097b8cb8e595abda7cae7a01d5884 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 03:01:37 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=cec95c50654097b8cb8e595abda7cae7a01d5884 commit cec95c50654097b8cb8e595abda7cae7a01d5884 Author: Alexander Motin AuthorDate: 2021-03-02 23:39:44 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:54:34 +0000 Replace STAILQ_SWAP() with simpler STAILQ_CONCAT(). Also remove stray STAILQ_REMOVE_AFTER(), not causing problems only because STAILQ_SWAP() fixed corrupted stqh_last. MFC after: 1 week (cherry picked from commit df3747c6607be12d48db825653e6adfc3041e97f) --- sys/dev/iscsi/icl_soft.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index ce0bb3bd4d2d..d4333b64a77c 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -870,7 +870,6 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) request2->ip_bhs_mbuf = NULL; request->ip_bhs_mbuf->m_pkthdr.len += size2; size += size2; - STAILQ_REMOVE_AFTER(queue, request, ip_next); icl_soft_conn_pdu_free(ic, request2); } #if 0 @@ -909,13 +908,11 @@ icl_send_thread(void *arg) for (;;) { for (;;) { /* - * If the local queue is empty, populate it from - * the main one. This way the icl_conn_send_pdus() - * can go through all the queued PDUs without holding - * any locks. + * Populate the local queue from the main one. + * This way the icl_conn_send_pdus() can go through + * all the queued PDUs without holding any locks. */ - if (STAILQ_EMPTY(&queue)) - STAILQ_SWAP(&ic->ic_to_send, &queue, icl_pdu); + STAILQ_CONCAT(&queue, &ic->ic_to_send); ic->ic_check_send_space = false; ICL_CONN_UNLOCK(ic); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 03:01:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61FC256CC43; Mon, 15 Mar 2021 03:01: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 4DzLmM6VJXz3Qcy; Mon, 15 Mar 2021 03:01:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F40CE10CF; Mon, 15 Mar 2021 03:01: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 12F31YOp098109; Mon, 15 Mar 2021 03:01:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F31YLR098108; Mon, 15 Mar 2021 03:01:34 GMT (envelope-from git) Date: Mon, 15 Mar 2021 03:01:34 GMT Message-Id: <202103150301.12F31YLR098108@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 3ef86cd7c3cc - stable/12 - Make software iSCSI more configurable. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 3ef86cd7c3ccef27d42bb7cbdecd41f0fdd81f69 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 03:01:40 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=3ef86cd7c3ccef27d42bb7cbdecd41f0fdd81f69 commit 3ef86cd7c3ccef27d42bb7cbdecd41f0fdd81f69 Author: Alexander Motin AuthorDate: 2021-01-28 20:53:49 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 03:00:38 +0000 Make software iSCSI more configurable. Move software iSCSI tunables/sysctls into kern.icl.soft subtree. Replace several hardcoded length constants there with variables. While there, stretch the limits to better match Linux' open-iscsi and our own initiator with new MAXPHYS of 1MB. Our CTL target is also optimized for up to 1MB I/Os, so there is also a match now. For Windows 10 and VMware 6.7 initiators at default settings it should make no change, since previous limits were sufficient there. Tests of QD1 1MB writes from FreeBSD over 10GigE link show throughput increase by 29% on idle connection and 132% with concurrent QD8 reads. MFC after: 3 days Sponsored by: iXsystems, Inc. (cherry picked from commit b75168ed24ca74f65929e5c57d4fed5f0ab08f2a) --- sys/dev/iscsi/icl.h | 2 -- sys/dev/iscsi/icl_soft.c | 45 +++++++++++++++++++++++++-------------------- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/sys/dev/iscsi/icl.h b/sys/dev/iscsi/icl.h index 9105f0d68a35..0039a31390fd 100644 --- a/sys/dev/iscsi/icl.h +++ b/sys/dev/iscsi/icl.h @@ -91,8 +91,6 @@ struct icl_pdu { #define ICL_CONN_STATE_DATA 4 #define ICL_CONN_STATE_DATA_DIGEST 5 -#define ICL_MAX_DATA_SEGMENT_LENGTH (128 * 1024) - struct icl_conn { KOBJ_FIELDS; struct mtx *ic_lock; diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index 454afe15c398..32b59fe60e50 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -63,18 +63,29 @@ __FBSDID("$FreeBSD$"); #include #include +SYSCTL_NODE(_kern_icl, OID_AUTO, soft, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "Software iSCSI"); static int coalesce = 1; -SYSCTL_INT(_kern_icl, OID_AUTO, coalesce, CTLFLAG_RWTUN, +SYSCTL_INT(_kern_icl_soft, OID_AUTO, coalesce, CTLFLAG_RWTUN, &coalesce, 0, "Try to coalesce PDUs before sending"); -static int partial_receive_len = 128 * 1024; -SYSCTL_INT(_kern_icl, OID_AUTO, partial_receive_len, CTLFLAG_RWTUN, +static int partial_receive_len = 256 * 1024; +SYSCTL_INT(_kern_icl_soft, OID_AUTO, partial_receive_len, CTLFLAG_RWTUN, &partial_receive_len, 0, "Minimum read size for partially received " "data segment"); -static int sendspace = 1048576; -SYSCTL_INT(_kern_icl, OID_AUTO, sendspace, CTLFLAG_RWTUN, +static int max_data_segment_length = 256 * 1024; +SYSCTL_INT(_kern_icl_soft, OID_AUTO, max_data_segment_length, CTLFLAG_RWTUN, + &max_data_segment_length, 0, "Maximum data segment length"); +static int first_burst_length = 1024 * 1024; +SYSCTL_INT(_kern_icl_soft, OID_AUTO, first_burst_length, CTLFLAG_RWTUN, + &first_burst_length, 0, "First burst length"); +static int max_burst_length = 1024 * 1024; +SYSCTL_INT(_kern_icl_soft, OID_AUTO, max_burst_length, CTLFLAG_RWTUN, + &max_burst_length, 0, "Maximum burst length"); +static int sendspace = 1536 * 1024; +SYSCTL_INT(_kern_icl_soft, OID_AUTO, sendspace, CTLFLAG_RWTUN, &sendspace, 0, "Default send socket buffer size"); -static int recvspace = 1048576; -SYSCTL_INT(_kern_icl, OID_AUTO, recvspace, CTLFLAG_RWTUN, +static int recvspace = 1536 * 1024; +SYSCTL_INT(_kern_icl_soft, OID_AUTO, recvspace, CTLFLAG_RWTUN, &recvspace, 0, "Default receive socket buffer size"); static MALLOC_DEFINE(M_ICL_SOFT, "icl_soft", "iSCSI software backend"); @@ -509,10 +520,8 @@ icl_conn_receive_pdu(struct icl_conn *ic, struct mbuf **r, size_t *rs) len = icl_pdu_data_segment_length(request); if (len > ic->ic_max_data_segment_length) { ICL_WARN("received data segment " - "length %zd is larger than negotiated " - "MaxDataSegmentLength %zd; " - "dropping connection", - len, ic->ic_max_data_segment_length); + "length %zd is larger than negotiated; " + "dropping connection", len); error = EINVAL; break; } @@ -1076,7 +1085,7 @@ icl_soft_new_conn(const char *name, struct mtx *lock) #ifdef DIAGNOSTIC refcount_init(&ic->ic_outstanding_pdus, 0); #endif - ic->ic_max_data_segment_length = ICL_MAX_DATA_SEGMENT_LENGTH; + ic->ic_max_data_segment_length = max_data_segment_length; ic->ic_name = name; ic->ic_offload = "None"; ic->ic_unmapped = false; @@ -1126,10 +1135,6 @@ icl_conn_start(struct icl_conn *ic) * For sendspace, this is required because the current code cannot * send a PDU in pieces; thus, the minimum buffer size is equal * to the maximum PDU size. "+4" is to account for possible padding. - * - * What we should actually do here is to use autoscaling, but set - * some minimal buffer size to "minspace". I don't know a way to do - * that, though. */ minspace = sizeof(struct iscsi_bhs) + ic->ic_max_data_segment_length + ISCSI_HEADER_DIGEST_SIZE + ISCSI_DATA_DIGEST_SIZE + 4; @@ -1373,10 +1378,10 @@ static int icl_soft_limits(struct icl_drv_limits *idl) { - idl->idl_max_recv_data_segment_length = 128 * 1024; - idl->idl_max_send_data_segment_length = 128 * 1024; - idl->idl_max_burst_length = 262144; - idl->idl_first_burst_length = idl->idl_max_burst_length; + idl->idl_max_recv_data_segment_length = max_data_segment_length; + idl->idl_max_send_data_segment_length = max_data_segment_length; + idl->idl_max_burst_length = max_burst_length; + idl->idl_first_burst_length = first_burst_length; return (0); } From owner-dev-commits-src-all@freebsd.org Mon Mar 15 03:01:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C110A56C7EE; Mon, 15 Mar 2021 03:01: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 4DzLmJ1Knsz3QWr; Mon, 15 Mar 2021 03:01: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 B2D641203; Mon, 15 Mar 2021 03:01: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 12F31WCg098069; Mon, 15 Mar 2021 03:01:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F31WWO098068; Mon, 15 Mar 2021 03:01:32 GMT (envelope-from git) Date: Mon, 15 Mar 2021 03:01:32 GMT Message-Id: <202103150301.12F31WWO098068@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 2cd7a99cebaf - stable/12 - Restore condition removed in df3747c6607b. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2cd7a99cebafb932fc91e5a1c20cde1d4000f4c5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 03:01:37 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=2cd7a99cebafb932fc91e5a1c20cde1d4000f4c5 commit 2cd7a99cebafb932fc91e5a1c20cde1d4000f4c5 Author: Alexander Motin AuthorDate: 2021-03-03 16:58:04 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:54:45 +0000 Restore condition removed in df3747c6607b. I think it allowed to avoid some TX thread wakeups while the socket buffer is full. But add there another options if ic_check_send_space is set, which means socket just reported that new space appeared, so it may have sense to pull more data from ic_to_send for better TX coalescing. MFC after: 1 week (cherry picked from commit aff9b9ee894e3e6b6d8c7e4182d6b973804df853) --- sys/dev/iscsi/icl_soft.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index d4333b64a77c..d995bedbcb72 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -912,7 +912,8 @@ icl_send_thread(void *arg) * This way the icl_conn_send_pdus() can go through * all the queued PDUs without holding any locks. */ - STAILQ_CONCAT(&queue, &ic->ic_to_send); + if (STAILQ_EMPTY(&queue) || ic->ic_check_send_space) + STAILQ_CONCAT(&queue, &ic->ic_to_send); ic->ic_check_send_space = false; ICL_CONN_UNLOCK(ic); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 03:01:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A97FC56CD8E; Mon, 15 Mar 2021 03:01: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 4DzLmK3ZMJz3QZC; Mon, 15 Mar 2021 03:01: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 C2A541199; Mon, 15 Mar 2021 03:01: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 12F31XoF098089; Mon, 15 Mar 2021 03:01:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F31XTd098088; Mon, 15 Mar 2021 03:01:33 GMT (envelope-from git) Date: Mon, 15 Mar 2021 03:01:33 GMT Message-Id: <202103150301.12F31XTd098088@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alexander Motin Subject: git: 6cd4542786f9 - stable/12 - Move ic_check_send_space clear to the actual check. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 6cd4542786f929ea57604662d7d5537f13261382 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 03:01:38 -0000 The branch stable/12 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=6cd4542786f929ea57604662d7d5537f13261382 commit 6cd4542786f929ea57604662d7d5537f13261382 Author: Alexander Motin AuthorDate: 2021-03-03 20:21:26 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 02:54:56 +0000 Move ic_check_send_space clear to the actual check. It closes tiny race when the flag could be set between being cleared and the space is checked, that would create us some more work. The flag setting is protected by both locks, so we can clear it in either place, but in between both locks are dropped. MFC after: 1 week (cherry picked from commit afc3e54eeee635a525c88e4678cc38e3219302c3) --- sys/dev/iscsi/icl_soft.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c index d995bedbcb72..454afe15c398 100644 --- a/sys/dev/iscsi/icl_soft.c +++ b/sys/dev/iscsi/icl_soft.c @@ -802,6 +802,7 @@ icl_conn_send_pdus(struct icl_conn *ic, struct icl_pdu_stailq *queue) * of error. */ available = sbspace(&so->so_snd); + ic->ic_check_send_space = false; /* * Notify the socket upcall that we don't need wakeups @@ -915,7 +916,6 @@ icl_send_thread(void *arg) if (STAILQ_EMPTY(&queue) || ic->ic_check_send_space) STAILQ_CONCAT(&queue, &ic->ic_to_send); - ic->ic_check_send_space = false; ICL_CONN_UNLOCK(ic); icl_conn_send_pdus(ic, &queue); ICL_CONN_LOCK(ic); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 04:53:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6971A56F158; Mon, 15 Mar 2021 04:53:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzPDr2NbLz3n1m; Mon, 15 Mar 2021 04:53:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4461C2985; Mon, 15 Mar 2021 04:53:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12F4r02r047369; Mon, 15 Mar 2021 04:53:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F4qxjV047368; Mon, 15 Mar 2021 04:52:59 GMT (envelope-from git) Date: Mon, 15 Mar 2021 04:52:59 GMT Message-Id: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 74ae3f3e33b810248da19004c58b3581cd367843 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 04:53:00 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=74ae3f3e33b810248da19004c58b3581cd367843 commit 74ae3f3e33b810248da19004c58b3581cd367843 Author: Kyle Evans AuthorDate: 2021-03-15 02:25:40 +0000 Commit: Kyle Evans CommitDate: 2021-03-15 04:52:04 +0000 if_wg: import latest fixup work from the wireguard-freebsd project This is the culmination of about a week of work from three developers to fix a number of functional and security issues. This patch consists of work done by the following folks: - Jason A. Donenfeld - Matt Dunwoodie - Kyle Evans Notable changes include: - Packets are now correctly staged for processing once the handshake has completed, resulting in less packet loss in the interim. - Various race conditions have been resolved, particularly w.r.t. socket and packet lifetime (panics) - Various tests have been added to assure correct functionality and tooling conformance - Many security issues have been addressed - if_wg now maintains jail-friendly semantics: sockets are created in the interface's home vnet so that it can act as the sole network connection for a jail - if_wg no longer fails to remove peer allowed-ips of 0.0.0.0/0 - if_wg now exports via ioctl a format that is future proof and complete. It is additionally supported by the upstream wireguard-tools (which we plan to merge in to base soon) - if_wg now conforms to the WireGuard protocol and is more closely aligned with security auditing guidelines Note that the driver has been rebased away from using iflib. iflib poses a number of challenges for a cloned device trying to operate in a vnet that are non-trivial to solve and adds complexity to the implementation for little gain. The crypto implementation that was previously added to the tree was a super complex integration of what previously appeared in an old out of tree Linux module, which has been reduced to crypto.c containing simple boring reference implementations. This is part of a near-to-mid term goal to work with FreeBSD kernel crypto folks and take advantage of or improve accelerated crypto already offered elsewhere. There's additional test suite effort underway out-of-tree taking advantage of the aforementioned jail-friendly semantics to test a number of real-world topologies, based on netns.sh. Also note that this is still a work in progress; work going further will be much smaller in nature. MFC after: 1 month (maybe) --- etc/mtree/BSD.include.dist | 2 + include/Makefile | 9 +- sbin/ifconfig/ifwg.c | 395 +- share/man/man4/wg.4 | 26 +- sys/dev/if_wg/crypto.c | 1705 ++++ sys/dev/if_wg/crypto.h | 114 + sys/dev/if_wg/if_wg.c | 3454 ++++++++ sys/dev/if_wg/if_wg.h | 36 + sys/dev/if_wg/include/crypto/blake2s.h | 56 - sys/dev/if_wg/include/crypto/curve25519.h | 74 - sys/dev/if_wg/include/crypto/zinc.h | 15 - sys/dev/if_wg/include/sys/if_wg_session.h | 89 - sys/dev/if_wg/include/sys/if_wg_session_vars.h | 319 - sys/dev/if_wg/include/sys/simd-x86_64.h | 74 - sys/dev/if_wg/include/sys/support.h | 342 - sys/dev/if_wg/include/sys/wg_module.h | 121 - sys/dev/if_wg/include/sys/wg_noise.h | 286 - sys/dev/if_wg/include/zinc/blake2s.h | 50 - sys/dev/if_wg/include/zinc/chacha20.h | 68 - sys/dev/if_wg/include/zinc/chacha20poly1305.h | 48 - sys/dev/if_wg/include/zinc/curve25519.h | 28 - sys/dev/if_wg/include/zinc/poly1305.h | 29 - sys/dev/if_wg/module/blake2s.c | 256 - sys/dev/if_wg/module/blake2s.h | 58 - sys/dev/if_wg/module/chacha20-x86_64.S | 2834 ------- .../crypto/zinc/chacha20/chacha20-arm-glue.c | 98 - .../module/crypto/zinc/chacha20/chacha20-arm.pl | 1227 --- .../module/crypto/zinc/chacha20/chacha20-arm64.pl | 1163 --- .../crypto/zinc/chacha20/chacha20-mips-glue.c | 27 - .../module/crypto/zinc/chacha20/chacha20-mips.S | 424 - .../crypto/zinc/chacha20/chacha20-x86_64-glue.c | 132 - .../module/crypto/zinc/chacha20/chacha20-x86_64.pl | 4106 ---------- .../if_wg/module/crypto/zinc/chacha20/chacha20.c | 238 - .../if_wg/module/crypto/zinc/chacha20poly1305.c | 196 - .../crypto/zinc/poly1305/poly1305-arm-glue.c | 140 - .../module/crypto/zinc/poly1305/poly1305-arm.pl | 1276 --- .../module/crypto/zinc/poly1305/poly1305-arm64.pl | 974 --- .../module/crypto/zinc/poly1305/poly1305-donna32.c | 205 - .../module/crypto/zinc/poly1305/poly1305-donna64.c | 182 - .../crypto/zinc/poly1305/poly1305-mips-glue.c | 37 - .../module/crypto/zinc/poly1305/poly1305-mips.S | 407 - .../module/crypto/zinc/poly1305/poly1305-mips64.pl | 467 -- .../crypto/zinc/poly1305/poly1305-x86_64-glue.c | 171 - .../module/crypto/zinc/poly1305/poly1305-x86_64.pl | 4266 ---------- .../if_wg/module/crypto/zinc/poly1305/poly1305.c | 163 - .../if_wg/module/crypto/zinc/selftest/blake2s.c | 2090 ----- .../if_wg/module/crypto/zinc/selftest/chacha20.c | 2703 ------- .../module/crypto/zinc/selftest/chacha20poly1305.c | 8443 -------------------- .../if_wg/module/crypto/zinc/selftest/curve25519.c | 1315 --- .../if_wg/module/crypto/zinc/selftest/poly1305.c | 1110 --- sys/dev/if_wg/module/crypto/zinc/selftest/run.h | 43 - sys/dev/if_wg/module/curve25519.c | 867 -- sys/dev/if_wg/module/if_wg_session.c | 1984 ----- sys/dev/if_wg/module/module.c | 954 --- sys/dev/if_wg/module/poly1305-x86_64.S | 3021 ------- sys/dev/if_wg/support.h | 56 + sys/dev/if_wg/{module => }/wg_cookie.c | 105 +- sys/dev/if_wg/{include/sys => }/wg_cookie.h | 81 +- sys/dev/if_wg/{module => }/wg_noise.c | 409 +- sys/dev/if_wg/wg_noise.h | 191 + sys/kern/kern_jail.c | 1 + sys/kern/uipc_socket.c | 11 + sys/kern/uipc_syscalls.c | 4 +- sys/modules/if_wg/Makefile | 30 +- sys/net/if_types.h | 1 + sys/netinet6/nd6.c | 4 +- sys/sys/priv.h | 1 + sys/sys/socketvar.h | 1 + tests/sys/netinet/Makefile | 10 +- tests/sys/netinet/if_wg_test.sh | 188 + 70 files changed, 6333 insertions(+), 43677 deletions(-) diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist index e7784cbb0a47..0f85798815d5 100644 --- a/etc/mtree/BSD.include.dist +++ b/etc/mtree/BSD.include.dist @@ -64,6 +64,8 @@ .. iicbus .. + if_wg + .. io .. mfi diff --git a/include/Makefile b/include/Makefile index 3a34ddb8aa18..31e207f6b199 100644 --- a/include/Makefile +++ b/include/Makefile @@ -44,7 +44,7 @@ LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \ LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ dev/hwpmc dev/hyperv \ - dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \ + dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ @@ -170,6 +170,10 @@ NVPAIRDIR= ${INCLUDEDIR}/sys MLX5= mlx5io.h MLX5DIR= ${INCLUDEDIR}/dev/mlx5 +.PATH: ${SRCTOP}/sys/dev/if_wg +WG= if_wg.h +WGDIR= ${INCLUDEDIR}/dev/if_wg + INCSGROUPS= INCS \ ACPICA \ AGP \ @@ -182,7 +186,8 @@ INCSGROUPS= INCS \ PCI \ RPC \ TEKEN \ - VERIEXEC + VERIEXEC \ + WG .if ${MK_IPFILTER} != "no" INCSGROUPS+= IPFILTER diff --git a/sbin/ifconfig/ifwg.c b/sbin/ifconfig/ifwg.c index 86bacc59f50d..a102f392cf80 100644 --- a/sbin/ifconfig/ifwg.c +++ b/sbin/ifconfig/ifwg.c @@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -65,40 +67,60 @@ __FBSDID("$FreeBSD$"); #include "ifconfig.h" -typedef enum { - WGC_GET = 0x5, - WGC_SET = 0x6, -} wg_cmd_t; +static void wgfinish(int s, void *arg); + +static bool wgfinish_registered; -static nvlist_t *nvl_params; -static bool do_peer; static int allowed_ips_count; static int allowed_ips_max; -struct allowedip { - struct sockaddr_storage a_addr; - struct sockaddr_storage a_mask; -}; -struct allowedip *allowed_ips; +static nvlist_t **allowed_ips, *nvl_peer; #define ALLOWEDIPS_START 16 -#define WG_KEY_LEN 32 -#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1) -#define WG_KEY_LEN_HEX (WG_KEY_LEN * 2 + 1) +#define WG_KEY_SIZE_BASE64 ((((WG_KEY_SIZE) + 2) / 3) * 4 + 1) +#define WG_KEY_SIZE_HEX (WG_KEY_SIZE * 2 + 1) #define WG_MAX_STRLEN 64 +struct allowedip { + union { + struct in_addr ip4; + struct in6_addr ip6; + }; +}; + +static void +register_wgfinish(void) +{ + + if (wgfinish_registered) + return; + callback_register(wgfinish, NULL); + wgfinish_registered = true; +} + +static nvlist_t * +nvl_device(void) +{ + static nvlist_t *_nvl_device; + + if (_nvl_device == NULL) + _nvl_device = nvlist_create(0); + register_wgfinish(); + return (_nvl_device); +} + static bool -key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64) +key_from_base64(uint8_t key[static WG_KEY_SIZE], const char *base64) { - if (strlen(base64) != WG_KEY_LEN_BASE64 - 1) { - warnx("bad key len - need %d got %zu\n", WG_KEY_LEN_BASE64 - 1, strlen(base64)); + if (strlen(base64) != WG_KEY_SIZE_BASE64 - 1) { + warnx("bad key len - need %d got %zu\n", WG_KEY_SIZE_BASE64 - 1, strlen(base64)); return false; } - if (base64[WG_KEY_LEN_BASE64 - 2] != '=') { - warnx("bad key terminator, expected '=' got '%c'", base64[WG_KEY_LEN_BASE64 - 2]); + if (base64[WG_KEY_SIZE_BASE64 - 2] != '=') { + warnx("bad key terminator, expected '=' got '%c'", base64[WG_KEY_SIZE_BASE64 - 2]); return false; } - return (b64_pton(base64, key, WG_KEY_LEN)); + return (b64_pton(base64, key, WG_KEY_SIZE)); } static void @@ -128,7 +150,7 @@ parse_endpoint(const char *endpoint_) err = getaddrinfo(endpoint, port, &hints, &res); if (err) errx(1, "%s", gai_strerror(err)); - nvlist_add_binary(nvl_params, "endpoint", res->ai_addr, res->ai_addrlen); + nvlist_add_binary(nvl_peer, "endpoint", res->ai_addr, res->ai_addrlen); freeaddrinfo(res); free(base); } @@ -227,12 +249,14 @@ in6_mask2len(struct in6_addr *mask, u_char *lim0) } static bool -parse_ip(struct allowedip *aip, const char *value) +parse_ip(struct allowedip *aip, uint16_t *family, const char *value) { struct addrinfo hints, *res; int err; + bool ret; - bzero(&aip->a_addr, sizeof(aip->a_addr)); + ret = true; + bzero(aip, sizeof(*aip)); bzero(&hints, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_flags = AI_NUMERICHOST; @@ -240,10 +264,21 @@ parse_ip(struct allowedip *aip, const char *value) if (err) errx(1, "%s", gai_strerror(err)); - memcpy(&aip->a_addr, res->ai_addr, res->ai_addrlen); + *family = res->ai_family; + if (res->ai_family == AF_INET) { + struct sockaddr_in *sin = (struct sockaddr_in *)res->ai_addr; + + aip->ip4 = sin->sin_addr; + } else if (res->ai_family == AF_INET6) { + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)res->ai_addr; + + aip->ip6 = sin6->sin6_addr; + } else { + ret = false; + } freeaddrinfo(res); - return (true); + return (ret); } static void @@ -271,61 +306,84 @@ sa_ntop(const struct sockaddr *sa, char *buf, int *port) } static void -dump_peer(const nvlist_t *nvl_peer) +dump_peer(const nvlist_t *nvl_peer_cfg) { const void *key; - const struct allowedip *aips; const struct sockaddr *endpoint; char outbuf[WG_MAX_STRLEN]; char addr_buf[INET6_ADDRSTRLEN]; - size_t size; - int count, port; + size_t aip_count, size; + int port; uint16_t persistent_keepalive; + const nvlist_t * const *nvl_aips; printf("[Peer]\n"); - if (nvlist_exists_binary(nvl_peer, "public-key")) { - key = nvlist_get_binary(nvl_peer, "public-key", &size); + if (nvlist_exists_binary(nvl_peer_cfg, "public-key")) { + key = nvlist_get_binary(nvl_peer_cfg, "public-key", &size); b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); printf("PublicKey = %s\n", outbuf); } - if (nvlist_exists_binary(nvl_peer, "endpoint")) { - endpoint = nvlist_get_binary(nvl_peer, "endpoint", &size); + if (nvlist_exists_binary(nvl_peer_cfg, "preshared-key")) { + key = nvlist_get_binary(nvl_peer_cfg, "preshared-key", &size); + b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); + printf("PresharedKey = %s\n", outbuf); + } + if (nvlist_exists_binary(nvl_peer_cfg, "endpoint")) { + endpoint = nvlist_get_binary(nvl_peer_cfg, "endpoint", &size); sa_ntop(endpoint, addr_buf, &port); printf("Endpoint = %s:%d\n", addr_buf, ntohs(port)); } - if (nvlist_exists_number(nvl_peer, "persistent-keepalive-interval")) { - persistent_keepalive = nvlist_get_number(nvl_peer, + if (nvlist_exists_number(nvl_peer_cfg, + "persistent-keepalive-interval")) { + persistent_keepalive = nvlist_get_number(nvl_peer_cfg, "persistent-keepalive-interval"); printf("PersistentKeepalive = %d\n", persistent_keepalive); } - if (!nvlist_exists_binary(nvl_peer, "allowed-ips")) + if (!nvlist_exists_nvlist_array(nvl_peer_cfg, "allowed-ips")) return; - aips = nvlist_get_binary(nvl_peer, "allowed-ips", &size); - if (size == 0 || size % sizeof(struct allowedip) != 0) { - errx(1, "size %zu not integer multiple of allowedip", size); - } + + nvl_aips = nvlist_get_nvlist_array(nvl_peer_cfg, "allowed-ips", &aip_count); + if (nvl_aips == NULL || aip_count == 0) + return; + printf("AllowedIPs = "); - count = size / sizeof(struct allowedip); - for (int i = 0; i < count; i++) { - int mask; + for (size_t i = 0; i < aip_count; i++) { + uint8_t cidr; + struct sockaddr_storage ss; sa_family_t family; - void *bitmask; - struct sockaddr *sa; - - sa = __DECONST(void *, &aips[i].a_addr); - bitmask = __DECONST(void *, - ((const struct sockaddr *)&(&aips[i])->a_mask)->sa_data); - family = aips[i].a_addr.ss_family; - getnameinfo(sa, sa->sa_len, addr_buf, INET6_ADDRSTRLEN, NULL, - 0, NI_NUMERICHOST); - if (family == AF_INET) - mask = in_mask2len(bitmask); - else if (family == AF_INET6) - mask = in6_mask2len(bitmask, NULL); - else - errx(1, "bad family in peer %d\n", family); - printf("%s/%d", addr_buf, mask); - if (i < count -1) + + if (!nvlist_exists_number(nvl_aips[i], "cidr")) + continue; + cidr = nvlist_get_number(nvl_aips[i], "cidr"); + if (nvlist_exists_binary(nvl_aips[i], "ipv4")) { + struct sockaddr_in *sin = (struct sockaddr_in *)&ss; + const struct in_addr *ip4; + + ip4 = nvlist_get_binary(nvl_aips[i], "ipv4", &size); + if (ip4 == NULL || cidr > 32) + continue; + sin->sin_len = sizeof(*sin); + sin->sin_family = AF_INET; + sin->sin_addr = *ip4; + } else if (nvlist_exists_binary(nvl_aips[i], "ipv6")) { + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&ss; + const struct in6_addr *ip6; + + ip6 = nvlist_get_binary(nvl_aips[i], "ipv6", &size); + if (ip6 == NULL || cidr > 128) + continue; + sin6->sin6_len = sizeof(*sin6); + sin6->sin6_family = AF_INET6; + sin6->sin6_addr = *ip6; + } else { + continue; + } + + family = ss.ss_family; + getnameinfo((struct sockaddr *)&ss, ss.ss_len, addr_buf, + INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST); + printf("%s/%d", addr_buf, cidr); + if (i < aip_count - 1) printf(", "); } printf("\n"); @@ -334,36 +392,34 @@ dump_peer(const nvlist_t *nvl_peer) static int get_nvl_out_size(int sock, u_long op, size_t *size) { - struct ifdrv ifd; + struct wg_data_io wgd; int err; - memset(&ifd, 0, sizeof(ifd)); + memset(&wgd, 0, sizeof(wgd)); - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); - ifd.ifd_cmd = op; - ifd.ifd_len = 0; - ifd.ifd_data = NULL; + strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); + wgd.wgd_size = 0; + wgd.wgd_data = NULL; - err = ioctl(sock, SIOCGDRVSPEC, &ifd); + err = ioctl(sock, op, &wgd); if (err) return (err); - *size = ifd.ifd_len; + *size = wgd.wgd_size; return (0); } static int do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) { - struct ifdrv ifd; + struct wg_data_io wgd; - memset(&ifd, 0, sizeof(ifd)); + memset(&wgd, 0, sizeof(wgd)); - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); - ifd.ifd_cmd = op; - ifd.ifd_len = argsize; - ifd.ifd_data = arg; + strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); + wgd.wgd_size = argsize; + wgd.wgd_data = arg; - return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); + return (ioctl(sock, op, &wgd)); } static @@ -371,62 +427,83 @@ DECL_CMD_FUNC(peerlist, val, d) { size_t size, peercount; void *packed; - const nvlist_t *nvl, *nvl_peer; + const nvlist_t *nvl; const nvlist_t *const *nvl_peerlist; - if (get_nvl_out_size(s, WGC_GET, &size)) + if (get_nvl_out_size(s, SIOCGWG, &size)) errx(1, "can't get peer list size"); if ((packed = malloc(size)) == NULL) errx(1, "malloc failed for peer list"); - if (do_cmd(s, WGC_GET, packed, size, 0)) + if (do_cmd(s, SIOCGWG, packed, size, 0)) errx(1, "failed to obtain peer list"); nvl = nvlist_unpack(packed, size, 0); - if (!nvlist_exists_nvlist_array(nvl, "peer-list")) + if (!nvlist_exists_nvlist_array(nvl, "peers")) return; - nvl_peerlist = nvlist_get_nvlist_array(nvl, "peer-list", &peercount); + nvl_peerlist = nvlist_get_nvlist_array(nvl, "peers", &peercount); for (int i = 0; i < peercount; i++, nvl_peerlist++) { - nvl_peer = *nvl_peerlist; - dump_peer(nvl_peer); + dump_peer(*nvl_peerlist); } } static void -peerfinish(int s, void *arg) +wgfinish(int s, void *arg) { - nvlist_t *nvl, **nvl_array; void *packed; size_t size; + static nvlist_t *nvl_dev; + + nvl_dev = nvl_device(); + if (nvl_peer != NULL) { + if (!nvlist_exists_binary(nvl_peer, "public-key")) + errx(1, "must specify a public-key for adding peer"); + if (allowed_ips_count != 0) { + nvlist_add_nvlist_array(nvl_peer, "allowed-ips", + (const nvlist_t * const *)allowed_ips, + allowed_ips_count); + for (size_t i = 0; i < allowed_ips_count; i++) { + nvlist_destroy(allowed_ips[i]); + } + + free(allowed_ips); + } + + nvlist_add_nvlist_array(nvl_dev, "peers", + (const nvlist_t * const *)&nvl_peer, 1); + } + + packed = nvlist_pack(nvl_dev, &size); - if ((nvl = nvlist_create(0)) == NULL) - errx(1, "failed to allocate nvlist"); - if ((nvl_array = calloc(sizeof(void *), 1)) == NULL) - errx(1, "failed to allocate nvl_array"); - if (!nvlist_exists_binary(nvl_params, "public-key")) - errx(1, "must specify a public-key for adding peer"); - if (allowed_ips_count == 0) - errx(1, "must specify at least one range of allowed-ips to add a peer"); - - nvl_array[0] = nvl_params; - nvlist_add_nvlist_array(nvl, "peer-list", (const nvlist_t * const *)nvl_array, 1); - packed = nvlist_pack(nvl, &size); - - if (do_cmd(s, WGC_SET, packed, size, true)) - errx(1, "failed to install peer"); + if (do_cmd(s, SIOCSWG, packed, size, true)) + errx(1, "failed to configure"); } static DECL_CMD_FUNC(peerstart, val, d) { - do_peer = true; - callback_register(peerfinish, NULL); - allowed_ips = malloc(ALLOWEDIPS_START * sizeof(struct allowedip)); + + if (nvl_peer != NULL) + errx(1, "cannot both add and remove a peer"); + register_wgfinish(); + nvl_peer = nvlist_create(0); + allowed_ips = calloc(ALLOWEDIPS_START, sizeof(*allowed_ips)); allowed_ips_max = ALLOWEDIPS_START; if (allowed_ips == NULL) errx(1, "failed to allocate array for allowedips"); } +static +DECL_CMD_FUNC(peerdel, val, d) +{ + + if (nvl_peer != NULL) + errx(1, "cannot both add and remove a peer"); + register_wgfinish(); + nvl_peer = nvlist_create(0); + nvlist_add_bool(nvl_peer, "remove", true); +} + static DECL_CMD_FUNC(setwglistenport, val, d) { @@ -454,39 +531,53 @@ DECL_CMD_FUNC(setwglistenport, val, d) errx(1, "unknown family"); } ul = ntohs((u_short)ul); - nvlist_add_number(nvl_params, "listen-port", ul); + nvlist_add_number(nvl_device(), "listen-port", ul); } static DECL_CMD_FUNC(setwgprivkey, val, d) { - uint8_t key[WG_KEY_LEN]; + uint8_t key[WG_KEY_SIZE]; if (!key_from_base64(key, val)) errx(1, "invalid key %s", val); - nvlist_add_binary(nvl_params, "private-key", key, WG_KEY_LEN); + nvlist_add_binary(nvl_device(), "private-key", key, WG_KEY_SIZE); } static DECL_CMD_FUNC(setwgpubkey, val, d) { - uint8_t key[WG_KEY_LEN]; + uint8_t key[WG_KEY_SIZE]; - if (!do_peer) + if (nvl_peer == NULL) errx(1, "setting public key only valid when adding peer"); if (!key_from_base64(key, val)) errx(1, "invalid key %s", val); - nvlist_add_binary(nvl_params, "public-key", key, WG_KEY_LEN); + nvlist_add_binary(nvl_peer, "public-key", key, WG_KEY_SIZE); } +static +DECL_CMD_FUNC(setwgpresharedkey, val, d) +{ + uint8_t key[WG_KEY_SIZE]; + + if (nvl_peer == NULL) + errx(1, "setting preshared-key only valid when adding peer"); + + if (!key_from_base64(key, val)) + errx(1, "invalid key %s", val); + nvlist_add_binary(nvl_peer, "preshared-key", key, WG_KEY_SIZE); +} + + static DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) { unsigned long persistent_keepalive; char *endp; - if (!do_peer) + if (nvl_peer == NULL) errx(1, "setting persistent keepalive only valid when adding peer"); errno = 0; @@ -496,7 +587,7 @@ DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) if (persistent_keepalive > USHRT_MAX) errx(1, "persistent-keepalive '%lu' too large", persistent_keepalive); - nvlist_add_number(nvl_params, "persistent-keepalive-interval", + nvlist_add_number(nvl_peer, "persistent-keepalive-interval", persistent_keepalive); } @@ -506,45 +597,57 @@ DECL_CMD_FUNC(setallowedips, val, d) char *base, *allowedip, *mask; u_long ul; char *endp; - struct allowedip *aip; + struct allowedip aip; + nvlist_t *nvl_aip; + uint16_t family; - if (!do_peer) + if (nvl_peer == NULL) errx(1, "setting allowed ip only valid when adding peer"); if (allowed_ips_count == allowed_ips_max) { - /* XXX grow array */ + allowed_ips_max *= 2; + allowed_ips = reallocarray(allowed_ips, allowed_ips_max, + sizeof(*allowed_ips)); + if (allowed_ips == NULL) + errx(1, "failed to grow allowed ip array"); } - aip = &allowed_ips[allowed_ips_count]; + + allowed_ips[allowed_ips_count] = nvl_aip = nvlist_create(0); + if (nvl_aip == NULL) + errx(1, "failed to create new allowedip nvlist"); + base = allowedip = strdup(val); mask = index(allowedip, '/'); if (mask == NULL) errx(1, "mask separator not found in allowedip %s", val); *mask = '\0'; mask++; - parse_ip(aip, allowedip); + + parse_ip(&aip, &family, allowedip); ul = strtoul(mask, &endp, 0); if (*endp != '\0') errx(1, "invalid value for allowedip mask"); - bzero(&aip->a_mask, sizeof(aip->a_mask)); - if (aip->a_addr.ss_family == AF_INET) - in_len2mask((struct in_addr *)&((struct sockaddr *)&aip->a_mask)->sa_data, ul); - else if (aip->a_addr.ss_family == AF_INET6) - in6_prefixlen2mask((struct in6_addr *)&((struct sockaddr *)&aip->a_mask)->sa_data, ul); - else - errx(1, "invalid address family %d\n", aip->a_addr.ss_family); + + nvlist_add_number(nvl_aip, "cidr", ul); + if (family == AF_INET) { + nvlist_add_binary(nvl_aip, "ipv4", &aip.ip4, sizeof(aip.ip4)); + } else if (family == AF_INET6) { + nvlist_add_binary(nvl_aip, "ipv6", &aip.ip6, sizeof(aip.ip6)); + } else { + /* Shouldn't happen */ + nvlist_destroy(nvl_aip); + goto out; + } + allowed_ips_count++; - if (allowed_ips_count > 1) - nvlist_free_binary(nvl_params, "allowed-ips"); - nvlist_add_binary(nvl_params, "allowed-ips", allowed_ips, - allowed_ips_count*sizeof(*aip)); - dump_peer(nvl_params); +out: free(base); } static DECL_CMD_FUNC(setendpoint, val, d) { - if (!do_peer) + if (nvl_peer == NULL) errx(1, "setting endpoint only valid when adding peer"); parse_endpoint(val); } @@ -555,15 +658,15 @@ wireguard_status(int s) size_t size; void *packed; nvlist_t *nvl; - char buf[WG_KEY_LEN_BASE64]; + char buf[WG_KEY_SIZE_BASE64]; const void *key; uint16_t listen_port; - if (get_nvl_out_size(s, WGC_GET, &size)) + if (get_nvl_out_size(s, SIOCGWG, &size)) return; if ((packed = malloc(size)) == NULL) return; - if (do_cmd(s, WGC_GET, packed, size, 0)) + if (do_cmd(s, SIOCGWG, packed, size, 0)) return; nvl = nvlist_unpack(packed, size, 0); if (nvlist_exists_number(nvl, "listen-port")) { @@ -583,10 +686,14 @@ wireguard_status(int s) } static struct cmd wireguard_cmds[] = { - DEF_CLONE_CMD_ARG("listen-port", setwglistenport), - DEF_CLONE_CMD_ARG("private-key", setwgprivkey), + DEF_CMD_ARG("listen-port", setwglistenport), + DEF_CMD_ARG("private-key", setwgprivkey), + /* XXX peer-list is deprecated. */ DEF_CMD("peer-list", 0, peerlist), + DEF_CMD("peers", 0, peerlist), DEF_CMD("peer", 0, peerstart), + DEF_CMD("-peer", 0, peerdel), + DEF_CMD_ARG("preshared-key", setwgpresharedkey), DEF_CMD_ARG("public-key", setwgpubkey), DEF_CMD_ARG("persistent-keepalive", setwgpersistentkeepalive), DEF_CMD_ARG("allowed-ips", setallowedips), @@ -602,27 +709,10 @@ static struct afswtch af_wireguard = { static void wg_create(int s, struct ifreq *ifr) { - struct iovec iov; - void *packed; - size_t size; setproctitle("ifconfig %s create ...\n", name); - if (!nvlist_exists_number(nvl_params, "listen-port")) - goto legacy; - if (!nvlist_exists_binary(nvl_params, "private-key")) - goto legacy; - - packed = nvlist_pack(nvl_params, &size); - if (packed == NULL) - errx(1, "failed to setup create request"); - iov.iov_len = size; - iov.iov_base = packed; - ifr->ifr_data = (caddr_t)&iov; - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) - err(1, "SIOCIFCREATE2"); - return; -legacy: - ifr->ifr_data == NULL; + + ifr->ifr_data = NULL; if (ioctl(s, SIOCIFCREATE, ifr) < 0) err(1, "SIOCIFCREATE"); } @@ -632,7 +722,6 @@ wireguard_ctor(void) { int i; - nvl_params = nvlist_create(0); for (i = 0; i < nitems(wireguard_cmds); i++) cmd_register(&wireguard_cmds[i]); af_register(&af_wireguard); diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 index 335d3e70b64a..29215bd438ff 100644 --- a/share/man/man4/wg.4 +++ b/share/man/man4/wg.4 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 9, 2021 +.Dd March 12, 2021 .Dt WG 4 .Os .Sh NAME @@ -68,7 +68,7 @@ interface. The private key of the .Nm interface. -.It Cm pre-shared-key +.It Cm preshared-key Defines a pre-shared key for the .Nm interface. @@ -76,9 +76,9 @@ interface. A list of allowed IP addresses. .It Cm endpoint The IP address of the WiredGuard to connect to. -.It Cm peer-list +.It Cm peers A list of peering IP addresses to connect to. -.It Cm persistent-keepalive +.It Cm persistent-keepalive-interval Interval, in seconds, at which to send persistent keepalive packets. .El .Pp @@ -188,6 +188,11 @@ Connect to a specific endpoint using its public-key and set the allowed IP addre .Bd -literal -offset indent # ifconfig wg0 peer public-key '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=' endpoint 10.0.1.100:54321 allowed-ips 192.168.2.100/32 .Ed +.Pp +Remove a peer +.Bd -literal -offset indent +# ifconfig wg0 -peer public-key '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=' +.Ed .Sh DIAGNOSTICS The .Nm @@ -240,14 +245,11 @@ device driver first appeared in .Sh AUTHORS The .Nm -device driver was originally written for -.Ox -by -.An Matt Dunwoodie Aq Mt ncon@nconroy.net -and ported to -.Fx -by -.An Matt Macy Aq Mt mmacy@FreeBSD.org . +device driver written by +.An Jason A. Donenfeld Aq Mt Jason@zx2c4.com , +.An Matt Dunwoodie Aq Mt ncon@nconroy.net , +and +.An Kyle Evans Aq Mt kevans@FreeBSD.org . .Pp This manual page was written by .An Gordon Bergling Aq Mt gbe@FreeBSD.org diff --git a/sys/dev/if_wg/crypto.c b/sys/dev/if_wg/crypto.c new file mode 100644 index 000000000000..f28585429272 --- /dev/null +++ b/sys/dev/if_wg/crypto.c @@ -0,0 +1,1705 @@ +/* + * Copyright (C) 2015-2021 Jason A. Donenfeld . All Rights Reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include + +#include "crypto.h" + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +#endif +#ifndef noinline +#define noinline __attribute__((noinline)) +#endif +#ifndef __aligned +#define __aligned(x) __attribute__((aligned(x))) +#endif +#ifndef DIV_ROUND_UP +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) +#endif + +#define le32_to_cpup(a) le32toh(*(a)) +#define le64_to_cpup(a) le64toh(*(a)) +#define cpu_to_le32(a) htole32(a) +#define cpu_to_le64(a) htole64(a) + +static inline uint32_t get_unaligned_le32(const uint8_t *a) +{ + uint32_t l; + __builtin_memcpy(&l, a, sizeof(l)); + return le32_to_cpup(&l); +} +static inline uint64_t get_unaligned_le64(const uint8_t *a) +{ + uint64_t l; + __builtin_memcpy(&l, a, sizeof(l)); + return le64_to_cpup(&l); +} +static inline void put_unaligned_le32(uint32_t s, uint8_t *d) +{ + uint32_t l = cpu_to_le32(s); + __builtin_memcpy(d, &l, sizeof(l)); +} +static inline void cpu_to_le32_array(uint32_t *buf, unsigned int words) +{ + while (words--) { + *buf = cpu_to_le32(*buf); + ++buf; + } +} +static inline void le32_to_cpu_array(uint32_t *buf, unsigned int words) +{ + while (words--) { + *buf = le32_to_cpup(buf); + ++buf; + } +} + +static inline uint32_t rol32(uint32_t word, unsigned int shift) +{ + return (word << (shift & 31)) | (word >> ((-shift) & 31)); +} +static inline uint32_t ror32(uint32_t word, unsigned int shift) +{ + return (word >> (shift & 31)) | (word << ((-shift) & 31)); +} + +static void xor_cpy(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, + size_t len) +{ + size_t i; + + for (i = 0; i < len; ++i) + dst[i] = src1[i] ^ src2[i]; +} + +#define QUARTER_ROUND(x, a, b, c, d) ( \ + x[a] += x[b], \ *** 50620 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Mon Mar 15 04:56:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 584E556F68D for ; Mon, 15 Mar 2021 04:56:34 +0000 (UTC) (envelope-from bounces+17430347-ff63-dev-commits-src-all=freebsd.org@em4842.fdc-k.africa) Received: from wrqvbrbn.outbound-mail.sendgrid.net (wrqvbrbn.outbound-mail.sendgrid.net [149.72.181.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzPJx5YBkz3nTx for ; Mon, 15 Mar 2021 04:56:33 +0000 (UTC) (envelope-from bounces+17430347-ff63-dev-commits-src-all=freebsd.org@em4842.fdc-k.africa) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fdc-k.africa; h=content-transfer-encoding:content-type:from:mime-version:to:subject:list-unsubscribe; s=s1; bh=bJyzAGzXHuLHV2sDt+3ADNpzYMEIWERpVK4d8dwnB/o=; b=oYiBIz6 iHJqkLeT6yfOk1ncG6M49ytNvcsAKVCXi/KrsySmAgEIt+konvGsQqraeiSieFY0 wSwpeULYfgo8GSJ12r2IOtwHgfi+7UTT6PGpMqsSBDOy8EaeIFFDoO5KI/RlD/a3 kv7JeoeMoMzAt/EvmWxsBz67mde4mdfXNArc= Received: by filter1993p1las1.sendgrid.net with SMTP id filter1993p1las1-23235-604EE09B-25 2021-03-15 04:20:43.860328021 +0000 UTC m=+1186483.635104188 Received: from MTc0MzAzNDc (unknown) by geopod-ismtpd-5-0 (SG) with HTTP id 5w9EDYp3RPGKj5nmM4P_ZA Mon, 15 Mar 2021 04:20:43.166 +0000 (UTC) Date: Mon, 15 Mar 2021 04:21:27 +0000 (UTC) From: "FDC Training" To: dev-commits-src-all@freebsd.org Message-ID: <5w9EDYp3RPGKj5nmM4P_ZA@geopod-ismtpd-5-0> Subject: Invitation to FDC training Programme May 2021 X-SG-EID: tEzs+hGm85Gb96SmeoEyTlo5qbM35JTqEkPku4I7SE2ngdt8tKZUJupKFKBbdrz37SrNE3KrQXM+C3 SBF1cn1hRMr9/Nh/2f63yt63/PiUM2JvaguYcc5dBPIu3A5ie01uQAWV1W9sbiZEzClk7ucQupDHCt y7SoOFa+/3fkixUjFRjtGtpL/aEM83yUHb7KENae6lEZghByFyMJ3DsnEQdjTFKf8/dx2+Btkmx8K0 ouF7cXinIYRClnN7u62C/I X-Entity-ID: lgZohGoWIjvYsKzlUpYsxA== X-Rspamd-Queue-Id: 4DzPJx5YBkz3nTx X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=fdc-k.africa header.s=s1 header.b=oYiBIz6 ; dmarc=pass (policy=none) header.from=fdc-k.africa; spf=pass (mx1.freebsd.org: domain of bounces@em4842.fdc-k.africa designates 149.72.181.178 as permitted sender) smtp.mailfrom=bounces@em4842.fdc-k.africa X-Spamd-Result: default: False [-2.41 / 15.00]; R_SPF_ALLOW(-0.20)[+ip4:149.72.0.0/16:c]; MV_CASE(0.50)[]; TO_DN_NONE(0.00)[]; DKIM_TRACE(0.00)[fdc-k.africa:+]; DMARC_POLICY_ALLOW(-0.50)[fdc-k.africa,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FORGED_SENDER(0.30)[training@fdc-k.africa,bounces@em4842.fdc-k.africa]; RCVD_TLS_LAST(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[149.72.181.178:from]; ASN(0.00)[asn:11377, ipnet:149.72.128.0/17, country:US]; MIME_TRACE(0.00)[0:~]; TAGGED_FROM(0.00)[17430347-ff63-dev-commits-src-all=freebsd.org]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[fdc-k.africa:s=s1]; FROM_NEQ_ENVFROM(0.00)[training@fdc-k.africa,bounces@em4842.fdc-k.africa]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; HAS_LIST_UNSUB(-0.01)[]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[149.72.181.178:from:127.0.2.255]; MIME_HTML_ONLY(0.20)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[149.72.181.178:from]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[dev-commits-src-all] MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 04:56:34 -0000 From owner-dev-commits-src-all@freebsd.org Mon Mar 15 04:56:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C93B956F261; Mon, 15 Mar 2021 04:56: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 4DzPKC5G4hz3nFc; Mon, 15 Mar 2021 04:56: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 A749728A3; Mon, 15 Mar 2021 04:56: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 12F4ul6r048040; Mon, 15 Mar 2021 04:56:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F4ulsF048039; Mon, 15 Mar 2021 04:56:47 GMT (envelope-from git) Date: Mon, 15 Mar 2021 04:56:47 GMT Message-Id: <202103150456.12F4ulsF048039@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: e801c980e253 - stable/12 - Prevent framebuffer mmio space from being allocated to other devices on HyperV. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e801c980e253d3f4087ef6d6b8fd382aed68d51c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 04:56:47 -0000 The branch stable/12 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=e801c980e253d3f4087ef6d6b8fd382aed68d51c commit e801c980e253d3f4087ef6d6b8fd382aed68d51c Author: Wei Hu AuthorDate: 2020-07-30 07:26:11 +0000 Commit: Wei Hu CommitDate: 2021-03-15 04:47:18 +0000 Prevent framebuffer mmio space from being allocated to other devices on HyperV. On Gen2 VMs, Hyper-V provides mmio space for framebuffer. This mmio address range is not useable for other PCI devices. Currently only efifb driver is using this range without reserving it from system. Therefore, vmbus driver reserves it before any other PCI device drivers start to request mmio addresses. PR: 222996 Submitted by: weh@microsoft.com Reported by: dmitry_kuleshov@ukr.net Reviewed by: decui@microsoft.com Sponsored by: Microsoft (cherry picked from commit c565776195f2f2b62427af07f6b1a9b7670cbc1f) --- sys/dev/hyperv/vmbus/vmbus.c | 57 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c index b027752290be..9d58c5e3e680 100644 --- a/sys/dev/hyperv/vmbus/vmbus.c +++ b/sys/dev/hyperv/vmbus/vmbus.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -46,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1292,12 +1294,66 @@ vmbus_get_mmio_res(device_t dev) vmbus_get_mmio_res_pass(dev, parse_32); } +/* + * On Gen2 VMs, Hyper-V provides mmio space for framebuffer. + * This mmio address range is not useable for other PCI devices. + * Currently only efifb driver is using this range without reserving + * it from system. + * Therefore, vmbus driver reserves it before any other PCI device + * drivers start to request mmio addresses. + */ +static struct resource *hv_fb_res; + +static void +vmbus_fb_mmio_res(device_t dev) +{ + struct efi_fb *efifb; + caddr_t kmdp; + + struct vmbus_softc *sc = device_get_softc(dev); + int rid = 0; + + kmdp = preload_search_by_type("elf kernel"); + if (kmdp == NULL) + kmdp = preload_search_by_type("elf64 kernel"); + efifb = (struct efi_fb *)preload_search_info(kmdp, + MODINFO_METADATA | MODINFOMD_EFI_FB); + if (efifb == NULL) { + if (bootverbose) + device_printf(dev, + "fb has no preloaded kernel efi information\n"); + /* We are on Gen1 VM, just return. */ + return; + } else { + if (bootverbose) + device_printf(dev, + "efifb: fb_addr: %#jx, size: %#jx, " + "actual size needed: 0x%x\n", + efifb->fb_addr, efifb->fb_size, + (int) efifb->fb_height * efifb->fb_width); + } + + hv_fb_res = pcib_host_res_alloc(&sc->vmbus_mmio_res, dev, + SYS_RES_MEMORY, &rid, + efifb->fb_addr, efifb->fb_addr + efifb->fb_size, efifb->fb_size, + RF_ACTIVE | rman_make_alignment_flags(PAGE_SIZE)); + + if (hv_fb_res && bootverbose) + device_printf(dev, + "successfully reserved memory for framebuffer " + "starting at %#jx, size %#jx\n", + efifb->fb_addr, efifb->fb_size); +} + static void vmbus_free_mmio_res(device_t dev) { struct vmbus_softc *sc = device_get_softc(dev); pcib_host_res_free(dev, &sc->vmbus_mmio_res); + + if (hv_fb_res) + hv_fb_res = NULL; } #endif /* NEW_PCIB */ @@ -1347,6 +1403,7 @@ vmbus_doattach(struct vmbus_softc *sc) #ifdef NEW_PCIB vmbus_get_mmio_res(sc->vmbus_dev); + vmbus_fb_mmio_res(sc->vmbus_dev); #endif sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; From owner-dev-commits-src-all@freebsd.org Mon Mar 15 05:05:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 312D156F663; Mon, 15 Mar 2021 05:05: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 4DzPWG0xSvz3nnl; Mon, 15 Mar 2021 05:05: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 0F16329AB; Mon, 15 Mar 2021 05:05:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12F55T3T061562; Mon, 15 Mar 2021 05:05:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F55T4E061561; Mon, 15 Mar 2021 05:05:29 GMT (envelope-from git) Date: Mon, 15 Mar 2021 05:05:29 GMT Message-Id: <202103150505.12F55T4E061561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: c38b9b80149f - stable/12 - hyperv/vmbus: Update VMBus version 4.0 and 5.0 support. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c38b9b80149f463b0c39a677e91b20925ec486d1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 05:05:30 -0000 The branch stable/12 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=c38b9b80149f463b0c39a677e91b20925ec486d1 commit c38b9b80149f463b0c39a677e91b20925ec486d1 Author: Wei Hu AuthorDate: 2019-07-09 07:24:18 +0000 Commit: Wei Hu CommitDate: 2021-03-15 05:00:05 +0000 hyperv/vmbus: Update VMBus version 4.0 and 5.0 support. Add VMBus protocol version 4.0. and 5.0 to support Windows 10 and newer HyperV hosts. For VMBus 4.0 and newer HyperV, the netvsc gpadl teardown must be done after vmbus close. Submitted by: whu MFC after: 2 weeks Sponsored by: Microsoft (cherry picked from commit ace5ce7e701e5a98c23f820d4f126e5c265aa667) --- sys/dev/hyperv/include/hyperv.h | 5 +++++ sys/dev/hyperv/include/vmbus.h | 4 ++++ sys/dev/hyperv/netvsc/hn_nvs.c | 4 ++-- sys/dev/hyperv/netvsc/if_hn.c | 32 ++++++++++++++++++++++++++++++++ sys/dev/hyperv/vmbus/vmbus.c | 4 ++++ 5 files changed, 47 insertions(+), 2 deletions(-) diff --git a/sys/dev/hyperv/include/hyperv.h b/sys/dev/hyperv/include/hyperv.h index 3761b2864eef..8b985b2f31a7 100644 --- a/sys/dev/hyperv/include/hyperv.h +++ b/sys/dev/hyperv/include/hyperv.h @@ -94,6 +94,11 @@ extern hyperv_tc64_t hyperv_tc64; extern u_int hyperv_features; /* CPUID_HV_MSR_ */ extern u_int hyperv_ver_major; +/* + * Vmbus version after negotiation with host. + */ +extern uint32_t vmbus_current_version; + #endif /* _KERNEL */ #endif /* _HYPERV_H_ */ diff --git a/sys/dev/hyperv/include/vmbus.h b/sys/dev/hyperv/include/vmbus.h index 4b0060e9241d..6f9cb6459dce 100644 --- a/sys/dev/hyperv/include/vmbus.h +++ b/sys/dev/hyperv/include/vmbus.h @@ -40,11 +40,15 @@ * 1.1 -- Windows 7 * 2.4 -- Windows 8 * 3.0 -- Windows 8.1 + * 4.0 -- Windows 10 + * 5.0 -- Newer Windows 10 */ #define VMBUS_VERSION_WS2008 ((0 << 16) | (13)) #define VMBUS_VERSION_WIN7 ((1 << 16) | (1)) #define VMBUS_VERSION_WIN8 ((2 << 16) | (4)) #define VMBUS_VERSION_WIN8_1 ((3 << 16) | (0)) +#define VMBUS_VERSION_WIN10 ((4 << 16) | (0)) +#define VMBUS_VERSION_WIN10_V5 ((5 << 16) | (0)) #define VMBUS_VERSION_MAJOR(ver) (((uint32_t)(ver)) >> 16) #define VMBUS_VERSION_MINOR(ver) (((uint32_t)(ver)) & 0xffff) diff --git a/sys/dev/hyperv/netvsc/hn_nvs.c b/sys/dev/hyperv/netvsc/hn_nvs.c index f21f989d876a..73a112c4e5e1 100644 --- a/sys/dev/hyperv/netvsc/hn_nvs.c +++ b/sys/dev/hyperv/netvsc/hn_nvs.c @@ -365,7 +365,7 @@ hn_nvs_disconn_rxbuf(struct hn_softc *sc) pause("lingtx", (200 * hz) / 1000); } - if (sc->hn_rxbuf_gpadl != 0) { + if (vmbus_current_version < VMBUS_VERSION_WIN10 && sc->hn_rxbuf_gpadl != 0) { /* * Disconnect RXBUF from primary channel. */ @@ -426,7 +426,7 @@ hn_nvs_disconn_chim(struct hn_softc *sc) pause("lingtx", (200 * hz) / 1000); } - if (sc->hn_chim_gpadl != 0) { + if (vmbus_current_version < VMBUS_VERSION_WIN10 && sc->hn_chim_gpadl != 0) { /* * Disconnect chimney sending buffer from primary channel. */ diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index 78e3bb36cf7c..e9d1b9439671 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -6630,6 +6630,38 @@ hn_synth_detach(struct hn_softc *sc) /* Detach all of the channels. */ hn_detach_allchans(sc); + if (vmbus_current_version >= VMBUS_VERSION_WIN10 && sc->hn_rxbuf_gpadl != 0) { + /* + * Host is post-Win2016, disconnect RXBUF from primary channel here. + */ + int error; + + error = vmbus_chan_gpadl_disconnect(sc->hn_prichan, + sc->hn_rxbuf_gpadl); + if (error) { + if_printf(sc->hn_ifp, + "rxbuf gpadl disconn failed: %d\n", error); + sc->hn_flags |= HN_FLAG_RXBUF_REF; + } + sc->hn_rxbuf_gpadl = 0; + } + + if (vmbus_current_version >= VMBUS_VERSION_WIN10 && sc->hn_chim_gpadl != 0) { + /* + * Host is post-Win2016, disconnect chimney sending buffer from + * primary channel here. + */ + int error; + + error = vmbus_chan_gpadl_disconnect(sc->hn_prichan, + sc->hn_chim_gpadl); + if (error) { + if_printf(sc->hn_ifp, + "chim gpadl disconn failed: %d\n", error); + sc->hn_flags |= HN_FLAG_CHIM_REF; + } + sc->hn_chim_gpadl = 0; + } sc->hn_flags &= ~HN_FLAG_SYNTH_ATTACHED; } diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c index 9d58c5e3e680..d943fb5c8010 100644 --- a/sys/dev/hyperv/vmbus/vmbus.c +++ b/sys/dev/hyperv/vmbus/vmbus.c @@ -140,7 +140,10 @@ SYSCTL_INT(_hw_vmbus, OID_AUTO, pin_evttask, CTLFLAG_RDTUN, extern inthand_t IDTVEC(vmbus_isr), IDTVEC(vmbus_isr_pti); +uint32_t vmbus_current_version; + static const uint32_t vmbus_version[] = { + VMBUS_VERSION_WIN10, VMBUS_VERSION_WIN8_1, VMBUS_VERSION_WIN8, VMBUS_VERSION_WIN7, @@ -414,6 +417,7 @@ vmbus_init(struct vmbus_softc *sc) error = vmbus_connect(sc, vmbus_version[i]); if (!error) { + vmbus_current_version = vmbus_version[i]; sc->vmbus_version = vmbus_version[i]; device_printf(sc->vmbus_dev, "version %u.%u\n", VMBUS_VERSION_MAJOR(sc->vmbus_version), From owner-dev-commits-src-all@freebsd.org Mon Mar 15 05:05:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5371956F7D9; Mon, 15 Mar 2021 05:05: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 4DzPWH1ZPNz3p9Z; Mon, 15 Mar 2021 05:05: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 28F1825C3; Mon, 15 Mar 2021 05:05: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 12F55VDE061584; Mon, 15 Mar 2021 05:05:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F55VKQ061583; Mon, 15 Mar 2021 05:05:31 GMT (envelope-from git) Date: Mon, 15 Mar 2021 05:05:31 GMT Message-Id: <202103150505.12F55VKQ061583@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: b05c1dd0d162 - stable/12 - hyperv/vmbus: Fix the wrong size in ndis_offload structure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b05c1dd0d1622fba5810513f3cefee4e34041c36 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 05:05:31 -0000 The branch stable/12 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=b05c1dd0d1622fba5810513f3cefee4e34041c36 commit b05c1dd0d1622fba5810513f3cefee4e34041c36 Author: Wei Hu AuthorDate: 2019-07-09 08:21:14 +0000 Commit: Wei Hu CommitDate: 2021-03-15 05:03:58 +0000 hyperv/vmbus: Fix the wrong size in ndis_offload structure Submitted by: whu MFC after: 2 weeks Sponsored by: Microsoft (cherry picked from commit 23a499203c5b3fd74f781d1383269a6e168588cf) --- sys/dev/hyperv/netvsc/ndis.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/hyperv/netvsc/ndis.h b/sys/dev/hyperv/netvsc/ndis.h index 4e34b51ca30f..32b6aa307452 100644 --- a/sys/dev/hyperv/netvsc/ndis.h +++ b/sys/dev/hyperv/netvsc/ndis.h @@ -115,8 +115,8 @@ struct ndis_offload_params { /* NDIS >= 6.30 */ uint8_t ndis_rsc_ip4; /* NDIS_OFFLOAD_RSC_ */ uint8_t ndis_rsc_ip6; /* NDIS_OFFLOAD_RSC_ */ - uint8_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ - uint8_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ + uint32_t ndis_encap; /* NDIS_OFFLOAD_SET_ */ + uint32_t ndis_encap_types;/* NDIS_ENCAP_TYPE_ */ }; #define NDIS_OFFLOAD_PARAMS_SIZE sizeof(struct ndis_offload_params) From owner-dev-commits-src-all@freebsd.org Mon Mar 15 05:11:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB9BF56FDD0; Mon, 15 Mar 2021 05:11: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 4DzPf04zp1z3pRK; Mon, 15 Mar 2021 05:11: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 9E598256E; Mon, 15 Mar 2021 05:11: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 12F5BKPX073066; Mon, 15 Mar 2021 05:11:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F5BKQM073065; Mon, 15 Mar 2021 05:11:20 GMT (envelope-from git) Date: Mon, 15 Mar 2021 05:11:20 GMT Message-Id: <202103150511.12F5BKQM073065@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: 919a160fc622 - stable/12 - Hyper-V: storvsc: Enhance srb_status code handling. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 919a160fc6224a4bf281134b3b9584ffb7ebba3d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 05:11:20 -0000 The branch stable/12 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=919a160fc6224a4bf281134b3b9584ffb7ebba3d commit 919a160fc6224a4bf281134b3b9584ffb7ebba3d Author: Wei Hu AuthorDate: 2020-08-31 09:05:45 +0000 Commit: Wei Hu CommitDate: 2021-03-15 05:08:43 +0000 Hyper-V: storvsc: Enhance srb_status code handling. In hv_storvsc_io_request() when coring, prevent changing of the send channel from the base channel to another one. storvsc_poll always probes on the base channel. Based upon conversations with Microsoft, changed the handling of srb_status codes. Most we should never get, others yes. All are treated as retry-able except for two. We should not get these statuses, but if we ever do, the I/O state is not known. Submitted by: Alexander Sideropoulos Reviewed by: trasz, allanjude, whu MFC after: 1 week Sponsored by: Netapp Inc Differential Revision: https://reviews.freebsd.org/D25756 (cherry picked from commit 2a0ce39d086ffe13782c9dc1e24bb240abbe790a) --- sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c | 158 +++++++++++++++++++++--- sys/dev/hyperv/storvsc/hv_vstorage.h | 34 ++++- 2 files changed, 168 insertions(+), 24 deletions(-) diff --git a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c index cab86500ace1..968de9d14e7b 100644 --- a/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c +++ b/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c @@ -151,6 +151,12 @@ SYSCTL_UINT(_hw_storvsc, OID_AUTO, max_io, CTLFLAG_RDTUN, static int hv_storvsc_chan_cnt = 0; SYSCTL_INT(_hw_storvsc, OID_AUTO, chan_cnt, CTLFLAG_RDTUN, &hv_storvsc_chan_cnt, 0, "# of channels to use"); +#ifdef DIAGNOSTIC +static int hv_storvsc_srb_status = -1; +SYSCTL_INT(_hw_storvsc, OID_AUTO, srb_status, CTLFLAG_RW, + &hv_storvsc_srb_status, 0, "srb_status to inject"); +TUNABLE_INT("hw_storvsc.srb_status", &hv_storvsc_srb_status); +#endif /* DIAGNOSTIC */ #define STORVSC_MAX_IO \ vmbus_chan_prplist_nelem(hv_storvsc_ringbuffer_size, \ @@ -704,7 +710,16 @@ hv_storvsc_io_request(struct storvsc_softc *sc, vstor_packet->operation = VSTOR_OPERATION_EXECUTESRB; ch_sel = (vstor_packet->u.vm_srb.lun + curcpu) % sc->hs_nchan; - outgoing_channel = sc->hs_sel_chan[ch_sel]; + /* + * If we are panic'ing, then we are dumping core. Since storvsc_polls + * always uses sc->hs_chan, then we must send to that channel or a poll + * timeout will occur. + */ + if (panicstr) { + outgoing_channel = sc->hs_chan; + } else { + outgoing_channel = sc->hs_sel_chan[ch_sel]; + } mtx_unlock(&request->softc->hs_lock); if (request->prp_list.gpa_range.gpa_len) { @@ -2155,26 +2170,133 @@ storvsc_io_done(struct hv_storvsc_request *reqp) ccb->ccb_h.status &= ~CAM_SIM_QUEUED; ccb->ccb_h.status &= ~CAM_STATUS_MASK; int srb_status = SRB_STATUS(vm_srb->srb_status); +#ifdef DIAGNOSTIC + if (hv_storvsc_srb_status != -1) { + srb_status = SRB_STATUS(hv_storvsc_srb_status & 0x3f); + hv_storvsc_srb_status = -1; + } +#endif /* DIAGNOSTIC */ if (vm_srb->scsi_status == SCSI_STATUS_OK) { if (srb_status != SRB_STATUS_SUCCESS) { - /* - * If there are errors, for example, invalid LUN, - * host will inform VM through SRB status. - */ - if (bootverbose) { - if (srb_status == SRB_STATUS_INVALID_LUN) { - xpt_print(ccb->ccb_h.path, - "invalid LUN %d for op: %s\n", - vm_srb->lun, - scsi_op_desc(cmd->opcode, NULL)); - } else { - xpt_print(ccb->ccb_h.path, - "Unknown SRB flag: %d for op: %s\n", - srb_status, - scsi_op_desc(cmd->opcode, NULL)); - } + bool log_error = true; + switch (srb_status) { + case SRB_STATUS_PENDING: + /* We should never get this */ + panic("storvsc_io_done: SRB_STATUS_PENDING"); + break; + case SRB_STATUS_ABORTED: + /* + * storvsc doesn't support aborts yet + * but if we ever get this status + * the I/O is complete - treat it as a + * timeout + */ + ccb->ccb_h.status |= CAM_CMD_TIMEOUT; + break; + case SRB_STATUS_ABORT_FAILED: + /* We should never get this */ + panic("storvsc_io_done: SRB_STATUS_ABORT_FAILED"); + break; + case SRB_STATUS_ERROR: + /* + * We should never get this. + * Treat it as a CAM_UNREC_HBA_ERROR. + * It will be retried + */ + ccb->ccb_h.status |= CAM_UNREC_HBA_ERROR; + break; + case SRB_STATUS_BUSY: + /* Host is busy. Delay and retry */ + ccb->ccb_h.status |= CAM_BUSY; + break; + case SRB_STATUS_INVALID_REQUEST: + case SRB_STATUS_INVALID_PATH_ID: + case SRB_STATUS_NO_DEVICE: + case SRB_STATUS_INVALID_TARGET_ID: + /* + * These indicate an invalid address + * and really should never be seen. + * A CAM_PATH_INVALID could be + * used here but I want to run + * down retries. Do a CAM_BUSY + * since the host might be having issues. + */ + ccb->ccb_h.status |= CAM_BUSY; + break; + case SRB_STATUS_TIMEOUT: + case SRB_STATUS_COMMAND_TIMEOUT: + /* The backend has timed this out */ + ccb->ccb_h.status |= CAM_BUSY; + break; + /* Some old pSCSI errors below */ + case SRB_STATUS_SELECTION_TIMEOUT: + case SRB_STATUS_MESSAGE_REJECTED: + case SRB_STATUS_PARITY_ERROR: + case SRB_STATUS_NO_HBA: + case SRB_STATUS_DATA_OVERRUN: + case SRB_STATUS_UNEXPECTED_BUS_FREE: + case SRB_STATUS_PHASE_SEQUENCE_FAILURE: + /* + * Old pSCSI responses, should never get. + * If we do treat as a CAM_UNREC_HBA_ERROR + * which will be retried + */ + ccb->ccb_h.status |= CAM_UNREC_HBA_ERROR; + break; + case SRB_STATUS_BUS_RESET: + ccb->ccb_h.status |= CAM_SCSI_BUS_RESET; + break; + case SRB_STATUS_BAD_SRB_BLOCK_LENGTH: + /* + * The request block is malformed and + * I doubt it is from the guest. Just retry. + */ + ccb->ccb_h.status |= CAM_UNREC_HBA_ERROR; + break; + /* Not used statuses just retry */ + case SRB_STATUS_REQUEST_FLUSHED: + case SRB_STATUS_BAD_FUNCTION: + case SRB_STATUS_NOT_POWERED: + ccb->ccb_h.status |= CAM_UNREC_HBA_ERROR; + break; + case SRB_STATUS_INVALID_LUN: + /* + * Don't log an EMS for this response since + * there is no device at this LUN. This is a + * normal and expected response when a device + * is detached. + */ + ccb->ccb_h.status |= CAM_DEV_NOT_THERE; + log_error = false; + break; + case SRB_STATUS_ERROR_RECOVERY: + case SRB_STATUS_LINK_DOWN: + /* + * I don't ever expect these from + * the host but if we ever get + * retry after a delay + */ + ccb->ccb_h.status |= CAM_BUSY; + break; + default: + /* + * An undefined response assert on + * on debug builds else retry + */ + ccb->ccb_h.status |= CAM_UNREC_HBA_ERROR; + KASSERT(srb_status <= SRB_STATUS_LINK_DOWN, + ("storvsc: %s, unexpected srb_status of 0x%x", + __func__, srb_status)); + break; + } + if (log_error) { + xpt_print(ccb->ccb_h.path, "The hypervisor's I/O adapter " + "driver received an unexpected response code 0x%x " + "for operation: %s. If this continues to occur, " + "report the condition to your hypervisor vendor so " + "they can rectify the issue.\n", srb_status, + scsi_op_desc(cmd->opcode, NULL)); } - ccb->ccb_h.status |= CAM_DEV_NOT_THERE; } else { ccb->ccb_h.status |= CAM_REQ_CMP; } diff --git a/sys/dev/hyperv/storvsc/hv_vstorage.h b/sys/dev/hyperv/storvsc/hv_vstorage.h index 866623c22e7a..f1d4c1dfd2e2 100644 --- a/sys/dev/hyperv/storvsc/hv_vstorage.h +++ b/sys/dev/hyperv/storvsc/hv_vstorage.h @@ -241,12 +241,34 @@ struct vstor_packet { /** * SRB (SCSI Request Block) Status Codes */ -#define SRB_STATUS_PENDING 0x00 -#define SRB_STATUS_SUCCESS 0x01 -#define SRB_STATUS_ABORTED 0x02 -#define SRB_STATUS_ERROR 0x04 -#define SRB_STATUS_DATA_OVERRUN 0x12 -#define SRB_STATUS_INVALID_LUN 0x20 +#define SRB_STATUS_PENDING 0x00 +#define SRB_STATUS_SUCCESS 0x01 +#define SRB_STATUS_ABORTED 0x02 +#define SRB_STATUS_ABORT_FAILED 0x03 +#define SRB_STATUS_ERROR 0x04 +#define SRB_STATUS_BUSY 0x05 +#define SRB_STATUS_INVALID_REQUEST 0x06 +#define SRB_STATUS_INVALID_PATH_ID 0x07 +#define SRB_STATUS_NO_DEVICE 0x08 +#define SRB_STATUS_TIMEOUT 0x09 +#define SRB_STATUS_SELECTION_TIMEOUT 0x0A +#define SRB_STATUS_COMMAND_TIMEOUT 0x0B +#define SRB_STATUS_MESSAGE_REJECTED 0x0D +#define SRB_STATUS_BUS_RESET 0x0E +#define SRB_STATUS_PARITY_ERROR 0x0F +#define SRB_STATUS_REQUEST_SENSE_FAILED 0x10 +#define SRB_STATUS_NO_HBA 0x11 +#define SRB_STATUS_DATA_OVERRUN 0x12 +#define SRB_STATUS_UNEXPECTED_BUS_FREE 0x13 +#define SRB_STATUS_PHASE_SEQUENCE_FAILURE 0x14 +#define SRB_STATUS_BAD_SRB_BLOCK_LENGTH 0x15 +#define SRB_STATUS_REQUEST_FLUSHED 0x16 +#define SRB_STATUS_INVALID_LUN 0x20 +#define SRB_STATUS_INVALID_TARGET_ID 0x21 +#define SRB_STATUS_BAD_FUNCTION 0x22 +#define SRB_STATUS_ERROR_RECOVERY 0x23 +#define SRB_STATUS_NOT_POWERED 0x24 +#define SRB_STATUS_LINK_DOWN 0x25 /** * SRB Status Masks (can be combined with above status codes) */ From owner-dev-commits-src-all@freebsd.org Mon Mar 15 05:14:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 341A05700F8; Mon, 15 Mar 2021 05:14: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 4DzPjm10NFz3q3L; Mon, 15 Mar 2021 05:14: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 1529228E9; Mon, 15 Mar 2021 05:14: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 12F5EaYF074351; Mon, 15 Mar 2021 05:14:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F5EanN074350; Mon, 15 Mar 2021 05:14:36 GMT (envelope-from git) Date: Mon, 15 Mar 2021 05:14:36 GMT Message-Id: <202103150514.12F5EanN074350@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: 279041093326 - stable/12 - Hyper-V: pcib: Check revoke status during device attach MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 279041093326704636531051ad188e81b8beb32c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 05:14:36 -0000 The branch stable/12 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=279041093326704636531051ad188e81b8beb32c commit 279041093326704636531051ad188e81b8beb32c Author: Wei Hu AuthorDate: 2020-10-15 05:57:20 +0000 Commit: Wei Hu CommitDate: 2021-03-15 05:11:50 +0000 Hyper-V: pcib: Check revoke status during device attach It is possible that the vmbus pcib channel is revoked during attach path. The attach path could be waiting for response from host and this response will never arrive since the channel has already been revoked from host point of view. Check this situation during wait complete and return failed if this happens. Reported by: Netapp MFC after: 2 weeks Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D26486 (cherry picked from commit 75c2786c25fef9a6f8239c9fc1631cd17756579b) --- sys/dev/hyperv/pcib/vmbus_pcib.c | 78 +++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 12 deletions(-) diff --git a/sys/dev/hyperv/pcib/vmbus_pcib.c b/sys/dev/hyperv/pcib/vmbus_pcib.c index 0d49ae313ccd..72e430c946db 100644 --- a/sys/dev/hyperv/pcib/vmbus_pcib.c +++ b/sys/dev/hyperv/pcib/vmbus_pcib.c @@ -117,6 +117,31 @@ wait_for_completion(struct completion *c) mtx_unlock(&c->lock); } +/* + * Return: 0 if completed, a non-zero value if timed out. + */ +static int +wait_for_completion_timeout(struct completion *c, int timeout) +{ + int ret; + + mtx_lock(&c->lock); + + if (c->done == 0) + mtx_sleep(c, &c->lock, 0, "hvwfc", timeout); + + if (c->done > 0) { + c->done--; + ret = 0; + } else { + ret = 1; + } + + mtx_unlock(&c->lock); + + return (ret); +} + #define PCI_MAKE_VERSION(major, minor) ((uint32_t)(((major) << 16) | (major))) enum { @@ -438,6 +463,25 @@ struct compose_comp_ctxt { struct tran_int_desc int_desc; }; +/* + * It is possible the device is revoked during initialization. + * Check if this happens during wait. + * Return: 0 if response arrived, ENODEV if device revoked. + */ +static int +wait_for_response(struct hv_pcibus *hbus, struct completion *c) +{ + do { + if (vmbus_chan_is_revoked(hbus->sc->chan)) { + device_printf(hbus->pcib, + "The device is revoked.\n"); + return (ENODEV); + } + } while (wait_for_completion_timeout(c, hz /10) != 0); + + return 0; +} + static void hv_pci_generic_compl(void *context, struct pci_response *resp, int resp_packet_size) @@ -568,7 +612,9 @@ new_pcichild_device(struct hv_pcibus *hbus, struct pci_func_desc *desc) if (ret) goto err; - wait_for_completion(&comp_pkt.host_event); + if (wait_for_response(hbus, &comp_pkt.host_event)) + goto err; + free_completion(&comp_pkt.host_event); hpdev->desc = *desc; @@ -1011,10 +1057,15 @@ hv_pci_protocol_negotiation(struct hv_pcibus *hbus) ret = vmbus_chan_send(hbus->sc->chan, VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, version_req, sizeof(*version_req), (uint64_t)(uintptr_t)&ctxt.pkt); - if (ret) - goto out; + if (!ret) + ret = wait_for_response(hbus, &comp_pkt.host_event); - wait_for_completion(&comp_pkt.host_event); + if (ret) { + device_printf(hbus->pcib, + "vmbus_pcib failed to request version: %d\n", + ret); + goto out; + } if (comp_pkt.completion_status < 0) { device_printf(hbus->pcib, @@ -1072,11 +1123,12 @@ hv_pci_enter_d0(struct hv_pcibus *hbus) ret = vmbus_chan_send(hbus->sc->chan, VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, d0_entry, sizeof(*d0_entry), (uint64_t)(uintptr_t)&ctxt.pkt); + if (!ret) + ret = wait_for_response(hbus, &comp_pkt.host_event); + if (ret) goto out; - wait_for_completion(&comp_pkt.host_event); - if (comp_pkt.completion_status < 0) { device_printf(hbus->pcib, "vmbus_pcib failed to enable D0\n"); ret = EPROTO; @@ -1125,14 +1177,14 @@ hv_send_resources_allocated(struct hv_pcibus *hbus) VMBUS_CHANPKT_TYPE_INBAND, VMBUS_CHANPKT_FLAG_RC, &pkt->message, sizeof(*res_assigned), (uint64_t)(uintptr_t)pkt); - if (ret) { - free_completion(&comp_pkt.host_event); - break; - } + if (!ret) + ret = wait_for_response(hbus, &comp_pkt.host_event); - wait_for_completion(&comp_pkt.host_event); free_completion(&comp_pkt.host_event); + if (ret) + break; + if (comp_pkt.completion_status < 0) { ret = EPROTO; device_printf(hbus->pcib, @@ -1413,9 +1465,11 @@ vmbus_pcib_attach(device_t dev) goto vmbus_close; ret = hv_pci_query_relations(hbus); + if (!ret) + ret = wait_for_response(hbus, hbus->query_comp); + if (ret) goto vmbus_close; - wait_for_completion(hbus->query_comp); ret = hv_pci_enter_d0(hbus); if (ret) From owner-dev-commits-src-all@freebsd.org Mon Mar 15 05:16:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9C9756FCE5; Mon, 15 Mar 2021 05:16: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 4DzPmB4wNRz3q8B; Mon, 15 Mar 2021 05:16: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 9B1312D82; Mon, 15 Mar 2021 05:16: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 12F5Ggo2074773; Mon, 15 Mar 2021 05:16:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F5GgBw074772; Mon, 15 Mar 2021 05:16:42 GMT (envelope-from git) Date: Mon, 15 Mar 2021 05:16:42 GMT Message-Id: <202103150516.12F5GgBw074772@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: 70f7b2475333 - stable/12 - Hyper-V: hn: Relinquish cpu in HN_LOCK to avoid deadlock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 70f7b24753336efeb3cf6e73040780b2e4d28d8a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 05:16:42 -0000 The branch stable/12 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=70f7b24753336efeb3cf6e73040780b2e4d28d8a commit 70f7b24753336efeb3cf6e73040780b2e4d28d8a Author: Wei Hu AuthorDate: 2020-10-15 11:44:28 +0000 Commit: Wei Hu CommitDate: 2021-03-15 05:15:21 +0000 Hyper-V: hn: Relinquish cpu in HN_LOCK to avoid deadlock The try lock loop in HN_LOCK put the thread spinning on cpu if the lock is not available. It is possible to cause deadlock if the thread holding the lock is sleeping. Relinquish the cpu to work around this problem even it doesn't completely solve the issue. The priority inversion could cause the livelock no matter how less likely it could happen. A more complete solution may be needed in the future. Reported by: Microsoft, Netapp MFC after: 2 weeks Sponsored by: Microsoft (cherry picked from commit b3460f44524b145c6c8a760ebe65052560a810bf) --- sys/dev/hyperv/netvsc/if_hn.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index e9d1b9439671..1945732590cc 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -71,8 +71,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include #include @@ -165,8 +167,11 @@ __FBSDID("$FreeBSD$"); #define HN_LOCK_ASSERT(sc) sx_assert(&(sc)->hn_lock, SA_XLOCKED) #define HN_LOCK(sc) \ do { \ - while (sx_try_xlock(&(sc)->hn_lock) == 0) \ + while (sx_try_xlock(&(sc)->hn_lock) == 0) { \ + /* Relinquish cpu to avoid deadlock */ \ + sched_relinquish(curthread); \ DELAY(1000); \ + } \ } while (0) #define HN_UNLOCK(sc) sx_xunlock(&(sc)->hn_lock) From owner-dev-commits-src-all@freebsd.org Mon Mar 15 05:40:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 72AFE570C9B; Mon, 15 Mar 2021 05:40:52 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) (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 4DzQJ42ZdWz3r23; Mon, 15 Mar 2021 05:40:52 +0000 (UTC) (envelope-from koobs.freebsd@gmail.com) Received: by mail-pl1-x62b.google.com with SMTP id j6so14720141plx.6; Sun, 14 Mar 2021 22:40:52 -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:cc:from:in-reply-to :content-transfer-encoding; bh=LNXi0dWG7+Pj5YkfSA1R0xyRk3hay5DKIgrfW7xexbo=; b=QFXVI14QjtsA39EmRnY+r8noSB/uvas7C4bU1/fAHMtxao7RB1988Hz675aVTl7OZu qC+YIQWKBMklfCcRCYbY5w2AFCXeQJBigN5ZXULxrml6TuBczSb5QuEUrxSBOHKob6zN sOXKNpMeBLIQaItIOcejBzcbZGMSNrjNI8NuxsZ6OrPicNnBHVlGn72zOXKqQoCJsuG+ K+5KyJrpYDsscGRXDQfZR9Dwqab1bL9RX2u5+w8noGJ+nRhNjG8Xs0oJ/Nf3lgW33E0L GtdxZXRrI7DJ6Ys3ClF9SzNjdnq1OO9kyvkP+96RiYC9G14we1Y4JfDPM09DpjCw0NGY P1qg== 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:cc:from:in-reply-to :content-transfer-encoding; bh=LNXi0dWG7+Pj5YkfSA1R0xyRk3hay5DKIgrfW7xexbo=; b=RkxIqFO1HAmiPdxgxmgvPnavcvhr63McTvpqxB9HYxGOmxXzzwbtaMDEiYkFLynVhj uZlmVdNPQURW9S8CQ4agpVP1LHX8BkDvRXaVm62d4nHCngY0Quy6kqAhqtqBOZZH3GZ5 26wONc1ZUPvDtHQsdD3ef6JWfGNZXB5vEdaXAEwD/cZAA+rclJu5iPhGGxnDxlJhII04 sCHhMq3UWhftWukpuoWSB3aUoomEDTd8IvgraZlQiU5sncqsGz3NBbcWADqwvOGQvhoM newAiitIJSCxlRUkYPmmjlXwl1202xGvo3xw9zW/Yg8Yc7fvqHIQODCReq1qa3mzsZQa Uwww== X-Gm-Message-State: AOAM531rLCw5pAZh0S50KtMd9zCRM5sWoyAuhQqjfBBHIn1POiZF4ScR ThLn6MJ46XeEBUBk+at1MvW+qaGJHpg= X-Google-Smtp-Source: ABdhPJwr+EhfhZ/XJNpiOTOoR1yuPCkMHro55hi6buBbbIMMXkk1Jo16ocb7NgcVyVNq/miDN1AbfQ== X-Received: by 2002:a17:90a:1049:: with SMTP id y9mr10948275pjd.173.1615786850809; Sun, 14 Mar 2021 22:40:50 -0700 (PDT) Received: from localhost (167-179-159-58.a7b39f.syd.nbn.aussiebb.net. [167.179.159.58]) by smtp.gmail.com with UTF8SMTPSA id bk8sm9312647pjb.13.2021.03.14.22.40.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 14 Mar 2021 22:40:50 -0700 (PDT) Sender: Kubilay Kocak Message-ID: <933ecb8e-9c89-2c6f-9442-c9326b12f111@FreeBSD.org> Date: Mon, 15 Mar 2021 16:40:45 +1100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Thunderbird/88.0a1 Reply-To: koobs@FreeBSD.org Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project Content-Language: en-US To: Kyle Evans References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kubilay Kocak In-Reply-To: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4DzQJ42ZdWz3r23 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 05:40:52 -0000 On 15/03/2021 3:52 pm, Kyle Evans wrote: > The branch main has been updated by kevans: > > URL: https://cgit.FreeBSD.org/src/commit/?id=74ae3f3e33b810248da19004c58b3581cd367843 > > commit 74ae3f3e33b810248da19004c58b3581cd367843 > Author: Kyle Evans > AuthorDate: 2021-03-15 02:25:40 +0000 > Commit: Kyle Evans > CommitDate: 2021-03-15 04:52:04 +0000 > > if_wg: import latest fixup work from the wireguard-freebsd project > > This is the culmination of about a week of work from three developers to > fix a number of functional and security issues. This patch consists of > - Many security issues have been addressed > MFC after: 1 month (maybe) Does 'maybe' refer to the MFC period (potentially less or more time), or that it may not be MFC'd? From owner-dev-commits-src-all@freebsd.org Mon Mar 15 05:42:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3945570E30; Mon, 15 Mar 2021 05:42:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzQKN4kThz3rMS; Mon, 15 Mar 2021 05:42: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 95C5932A5; Mon, 15 Mar 2021 05:42: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 12F5g0RD010336; Mon, 15 Mar 2021 05:42:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F5g0qV010335; Mon, 15 Mar 2021 05:42:00 GMT (envelope-from git) Date: Mon, 15 Mar 2021 05:42:00 GMT Message-Id: <202103150542.12F5g0qV010335@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: e277a507d8f9 - main - tests: netinet: add missing up from local change MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e277a507d8f935e2ca6d1022dd1e86a73bcf1982 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 05:42:00 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=e277a507d8f935e2ca6d1022dd1e86a73bcf1982 commit e277a507d8f935e2ca6d1022dd1e86a73bcf1982 Author: Kyle Evans AuthorDate: 2021-03-15 05:24:54 +0000 Commit: Kyle Evans CommitDate: 2021-03-15 05:24:54 +0000 tests: netinet: add missing up from local change --- tests/sys/netinet/if_wg_test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/netinet/if_wg_test.sh b/tests/sys/netinet/if_wg_test.sh index 3cf69b035f97..b0ab70108cf4 100644 --- a/tests/sys/netinet/if_wg_test.sh +++ b/tests/sys/netinet/if_wg_test.sh @@ -75,13 +75,13 @@ wg_basic_body() jexec wgtest1 ifconfig $wg1 peer public-key "$pub2" \ endpoint ${endpoint2}:12345 allowed-ips ${tunnel2}/32 atf_check -s exit:0 \ - jexec wgtest1 ifconfig $wg1 inet $tunnel1 + jexec wgtest1 ifconfig $wg1 inet $tunnel1 up atf_check -s exit:0 -o ignore \ jexec wgtest2 ifconfig $wg2 peer public-key "$pub1" \ endpoint ${endpoint1}:12345 allowed-ips ${tunnel1}/32 atf_check -s exit:0 \ - jexec wgtest2 ifconfig $wg2 inet $tunnel2 + jexec wgtest2 ifconfig $wg2 inet $tunnel2 up # Generous timeout since the handshake takes some time. atf_check -s exit:0 -o ignore jexec wgtest1 ping -o -t 5 -i 0.25 $tunnel2 From owner-dev-commits-src-all@freebsd.org Mon Mar 15 05:42:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29ADE570C59; Mon, 15 Mar 2021 05:42: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 4DzQKP6JzJz3rMW; Mon, 15 Mar 2021 05:42: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 AC1AE2BFA; Mon, 15 Mar 2021 05:42: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 12F5g1u9010357; Mon, 15 Mar 2021 05:42:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F5g1A8010356; Mon, 15 Mar 2021 05:42:01 GMT (envelope-from git) Date: Mon, 15 Mar 2021 05:42:01 GMT Message-Id: <202103150542.12F5g1A8010356@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 11704859477c - main - if_wg: fix the !INET6 support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 11704859477cdb75a077807f53132be4d518e7f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 05:42:02 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=11704859477cdb75a077807f53132be4d518e7f5 commit 11704859477cdb75a077807f53132be4d518e7f5 Author: Kyle Evans AuthorDate: 2021-03-15 05:38:22 +0000 Commit: Kyle Evans CommitDate: 2021-03-15 05:41:38 +0000 if_wg: fix the !INET6 support INET is still required, so formally don't build it in !INET configurations. --- sys/dev/if_wg/if_wg.c | 6 ++++++ sys/modules/Makefile | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/dev/if_wg/if_wg.c b/sys/dev/if_wg/if_wg.c index ba2eb3221fac..c0b3ecdaa002 100644 --- a/sys/dev/if_wg/if_wg.c +++ b/sys/dev/if_wg/if_wg.c @@ -1102,11 +1102,13 @@ wg_send(struct wg_softc *sc, struct wg_endpoint *e, struct mbuf *m) control = sbcreatecontrol((caddr_t)&e->e_local.l_in, sizeof(struct in_addr), IP_SENDSRCADDR, IPPROTO_IP); +#ifdef INET6 } else if (e->e_remote.r_sa.sa_family == AF_INET6) { if (!IN6_IS_ADDR_UNSPECIFIED(&e->e_local.l_in6)) control = sbcreatecontrol((caddr_t)&e->e_local.l_pktinfo6, sizeof(struct in6_pktinfo), IPV6_PKTINFO, IPPROTO_IPV6); +#endif } else { m_freem(m); return (EAFNOSUPPORT); @@ -2296,7 +2298,9 @@ wg_update_endpoint_addrs(struct wg_endpoint *e, const struct sockaddr *srcsa, struct ifnet *rcvif) { const struct sockaddr_in *sa4; +#ifdef INET6 const struct sockaddr_in6 *sa6; +#endif int ret = 0; /* @@ -2307,10 +2311,12 @@ wg_update_endpoint_addrs(struct wg_endpoint *e, const struct sockaddr *srcsa, sa4 = (const struct sockaddr_in *)srcsa; e->e_remote.r_sin = sa4[0]; e->e_local.l_in = sa4[1].sin_addr; +#ifdef INET6 } else if (srcsa->sa_family == AF_INET6) { sa6 = (const struct sockaddr_in6 *)srcsa; e->e_remote.r_sin6 = sa6[0]; e->e_local.l_in6 = sa6[1].sin6_addr; +#endif } else { ret = EAFNOSUPPORT; } diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 781495110cb9..32919674901b 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -163,7 +163,7 @@ SUBDIR= \ if_tuntap \ if_vlan \ if_vxlan \ - if_wg \ + ${_if_wg} \ iflib \ ${_iir} \ imgact_binmisc \ @@ -456,6 +456,10 @@ _sctp= sctp _if_stf= if_stf .endif +.if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES) +_if_wg= if_wg +.endif + .if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES) _if_me= if_me _ipdivert= ipdivert From owner-dev-commits-src-all@freebsd.org Mon Mar 15 05:47:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49681570F5A; Mon, 15 Mar 2021 05:47:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzQRC1WdTz3rlG; Mon, 15 Mar 2021 05:47:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 209BF263FB; Mon, 15 Mar 2021 05:47:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f180.google.com with SMTP id 73so8341326qtg.13; Sun, 14 Mar 2021 22:47:03 -0700 (PDT) X-Gm-Message-State: AOAM530zyGDI6eo3IQB43nbWzZr17tUSJApM4siO0AllTZzZrVkLZN87 469rno0BubsYYR2n1ngfX+kujmquO4o2Wdp2lWw= X-Google-Smtp-Source: ABdhPJz7JJIvJq+6R2ikf92ztmWukYa77bHUSp+wWDKWsbmRy3LmZXCpIlnfsQ4HZc6TLHp9QzUbBB9LsGPNLBVIvLI= X-Received: by 2002:ac8:7a69:: with SMTP id w9mr10894242qtt.60.1615787222656; Sun, 14 Mar 2021 22:47:02 -0700 (PDT) MIME-Version: 1.0 References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> <933ecb8e-9c89-2c6f-9442-c9326b12f111@FreeBSD.org> In-Reply-To: <933ecb8e-9c89-2c6f-9442-c9326b12f111@FreeBSD.org> From: Kyle Evans Date: Sun, 14 Mar 2021 22:46:51 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Kubilay Kocak Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 05:47:03 -0000 On Sun, Mar 14, 2021 at 10:40 PM Kubilay Kocak wrote: > > On 15/03/2021 3:52 pm, Kyle Evans wrote: > > The branch main has been updated by kevans: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=74ae3f3e33b810248da19004c58b3581cd367843 > > > > commit 74ae3f3e33b810248da19004c58b3581cd367843 > > Author: Kyle Evans > > AuthorDate: 2021-03-15 02:25:40 +0000 > > Commit: Kyle Evans > > CommitDate: 2021-03-15 04:52:04 +0000 > > > > if_wg: import latest fixup work from the wireguard-freebsd project > > > > This is the culmination of about a week of work from three developers to > > fix a number of functional and security issues. This patch consists of > > > > > - Many security issues have been addressed > > > > > MFC after: 1 month (maybe) > > Does 'maybe' refer to the MFC period (potentially less or more time), or > that it may not be MFC'd? > Hi, The time here is the variable. It will get merged back because it needs to be, but it won't be happening this week and probably not next week either to give it ample bake time. Thank, Kyle Evans From owner-dev-commits-src-all@freebsd.org Mon Mar 15 06:13:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 33B6C571897; Mon, 15 Mar 2021 06:13: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 4DzR270yryz3tNf; Mon, 15 Mar 2021 06:13: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 13DE73AFF; Mon, 15 Mar 2021 06:13: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 12F6DoYI053737; Mon, 15 Mar 2021 06:13:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F6DoUh053736; Mon, 15 Mar 2021 06:13:50 GMT (envelope-from git) Date: Mon, 15 Mar 2021 06:13:50 GMT Message-Id: <202103150613.12F6DoUh053736@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 0264d12ee865 - stable/13 - Make kern.timecounter.hardware tunable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0264d12ee865658b58f647e50fe2f7164873db66 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 06:13:51 -0000 The branch stable/13 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0264d12ee865658b58f647e50fe2f7164873db66 commit 0264d12ee865658b58f647e50fe2f7164873db66 Author: Konstantin Belousov AuthorDate: 2021-03-07 23:50:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-15 06:09:59 +0000 Make kern.timecounter.hardware tunable (cherry picked from commit 56b9bee63a42dbac712acf540f23a4c3dbd099a9) --- sys/kern/kern_tc.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index 07841fd5ca0e..b1dcb18e31be 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -141,6 +141,7 @@ SYSCTL_PROC(_kern_timecounter, OID_AUTO, alloweddeviation, volatile int rtc_generation = 1; static int tc_chosen; /* Non-zero if a specific tc was chosen via sysctl. */ +static char tc_from_tunable[16]; static void tc_windup(struct bintime *new_boottimebin); static void cpu_tick_calibrate(int); @@ -1215,11 +1216,17 @@ tc_init(struct timecounter *tc) return; if (tc->tc_quality < 0) return; - if (tc->tc_quality < timecounter->tc_quality) - return; - if (tc->tc_quality == timecounter->tc_quality && - tc->tc_frequency < timecounter->tc_frequency) - return; + if (tc_from_tunable[0] != '\0' && + strcmp(tc->tc_name, tc_from_tunable) == 0) { + tc_chosen = 1; + tc_from_tunable[0] = '\0'; + } else { + if (tc->tc_quality < timecounter->tc_quality) + return; + if (tc->tc_quality == timecounter->tc_quality && + tc->tc_frequency < timecounter->tc_frequency) + return; + } (void)tc->tc_get_timecount(tc); timecounter = tc; } @@ -1500,7 +1507,7 @@ sysctl_kern_timecounter_hardware(SYSCTL_HANDLER_ARGS) } SYSCTL_PROC(_kern_timecounter, OID_AUTO, hardware, - CTLTYPE_STRING | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, 0, + CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, 0, 0, sysctl_kern_timecounter_hardware, "A", "Timecounter hardware selected"); @@ -1940,6 +1947,9 @@ inittimehands(void *dummy) for (i = 1, thp = &ths[0]; i < timehands_count; thp = &ths[i++]) thp->th_next = &ths[i]; thp->th_next = &ths[0]; + + TUNABLE_STR_FETCH("kern.timecounter.hardware", tc_from_tunable, + sizeof(tc_from_tunable)); } SYSINIT(timehands, SI_SUB_TUNABLES, SI_ORDER_ANY, inittimehands, NULL); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 06:23:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91C7B57184B; Mon, 15 Mar 2021 06:23: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 4DzRDz3l5Nz3tYq; Mon, 15 Mar 2021 06:23: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 68DA13478; Mon, 15 Mar 2021 06:23: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 12F6NFZE066526; Mon, 15 Mar 2021 06:23:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F6NFSG066525; Mon, 15 Mar 2021 06:23:15 GMT (envelope-from git) Date: Mon, 15 Mar 2021 06:23:15 GMT Message-Id: <202103150623.12F6NFSG066525@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 791b89dad7c2 - stable/12 - Make kern.timecounter.hardware tunable MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 791b89dad7c2f13c00f6771891da2a8506a5544b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 06:23:15 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=791b89dad7c2f13c00f6771891da2a8506a5544b commit 791b89dad7c2f13c00f6771891da2a8506a5544b Author: Konstantin Belousov AuthorDate: 2021-03-07 23:50:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-15 06:22:40 +0000 Make kern.timecounter.hardware tunable (cherry picked from commit 56b9bee63a42dbac712acf540f23a4c3dbd099a9) --- sys/kern/kern_tc.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c index f916cbc75ac8..7f9b48cb1dd4 100644 --- a/sys/kern/kern_tc.c +++ b/sys/kern/kern_tc.c @@ -136,6 +136,7 @@ SYSCTL_PROC(_kern_timecounter, OID_AUTO, alloweddeviation, volatile int rtc_generation = 1; static int tc_chosen; /* Non-zero if a specific tc was chosen via sysctl. */ +static char tc_from_tunable[16]; static void tc_windup(struct bintime *new_boottimebin); static void cpu_tick_calibrate(int); @@ -1195,11 +1196,17 @@ tc_init(struct timecounter *tc) return; if (tc->tc_quality < 0) return; - if (tc->tc_quality < timecounter->tc_quality) - return; - if (tc->tc_quality == timecounter->tc_quality && - tc->tc_frequency < timecounter->tc_frequency) - return; + if (tc_from_tunable[0] != '\0' && + strcmp(tc->tc_name, tc_from_tunable) == 0) { + tc_chosen = 1; + tc_from_tunable[0] = '\0'; + } else { + if (tc->tc_quality < timecounter->tc_quality) + return; + if (tc->tc_quality == timecounter->tc_quality && + tc->tc_frequency < timecounter->tc_frequency) + return; + } (void)tc->tc_get_timecount(tc); timecounter = tc; } @@ -1479,8 +1486,9 @@ sysctl_kern_timecounter_hardware(SYSCTL_HANDLER_ARGS) return (EINVAL); } -SYSCTL_PROC(_kern_timecounter, OID_AUTO, hardware, CTLTYPE_STRING | CTLFLAG_RW, - 0, 0, sysctl_kern_timecounter_hardware, "A", +SYSCTL_PROC(_kern_timecounter, OID_AUTO, hardware, + CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_NOFETCH | CTLFLAG_MPSAFE, 0, 0, + sysctl_kern_timecounter_hardware, "A", "Timecounter hardware selected"); @@ -1918,6 +1926,9 @@ inittimehands(void *dummy) for (i = 1, thp = &ths[0]; i < timehands_count; thp = &ths[i++]) thp->th_next = &ths[i]; thp->th_next = &ths[0]; + + TUNABLE_STR_FETCH("kern.timecounter.hardware", tc_from_tunable, + sizeof(tc_from_tunable)); } SYSINIT(timehands, SI_SUB_TUNABLES, SI_ORDER_ANY, inittimehands, NULL); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 06:23:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D39D571C7F; Mon, 15 Mar 2021 06:23: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 4DzRF047Nkz3tkq; Mon, 15 Mar 2021 06:23: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 80BC93873; Mon, 15 Mar 2021 06:23: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 12F6NG65066548; Mon, 15 Mar 2021 06:23:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F6NGJq066547; Mon, 15 Mar 2021 06:23:16 GMT (envelope-from git) Date: Mon, 15 Mar 2021 06:23:16 GMT Message-Id: <202103150623.12F6NGJq066547@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2428cc639d6f - stable/12 - fhlink(2): the syscalls do not take flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2428cc639d6f361368ea050e16fb93b9191abc0d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 06:23:16 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2428cc639d6f361368ea050e16fb93b9191abc0d commit 2428cc639d6f361368ea050e16fb93b9191abc0d Author: Konstantin Belousov AuthorDate: 2021-02-28 00:38:11 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-15 06:22:40 +0000 fhlink(2): the syscalls do not take flag (cherry picked from commit 600756afb532a86a39fb488f5c4fc7e248921655) --- lib/libc/sys/fhlink.2 | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/lib/libc/sys/fhlink.2 b/lib/libc/sys/fhlink.2 index 1fcb7365fc0c..f232fe3db6a5 100644 --- a/lib/libc/sys/fhlink.2 +++ b/lib/libc/sys/fhlink.2 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt FHLINK 2 .Os .Sh NAME @@ -95,33 +95,6 @@ the directory associated with the file descriptor .Fa tofd instead of the current working directory. .Pp -Values for -.Fa flag -are constructed by a bitwise-inclusive OR of flags from the following -list, defined in -.In fcntl.h : -.Bl -tag -width indent -.It Dv AT_SYMLINK_FOLLOW -If -.Fa fhp -names a symbolic link, a new link for the target of the symbolic link is -created. -.It Dv AT_BENEATH -Only allow to link to a file which is beneath of the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. -.It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. -See the description of the -.Dv O_RESOLVE_BENEATH -flag in the -.Xr open 2 -manual page. -.El -.Pp If .Fn fhlinkat is passed the special value From owner-dev-commits-src-all@freebsd.org Mon Mar 15 06:28:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA35F571A7C; Mon, 15 Mar 2021 06:28: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 4DzRMN5MrJz3tw2; Mon, 15 Mar 2021 06:28: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 AB50B394A; Mon, 15 Mar 2021 06:28:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12F6SmSY067510; Mon, 15 Mar 2021 06:28:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F6SmTr067509; Mon, 15 Mar 2021 06:28:48 GMT (envelope-from git) Date: Mon, 15 Mar 2021 06:28:48 GMT Message-Id: <202103150628.12F6SmTr067509@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 99158c7fbd56 - main - if_wg: stop holding creds in wg_socket_init() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 99158c7fbd565e0898ee31f47bbdf091e0c853d8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 06:28:48 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=99158c7fbd565e0898ee31f47bbdf091e0c853d8 commit 99158c7fbd565e0898ee31f47bbdf091e0c853d8 Author: Kyle Evans AuthorDate: 2021-03-15 06:21:25 +0000 Commit: Kyle Evans CommitDate: 2021-03-15 06:21:25 +0000 if_wg: stop holding creds in wg_socket_init() We're now xlocked when we create sockets, so we're now guaranteed that the creds won't be released out from underneath us over in wg_prison_remove(). --- sys/dev/if_wg/if_wg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sys/dev/if_wg/if_wg.c b/sys/dev/if_wg/if_wg.c index c0b3ecdaa002..4d5c66133a8f 100644 --- a/sys/dev/if_wg/if_wg.c +++ b/sys/dev/if_wg/if_wg.c @@ -953,9 +953,8 @@ wg_socket_init(struct wg_softc *sc, in_port_t port) sx_assert(&sc->sc_lock, SX_XLOCKED); td = curthread; - if (sc->sc_ucred == NULL) + if ((cred = sc->sc_ucred) == NULL) return (EBUSY); - cred = crhold(sc->sc_ucred); /* * For socket creation, we use the creds of the thread that created the @@ -993,7 +992,6 @@ wg_socket_init(struct wg_softc *sc, in_port_t port) wg_socket_set(sc, so4, so6); } out: - crfree(cred); return (rc); } From owner-dev-commits-src-all@freebsd.org Mon Mar 15 06:28:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DA332571CD3; Mon, 15 Mar 2021 06:28: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 4DzRMP5twMz3tyn; Mon, 15 Mar 2021 06:28: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 BCCB1394B; Mon, 15 Mar 2021 06:28: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 12F6SntS067533; Mon, 15 Mar 2021 06:28:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F6SnTP067532; Mon, 15 Mar 2021 06:28:49 GMT (envelope-from git) Date: Mon, 15 Mar 2021 06:28:49 GMT Message-Id: <202103150628.12F6SnTP067532@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 25529f11cff8 - main - if_wg: close the sockets if wg_socket_bind() failed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 25529f11cff891139bbddb257f54fcd67c1b3ef7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 06:28:49 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=25529f11cff891139bbddb257f54fcd67c1b3ef7 commit 25529f11cff891139bbddb257f54fcd67c1b3ef7 Author: Kyle Evans AuthorDate: 2021-03-15 06:23:56 +0000 Commit: Kyle Evans CommitDate: 2021-03-15 06:23:56 +0000 if_wg: close the sockets if wg_socket_bind() failed This fixes the remaining cred leak that prevented jails from fully dying in some error cases. --- sys/dev/if_wg/if_wg.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/dev/if_wg/if_wg.c b/sys/dev/if_wg/if_wg.c index 4d5c66133a8f..8c11cc58a3bb 100644 --- a/sys/dev/if_wg/if_wg.c +++ b/sys/dev/if_wg/if_wg.c @@ -952,6 +952,7 @@ wg_socket_init(struct wg_softc *sc, in_port_t port) sx_assert(&sc->sc_lock, SX_XLOCKED); + so4 = so6 = NULL; td = curthread; if ((cred = sc->sc_ucred) == NULL) return (EBUSY); @@ -965,7 +966,7 @@ wg_socket_init(struct wg_softc *sc, in_port_t port) * to the network. */ rc = socreate(AF_INET, &so4, SOCK_DGRAM, IPPROTO_UDP, cred, td); - if (rc) + if (rc != 0) goto out; rc = udp_set_kernel_tunneling(so4, wg_input, NULL, sc); @@ -976,11 +977,8 @@ wg_socket_init(struct wg_softc *sc, in_port_t port) MPASS(rc == 0); rc = socreate(AF_INET6, &so6, SOCK_DGRAM, IPPROTO_UDP, cred, td); - if (rc) { - SOCK_LOCK(so4); - sofree(so4); + if (rc != 0) goto out; - } rc = udp_set_kernel_tunneling(so6, wg_input, NULL, sc); MPASS(rc == 0); @@ -992,6 +990,12 @@ wg_socket_init(struct wg_softc *sc, in_port_t port) wg_socket_set(sc, so4, so6); } out: + if (rc != 0) { + if (so4 != NULL) + soclose(so4); + if (so6 != NULL) + soclose(so6); + } return (rc); } From owner-dev-commits-src-all@freebsd.org Mon Mar 15 09:10:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EED9D5759DD; Mon, 15 Mar 2021 09:10: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 4DzVyV6SNYz4Y2n; Mon, 15 Mar 2021 09:10: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 D1108600D; Mon, 15 Mar 2021 09:10: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 12F9Aw2T086677; Mon, 15 Mar 2021 09:10:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12F9AwU7086676; Mon, 15 Mar 2021 09:10:58 GMT (envelope-from git) Date: Mon, 15 Mar 2021 09:10:58 GMT Message-Id: <202103150910.12F9AwU7086676@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Fernando Apesteguía Subject: git: 16b2290447de - main - wlandebug.8: remove Xref for missing manpages MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: fernape X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 16b2290447de6af652f8eee1f585be8f94b30082 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 09:10:59 -0000 The branch main has been updated by fernape (doc, ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=16b2290447de6af652f8eee1f585be8f94b30082 commit 16b2290447de6af652f8eee1f585be8f94b30082 Author: Fernando Apesteguía AuthorDate: 2021-03-03 06:48:11 +0000 Commit: Fernando Apesteguía CommitDate: 2021-03-15 09:04:13 +0000 wlandebug.8: remove Xref for missing manpages Remove references for: athdebug(8), athstats(8) and wlanstats(8) Those are tools in the tools/ directory that are not built as part of the base system. According to the toolds/README file: "...these tools are not meant to be built as part of the standard system..." Even more, the tools/tools/README is not udpated and wlanstats does not even built on current: error: cast from 'struct sockaddr *' to 'const struct sockaddr_dl *' increases required alignment from 1 to 2 [-Werror,-Wcast-align] PR: 227174 Reported by: freebsd.org@alexandrews.me.uk Reviewed by: gbe@ adrian@ Approved by: gbe@ (mentor) adrian@ Differential Revision: https://reviews.freebsd.org/D29033 --- usr.sbin/wlandebug/wlandebug.8 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usr.sbin/wlandebug/wlandebug.8 b/usr.sbin/wlandebug/wlandebug.8 index 0640eff01b20..28fb904306e9 100644 --- a/usr.sbin/wlandebug/wlandebug.8 +++ b/usr.sbin/wlandebug/wlandebug.8 @@ -153,10 +153,12 @@ The following might be used to debug basic station mode operation: it enables debug messages while scanning, authenticating to an access point, and associating to an access point. .Sh SEE ALSO -.Xr athdebug 8 , -.Xr athstats 8 , -.Xr ifconfig 8 , -.Xr wlanstats 8 +.Xr ifconfig 8 +.Pp +The +.Pa /usr/src/tools +directory contains some utilities that might be relevant to debug wireless +issues. .Sh NOTES Different wireless drivers support different debugging messages. Drivers such as From owner-dev-commits-src-all@freebsd.org Mon Mar 15 10:34:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 400DE5777BE; Mon, 15 Mar 2021 10:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzXpm18w9z4dZt; Mon, 15 Mar 2021 10:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1688F6C64; Mon, 15 Mar 2021 10:34:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FAYNw6097450; Mon, 15 Mar 2021 10:34:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FAYNl0097449; Mon, 15 Mar 2021 10:34:23 GMT (envelope-from git) Date: Mon, 15 Mar 2021 10:34:23 GMT Message-Id: <202103151034.12FAYNl0097449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wei Hu Subject: git: 805dbff6c36a - main - Hyper-V: hn: Initialize the internal field of per packet info on tx path MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 805dbff6c36a6cd84491aa53a02315fa025734cc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 10:34:24 -0000 The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=805dbff6c36a6cd84491aa53a02315fa025734cc commit 805dbff6c36a6cd84491aa53a02315fa025734cc Author: Wei Hu AuthorDate: 2021-03-15 10:20:52 +0000 Commit: Wei Hu CommitDate: 2021-03-15 10:33:29 +0000 Hyper-V: hn: Initialize the internal field of per packet info on tx path The RSC support feature introduced a bit field "rm_internal" in struct rndis_pktinfo with total size unchanged. The guest does not use this field in the tx path. However we need to initialize it to zero in case older hosts which are not aware of this field. Fixes: a491581f ("Hyper-V: hn: Enable vSwitch RSC support") MFC after: 2 weeks Sponsored by: Microsoft --- sys/dev/hyperv/netvsc/if_hn.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/hyperv/netvsc/if_hn.c b/sys/dev/hyperv/netvsc/if_hn.c index f4bdbb1ee788..cd0b5a5fa8b9 100644 --- a/sys/dev/hyperv/netvsc/if_hn.c +++ b/sys/dev/hyperv/netvsc/if_hn.c @@ -2932,6 +2932,7 @@ hn_rndis_pktinfo_append(struct rndis_packet_msg *pkt, size_t pktsize, pi->rm_size = pi_size; pi->rm_type = pi_type; + pi->rm_internal = 0; pi->rm_pktinfooffset = RNDIS_PKTINFO_OFFSET; return (pi->rm_data); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 11:02:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 30AB25784D2; Mon, 15 Mar 2021 11:02:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzYQn0y4Cz4gCy; Mon, 15 Mar 2021 11:02:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1403F74C8; Mon, 15 Mar 2021 11:02:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FB29Hb037446; Mon, 15 Mar 2021 11:02:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FB299J037445; Mon, 15 Mar 2021 11:02:09 GMT (envelope-from git) Date: Mon, 15 Mar 2021 11:02:09 GMT Message-Id: <202103151102.12FB299J037445@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: f619b21d0f42 - main - stress2: Fix usage of unitializer data MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f619b21d0f42dfef1c82f4d4f0187ed5b563d69e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 11:02:09 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=f619b21d0f42dfef1c82f4d4f0187ed5b563d69e commit f619b21d0f42dfef1c82f4d4f0187ed5b563d69e Author: Peter Holm AuthorDate: 2021-03-15 11:00:01 +0000 Commit: Peter Holm CommitDate: 2021-03-15 11:00:01 +0000 stress2: Fix usage of unitializer data --- tools/test/stress2/misc/setuid.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/test/stress2/misc/setuid.sh b/tools/test/stress2/misc/setuid.sh index 4703ffe68e77..770c20366f7d 100755 --- a/tools/test/stress2/misc/setuid.sh +++ b/tools/test/stress2/misc/setuid.sh @@ -86,7 +86,7 @@ EOF int main(int argc, char **argv) { - char *av[4]; + char *av[2]; int fd; if (argc == 1) @@ -112,9 +112,8 @@ main(int argc, char **argv) if (chdir("/") != 0) err(1, "chdir"); - av[0] = "nop"; - av[1] = "nop"; - av[3] = 0; + av[0] = "/nop"; + av[1] = 0; if (execve(av[0], av, NULL) == -1) err(1, "execve"); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 11:17:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8458578965; Mon, 15 Mar 2021 11:17: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 4DzYmX5Rn0z4h1D; Mon, 15 Mar 2021 11:17: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 A8D5E7636; Mon, 15 Mar 2021 11:17: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 12FBHWgK051428; Mon, 15 Mar 2021 11:17:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FBHW4W051427; Mon, 15 Mar 2021 11:17:32 GMT (envelope-from git) Date: Mon, 15 Mar 2021 11:17:32 GMT Message-Id: <202103151117.12FBHW4W051427@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Holm Subject: git: cefb959e18ef - main - stress2: Update expetced errno MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pho X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cefb959e18efd7da76724fdacdfb7031ec06fa94 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 11:17:33 -0000 The branch main has been updated by pho: URL: https://cgit.FreeBSD.org/src/commit/?id=cefb959e18efd7da76724fdacdfb7031ec06fa94 commit cefb959e18efd7da76724fdacdfb7031ec06fa94 Author: Peter Holm AuthorDate: 2021-03-15 11:16:52 +0000 Commit: Peter Holm CommitDate: 2021-03-15 11:16:52 +0000 stress2: Update expetced errno --- tools/test/stress2/misc/beneath4.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/test/stress2/misc/beneath4.sh b/tools/test/stress2/misc/beneath4.sh index f1a5c8817662..0f51980cb75a 100755 --- a/tools/test/stress2/misc/beneath4.sh +++ b/tools/test/stress2/misc/beneath4.sh @@ -124,8 +124,8 @@ $dir/beneath4 $top c 0x2000 0 || s=1 $dir/beneath4 $top d 0x2000 93 || s=1 $dir/beneath4 $top e 0x2000 93 || s=1 $dir/beneath4 $top fifo 0x2000 0 || s=1 -$dir/beneath4 $top $top/../../beneath4.d/a/a 0x2000 22 || s=1 -$dir/beneath4 $top $top/.. 0x2000 22 || s=1 +$dir/beneath4 $top $top/../../beneath4.d/a/a 0x2000 93 || s=1 +$dir/beneath4 $top $top/.. 0x2000 93 || s=1 $dir/beneath4 $top ../a 0x2000 93 || s=1 printf "\nNo flag\n" $dir/beneath4 $top ../a 0x0000 0 || s=1 From owner-dev-commits-src-all@freebsd.org Mon Mar 15 12:36:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 090DD57AD4E; Mon, 15 Mar 2021 12:36: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 4DzbWL6nzpz4mCC; Mon, 15 Mar 2021 12:36: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 D77A110B23; Mon, 15 Mar 2021 12:36: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 12FCaENg057612; Mon, 15 Mar 2021 12:36:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FCaE8X057611; Mon, 15 Mar 2021 12:36:14 GMT (envelope-from git) Date: Mon, 15 Mar 2021 12:36:14 GMT Message-Id: <202103151236.12FCaE8X057611@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: ff92a03616c5 - main - if_wg: fix build with DIAGNOSTICS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ff92a03616c5caec5ce0c42dd76722e1b6dc9e51 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 12:36:15 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=ff92a03616c5caec5ce0c42dd76722e1b6dc9e51 commit ff92a03616c5caec5ce0c42dd76722e1b6dc9e51 Author: Kyle Evans AuthorDate: 2021-03-15 12:31:09 +0000 Commit: Kyle Evans CommitDate: 2021-03-15 12:36:02 +0000 if_wg: fix build with DIAGNOSTICS This file got resynced with OpenBSD to pick up fixes that had taken place after the version initially ported to FreeBSD. KASSERT there is more like MPASS here. Reported by: David Wolfskill --- sys/dev/if_wg/wg_noise.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/dev/if_wg/wg_noise.c b/sys/dev/if_wg/wg_noise.c index 373a8578a9f3..ae527eb99bde 100644 --- a/sys/dev/if_wg/wg_noise.c +++ b/sys/dev/if_wg/wg_noise.c @@ -784,10 +784,10 @@ noise_kdf(uint8_t *a, uint8_t *b, uint8_t *c, const uint8_t *x, uint8_t sec[BLAKE2S_HASH_SIZE]; #ifdef DIAGNOSTIC - KASSERT(a_len <= BLAKE2S_HASH_SIZE && b_len <= BLAKE2S_HASH_SIZE && + MPASS(a_len <= BLAKE2S_HASH_SIZE && b_len <= BLAKE2S_HASH_SIZE && c_len <= BLAKE2S_HASH_SIZE); - KASSERT(!(b || b_len || c || c_len) || (a && a_len)); - KASSERT(!(c || c_len) || (b && b_len)); + MPASS(!(b || b_len || c || c_len) || (a && a_len)); + MPASS(!(c || c_len) || (b && b_len)); #endif /* Extract entropy from "x" into sec */ From owner-dev-commits-src-all@freebsd.org Mon Mar 15 13:20:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F245B57BC56; Mon, 15 Mar 2021 13:20: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 4DzcVN6c1Gz4p9w; Mon, 15 Mar 2021 13:20:28 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D566D11235; Mon, 15 Mar 2021 13:20: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 12FDKSHN021943; Mon, 15 Mar 2021 13:20:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FDKS9b021942; Mon, 15 Mar 2021 13:20:28 GMT (envelope-from git) Date: Mon, 15 Mar 2021 13:20:28 GMT Message-Id: <202103151320.12FDKS9b021942@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roger Pau Monné Subject: git: ff5272ca7149 - main - xen/xenusb: always include xen/xen-os.h rather than machine/xen/xen-os.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ff5272ca714906c99df5502781d261c688f003ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 13:20:29 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=ff5272ca714906c99df5502781d261c688f003ac commit ff5272ca714906c99df5502781d261c688f003ac Author: Julien Grall AuthorDate: 2021-03-15 11:15:47 +0000 Commit: Roger Pau Monné CommitDate: 2021-03-15 13:20:21 +0000 xen/xenusb: always include xen/xen-os.h rather than machine/xen/xen-os.h Fix compilation since machine/xen/xen-os.h is requiring definition existing in xen/xen-os.h. In general machine/xen/xen-os.h should never be included Submitted by: Elliott Mitchell Reviewed by: royger Differential revision: https://reviews.freebsd.org/D29043 --- sys/xen/xenbus/xenbusb.c | 2 +- sys/xen/xenbus/xenbusb_back.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/xen/xenbus/xenbusb.c b/sys/xen/xenbus/xenbusb.c index 3e49dfd9424c..74e095f6cda2 100644 --- a/sys/xen/xenbus/xenbusb.c +++ b/sys/xen/xenbus/xenbusb.c @@ -67,9 +67,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include #include diff --git a/sys/xen/xenbus/xenbusb_back.c b/sys/xen/xenbus/xenbusb_back.c index 9beb1f6cdae1..e81d326e7a26 100644 --- a/sys/xen/xenbus/xenbusb_back.c +++ b/sys/xen/xenbus/xenbusb_back.c @@ -51,9 +51,9 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include #include #include From owner-dev-commits-src-all@freebsd.org Mon Mar 15 13:20:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4146657BBE9; Mon, 15 Mar 2021 13:20:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzcVQ0K7Dz4p9y; Mon, 15 Mar 2021 13:20: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 F152411591; Mon, 15 Mar 2021 13:20: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 12FDKTfj021964; Mon, 15 Mar 2021 13:20:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FDKT9h021963; Mon, 15 Mar 2021 13:20:29 GMT (envelope-from git) Date: Mon, 15 Mar 2021 13:20:29 GMT Message-Id: <202103151320.12FDKT9h021963@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Roger Pau Monné Subject: git: b55c0d5f56bd - main - xen: move x86-specific xen_vector_callback_enabled to sys/x86 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: royger X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b55c0d5f56bde414b2c9842c23deaa30ab17e474 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 13:20:30 -0000 The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=b55c0d5f56bde414b2c9842c23deaa30ab17e474 commit b55c0d5f56bde414b2c9842c23deaa30ab17e474 Author: Julien Grall AuthorDate: 2021-03-15 11:27:36 +0000 Commit: Roger Pau Monné CommitDate: 2021-03-15 13:20:21 +0000 xen: move x86-specific xen_vector_callback_enabled to sys/x86 This is x86-only and so should not be in the common area. Submitted by: Elliott Mitchell Reviewed by: royger Differential revision: https://reviews.freebsd.org/D29040 --- sys/x86/include/xen/xen-os.h | 3 +++ sys/xen/xen_intr.h | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/x86/include/xen/xen-os.h b/sys/x86/include/xen/xen-os.h index 115310520af0..86bacadc8521 100644 --- a/sys/x86/include/xen/xen-os.h +++ b/sys/x86/include/xen/xen-os.h @@ -33,6 +33,9 @@ /* Everything below this point is not included by assembler (.S) files. */ #ifndef __ASSEMBLY__ +/* If non-zero, the hypervisor has been configured to use a direct vector */ +extern int xen_vector_callback_enabled; + #endif /* !__ASSEMBLY__ */ #endif /* _MACHINE_X86_XEN_XEN_OS_H_ */ diff --git a/sys/xen/xen_intr.h b/sys/xen/xen_intr.h index 4aa4a9a8b8ea..74570267364d 100644 --- a/sys/xen/xen_intr.h +++ b/sys/xen/xen_intr.h @@ -38,9 +38,6 @@ /** Registered Xen interrupt callback handle. */ typedef void * xen_intr_handle_t; -/** If non-zero, the hypervisor has been configured to use a direct vector */ -extern int xen_vector_callback_enabled; - void xen_intr_handle_upcall(struct trapframe *trap_frame); /** From owner-dev-commits-src-all@freebsd.org Mon Mar 15 13:40:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F17857C723; Mon, 15 Mar 2021 13:40: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 4Dzcx41pC4z4rbF; Mon, 15 Mar 2021 13:40: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 30B55118B9; Mon, 15 Mar 2021 13:40: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 12FDe8N6043165; Mon, 15 Mar 2021 13:40:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FDe8S0043162; Mon, 15 Mar 2021 13:40:08 GMT (envelope-from git) Date: Mon, 15 Mar 2021 13:40:08 GMT Message-Id: <202103151340.12FDe8S0043162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: ab1a91d95872 - stable/13 - linux(4): make getcwd(2) return ERANGE instead of ENOMEM 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/stable/13 X-Git-Reftype: branch X-Git-Commit: ab1a91d95872e59db3d476be4fefb0b58df3afc4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 13:40:08 -0000 The branch stable/13 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=ab1a91d95872e59db3d476be4fefb0b58df3afc4 commit ab1a91d95872e59db3d476be4fefb0b58df3afc4 Author: Edward Tomasz Napierala AuthorDate: 2021-03-12 15:31:37 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-15 13:00:17 +0000 linux(4): make getcwd(2) return ERANGE instead of ENOMEM For native FreeBSD binaries, the return value from __getcwd(2) doesn't really matter, as the libc wrapper takes over and returns the proper errno. PR: kern/254120 Reported By: Alex S Reviewed By: kib Sponsored By: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29217 (cherry picked from commit 0dfbdd9fc269f0438ffcc31632d35234a90584ad) --- sys/compat/linux/linux_getcwd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linux/linux_getcwd.c b/sys/compat/linux/linux_getcwd.c index c39e69c4e707..4917641be5e5 100644 --- a/sys/compat/linux/linux_getcwd.c +++ b/sys/compat/linux/linux_getcwd.c @@ -74,6 +74,8 @@ linux_getcwd(struct thread *td, struct linux_getcwd_args *uap) buf = malloc(buflen, M_TEMP, M_WAITOK); error = vn_getcwd(buf, &retbuf, &buflen); + if (error == ENOMEM) + error = ERANGE; if (error == 0) { error = copyout(retbuf, uap->buf, buflen); if (error == 0) From owner-dev-commits-src-all@freebsd.org Mon Mar 15 13:40:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C369957C3FA; Mon, 15 Mar 2021 13:40: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 4Dzcx52kDSz4rdh; Mon, 15 Mar 2021 13:40: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 4E14A11732; Mon, 15 Mar 2021 13:40: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 12FDe9iv043379; Mon, 15 Mar 2021 13:40:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FDe9CM043376; Mon, 15 Mar 2021 13:40:09 GMT (envelope-from git) Date: Mon, 15 Mar 2021 13:40:09 GMT Message-Id: <202103151340.12FDe9CM043376@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: d7ef665e10dd - stable/13 - development(7): update to reflect Git transition 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d7ef665e10dd3bc0a6f3c0a8e928cf2fe695a113 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 13:40:10 -0000 The branch stable/13 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=d7ef665e10dd3bc0a6f3c0a8e928cf2fe695a113 commit d7ef665e10dd3bc0a6f3c0a8e928cf2fe695a113 Author: Edward Tomasz Napierala AuthorDate: 2021-03-11 20:03:30 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-15 13:00:53 +0000 development(7): update to reflect Git transition Reviewed By: debdrup, imp (earlier version) Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D28939 (cherry picked from commit d28cbb7944e5b1015d94a04cadc97d473838611e) --- share/man/man7/development.7 | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/share/man/man7/development.7 b/share/man/man7/development.7 index 48b3b19384ab..3feb133e0534 100644 --- a/share/man/man7/development.7 +++ b/share/man/man7/development.7 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 19, 2020 +.Dd March 11, 2021 .Dt DEVELOPMENT 7 .Os .Sh NAME @@ -58,17 +58,25 @@ can be found at: .Lk https://www.FreeBSD.org/doc/en/articles/committers-guide/ .Pp .Fx -src development takes place in the CURRENT branch in Subversion, -located at: +src development takes place in the project-hosted +Git repository, located at: .Pp -.Lk https://svn.FreeBSD.org/base/head +.Lk https://git.FreeBSD.org/src.git .Pp -There is also a read-only GitHub mirror at: +The push URL is: .Pp -.Lk https://github.com/freebsd/freebsd +.Lk ssh://git@gitrepo.FreeBSD.org/src.git .Pp -Changes are first committed to CURRENT and then usually merged back -to STABLE. +There is also a public, read-only GitHub mirror at: +.Pp +.Lk https://github.com/freebsd/freebsd-src +.Pp +The +.Ql main +Git branch represents CURRENT; +all changes are first committed to CURRENT and then usually cherry-picked +back to STABLE, which refers to Git branches such as +.Ql stable/13 . Every few years the CURRENT branch is renamed to STABLE, and a new CURRENT is branched, with an incremented major version number. Releases are then branched off STABLE and numbered with consecutive minor @@ -114,7 +122,7 @@ the continuous integration system is at: Check out the CURRENT branch, build it, and install, overwriting the current system: .Bd -literal -offset indent -svnlite co https://svn.FreeBSD.org/base/head src +git clone https://git.FreeBSD.org/src.git src cd src make -sj8 buildworld buildkernel installkernel shutdown -r now @@ -166,7 +174,7 @@ make buildenv TARGET_ARCH=armv6 make -sj8 kernel KERNFAST=1 DESTDIR=/clients/arm .Ed .Sh SEE ALSO -.Xr svnlite 1 , +.Xr git 1 , .Xr witness 4 , .Xr build 7 , .Xr hier 7 , From owner-dev-commits-src-all@freebsd.org Mon Mar 15 14:25:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B56D057D14D; Mon, 15 Mar 2021 14:25: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 4Dzdxf4mR0z4ttf; Mon, 15 Mar 2021 14:25: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 9694B121D6; Mon, 15 Mar 2021 14:25: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 12FEPgmx006246; Mon, 15 Mar 2021 14:25:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FEPgYq006245; Mon, 15 Mar 2021 14:25:42 GMT (envelope-from git) Date: Mon, 15 Mar 2021 14:25:42 GMT Message-Id: <202103151425.12FEPgYq006245@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 17d301f7b59f - stable/13 - ns8250: don't drop IER_TXRDY on bus_grab/ungrab 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 17d301f7b59f49c52983fe0957208dddf40b1232 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 14:25:42 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=17d301f7b59f49c52983fe0957208dddf40b1232 commit 17d301f7b59f49c52983fe0957208dddf40b1232 Author: Mitchell Horne AuthorDate: 2021-03-10 14:57:12 +0000 Commit: Mitchell Horne CommitDate: 2021-03-15 14:22:17 +0000 ns8250: don't drop IER_TXRDY on bus_grab/ungrab It has been observed that some systems are often unable to resume from ddb after entering with debug.kdb.enter=1. Checking the status further shows the terminal is blocked waiting in tty_drain(), but it never makes progress in clearing the output queue, because sc->sc_txbusy is high. I noticed that when entering polling mode for the debugger, IER_TXRDY is set in the failure case. Since this bit is never tracked by the softc, it will not be restored by ns8250_bus_ungrab(). This creates a race in which a TX interrupt can be lost, creating the hang described above. Ensuring that this bit is restored is enough to prevent this, and resume from ddb as expected. The solution is to track this bit in the sc->ier field, for the same lifetime that TX interrupts are enabled. PR: 223917, 240122 Sponsored by: The FreeBSD Foundation (cherry picked from commit 7e7f7beee732810d3afcc83828341ac3e139b5bd) --- sys/dev/uart/uart_dev_ns8250.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index d920a76ae275..45b4d315c3d5 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -738,6 +738,7 @@ ns8250_bus_ipend(struct uart_softc *sc) } else { if (iir & IIR_TXRDY) { ipend |= SER_INT_TXIDLE; + ns8250->ier &= ~IER_ETXRDY; uart_setreg(bas, REG_IER, ns8250->ier); uart_barrier(bas); } else @@ -1035,7 +1036,9 @@ ns8250_bus_transmit(struct uart_softc *sc) uart_setreg(bas, REG_DATA, sc->sc_txbuf[i]); uart_barrier(bas); } - uart_setreg(bas, REG_IER, ns8250->ier | IER_ETXRDY); + if (!broken_txfifo) + ns8250->ier |= IER_ETXRDY; + uart_setreg(bas, REG_IER, ns8250->ier); uart_barrier(bas); if (broken_txfifo) ns8250_drain(bas, UART_DRAIN_TRANSMITTER); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 14:56:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A76657E1A5; Mon, 15 Mar 2021 14:56:59 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.3 with cipher TLS_AES_256_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 4Dzfdk6Tk5z3CXZ; Mon, 15 Mar 2021 14:56:58 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 937A55C00E3; Mon, 15 Mar 2021 10:56:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 15 Mar 2021 10:56:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm2; bh=I z/HfmDmhCXGIeQ+wCMMBJ9kvEl89sfJq0HJT8Mfycc=; b=ffRZGX2Jg/6EEFceu OOQddJftEJ1Gqzo/GM0haopDh8lpb7EKrefmsnw1OsdoDn9VCz+ct6jgYl6newAo 9WFF8YOaoxJ9ToZCQNWsx0F44GtyGS8VeLcvf4idx1vY74vBHcL9tZMM3Km/0XNv 1u5e32DK7CpTdiZrwn3id5VG4LeODHnjwUIyHjpm7c5ZKq8D03Ny819VJ3m4Q7he 53uA1yRqmaEuITulxGoGgvjsbNEm6R7NMuuFDF8bzMzEkSnUUrHYC5BG/XjhcYYj J3LV4fJVo3h/26C8RLQt5KNDvl0zE/QhGjTILORmk+PNR9y4FPfMqbwR8N6XH1+2 D7jwA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=Iz/HfmDmhCXGIeQ+wCMMBJ9kvEl89sfJq0HJT8Mfy cc=; b=CnwLLndov35yrxY+Vjs7BPh6819fvhlXxyTuxLbVb6FOeCyEZtAMYAc+9 Aefusbdtpn9XY6sURDLBcdf+r3OViWZBpbm7gWjDmYKGWSKbOciWTHmoq2+Y0k0v rrdC2Och9J7/Nh7dppigWPAVYogc0oM6V8ymNqn/nPq5iFeurRjVJdWPOSi5JHxb gOYSxLsD3xI16t+yeT23B7lyUQoZ+YvPfq2FfORiVkN9ZadX2VxPeeaHl596/FGL XEbkSWVws4j0s67vNzsC1r29tTkOxmMoyoWX1Rak/tOeHnDZmNs4MnYxZz3flfgP 33ddpN99X83hreNvpSwzrVC/kVI9w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddvledgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurheptggguffhjgffgffkfhfvofesthhqmhdthhdtjeenucfhrhhomhepufgtohht thcunfhonhhguceoshgtohhtthhlsehsrghmshgtohdrohhrgheqnecuggftrfgrthhtvg hrnhepudduveekheehiedukeekleelvedufeevfeetudfgtdffteffleehheffueffgfeh necuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecukfhppeekrdegiedrkeelrddvud efnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgt ohhtthhlsehsrghmshgtohdrohhrgh X-ME-Proxy: Received: from [192.168.0.114] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id C11CC24005C; Mon, 15 Mar 2021 10:56:56 -0400 (EDT) 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: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project From: Scott Long In-Reply-To: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> Date: Mon, 15 Mar 2021 08:56:56 -0600 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> To: Kyle Evans X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4Dzfdk6Tk5z3CXZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 14:56:59 -0000 Here is the response I sent to you and Donenfeld in private. I won=E2=80=99= t include my direct conversation with you from Slack/IRC, but I made my concerns and objections pretty clear. This commit is quite disappointing. See = below: The good: - I=E2=80=99m happy that the community is taking a strong interest in = wireguard in FreeBSD. More hands make light work, and all that, and it=E2=80=99s = why we participate in open source. - I was excited that some of the issues that people have complained about were getting addressed, like packet queueing during re-keying. I know that vnet/jail was a sore spot, and while it=E2=80=99s not = something that Netgate depends on, I knew that it=E2=80=99s important to the community. - I was happy to hear that there=E2=80=99s going to be a new = wireguard-tools with =E2=80=9Cofficial=E2=80=9D FreebSD support. Again, growing = ecosystem, community interest, collaborative work. - I was happy to learn about the test code being ported to FreeBSD. We=E2=80=99re ramping up major resources into testing, and I want to get = my hands on anything and everything that will improve quality and drive better development. The bad: - I want to be pragmatic about code APIs. Maybe iflib isn=E2=80=99t = ready for pseudo interfaces yet, and fixing it is non-trivial and out of scope. Going back to ifnet puts it back in line with openbsd and likely does fix the vnet problems. However, it=E2=80=99s a radical change to the = driver, and not something that I can support as a last-minute action for FreeBSD 13.0 or for pfSense. Therefore, I=E2=80=99m advising against its = immediate inclusion. The final choice is not mine to make for FreeBSD, but that=E2=80=99s my recommendation. For pfSense, I=E2=80=99ll be = discussing this with the rest of the engineering staff on Monday. - The LKML wouldn=E2=80=99t accept this kind of submission, they=E2=80=99d= insist that it be broken down into consumable pieces, and that bug fixes be considered and provided that don=E2=80=99t rely on massive re-writes. = I=E2=80=99ve been dealing with linux for 20+ years and BSD for almost 30 years, and I=E2=80=99ve got to say that despite my distaste for how the LKML is = run, they get results. Does fixing a segfault or packet drop/reorder require the removal of iflib? The Ugly: - An accusation was made, tonight, to me, that the code Netgate=20 sponsored was not reviewed and was shoved into the tree at the last minute. This grossly ignores the actual history to the point of weakening my tolerance for this entire discussion. It shows a pretty irrational bias against mmacy and Netgate and a gross ignorance of the history and provenience of the work. - The Netgate copyright was unilaterally removed. Yes, it was re- instated a few minutes ago, and with good reason. Please don=E2=80=99t do that again. - The removal of the ASM crypto bits really confuses me. An accusation was made, again tonight, that Netgate merely paid to benchmark the code, that we contributed nothing to it, and that it=E2=80=99= s bad code that can=E2=80=99t be audited. What I see is that the meat of = the implementation is copyrighted by Jason and others. There=E2=80=99s a modest but non-trivial amount of glue code that has (or had) the Netgate copyright. I=E2=80=99m not going to touch the audit nonsense. I need data here, and I=E2=80=99m not seeing it. There seems to be a lot of bad blood, poor understanding, and misinformation going on. I need all of this bullshit to stop. This is 5000-ish lines of a nice way to get a point-to-point VPN going without the hassle of IPSec or the performance problems of OpenVPN. It=E2=80=99s consuming way more time and energy than it=E2=80=99= s worth to me, and I=E2=80=99d much rather spend time and money to implement OpenVPN DCO and work on profiling and optimizing IPSec. Wireguard is important to Netgate because we recognize that it=E2=80=99s a feature that customers want, we=E2=80=99re committed = to making security accessible, and we strongly believe in open source and FreeBSD. It=E2=80=99s not perfect code, not by a long shot, but I expect better collaboration and communication than what I=E2=80=99m seeing = here. Scott > On Mar 14, 2021, at 10:52 PM, Kyle Evans wrote: >=20 > The branch main has been updated by kevans: >=20 > URL: = https://cgit.FreeBSD.org/src/commit/?id=3D74ae3f3e33b810248da19004c58b3581= cd367843 >=20 > commit 74ae3f3e33b810248da19004c58b3581cd367843 > Author: Kyle Evans > AuthorDate: 2021-03-15 02:25:40 +0000 > Commit: Kyle Evans > CommitDate: 2021-03-15 04:52:04 +0000 >=20 > if_wg: import latest fixup work from the wireguard-freebsd project >=20 > This is the culmination of about a week of work from three = developers to > fix a number of functional and security issues. This patch = consists of > work done by the following folks: >=20 > - Jason A. Donenfeld > - Matt Dunwoodie > - Kyle Evans >=20 > Notable changes include: > - Packets are now correctly staged for processing once the = handshake has > completed, resulting in less packet loss in the interim. > - Various race conditions have been resolved, particularly w.r.t. = socket > and packet lifetime (panics) > - Various tests have been added to assure correct functionality and > tooling conformance > - Many security issues have been addressed > - if_wg now maintains jail-friendly semantics: sockets are created = in > the interface's home vnet so that it can act as the sole network > connection for a jail > - if_wg no longer fails to remove peer allowed-ips of 0.0.0.0/0 > - if_wg now exports via ioctl a format that is future proof and > complete. It is additionally supported by the upstream > wireguard-tools (which we plan to merge in to base soon) > - if_wg now conforms to the WireGuard protocol and is more closely > aligned with security auditing guidelines >=20 > Note that the driver has been rebased away from using iflib. iflib > poses a number of challenges for a cloned device trying to operate = in a > vnet that are non-trivial to solve and adds complexity to the > implementation for little gain. >=20 > The crypto implementation that was previously added to the tree was = a > super complex integration of what previously appeared in an old out = of > tree Linux module, which has been reduced to crypto.c containing = simple > boring reference implementations. This is part of a near-to-mid = term > goal to work with FreeBSD kernel crypto folks and take advantage of = or > improve accelerated crypto already offered elsewhere. >=20 > There's additional test suite effort underway out-of-tree taking > advantage of the aforementioned jail-friendly semantics to test a = number > of real-world topologies, based on netns.sh. >=20 > Also note that this is still a work in progress; work going further = will > be much smaller in nature. >=20 > MFC after: 1 month (maybe) > --- > etc/mtree/BSD.include.dist | 2 + > include/Makefile | 9 +- > sbin/ifconfig/ifwg.c | 395 +- > share/man/man4/wg.4 | 26 +- > sys/dev/if_wg/crypto.c | 1705 ++++ > sys/dev/if_wg/crypto.h | 114 + > sys/dev/if_wg/if_wg.c | 3454 ++++++++ > sys/dev/if_wg/if_wg.h | 36 + > sys/dev/if_wg/include/crypto/blake2s.h | 56 - > sys/dev/if_wg/include/crypto/curve25519.h | 74 - > sys/dev/if_wg/include/crypto/zinc.h | 15 - > sys/dev/if_wg/include/sys/if_wg_session.h | 89 - > sys/dev/if_wg/include/sys/if_wg_session_vars.h | 319 - > sys/dev/if_wg/include/sys/simd-x86_64.h | 74 - > sys/dev/if_wg/include/sys/support.h | 342 - > sys/dev/if_wg/include/sys/wg_module.h | 121 - > sys/dev/if_wg/include/sys/wg_noise.h | 286 - > sys/dev/if_wg/include/zinc/blake2s.h | 50 - > sys/dev/if_wg/include/zinc/chacha20.h | 68 - > sys/dev/if_wg/include/zinc/chacha20poly1305.h | 48 - > sys/dev/if_wg/include/zinc/curve25519.h | 28 - > sys/dev/if_wg/include/zinc/poly1305.h | 29 - > sys/dev/if_wg/module/blake2s.c | 256 - > sys/dev/if_wg/module/blake2s.h | 58 - > sys/dev/if_wg/module/chacha20-x86_64.S | 2834 ------- > .../crypto/zinc/chacha20/chacha20-arm-glue.c | 98 - > .../module/crypto/zinc/chacha20/chacha20-arm.pl | 1227 --- > .../module/crypto/zinc/chacha20/chacha20-arm64.pl | 1163 --- > .../crypto/zinc/chacha20/chacha20-mips-glue.c | 27 - > .../module/crypto/zinc/chacha20/chacha20-mips.S | 424 - > .../crypto/zinc/chacha20/chacha20-x86_64-glue.c | 132 - > .../module/crypto/zinc/chacha20/chacha20-x86_64.pl | 4106 ---------- > .../if_wg/module/crypto/zinc/chacha20/chacha20.c | 238 - > .../if_wg/module/crypto/zinc/chacha20poly1305.c | 196 - > .../crypto/zinc/poly1305/poly1305-arm-glue.c | 140 - > .../module/crypto/zinc/poly1305/poly1305-arm.pl | 1276 --- > .../module/crypto/zinc/poly1305/poly1305-arm64.pl | 974 --- > .../module/crypto/zinc/poly1305/poly1305-donna32.c | 205 - > .../module/crypto/zinc/poly1305/poly1305-donna64.c | 182 - > .../crypto/zinc/poly1305/poly1305-mips-glue.c | 37 - > .../module/crypto/zinc/poly1305/poly1305-mips.S | 407 - > .../module/crypto/zinc/poly1305/poly1305-mips64.pl | 467 -- > .../crypto/zinc/poly1305/poly1305-x86_64-glue.c | 171 - > .../module/crypto/zinc/poly1305/poly1305-x86_64.pl | 4266 ---------- > .../if_wg/module/crypto/zinc/poly1305/poly1305.c | 163 - > .../if_wg/module/crypto/zinc/selftest/blake2s.c | 2090 ----- > .../if_wg/module/crypto/zinc/selftest/chacha20.c | 2703 ------- > .../module/crypto/zinc/selftest/chacha20poly1305.c | 8443 = -------------------- > .../if_wg/module/crypto/zinc/selftest/curve25519.c | 1315 --- > .../if_wg/module/crypto/zinc/selftest/poly1305.c | 1110 --- > sys/dev/if_wg/module/crypto/zinc/selftest/run.h | 43 - > sys/dev/if_wg/module/curve25519.c | 867 -- > sys/dev/if_wg/module/if_wg_session.c | 1984 ----- > sys/dev/if_wg/module/module.c | 954 --- > sys/dev/if_wg/module/poly1305-x86_64.S | 3021 ------- > sys/dev/if_wg/support.h | 56 + > sys/dev/if_wg/{module =3D> }/wg_cookie.c | 105 +- > sys/dev/if_wg/{include/sys =3D> }/wg_cookie.h | 81 +- > sys/dev/if_wg/{module =3D> }/wg_noise.c | 409 +- > sys/dev/if_wg/wg_noise.h | 191 + > sys/kern/kern_jail.c | 1 + > sys/kern/uipc_socket.c | 11 + > sys/kern/uipc_syscalls.c | 4 +- > sys/modules/if_wg/Makefile | 30 +- > sys/net/if_types.h | 1 + > sys/netinet6/nd6.c | 4 +- > sys/sys/priv.h | 1 + > sys/sys/socketvar.h | 1 + > tests/sys/netinet/Makefile | 10 +- > tests/sys/netinet/if_wg_test.sh | 188 + > 70 files changed, 6333 insertions(+), 43677 deletions(-) >=20 > diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist > index e7784cbb0a47..0f85798815d5 100644 > --- a/etc/mtree/BSD.include.dist > +++ b/etc/mtree/BSD.include.dist > @@ -64,6 +64,8 @@ > .. > iicbus > .. > + if_wg > + .. > io > .. > mfi > diff --git a/include/Makefile b/include/Makefile > index 3a34ddb8aa18..31e207f6b199 100644 > --- a/include/Makefile > +++ b/include/Makefile > @@ -44,7 +44,7 @@ LDIRS=3D bsm cam geom net net80211 netgraph = netinet netinet6 \ > LSUBDIRS=3D cam/ata cam/mmc cam/nvme cam/scsi \ > dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ > dev/hwpmc dev/hyperv \ > - dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \ > + dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ > dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus = dev/pwm \ > dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ > fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ > @@ -170,6 +170,10 @@ NVPAIRDIR=3D ${INCLUDEDIR}/sys > MLX5=3D mlx5io.h > MLX5DIR=3D ${INCLUDEDIR}/dev/mlx5 >=20 > +.PATH: ${SRCTOP}/sys/dev/if_wg > +WG=3D if_wg.h > +WGDIR=3D ${INCLUDEDIR}/dev/if_wg > + > INCSGROUPS=3D INCS \ > ACPICA \ > AGP \ > @@ -182,7 +186,8 @@ INCSGROUPS=3D INCS \ > PCI \ > RPC \ > TEKEN \ > - VERIEXEC > + VERIEXEC \ > + WG >=20 > .if ${MK_IPFILTER} !=3D "no" > INCSGROUPS+=3D IPFILTER > diff --git a/sbin/ifconfig/ifwg.c b/sbin/ifconfig/ifwg.c > index 86bacc59f50d..a102f392cf80 100644 > --- a/sbin/ifconfig/ifwg.c > +++ b/sbin/ifconfig/ifwg.c > @@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$"); > #include > #include >=20 > +#include > + > #include > #include > #include > @@ -65,40 +67,60 @@ __FBSDID("$FreeBSD$"); >=20 > #include "ifconfig.h" >=20 > -typedef enum { > - WGC_GET =3D 0x5, > - WGC_SET =3D 0x6, > -} wg_cmd_t; > +static void wgfinish(int s, void *arg); > + > +static bool wgfinish_registered; >=20 > -static nvlist_t *nvl_params; > -static bool do_peer; > static int allowed_ips_count; > static int allowed_ips_max; > -struct allowedip { > - struct sockaddr_storage a_addr; > - struct sockaddr_storage a_mask; > -}; > -struct allowedip *allowed_ips; > +static nvlist_t **allowed_ips, *nvl_peer; >=20 > #define ALLOWEDIPS_START 16 > -#define WG_KEY_LEN 32 > -#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1) > -#define WG_KEY_LEN_HEX (WG_KEY_LEN * 2 + 1) > +#define WG_KEY_SIZE_BASE64 ((((WG_KEY_SIZE) + 2) / 3) * 4 + 1) > +#define WG_KEY_SIZE_HEX (WG_KEY_SIZE * 2 + 1) > #define WG_MAX_STRLEN 64 >=20 > +struct allowedip { > + union { > + struct in_addr ip4; > + struct in6_addr ip6; > + }; > +}; > + > +static void > +register_wgfinish(void) > +{ > + > + if (wgfinish_registered) > + return; > + callback_register(wgfinish, NULL); > + wgfinish_registered =3D true; > +} > + > +static nvlist_t * > +nvl_device(void) > +{ > + static nvlist_t *_nvl_device; > + > + if (_nvl_device =3D=3D NULL) > + _nvl_device =3D nvlist_create(0); > + register_wgfinish(); > + return (_nvl_device); > +} > + > static bool > -key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64) > +key_from_base64(uint8_t key[static WG_KEY_SIZE], const char *base64) > { >=20 > - if (strlen(base64) !=3D WG_KEY_LEN_BASE64 - 1) { > - warnx("bad key len - need %d got %zu\n", = WG_KEY_LEN_BASE64 - 1, strlen(base64)); > + if (strlen(base64) !=3D WG_KEY_SIZE_BASE64 - 1) { > + warnx("bad key len - need %d got %zu\n", = WG_KEY_SIZE_BASE64 - 1, strlen(base64)); > return false; > } > - if (base64[WG_KEY_LEN_BASE64 - 2] !=3D '=3D') { > - warnx("bad key terminator, expected '=3D' got '%c'", = base64[WG_KEY_LEN_BASE64 - 2]); > + if (base64[WG_KEY_SIZE_BASE64 - 2] !=3D '=3D') { > + warnx("bad key terminator, expected '=3D' got '%c'", = base64[WG_KEY_SIZE_BASE64 - 2]); > return false; > } > - return (b64_pton(base64, key, WG_KEY_LEN)); > + return (b64_pton(base64, key, WG_KEY_SIZE)); > } >=20 > static void > @@ -128,7 +150,7 @@ parse_endpoint(const char *endpoint_) > err =3D getaddrinfo(endpoint, port, &hints, &res); > if (err) > errx(1, "%s", gai_strerror(err)); > - nvlist_add_binary(nvl_params, "endpoint", res->ai_addr, = res->ai_addrlen); > + nvlist_add_binary(nvl_peer, "endpoint", res->ai_addr, = res->ai_addrlen); > freeaddrinfo(res); > free(base); > } > @@ -227,12 +249,14 @@ in6_mask2len(struct in6_addr *mask, u_char = *lim0) > } >=20 > static bool > -parse_ip(struct allowedip *aip, const char *value) > +parse_ip(struct allowedip *aip, uint16_t *family, const char *value) > { > struct addrinfo hints, *res; > int err; > + bool ret; >=20 > - bzero(&aip->a_addr, sizeof(aip->a_addr)); > + ret =3D true; > + bzero(aip, sizeof(*aip)); > bzero(&hints, sizeof(hints)); > hints.ai_family =3D AF_UNSPEC; > hints.ai_flags =3D AI_NUMERICHOST; > @@ -240,10 +264,21 @@ parse_ip(struct allowedip *aip, const char = *value) > if (err) > errx(1, "%s", gai_strerror(err)); >=20 > - memcpy(&aip->a_addr, res->ai_addr, res->ai_addrlen); > + *family =3D res->ai_family; > + if (res->ai_family =3D=3D AF_INET) { > + struct sockaddr_in *sin =3D (struct sockaddr_in = *)res->ai_addr; > + > + aip->ip4 =3D sin->sin_addr; > + } else if (res->ai_family =3D=3D AF_INET6) { > + struct sockaddr_in6 *sin6 =3D (struct sockaddr_in6 = *)res->ai_addr; > + > + aip->ip6 =3D sin6->sin6_addr; > + } else { > + ret =3D false; > + } >=20 > freeaddrinfo(res); > - return (true); > + return (ret); > } >=20 > static void > @@ -271,61 +306,84 @@ sa_ntop(const struct sockaddr *sa, char *buf, = int *port) > } >=20 > static void > -dump_peer(const nvlist_t *nvl_peer) > +dump_peer(const nvlist_t *nvl_peer_cfg) > { > const void *key; > - const struct allowedip *aips; > const struct sockaddr *endpoint; > char outbuf[WG_MAX_STRLEN]; > char addr_buf[INET6_ADDRSTRLEN]; > - size_t size; > - int count, port; > + size_t aip_count, size; > + int port; > uint16_t persistent_keepalive; > + const nvlist_t * const *nvl_aips; >=20 > printf("[Peer]\n"); > - if (nvlist_exists_binary(nvl_peer, "public-key")) { > - key =3D nvlist_get_binary(nvl_peer, "public-key", = &size); > + if (nvlist_exists_binary(nvl_peer_cfg, "public-key")) { > + key =3D nvlist_get_binary(nvl_peer_cfg, "public-key", = &size); > b64_ntop((const uint8_t *)key, size, outbuf, = WG_MAX_STRLEN); > printf("PublicKey =3D %s\n", outbuf); > } > - if (nvlist_exists_binary(nvl_peer, "endpoint")) { > - endpoint =3D nvlist_get_binary(nvl_peer, "endpoint", = &size); > + if (nvlist_exists_binary(nvl_peer_cfg, "preshared-key")) { > + key =3D nvlist_get_binary(nvl_peer_cfg, "preshared-key", = &size); > + b64_ntop((const uint8_t *)key, size, outbuf, = WG_MAX_STRLEN); > + printf("PresharedKey =3D %s\n", outbuf); > + } > + if (nvlist_exists_binary(nvl_peer_cfg, "endpoint")) { > + endpoint =3D nvlist_get_binary(nvl_peer_cfg, "endpoint", = &size); > sa_ntop(endpoint, addr_buf, &port); > printf("Endpoint =3D %s:%d\n", addr_buf, ntohs(port)); > } > - if (nvlist_exists_number(nvl_peer, = "persistent-keepalive-interval")) { > - persistent_keepalive =3D nvlist_get_number(nvl_peer, > + if (nvlist_exists_number(nvl_peer_cfg, > + "persistent-keepalive-interval")) { > + persistent_keepalive =3D nvlist_get_number(nvl_peer_cfg, > "persistent-keepalive-interval"); > printf("PersistentKeepalive =3D %d\n", = persistent_keepalive); > } > - if (!nvlist_exists_binary(nvl_peer, "allowed-ips")) > + if (!nvlist_exists_nvlist_array(nvl_peer_cfg, "allowed-ips")) > return; > - aips =3D nvlist_get_binary(nvl_peer, "allowed-ips", &size); > - if (size =3D=3D 0 || size % sizeof(struct allowedip) !=3D 0) { > - errx(1, "size %zu not integer multiple of allowedip", = size); > - } > + > + nvl_aips =3D nvlist_get_nvlist_array(nvl_peer_cfg, = "allowed-ips", &aip_count); > + if (nvl_aips =3D=3D NULL || aip_count =3D=3D 0) > + return; > + > printf("AllowedIPs =3D "); > - count =3D size / sizeof(struct allowedip); > - for (int i =3D 0; i < count; i++) { > - int mask; > + for (size_t i =3D 0; i < aip_count; i++) { > + uint8_t cidr; > + struct sockaddr_storage ss; > sa_family_t family; > - void *bitmask; > - struct sockaddr *sa; > - > - sa =3D __DECONST(void *, &aips[i].a_addr); > - bitmask =3D __DECONST(void *, > - ((const struct sockaddr = *)&(&aips[i])->a_mask)->sa_data); > - family =3D aips[i].a_addr.ss_family; > - getnameinfo(sa, sa->sa_len, addr_buf, INET6_ADDRSTRLEN, = NULL, > - 0, NI_NUMERICHOST); > - if (family =3D=3D AF_INET) > - mask =3D in_mask2len(bitmask); > - else if (family =3D=3D AF_INET6) > - mask =3D in6_mask2len(bitmask, NULL); > - else > - errx(1, "bad family in peer %d\n", family); > - printf("%s/%d", addr_buf, mask); > - if (i < count -1) > + > + if (!nvlist_exists_number(nvl_aips[i], "cidr")) > + continue; > + cidr =3D nvlist_get_number(nvl_aips[i], "cidr"); > + if (nvlist_exists_binary(nvl_aips[i], "ipv4")) { > + struct sockaddr_in *sin =3D (struct sockaddr_in = *)&ss; > + const struct in_addr *ip4; > + > + ip4 =3D nvlist_get_binary(nvl_aips[i], "ipv4", = &size); > + if (ip4 =3D=3D NULL || cidr > 32) > + continue; > + sin->sin_len =3D sizeof(*sin); > + sin->sin_family =3D AF_INET; > + sin->sin_addr =3D *ip4; > + } else if (nvlist_exists_binary(nvl_aips[i], "ipv6")) { > + struct sockaddr_in6 *sin6 =3D (struct = sockaddr_in6 *)&ss; > + const struct in6_addr *ip6; > + > + ip6 =3D nvlist_get_binary(nvl_aips[i], "ipv6", = &size); > + if (ip6 =3D=3D NULL || cidr > 128) > + continue; > + sin6->sin6_len =3D sizeof(*sin6); > + sin6->sin6_family =3D AF_INET6; > + sin6->sin6_addr =3D *ip6; > + } else { > + continue; > + } > + > + family =3D ss.ss_family; > + getnameinfo((struct sockaddr *)&ss, ss.ss_len, addr_buf, > + INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST); > + printf("%s/%d", addr_buf, cidr); > + if (i < aip_count - 1) > printf(", "); > } > printf("\n"); > @@ -334,36 +392,34 @@ dump_peer(const nvlist_t *nvl_peer) > static int > get_nvl_out_size(int sock, u_long op, size_t *size) > { > - struct ifdrv ifd; > + struct wg_data_io wgd; > int err; >=20 > - memset(&ifd, 0, sizeof(ifd)); > + memset(&wgd, 0, sizeof(wgd)); >=20 > - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); > - ifd.ifd_cmd =3D op; > - ifd.ifd_len =3D 0; > - ifd.ifd_data =3D NULL; > + strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); > + wgd.wgd_size =3D 0; > + wgd.wgd_data =3D NULL; >=20 > - err =3D ioctl(sock, SIOCGDRVSPEC, &ifd); > + err =3D ioctl(sock, op, &wgd); > if (err) > return (err); > - *size =3D ifd.ifd_len; > + *size =3D wgd.wgd_size; > return (0); > } >=20 > static int > do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) > { > - struct ifdrv ifd; > + struct wg_data_io wgd; >=20 > - memset(&ifd, 0, sizeof(ifd)); > + memset(&wgd, 0, sizeof(wgd)); >=20 > - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); > - ifd.ifd_cmd =3D op; > - ifd.ifd_len =3D argsize; > - ifd.ifd_data =3D arg; > + strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); > + wgd.wgd_size =3D argsize; > + wgd.wgd_data =3D arg; >=20 > - return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); > + return (ioctl(sock, op, &wgd)); > } >=20 > static > @@ -371,62 +427,83 @@ DECL_CMD_FUNC(peerlist, val, d) > { > size_t size, peercount; > void *packed; > - const nvlist_t *nvl, *nvl_peer; > + const nvlist_t *nvl; > const nvlist_t *const *nvl_peerlist; >=20 > - if (get_nvl_out_size(s, WGC_GET, &size)) > + if (get_nvl_out_size(s, SIOCGWG, &size)) > errx(1, "can't get peer list size"); > if ((packed =3D malloc(size)) =3D=3D NULL) > errx(1, "malloc failed for peer list"); > - if (do_cmd(s, WGC_GET, packed, size, 0)) > + if (do_cmd(s, SIOCGWG, packed, size, 0)) > errx(1, "failed to obtain peer list"); >=20 > nvl =3D nvlist_unpack(packed, size, 0); > - if (!nvlist_exists_nvlist_array(nvl, "peer-list")) > + if (!nvlist_exists_nvlist_array(nvl, "peers")) > return; > - nvl_peerlist =3D nvlist_get_nvlist_array(nvl, "peer-list", = &peercount); > + nvl_peerlist =3D nvlist_get_nvlist_array(nvl, "peers", = &peercount); >=20 > for (int i =3D 0; i < peercount; i++, nvl_peerlist++) { > - nvl_peer =3D *nvl_peerlist; > - dump_peer(nvl_peer); > + dump_peer(*nvl_peerlist); > } > } >=20 > static void > -peerfinish(int s, void *arg) > +wgfinish(int s, void *arg) > { > - nvlist_t *nvl, **nvl_array; > void *packed; > size_t size; > + static nvlist_t *nvl_dev; > + > + nvl_dev =3D nvl_device(); > + if (nvl_peer !=3D NULL) { > + if (!nvlist_exists_binary(nvl_peer, "public-key")) > + errx(1, "must specify a public-key for adding = peer"); > + if (allowed_ips_count !=3D 0) { > + nvlist_add_nvlist_array(nvl_peer, "allowed-ips", > + (const nvlist_t * const *)allowed_ips, > + allowed_ips_count); > + for (size_t i =3D 0; i < allowed_ips_count; i++) = { > + nvlist_destroy(allowed_ips[i]); > + } > + > + free(allowed_ips); > + } > + > + nvlist_add_nvlist_array(nvl_dev, "peers", > + (const nvlist_t * const *)&nvl_peer, 1); > + } > + > + packed =3D nvlist_pack(nvl_dev, &size); >=20 > - if ((nvl =3D nvlist_create(0)) =3D=3D NULL) > - errx(1, "failed to allocate nvlist"); > - if ((nvl_array =3D calloc(sizeof(void *), 1)) =3D=3D NULL) > - errx(1, "failed to allocate nvl_array"); > - if (!nvlist_exists_binary(nvl_params, "public-key")) > - errx(1, "must specify a public-key for adding peer"); > - if (allowed_ips_count =3D=3D 0) > - errx(1, "must specify at least one range of allowed-ips = to add a peer"); > - > - nvl_array[0] =3D nvl_params; > - nvlist_add_nvlist_array(nvl, "peer-list", (const nvlist_t * = const *)nvl_array, 1); > - packed =3D nvlist_pack(nvl, &size); > - > - if (do_cmd(s, WGC_SET, packed, size, true)) > - errx(1, "failed to install peer"); > + if (do_cmd(s, SIOCSWG, packed, size, true)) > + errx(1, "failed to configure"); > } >=20 > static > DECL_CMD_FUNC(peerstart, val, d) > { > - do_peer =3D true; > - callback_register(peerfinish, NULL); > - allowed_ips =3D malloc(ALLOWEDIPS_START * sizeof(struct = allowedip)); > + > + if (nvl_peer !=3D NULL) > + errx(1, "cannot both add and remove a peer"); > + register_wgfinish(); > + nvl_peer =3D nvlist_create(0); > + allowed_ips =3D calloc(ALLOWEDIPS_START, sizeof(*allowed_ips)); > allowed_ips_max =3D ALLOWEDIPS_START; > if (allowed_ips =3D=3D NULL) > errx(1, "failed to allocate array for allowedips"); > } >=20 > +static > +DECL_CMD_FUNC(peerdel, val, d) > +{ > + > + if (nvl_peer !=3D NULL) > + errx(1, "cannot both add and remove a peer"); > + register_wgfinish(); > + nvl_peer =3D nvlist_create(0); > + nvlist_add_bool(nvl_peer, "remove", true); > +} > + > static > DECL_CMD_FUNC(setwglistenport, val, d) > { > @@ -454,39 +531,53 @@ DECL_CMD_FUNC(setwglistenport, val, d) > errx(1, "unknown family"); > } > ul =3D ntohs((u_short)ul); > - nvlist_add_number(nvl_params, "listen-port", ul); > + nvlist_add_number(nvl_device(), "listen-port", ul); > } >=20 > static > DECL_CMD_FUNC(setwgprivkey, val, d) > { > - uint8_t key[WG_KEY_LEN]; > + uint8_t key[WG_KEY_SIZE]; >=20 > if (!key_from_base64(key, val)) > errx(1, "invalid key %s", val); > - nvlist_add_binary(nvl_params, "private-key", key, WG_KEY_LEN); > + nvlist_add_binary(nvl_device(), "private-key", key, = WG_KEY_SIZE); > } >=20 > static > DECL_CMD_FUNC(setwgpubkey, val, d) > { > - uint8_t key[WG_KEY_LEN]; > + uint8_t key[WG_KEY_SIZE]; >=20 > - if (!do_peer) > + if (nvl_peer =3D=3D NULL) > errx(1, "setting public key only valid when adding = peer"); >=20 > if (!key_from_base64(key, val)) > errx(1, "invalid key %s", val); > - nvlist_add_binary(nvl_params, "public-key", key, WG_KEY_LEN); > + nvlist_add_binary(nvl_peer, "public-key", key, WG_KEY_SIZE); > } >=20 > +static > +DECL_CMD_FUNC(setwgpresharedkey, val, d) > +{ > + uint8_t key[WG_KEY_SIZE]; > + > + if (nvl_peer =3D=3D NULL) > + errx(1, "setting preshared-key only valid when adding = peer"); > + > + if (!key_from_base64(key, val)) > + errx(1, "invalid key %s", val); > + nvlist_add_binary(nvl_peer, "preshared-key", key, WG_KEY_SIZE); > +} > + > + > static > DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) > { > unsigned long persistent_keepalive; > char *endp; >=20 > - if (!do_peer) > + if (nvl_peer =3D=3D NULL) > errx(1, "setting persistent keepalive only valid when = adding peer"); >=20 > errno =3D 0; > @@ -496,7 +587,7 @@ DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) > if (persistent_keepalive > USHRT_MAX) > errx(1, "persistent-keepalive '%lu' too large", > persistent_keepalive); > - nvlist_add_number(nvl_params, "persistent-keepalive-interval", > + nvlist_add_number(nvl_peer, "persistent-keepalive-interval", > persistent_keepalive); > } >=20 > @@ -506,45 +597,57 @@ DECL_CMD_FUNC(setallowedips, val, d) > char *base, *allowedip, *mask; > u_long ul; > char *endp; > - struct allowedip *aip; > + struct allowedip aip; > + nvlist_t *nvl_aip; > + uint16_t family; >=20 > - if (!do_peer) > + if (nvl_peer =3D=3D NULL) > errx(1, "setting allowed ip only valid when adding = peer"); > if (allowed_ips_count =3D=3D allowed_ips_max) { > - /* XXX grow array */ > + allowed_ips_max *=3D 2; > + allowed_ips =3D reallocarray(allowed_ips, = allowed_ips_max, > + sizeof(*allowed_ips)); > + if (allowed_ips =3D=3D NULL) > + errx(1, "failed to grow allowed ip array"); > } > - aip =3D &allowed_ips[allowed_ips_count]; > + > + allowed_ips[allowed_ips_count] =3D nvl_aip =3D nvlist_create(0); > + if (nvl_aip =3D=3D NULL) > + errx(1, "failed to create new allowedip nvlist"); > + > base =3D allowedip =3D strdup(val); > mask =3D index(allowedip, '/'); > if (mask =3D=3D NULL) > errx(1, "mask separator not found in allowedip %s", = val); > *mask =3D '\0'; > mask++; > - parse_ip(aip, allowedip); > + > + parse_ip(&aip, &family, allowedip); > ul =3D strtoul(mask, &endp, 0); > if (*endp !=3D '\0') > errx(1, "invalid value for allowedip mask"); > - bzero(&aip->a_mask, sizeof(aip->a_mask)); > - if (aip->a_addr.ss_family =3D=3D AF_INET) > - in_len2mask((struct in_addr *)&((struct sockaddr = *)&aip->a_mask)->sa_data, ul); > - else if (aip->a_addr.ss_family =3D=3D AF_INET6) > - in6_prefixlen2mask((struct in6_addr *)&((struct sockaddr = *)&aip->a_mask)->sa_data, ul); > - else > - errx(1, "invalid address family %d\n", = aip->a_addr.ss_family); > + > + nvlist_add_number(nvl_aip, "cidr", ul); > + if (family =3D=3D AF_INET) { > + nvlist_add_binary(nvl_aip, "ipv4", &aip.ip4, = sizeof(aip.ip4)); > + } else if (family =3D=3D AF_INET6) { > + nvlist_add_binary(nvl_aip, "ipv6", &aip.ip6, = sizeof(aip.ip6)); > + } else { > + /* Shouldn't happen */ > + nvlist_destroy(nvl_aip); > + goto out; > + } > + > allowed_ips_count++; > - if (allowed_ips_count > 1) > - nvlist_free_binary(nvl_params, "allowed-ips"); > - nvlist_add_binary(nvl_params, "allowed-ips", allowed_ips, > - = allowed_ips_count*sizeof(*aip)); >=20 > - dump_peer(nvl_params); > +out: > free(base); > } >=20 > static > DECL_CMD_FUNC(setendpoint, val, d) > { > - if (!do_peer) > + if (nvl_peer =3D=3D NULL) > errx(1, "setting endpoint only valid when adding peer"); > parse_endpoint(val); > } > @@ -555,15 +658,15 @@ wireguard_status(int s) > size_t size; > void *packed; > nvlist_t *nvl; > - char buf[WG_KEY_LEN_BASE64]; > + char buf[WG_KEY_SIZE_BASE64]; > const void *key; > uint16_t listen_port; >=20 > - if (get_nvl_out_size(s, WGC_GET, &size)) > + if (get_nvl_out_size(s, SIOCGWG, &size)) > return; > if ((packed =3D malloc(size)) =3D=3D NULL) > return; > - if (do_cmd(s, WGC_GET, packed, size, 0)) > + if (do_cmd(s, SIOCGWG, packed, size, 0)) > return; > nvl =3D nvlist_unpack(packed, size, 0); > if (nvlist_exists_number(nvl, "listen-port")) { > @@ -583,10 +686,14 @@ wireguard_status(int s) > } >=20 > static struct cmd wireguard_cmds[] =3D { > - DEF_CLONE_CMD_ARG("listen-port", setwglistenport), > - DEF_CLONE_CMD_ARG("private-key", setwgprivkey), > + DEF_CMD_ARG("listen-port", setwglistenport), > + DEF_CMD_ARG("private-key", setwgprivkey), > + /* XXX peer-list is deprecated. */ > DEF_CMD("peer-list", 0, peerlist), > + DEF_CMD("peers", 0, peerlist), > DEF_CMD("peer", 0, peerstart), > + DEF_CMD("-peer", 0, peerdel), > + DEF_CMD_ARG("preshared-key", setwgpresharedkey), > DEF_CMD_ARG("public-key", setwgpubkey), > DEF_CMD_ARG("persistent-keepalive", setwgpersistentkeepalive), > DEF_CMD_ARG("allowed-ips", setallowedips), > @@ -602,27 +709,10 @@ static struct afswtch af_wireguard =3D { > static void > wg_create(int s, struct ifreq *ifr) > { > - struct iovec iov; > - void *packed; > - size_t size; >=20 > setproctitle("ifconfig %s create ...\n", name); > - if (!nvlist_exists_number(nvl_params, "listen-port")) > - goto legacy; > - if (!nvlist_exists_binary(nvl_params, "private-key")) > - goto legacy; > - > - packed =3D nvlist_pack(nvl_params, &size); > - if (packed =3D=3D NULL) > - errx(1, "failed to setup create request"); > - iov.iov_len =3D size; > - iov.iov_base =3D packed; > - ifr->ifr_data =3D (caddr_t)&iov; > - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) > - err(1, "SIOCIFCREATE2"); > - return; > -legacy: > - ifr->ifr_data =3D=3D NULL; > + > + ifr->ifr_data =3D NULL; > if (ioctl(s, SIOCIFCREATE, ifr) < 0) > err(1, "SIOCIFCREATE"); > } > @@ -632,7 +722,6 @@ wireguard_ctor(void) > { > int i; >=20 > - nvl_params =3D nvlist_create(0); > for (i =3D 0; i < nitems(wireguard_cmds); i++) > cmd_register(&wireguard_cmds[i]); > af_register(&af_wireguard); > diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 > index 335d3e70b64a..29215bd438ff 100644 > --- a/share/man/man4/wg.4 > +++ b/share/man/man4/wg.4 > @@ -23,7 +23,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd March 9, 2021 > +.Dd March 12, 2021 > .Dt WG 4 > .Os > .Sh NAME > @@ -68,7 +68,7 @@ interface. > The private key of the > .Nm > interface. > -.It Cm pre-shared-key > +.It Cm preshared-key > Defines a pre-shared key for the > .Nm > interface. > @@ -76,9 +76,9 @@ interface. > A list of allowed IP addresses. > .It Cm endpoint > The IP address of the WiredGuard to connect to. > -.It Cm peer-list > +.It Cm peers > A list of peering IP addresses to connect to. > -.It Cm persistent-keepalive > +.It Cm persistent-keepalive-interval > Interval, in seconds, at which to send persistent keepalive packets. > .El > .Pp > @@ -188,6 +188,11 @@ Connect to a specific endpoint using its = public-key and set the allowed IP addre > .Bd -literal -offset indent > # ifconfig wg0 peer public-key = '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=3D' endpoint = 10.0.1.100:54321 allowed-ips 192.168.2.100/32 > .Ed > +.Pp > +Remove a peer > +.Bd -literal -offset indent > +# ifconfig wg0 -peer public-key = '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=3D' > +.Ed > .Sh DIAGNOSTICS > The > .Nm > @@ -240,14 +245,11 @@ device driver first appeared in > .Sh AUTHORS > The > .Nm > -device driver was originally written for > -.Ox > -by > -.An Matt Dunwoodie Aq Mt ncon@nconroy.net > -and ported to > -.Fx > -by > -.An Matt Macy Aq Mt mmacy@FreeBSD.org . > +device driver written by > +.An Jason A. Donenfeld Aq Mt Jason@zx2c4.com , > +.An Matt Dunwoodie Aq Mt ncon@nconroy.net , > +and > +.An Kyle Evans Aq Mt kevans@FreeBSD.org . > .Pp > This manual page was written by > .An Gordon Bergling Aq Mt gbe@FreeBSD.org > diff --git a/sys/dev/if_wg/crypto.c b/sys/dev/if_wg/crypto.c > new file mode 100644 > index 000000000000..f28585429272 > --- /dev/null > +++ b/sys/dev/if_wg/crypto.c > @@ -0,0 +1,1705 @@ > +/* > + * Copyright (C) 2015-2021 Jason A. Donenfeld . All = Rights Reserved. > + * > + * Permission to use, copy, modify, and distribute this software for = any > + * purpose with or without fee is hereby granted, provided that the = above > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL = WARRANTIES > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE = LIABLE FOR > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY = DAMAGES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN = AN > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING = OUT OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + */ > + > +#include > +#include > +#include > + > +#include "crypto.h" > + > +#ifndef ARRAY_SIZE > +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) > +#endif > +#ifndef noinline > +#define noinline __attribute__((noinline)) > +#endif > +#ifndef __aligned > +#define __aligned(x) __attribute__((aligned(x))) > +#endif > +#ifndef DIV_ROUND_UP > +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) > +#endif > + > +#define le32_to_cpup(a) le32toh(*(a)) > +#define le64_to_cpup(a) le64toh(*(a)) > +#define cpu_to_le32(a) htole32(a) > +#define cpu_to_le64(a) htole64(a) > + > +static inline uint32_t get_unaligned_le32(const uint8_t *a) > +{ > + uint32_t l; > + __builtin_memcpy(&l, a, sizeof(l)); > + return le32_to_cpup(&l); > +} > +static inline uint64_t get_unaligned_le64(const uint8_t *a) > +{ > + uint64_t l; > + __builtin_memcpy(&l, a, sizeof(l)); > + return le64_to_cpup(&l); > +} > +static inline void put_unaligned_le32(uint32_t s, uint8_t *d) > +{ > + uint32_t l =3D cpu_to_le32(s); > + __builtin_memcpy(d, &l, sizeof(l)); > +} > +static inline void cpu_to_le32_array(uint32_t *buf, unsigned int = words) > +{ > + while (words--) { > + *buf =3D cpu_to_le32(*buf); > + ++buf; > + } > +} > +static inline void le32_to_cpu_array(uint32_t *buf, unsigned int = words) > +{ > + while (words--) { > + *buf =3D le32_to_cpup(buf); > + ++buf; > + } > +} > + > +static inline uint32_t rol32(uint32_t word, unsigned int shift) > +{ > + return (word << (shift & 31)) | (word >> ((-shift) & 31)); > +} > +static inline uint32_t ror32(uint32_t word, unsigned int shift) > +{ > + return (word >> (shift & 31)) | (word << ((-shift) & 31)); > +} > + > +static void xor_cpy(uint8_t *dst, const uint8_t *src1, const uint8_t = *src2, > + size_t len) > +{ > + size_t i; > + > + for (i =3D 0; i < len; ++i) > + dst[i] =3D src1[i] ^ src2[i]; > +} > + > +#define QUARTER_ROUND(x, a, b, c, d) ( \ > + x[a] +=3D x[b], \ > *** 50620 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Mon Mar 15 15:27:56 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7AD4B57E898; Mon, 15 Mar 2021 15:27:56 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzgKS2rhbz3DmN; Mon, 15 Mar 2021 15:27:56 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 4F91A2B3FD; Mon, 15 Mar 2021 15:27:56 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qv1-f44.google.com with SMTP id g8so7939334qvx.1; Mon, 15 Mar 2021 08:27:56 -0700 (PDT) X-Gm-Message-State: AOAM533IG9KBHBQYWbXNOQj6JPH4gs/I2xCzHyrl9feCHNOk9fm4oGn9 j7ALak4HzceYGgx4jI7zr1sImg+LtR0EFclYh48= X-Google-Smtp-Source: ABdhPJwTRLUDgpJmU1e+9CtUO6N6Soe/6S3sdmlDaRCGp8u2IsbzrylLtqjP9HCVSwhBBKZprmT1xjvVkZ6pZCNJp9Q= X-Received: by 2002:ad4:58cf:: with SMTP id dh15mr11108728qvb.26.1615822075775; Mon, 15 Mar 2021 08:27:55 -0700 (PDT) MIME-Version: 1.0 References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> In-Reply-To: <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> From: Kyle Evans Date: Mon, 15 Mar 2021 10:27:42 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Scott Long Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 15:27:56 -0000 On Mon, Mar 15, 2021 at 9:57 AM Scott Long wrote: > > Here is the response I sent to you and Donenfeld in private. I won=E2=80= =99t include > my direct conversation with you from Slack/IRC, but I made my concerns > and objections pretty clear. This commit is quite disappointing. See be= low: > I'm sorry that you feel that way, but I've been pretty vocal about my intentions to merge this work as soon as we were done with internal review due to the pre-existing state of the driver. > The good: > [... snip ...] > > The bad: > - I want to be pragmatic about code APIs. Maybe iflib isn=E2=80=99t read= y for > pseudo interfaces yet, and fixing it is non-trivial and out of scope. > Going back to ifnet puts it back in line with openbsd and likely does > fix the vnet problems. However, it=E2=80=99s a radical change to the dri= ver, and > not something that I can support as a last-minute action for FreeBSD > 13.0 or for pfSense. Therefore, I=E2=80=99m advising against its immedia= te > inclusion. The final choice is not mine to make for FreeBSD, but > that=E2=80=99s my recommendation. For pfSense, I=E2=80=99ll be discussin= g this with > the rest of the engineering staff on Monday. > iflib is definitely not ready for pseudo interfaces, and I'd like to see the technical justification for using iflib here in the first place. if_wg used exactly 0 of its real features because the queueing system was bypassed by setting if_transmit in its IFDI_ATTACH_POST implementation. In other words, we gained all of its complexity and pseudo interfaces immaturity without any benefit that we found while exploring the possibilities. > - The LKML wouldn=E2=80=99t accept this kind of submission, they=E2=80=99= d insist that > it be broken down into consumable pieces, and that bug fixes be > considered and provided that don=E2=80=99t rely on massive re-writes. I= =E2=80=99ve > been dealing with linux for 20+ years and BSD for almost 30 years, > and I=E2=80=99ve got to say that despite my distaste for how the LKML is = run, > they get results. Does fixing a segfault or packet drop/reorder > require the removal of iflib? > The review process on FreeBSD breaks down, as you yourself have noted. mmacy has not been involved in if_wg since dropping it in the tree AFAICT, and grehan claimed to only be involved because it was passed to him at Netgate and that he didn't mind where it goes. Thus, I used developer discretion and sought review from the person that wrote the OpenBSD implementation and the person that designed the protocol. We iterated on this for days to fix the numerous issues we were presented with. > The Ugly: > - An accusation was made, tonight, to me, that the code Netgate > sponsored was not reviewed and was shoved into the tree at the last > minute. This grossly ignores the actual history to the point of > weakening my tolerance for this entire discussion. It shows a pretty > irrational bias against mmacy and Netgate and a gross ignorance of > the history and provenience of the work. > I'm sorry that I got heated here, your tone was immediately aggressive after I just spent five days cleaning up the mess that was left behind. At least one of the security issues I found was a small configuration tweak and near-immediate destruction of the system when applying any real load to the driver. > - The Netgate copyright was unilaterally removed. Yes, it was re- > instated a few minutes ago, and with good reason. Please don=E2=80=99t > do that again. > I won't touch on this, other than "ack". > - The removal of the ASM crypto bits really confuses me. An > accusation was made, again tonight, that Netgate merely paid to > benchmark the code, that we contributed nothing to it, and that it=E2=80= =99s > bad code that can=E2=80=99t be audited. What I see is that the meat of t= he > implementation is copyrighted by Jason and others. There=E2=80=99s a > modest but non-trivial amount of glue code that has (or had) the > Netgate copyright. I=E2=80=99m not going to touch the audit nonsense. > I need data here, and I=E2=80=99m not seeing it. > I would have appreciated a pointer to the copyrighted 63 lines in include/, because this was obviously ignorance on my part. You suggested functional testing and bug fixing, the former of which I inherently include in 'benchmarking' since you can't benchmark something that isn't functional, and received no pointer of the latter. > There seems to be a lot of bad blood, poor understanding, and > misinformation going on. I need all of this bullshit to stop. This > is 5000-ish lines of a nice way to get a point-to-point VPN going > without the hassle of IPSec or the performance problems of > OpenVPN. It=E2=80=99s consuming way more time and energy than it=E2=80= =99s > worth to me, and I=E2=80=99d much rather spend time and money to > implement OpenVPN DCO and work on profiling and optimizing > IPSec. Wireguard is important to Netgate because we recognize > that it=E2=80=99s a feature that customers want, we=E2=80=99re committed = to making > security accessible, and we strongly believe in open source and > FreeBSD. It=E2=80=99s not perfect code, not by a long shot, but I expect > better collaboration and communication than what I=E2=80=99m seeing here. > It's important to me that we do what's right for the community, and the if_wg module that was in-tree was not right for the community. I just want something secure and usable in the tree, the latter point being the packet loss complaints from the Netgate support forum that I pointed you at as well as the kernel not handling allowed-ips conflicts that I had mentioned, among various protocol violations and other things the module did not handle w.r.t. configuration. The former point being at least the buffer overflow I mentioned, but there are more. Thanks, Kyle Evans > Scott > > > > On Mar 14, 2021, at 10:52 PM, Kyle Evans wrote: > > > > The branch main has been updated by kevans: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D74ae3f3e33b810248da19004= c58b3581cd367843 > > > > commit 74ae3f3e33b810248da19004c58b3581cd367843 > > Author: Kyle Evans > > AuthorDate: 2021-03-15 02:25:40 +0000 > > Commit: Kyle Evans > > CommitDate: 2021-03-15 04:52:04 +0000 > > > > if_wg: import latest fixup work from the wireguard-freebsd project > > > > This is the culmination of about a week of work from three developer= s to > > fix a number of functional and security issues. This patch consists= of > > work done by the following folks: > > > > - Jason A. Donenfeld > > - Matt Dunwoodie > > - Kyle Evans > > > > Notable changes include: > > - Packets are now correctly staged for processing once the handshake= has > > completed, resulting in less packet loss in the interim. > > - Various race conditions have been resolved, particularly w.r.t. so= cket > > and packet lifetime (panics) > > - Various tests have been added to assure correct functionality and > > tooling conformance > > - Many security issues have been addressed > > - if_wg now maintains jail-friendly semantics: sockets are created i= n > > the interface's home vnet so that it can act as the sole network > > connection for a jail > > - if_wg no longer fails to remove peer allowed-ips of 0.0.0.0/0 > > - if_wg now exports via ioctl a format that is future proof and > > complete. It is additionally supported by the upstream > > wireguard-tools (which we plan to merge in to base soon) > > - if_wg now conforms to the WireGuard protocol and is more closely > > aligned with security auditing guidelines > > > > Note that the driver has been rebased away from using iflib. iflib > > poses a number of challenges for a cloned device trying to operate i= n a > > vnet that are non-trivial to solve and adds complexity to the > > implementation for little gain. > > > > The crypto implementation that was previously added to the tree was = a > > super complex integration of what previously appeared in an old out = of > > tree Linux module, which has been reduced to crypto.c containing sim= ple > > boring reference implementations. This is part of a near-to-mid ter= m > > goal to work with FreeBSD kernel crypto folks and take advantage of = or > > improve accelerated crypto already offered elsewhere. > > > > There's additional test suite effort underway out-of-tree taking > > advantage of the aforementioned jail-friendly semantics to test a nu= mber > > of real-world topologies, based on netns.sh. > > > > Also note that this is still a work in progress; work going further = will > > be much smaller in nature From owner-dev-commits-src-all@freebsd.org Mon Mar 15 15:41:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABF1F57ED29; Mon, 15 Mar 2021 15:41: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 4Dzgd44VXQz3FZY; Mon, 15 Mar 2021 15:41: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 8DDCD13320; Mon, 15 Mar 2021 15:41: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 12FFfS8B006535; Mon, 15 Mar 2021 15:41:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FFfSvF006534; Mon, 15 Mar 2021 15:41:28 GMT (envelope-from git) Date: Mon, 15 Mar 2021 15:41:28 GMT Message-Id: <202103151541.12FFfSvF006534@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d18a65a53509 - stable/13 - wg: Style MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d18a65a5350928597090b2559d9187bf68976275 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 15:41:28 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d18a65a5350928597090b2559d9187bf68976275 commit d18a65a5350928597090b2559d9187bf68976275 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:05 +0000 Commit: Mark Johnston CommitDate: 2021-03-15 15:38:15 +0000 wg: Style Sponsored by: The FreeBSD Foundation (cherry picked from commit d8cebef50e7b5fac1e28bcb1f931962210f9b5f6) --- sys/dev/if_wg/module/if_wg_session.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/dev/if_wg/module/if_wg_session.c b/sys/dev/if_wg/module/if_wg_session.c index 4164a531cc69..cfe1b5e898bb 100644 --- a/sys/dev/if_wg/module/if_wg_session.c +++ b/sys/dev/if_wg/module/if_wg_session.c @@ -254,15 +254,13 @@ wg_socket_reuse(struct wg_softc *sc, struct socket *so) error = sosetopt(so, &sopt); if (error) { ifp = iflib_get_ifp(sc->wg_ctx); - if_printf(ifp, - "cannot set REUSEPORT socket opt: %d\n", error); + if_printf(ifp, "cannot set REUSEPORT socket opt: %d\n", error); } sopt.sopt_name = SO_REUSEADDR; error = sosetopt(so, &sopt); if (error) { ifp = iflib_get_ifp(sc->wg_ctx); - if_printf(ifp, - "cannot set REUSEADDDR socket opt: %d\n", error); + if_printf(ifp, "cannot set REUSEADDDR socket opt: %d\n", error); } return (error); } From owner-dev-commits-src-all@freebsd.org Mon Mar 15 15:41:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE3B657ECC0; Mon, 15 Mar 2021 15:41: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 4Dzgd55dzMz3Fnf; Mon, 15 Mar 2021 15:41: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 B35CD130BD; Mon, 15 Mar 2021 15:41: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 12FFfT11006558; Mon, 15 Mar 2021 15:41:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FFfTDl006557; Mon, 15 Mar 2021 15:41:29 GMT (envelope-from git) Date: Mon, 15 Mar 2021 15:41:29 GMT Message-Id: <202103151541.12FFfTDl006557@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 9e33e2c5ce94 - stable/13 - posix timers: Declare unexported functions as static MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9e33e2c5ce94d169c9b10393243782d56c94c4c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 15:41:30 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=9e33e2c5ce94d169c9b10393243782d56c94c4c7 commit 9e33e2c5ce94d169c9b10393243782d56c94c4c7 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston CommitDate: 2021-03-15 15:38:17 +0000 posix timers: Declare unexported functions as static Sponsored by: The FreeBSD Foundation (cherry picked from commit 8ff2b41c05a8f98e30250b929e9722f714f1f319) --- sys/kern/kern_time.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 6222bdc39bee..1d5bd2343153 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -107,8 +107,8 @@ static void realtimer_clocktime(clockid_t, struct timespec *); static void realtimer_expire(void *); static int register_posix_clock(int, const struct kclock *); -void itimer_fire(struct itimer *it); -int itimespecfix(struct timespec *ts); +static void itimer_fire(struct itimer *it); +static int itimespecfix(struct timespec *ts); #define CLOCK_CALL(clock, call, arglist) \ ((*posix_clocks[clock].call) arglist) @@ -1592,7 +1592,7 @@ itimer_accept(struct proc *p, int timerid, ksiginfo_t *ksi) return (EINVAL); } -int +static int itimespecfix(struct timespec *ts) { @@ -1653,7 +1653,7 @@ realtimer_expire(void *arg) } } -void +static void itimer_fire(struct itimer *it) { struct proc *p = it->it_proc; From owner-dev-commits-src-all@freebsd.org Mon Mar 15 15:41:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4444657EF04; Mon, 15 Mar 2021 15:41: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 4Dzgd66Vkyz3FZt; Mon, 15 Mar 2021 15:41:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC74B12FE4; Mon, 15 Mar 2021 15:41:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FFfUiO006580; Mon, 15 Mar 2021 15:41:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FFfU0k006579; Mon, 15 Mar 2021 15:41:30 GMT (envelope-from git) Date: Mon, 15 Mar 2021 15:41:30 GMT Message-Id: <202103151541.12FFfU0k006579@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 7d1dda82cfda - stable/13 - posix timers: Sprinkle some style fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7d1dda82cfda8c9fb15064df0f18aaca66ea1276 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 15:41:31 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7d1dda82cfda8c9fb15064df0f18aaca66ea1276 commit 7d1dda82cfda8c9fb15064df0f18aaca66ea1276 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston CommitDate: 2021-03-15 15:38:19 +0000 posix timers: Sprinkle some style fixes Sponsored by: The FreeBSD Foundation (cherry picked from commit 60d12ef952a39581e967a1a608522fdbdedefa01) --- sys/kern/kern_time.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 1d5bd2343153..3e85f8e1d6ec 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1518,8 +1518,8 @@ realtimer_gettime(struct itimer *it, struct itimerspec *ovalue) } static int -realtimer_settime(struct itimer *it, int flags, - struct itimerspec *value, struct itimerspec *ovalue) +realtimer_settime(struct itimer *it, int flags, struct itimerspec *value, + struct itimerspec *ovalue) { struct timespec cts, ts; struct timeval tv; @@ -1548,7 +1548,7 @@ realtimer_settime(struct itimer *it, int flags, if ((flags & TIMER_ABSTIME) == 0) { /* Convert to absolute time. */ timespecadd(&it->it_time.it_value, &cts, - &it->it_time.it_value); + &it->it_time.it_value); } else { timespecsub(&ts, &cts, &ts); /* @@ -1557,8 +1557,8 @@ realtimer_settime(struct itimer *it, int flags, */ } TIMESPEC_TO_TIMEVAL(&tv, &ts); - callout_reset(&it->it_callout, tvtohz(&tv), - realtimer_expire, it); + callout_reset(&it->it_callout, tvtohz(&tv), realtimer_expire, + it); } else { callout_stop(&it->it_callout); } @@ -1618,16 +1618,16 @@ realtimer_expire(void *arg) if (timespeccmp(&cts, &it->it_time.it_value, >=)) { if (timespecisset(&it->it_time.it_interval)) { timespecadd(&it->it_time.it_value, - &it->it_time.it_interval, - &it->it_time.it_value); + &it->it_time.it_interval, + &it->it_time.it_value); while (timespeccmp(&cts, &it->it_time.it_value, >=)) { if (it->it_overrun < INT_MAX) it->it_overrun++; else it->it_ksi.ksi_errno = ERANGE; timespecadd(&it->it_time.it_value, - &it->it_time.it_interval, - &it->it_time.it_value); + &it->it_time.it_interval, + &it->it_time.it_value); } } else { /* single shot timer ? */ @@ -1637,7 +1637,7 @@ realtimer_expire(void *arg) timespecsub(&it->it_time.it_value, &cts, &ts); TIMESPEC_TO_TIMEVAL(&tv, &ts); callout_reset(&it->it_callout, tvtohz(&tv), - realtimer_expire, it); + realtimer_expire, it); } itimer_enter(it); ITIMER_UNLOCK(it); @@ -1649,7 +1649,7 @@ realtimer_expire(void *arg) timespecsub(&ts, &cts, &ts); TIMESPEC_TO_TIMEVAL(&tv, &ts); callout_reset(&it->it_callout, tvtohz(&tv), realtimer_expire, - it); + it); } } From owner-dev-commits-src-all@freebsd.org Mon Mar 15 15:41:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1797557ECCD; Mon, 15 Mar 2021 15:41: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 4Dzgd85FlFz3FsT; Mon, 15 Mar 2021 15:41: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 F15A512FE6; Mon, 15 Mar 2021 15:41: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 12FFfVHZ006598; Mon, 15 Mar 2021 15:41:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FFfVu2006597; Mon, 15 Mar 2021 15:41:31 GMT (envelope-from git) Date: Mon, 15 Mar 2021 15:41:31 GMT Message-Id: <202103151541.12FFfVu2006597@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: eeb0682964fc - stable/13 - posix timers: Improve the overrun calculation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: eeb0682964fccae585ce61ee322dd0062b7a4cd6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 15:41:33 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=eeb0682964fccae585ce61ee322dd0062b7a4cd6 commit eeb0682964fccae585ce61ee322dd0062b7a4cd6 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston CommitDate: 2021-03-15 15:38:43 +0000 posix timers: Improve the overrun calculation timer_settime(2) may be used to configure a timeout in the past. If the timer is also periodic, we also try to compute the number of timer overruns that occurred between the initial timeout and the time at which the timer fired. This is done in a loop which iterates once per period between the initial timeout and now. If the period is small and the initial timeout was a long time ago, this loop can take forever to run, so the system is effectively DOSed. Replace the loop with a more direct calculation of (now - initial timeout) / period to compute the number of overruns. Reported by: syzkaller Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29093 (cherry picked from commit 7995dae9d3f58abf38ef0001cee24131f3c9054b) --- sys/kern/kern_time.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index 3e85f8e1d6ec..44f6b4ad07f2 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -1603,6 +1603,13 @@ itimespecfix(struct timespec *ts) return (0); } +#define timespectons(tsp) \ + ((uint64_t)(tsp)->tv_sec * 1000000000 + (tsp)->tv_nsec) +#define timespecfromns(ns) (struct timespec){ \ + .tv_sec = (ns) / 1000000000, \ + .tv_nsec = (ns) % 1000000000 \ +} + /* Timeout callback for realtime timer */ static void realtimer_expire(void *arg) @@ -1610,6 +1617,7 @@ realtimer_expire(void *arg) struct timespec cts, ts; struct timeval tv; struct itimer *it; + uint64_t interval, now, overruns, value; it = (struct itimer *)arg; @@ -1620,14 +1628,27 @@ realtimer_expire(void *arg) timespecadd(&it->it_time.it_value, &it->it_time.it_interval, &it->it_time.it_value); - while (timespeccmp(&cts, &it->it_time.it_value, >=)) { - if (it->it_overrun < INT_MAX) - it->it_overrun++; - else + + interval = timespectons(&it->it_time.it_interval); + value = timespectons(&it->it_time.it_value); + now = timespectons(&cts); + + if (now >= value) { + /* + * We missed at least one period. + */ + overruns = howmany(now - value + 1, interval); + if (it->it_overrun + overruns >= + it->it_overrun && + it->it_overrun + overruns <= INT_MAX) { + it->it_overrun += (int)overruns; + } else { + it->it_overrun = INT_MAX; it->it_ksi.ksi_errno = ERANGE; - timespecadd(&it->it_time.it_value, - &it->it_time.it_interval, - &it->it_time.it_value); + } + value = + now + interval - (now - value) % interval; + it->it_time.it_value = timespecfromns(value); } } else { /* single shot timer ? */ From owner-dev-commits-src-all@freebsd.org Mon Mar 15 15:41:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 641E757EF09; Mon, 15 Mar 2021 15:41: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 4DzgdB35Hbz3Fw0; Mon, 15 Mar 2021 15:41: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 0B75D1313F; Mon, 15 Mar 2021 15:41: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 12FFfWAZ007473; Mon, 15 Mar 2021 15:41:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FFfWc0007472; Mon, 15 Mar 2021 15:41:32 GMT (envelope-from git) Date: Mon, 15 Mar 2021 15:41:32 GMT Message-Id: <202103151541.12FFfWc0007472@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 10e8aac9bbf5 - stable/13 - ath_hal: Stop printing messages during boot MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 10e8aac9bbf5e838d030ac6f7fb24c218d3a41b7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 15:41:36 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=10e8aac9bbf5e838d030ac6f7fb24c218d3a41b7 commit 10e8aac9bbf5e838d030ac6f7fb24c218d3a41b7 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston CommitDate: 2021-03-15 15:39:08 +0000 ath_hal: Stop printing messages during boot ath_hal is compiled into the kernel by default and so always prints a message to dmesg even when the system has no ath hardware. Sponsored by: The FreeBSD Foundation (cherry picked from commit 0e72eb460228e4b9cb790beb7113d0a5c88db503) --- sys/dev/ath/ah_osdep.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/ath/ah_osdep.c b/sys/dev/ath/ah_osdep.c index 44878486a0c7..a760540b0f3a 100644 --- a/sys/dev/ath/ah_osdep.c +++ b/sys/dev/ath/ah_osdep.c @@ -434,11 +434,13 @@ ath_hal_modevent(module_t mod __unused, int type, void *data __unused) switch (type) { case MOD_LOAD: - printf("[ath_hal] loaded\n"); + if (bootverbose) + printf("[ath_hal] loaded\n"); break; case MOD_UNLOAD: - printf("[ath_hal] unloaded\n"); + if (bootverbose) + printf("[ath_hal] unloaded\n"); break; case MOD_SHUTDOWN: From owner-dev-commits-src-all@freebsd.org Mon Mar 15 15:41:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDA1757EE86; Mon, 15 Mar 2021 15:41: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 4DzgdF1Nw6z3Fr7; Mon, 15 Mar 2021 15:41: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 49E8D12FE8; Mon, 15 Mar 2021 15:41: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 12FFfZik007515; Mon, 15 Mar 2021 15:41:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FFfZdb007514; Mon, 15 Mar 2021 15:41:35 GMT (envelope-from git) Date: Mon, 15 Mar 2021 15:41:35 GMT Message-Id: <202103151541.12FFfZdb007514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 763fb2fda014 - stable/13 - dumpon.8: Ask DDB to call doadump() rather than calling it directly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 763fb2fda0144e3630de74b918d06a96b7968ee2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 15:41:39 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=763fb2fda0144e3630de74b918d06a96b7968ee2 commit 763fb2fda0144e3630de74b918d06a96b7968ee2 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:05 +0000 Commit: Mark Johnston CommitDate: 2021-03-15 15:40:16 +0000 dumpon.8: Ask DDB to call doadump() rather than calling it directly Sponsored by: The FreeBSD Foundation (cherry picked from commit af06ff55535d9b2de253103e974558104e0a3d97) --- sbin/dumpon/dumpon.8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbin/dumpon/dumpon.8 b/sbin/dumpon/dumpon.8 index acdc554ae546..de9bd648e68b 100644 --- a/sbin/dumpon/dumpon.8 +++ b/sbin/dumpon/dumpon.8 @@ -275,7 +275,7 @@ debugger: In the debugger the following commands should be typed to write a core dump and reboot: .Pp -.Dl db> call doadump(0) +.Dl db> dump .Dl db> reset .Pp After reboot From owner-dev-commits-src-all@freebsd.org Mon Mar 15 15:41:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E12757EC60; Mon, 15 Mar 2021 15: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 4DzgdD2hm1z3FyB; Mon, 15 Mar 2021 15:41: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 33B7213321; Mon, 15 Mar 2021 15:41: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 12FFfYWZ007497; Mon, 15 Mar 2021 15:41:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FFfYnI007496; Mon, 15 Mar 2021 15:41:34 GMT (envelope-from git) Date: Mon, 15 Mar 2021 15:41:34 GMT Message-Id: <202103151541.12FFfYnI007496@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 980da033a868 - stable/13 - Rename _cscan_atomic.h and _cscan_bus.h to atomic_san.h and bus_san.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 980da033a8686bbe40ffb01435c0803af15b4a65 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 15:41:40 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=980da033a8686bbe40ffb01435c0803af15b4a65 commit 980da033a8686bbe40ffb01435c0803af15b4a65 Author: Mark Johnston AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston CommitDate: 2021-03-15 15:39:11 +0000 Rename _cscan_atomic.h and _cscan_bus.h to atomic_san.h and bus_san.h Other kernel sanitizers (KMSAN, KASAN) require interceptors as well, so put these in a more generic place as a step towards importing the other sanitizers. No functional change intended. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29103 (cherry picked from commit 435c7cfb2418fdac48fa53e29e38ef03646b817d) --- sys/amd64/include/atomic.h | 2 +- sys/arm64/include/atomic.h | 2 +- sys/arm64/include/bus.h | 2 +- sys/kern/subr_csan.c | 4 ++-- sys/sys/{_cscan_atomic.h => atomic_san.h} | 6 +++--- sys/sys/{_cscan_bus.h => bus_san.h} | 6 +++--- sys/x86/include/bus.h | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/amd64/include/atomic.h b/sys/amd64/include/atomic.h index 87f7b8e8293e..61cb79645c10 100644 --- a/sys/amd64/include/atomic.h +++ b/sys/amd64/include/atomic.h @@ -69,7 +69,7 @@ #endif #if defined(KCSAN) && !defined(KCSAN_RUNTIME) -#include +#include #else #include diff --git a/sys/arm64/include/atomic.h b/sys/arm64/include/atomic.h index 9c5d6224f3e2..6c63357f85b9 100644 --- a/sys/arm64/include/atomic.h +++ b/sys/arm64/include/atomic.h @@ -54,7 +54,7 @@ #define rmb() dmb(ld) /* Full system memory barrier load */ #if defined(KCSAN) && !defined(KCSAN_RUNTIME) -#include +#include #else #include diff --git a/sys/arm64/include/bus.h b/sys/arm64/include/bus.h index 917b2618b275..417b918f595f 100644 --- a/sys/arm64/include/bus.h +++ b/sys/arm64/include/bus.h @@ -92,7 +92,7 @@ #define BUS_SPACE_BARRIER_WRITE 0x02 #if defined(KCSAN) && !defined(KCSAN_RUNTIME) -#include +#include #else struct bus_space { diff --git a/sys/kern/subr_csan.c b/sys/kern/subr_csan.c index 3fa59ef2ea66..ec2fd23729b2 100644 --- a/sys/kern/subr_csan.c +++ b/sys/kern/subr_csan.c @@ -380,7 +380,7 @@ kcsan_copyout(const void *kaddr, void *uaddr, size_t len) /* -------------------------------------------------------------------------- */ #include -#include +#include #define _CSAN_ATOMIC_FUNC_ADD(name, type) \ void kcsan_atomic_add_##name(volatile type *ptr, type val) \ @@ -688,7 +688,7 @@ CSAN_ATOMIC_FUNC_THREAD_FENCE(seq_cst) #include #include -#include +#include int kcsan_bus_space_map(bus_space_tag_t tag, bus_addr_t hnd, bus_size_t size, diff --git a/sys/sys/_cscan_atomic.h b/sys/sys/atomic_san.h similarity index 99% rename from sys/sys/_cscan_atomic.h rename to sys/sys/atomic_san.h index b458c24841bf..c2b963ae8b92 100644 --- a/sys/sys/_cscan_atomic.h +++ b/sys/sys/atomic_san.h @@ -32,8 +32,8 @@ * $FreeBSD$ */ -#ifndef _SYS__CSAN_ATOMIC_H_ -#define _SYS__CSAN_ATOMIC_H_ +#ifndef _SYS_ATOMIC_SAN_H_ +#define _SYS_ATOMIC_SAN_H_ #ifndef _MACHINE_ATOMIC_H_ #error do not include this header, use machine/atomic.h @@ -377,4 +377,4 @@ void kcsan_atomic_thread_fence_seq_cst(void); #endif /* !KCSAN_RUNTIME */ -#endif /* !_SYS__CSAN_ATOMIC_H_ */ +#endif /* !_SYS_ATOMIC_SAN_H_ */ diff --git a/sys/sys/_cscan_bus.h b/sys/sys/bus_san.h similarity index 99% rename from sys/sys/_cscan_bus.h rename to sys/sys/bus_san.h index b1fd4135261e..96b2441fbdbe 100644 --- a/sys/sys/_cscan_bus.h +++ b/sys/sys/bus_san.h @@ -32,8 +32,8 @@ * $FreeBSD$ */ -#ifndef _SYS__CSAN_BUS_H_ -#define _SYS__CSAN_BUS_H_ +#ifndef _SYS_BUS_SAN_H_ +#define _SYS_BUS_SAN_H_ #define KCSAN_BS_MULTI(rw, width, type) \ void kcsan_bus_space_##rw##_multi_##width(bus_space_tag_t, \ @@ -206,4 +206,4 @@ void kcsan_bus_space_barrier(bus_space_tag_t, bus_space_handle_t, bus_size_t, #endif /* !KCSAN_RUNTIME */ -#endif /* !_SYS__CSAN_BUS_H_ */ +#endif /* !_SYS_BUS_SAN_H_ */ diff --git a/sys/x86/include/bus.h b/sys/x86/include/bus.h index 562445b81203..da2fe237ae99 100644 --- a/sys/x86/include/bus.h +++ b/sys/x86/include/bus.h @@ -136,7 +136,7 @@ #define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ #if defined(KCSAN) && !defined(KCSAN_RUNTIME) -#include +#include #else /* From owner-dev-commits-src-all@freebsd.org Mon Mar 15 15:46:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5364657F40F; Mon, 15 Mar 2021 15:46:54 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.3 with cipher TLS_AES_256_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 4DzglL1VCzz3H6R; Mon, 15 Mar 2021 15:46:53 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id DA6835C00F9; Mon, 15 Mar 2021 11:46:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 15 Mar 2021 11:46:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsco.org; h= content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=fm2; bh=v Z+SJYcYgRZdIRcmE8tdrtpaBJDOgwlbyfGElBDX8cQ=; b=MbPAEOKycrDF3FQf7 k/iCip0muRxZ6X+ZvGacSF6r/5TB6OWQLCQ2IAduriTlF2B30v9cweI29hgyXoDm RDLo73KTEPq/YIKmqCxSS9ffIMZnfCo+lVIDOCX7v6jhZUnyxRwzXRWWv/pX8unN kFdCW+/EsIZaTIt0a+WqnH2Ck4tzm3kk5E1fgWivPJ3C6YKNOzm/rs9UAPKGEQhs iF2WmArO45gkuWa56VXli90X+UQ8uwMQIHAo4N79fSOUCl0XGd+g0OBEFE+qzbvj hEwzkWdwbd2j7slNAXyKAPDHnbK1hkMuFn/FtF6dER4SqXw99WvG/aL5B7Yttlai hMdjg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=vZ+SJYcYgRZdIRcmE8tdrtpaBJDOgwlbyfGElBDX8 cQ=; b=DfQy7dj243dQdxknJVMIo4QOdAivqMBmcCPRAeYE4hXDocqQAJqndaQra eluX3bKTg0LfzXCeHvycne6eI0CiiuIn01ngUxzTTQUnBZ16EBTxFlRovokpW7Te Mbg0OGFA8mvy7bcXKElkM5P1bW5I+68M1UKhwVCNhdyfKxPbU/Rfj8aSl6hbbh3Z DPZ/hEOUjdh2G8rnBF1lpMzuW2V7dWE+PU1yRRUXGEAsaIeaL/OYudsu9nJH18Y2 Zlk+AhHhvlXXg6tvb2K88I+NXyPL6+7k7z3DOXXzn/ssG9yLQW2SW1fzWNBzl00C KMOzf7fA8bTSdgyL6yow3fouJt66Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddvledgkedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurheptggguffhjgffgffkfhfvofesthhqmhdthhdtjeenucfhrhhomhepufgtohht thcunfhonhhguceoshgtohhtthhlsehsrghmshgtohdrohhrgheqnecuggftrfgrthhtvg hrnhepudduveekheehiedukeekleelvedufeevfeetudfgtdffteffleehheffueffgfeh necuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecukfhppeekrdegiedrkeelrddvud efnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgt ohhtthhlsehsrghmshgtohdrohhrgh X-ME-Proxy: Received: from [192.168.0.114] (unknown [8.46.89.213]) by mail.messagingengine.com (Postfix) with ESMTPA id 2DEC6240057; Mon, 15 Mar 2021 11:46:53 -0400 (EDT) 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: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project From: Scott Long In-Reply-To: Date: Mon, 15 Mar 2021 09:46:52 -0600 Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Transfer-Encoding: quoted-printable Message-Id: <1D0606F6-73C2-42B9-9CF5-E3EBE01CE4EE@samsco.org> References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> To: Kyle Evans X-Mailer: Apple Mail (2.3654.60.0.2.21) X-Rspamd-Queue-Id: 4DzglL1VCzz3H6R X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 15:46:54 -0000 I=E2=80=99m sorry that you feel that I was =E2=80=9Cimmediately = aggressive=E2=80=9D. I have the IRC logs to back up my statement that I was supportive but concerned, and what I objected to. If you feel that I was immediately aggressive or = that I deserved the scorn you hurled, then I really have nothing more to add to this conversation, other than I=E2=80=99ll be looking for other ways for = Netgate to operate that don=E2=80=99t overlap with Wireguard. Scott > On Mar 15, 2021, at 9:27 AM, Kyle Evans wrote: >=20 > On Mon, Mar 15, 2021 at 9:57 AM Scott Long wrote: >>=20 >> Here is the response I sent to you and Donenfeld in private. I = won=E2=80=99t include >> my direct conversation with you from Slack/IRC, but I made my = concerns >> and objections pretty clear. This commit is quite disappointing. = See below: >>=20 >=20 > I'm sorry that you feel that way, but I've been pretty vocal about my > intentions to merge this work as soon as we were done with internal > review due to the pre-existing state of the driver. >=20 >> The good: >> [... snip ...] >>=20 >> The bad: >> - I want to be pragmatic about code APIs. Maybe iflib isn=E2=80=99t = ready for >> pseudo interfaces yet, and fixing it is non-trivial and out of scope. >> Going back to ifnet puts it back in line with openbsd and likely does >> fix the vnet problems. However, it=E2=80=99s a radical change to the = driver, and >> not something that I can support as a last-minute action for FreeBSD >> 13.0 or for pfSense. Therefore, I=E2=80=99m advising against its = immediate >> inclusion. The final choice is not mine to make for FreeBSD, but >> that=E2=80=99s my recommendation. For pfSense, I=E2=80=99ll be = discussing this with >> the rest of the engineering staff on Monday. >>=20 >=20 > iflib is definitely not ready for pseudo interfaces, and I'd like to > see the technical justification for using iflib here in the first > place. if_wg used exactly 0 of its real features because the queueing > system was bypassed by setting if_transmit in its IFDI_ATTACH_POST > implementation. In other words, we gained all of its complexity and > pseudo interfaces immaturity without any benefit that we found while > exploring the possibilities. >=20 >> - The LKML wouldn=E2=80=99t accept this kind of submission, they=E2=80=99= d insist that >> it be broken down into consumable pieces, and that bug fixes be >> considered and provided that don=E2=80=99t rely on massive re-writes. = I=E2=80=99ve >> been dealing with linux for 20+ years and BSD for almost 30 years, >> and I=E2=80=99ve got to say that despite my distaste for how the LKML = is run, >> they get results. Does fixing a segfault or packet drop/reorder >> require the removal of iflib? >>=20 >=20 > The review process on FreeBSD breaks down, as you yourself have noted. > mmacy has not been involved in if_wg since dropping it in the tree > AFAICT, and grehan claimed to only be involved because it was passed > to him at Netgate and that he didn't mind where it goes. Thus, I used > developer discretion and sought review from the person that wrote the > OpenBSD implementation and the person that designed the protocol. We > iterated on this for days to fix the numerous issues we were presented > with. >=20 >> The Ugly: >> - An accusation was made, tonight, to me, that the code Netgate >> sponsored was not reviewed and was shoved into the tree at the last >> minute. This grossly ignores the actual history to the point of >> weakening my tolerance for this entire discussion. It shows a pretty >> irrational bias against mmacy and Netgate and a gross ignorance of >> the history and provenience of the work. >>=20 >=20 > I'm sorry that I got heated here, your tone was immediately aggressive > after I just spent five days cleaning up the mess that was left > behind. At least one of the security issues I found was a small > configuration tweak and near-immediate destruction of the system when > applying any real load to the driver. >=20 >> - The Netgate copyright was unilaterally removed. Yes, it was re- >> instated a few minutes ago, and with good reason. Please don=E2=80=99t= >> do that again. >>=20 >=20 > I won't touch on this, other than "ack". >=20 >> - The removal of the ASM crypto bits really confuses me. An >> accusation was made, again tonight, that Netgate merely paid to >> benchmark the code, that we contributed nothing to it, and that = it=E2=80=99s >> bad code that can=E2=80=99t be audited. What I see is that the meat = of the >> implementation is copyrighted by Jason and others. There=E2=80=99s a >> modest but non-trivial amount of glue code that has (or had) the >> Netgate copyright. I=E2=80=99m not going to touch the audit nonsense. >> I need data here, and I=E2=80=99m not seeing it. >>=20 >=20 > I would have appreciated a pointer to the copyrighted 63 lines in > include/, because this was obviously ignorance on my part. You > suggested functional testing and bug fixing, the former of which I > inherently include in 'benchmarking' since you can't benchmark > something that isn't functional, and received no pointer of the > latter. >=20 >> There seems to be a lot of bad blood, poor understanding, and >> misinformation going on. I need all of this bullshit to stop. This >> is 5000-ish lines of a nice way to get a point-to-point VPN going >> without the hassle of IPSec or the performance problems of >> OpenVPN. It=E2=80=99s consuming way more time and energy than it=E2=80= =99s >> worth to me, and I=E2=80=99d much rather spend time and money to >> implement OpenVPN DCO and work on profiling and optimizing >> IPSec. Wireguard is important to Netgate because we recognize >> that it=E2=80=99s a feature that customers want, we=E2=80=99re = committed to making >> security accessible, and we strongly believe in open source and >> FreeBSD. It=E2=80=99s not perfect code, not by a long shot, but I = expect >> better collaboration and communication than what I=E2=80=99m seeing = here. >>=20 >=20 > It's important to me that we do what's right for the community, and > the if_wg module that was in-tree was not right for the community. I > just want something secure and usable in the tree, the latter point > being the packet loss complaints from the Netgate support forum that I > pointed you at as well as the kernel not handling allowed-ips > conflicts that I had mentioned, among various protocol violations and > other things the module did not handle w.r.t. configuration. The > former point being at least the buffer overflow I mentioned, but there > are more. >=20 > Thanks, >=20 > Kyle Evans >=20 >> Scott >>=20 >>=20 >>> On Mar 14, 2021, at 10:52 PM, Kyle Evans wrote: >>>=20 >>> The branch main has been updated by kevans: >>>=20 >>> URL: = https://cgit.FreeBSD.org/src/commit/?id=3D74ae3f3e33b810248da19004c58b3581= cd367843 >>>=20 >>> commit 74ae3f3e33b810248da19004c58b3581cd367843 >>> Author: Kyle Evans >>> AuthorDate: 2021-03-15 02:25:40 +0000 >>> Commit: Kyle Evans >>> CommitDate: 2021-03-15 04:52:04 +0000 >>>=20 >>> if_wg: import latest fixup work from the wireguard-freebsd project >>>=20 >>> This is the culmination of about a week of work from three = developers to >>> fix a number of functional and security issues. This patch = consists of >>> work done by the following folks: >>>=20 >>> - Jason A. Donenfeld >>> - Matt Dunwoodie >>> - Kyle Evans >>>=20 >>> Notable changes include: >>> - Packets are now correctly staged for processing once the = handshake has >>> completed, resulting in less packet loss in the interim. >>> - Various race conditions have been resolved, particularly w.r.t. = socket >>> and packet lifetime (panics) >>> - Various tests have been added to assure correct functionality = and >>> tooling conformance >>> - Many security issues have been addressed >>> - if_wg now maintains jail-friendly semantics: sockets are created = in >>> the interface's home vnet so that it can act as the sole network >>> connection for a jail >>> - if_wg no longer fails to remove peer allowed-ips of 0.0.0.0/0 >>> - if_wg now exports via ioctl a format that is future proof and >>> complete. It is additionally supported by the upstream >>> wireguard-tools (which we plan to merge in to base soon) >>> - if_wg now conforms to the WireGuard protocol and is more closely >>> aligned with security auditing guidelines >>>=20 >>> Note that the driver has been rebased away from using iflib. = iflib >>> poses a number of challenges for a cloned device trying to operate = in a >>> vnet that are non-trivial to solve and adds complexity to the >>> implementation for little gain. >>>=20 >>> The crypto implementation that was previously added to the tree = was a >>> super complex integration of what previously appeared in an old = out of >>> tree Linux module, which has been reduced to crypto.c containing = simple >>> boring reference implementations. This is part of a near-to-mid = term >>> goal to work with FreeBSD kernel crypto folks and take advantage = of or >>> improve accelerated crypto already offered elsewhere. >>>=20 >>> There's additional test suite effort underway out-of-tree taking >>> advantage of the aforementioned jail-friendly semantics to test a = number >>> of real-world topologies, based on netns.sh. >>>=20 >>> Also note that this is still a work in progress; work going = further will >>> be much smaller in nature From owner-dev-commits-src-all@freebsd.org Mon Mar 15 15:52:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0151757F8C9; Mon, 15 Mar 2021 15:52:16 +0000 (UTC) (envelope-from Jason@zx2c4.com) Received: from mail.zx2c4.com (mail.zx2c4.com [104.131.123.232]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.zx2c4.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzgsW6SQnz3HfJ; Mon, 15 Mar 2021 15:52:15 +0000 (UTC) (envelope-from Jason@zx2c4.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1615823531; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Lwq3nWSEELjAghtBF26qH8ZL1uGweuc33zcHVxgvanU=; b=ATmpSS8AIs2QLwmETm7JNmxxO1Jods35IjfMzKvbgA2jTvERfPKa1FcJIK7NfVdRbszjhG n7mhXGCsxNe1K3WHP1cY+HMcm2nZA4ABFwuaKV29XnmGdj17+xfK08FZgB6NM3ki59YYjH UkpaFRDZwRSSwdeuZ0xtKeYMKxdiNg8= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id da5399a8 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Mon, 15 Mar 2021 15:52:11 +0000 (UTC) Received: by mail-yb1-f174.google.com with SMTP id x19so33730750ybe.0; Mon, 15 Mar 2021 08:52:11 -0700 (PDT) X-Gm-Message-State: AOAM533SKhylQWTYRVJ/26+1V0km7OAhApyQA0apTIrN8bB89ijXNJzg q8UoSTtkmpAAByrO8gSwVSud3H3kOiVyfTUxDg8= X-Google-Smtp-Source: ABdhPJxr4UUciU/BbluJwgS/KefL/42g4BE/jgtroQVLJIzRZQTSJa0vONHVT+JrRAPf7TuZIOGka6WO4S0zOWVD/QI= X-Received: by 2002:a25:8c2:: with SMTP id 185mr578178ybi.20.1615823531126; Mon, 15 Mar 2021 08:52:11 -0700 (PDT) MIME-Version: 1.0 References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> In-Reply-To: <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> From: "Jason A. Donenfeld" Date: Mon, 15 Mar 2021 09:52:00 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Scott Long Cc: Kyle Evans , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4DzgsW6SQnz3HfJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 15:52:16 -0000 Hi Scott, I had hoped to talk about this with you in person, but I guess you wanted it drawn out publicly. So I'll try to respond point by point. I hope we can still talk about this face to face though, as I'd like to calm the intensity a bit. > - I want to be pragmatic about code APIs. Maybe iflib isn=E2=80=99t read= y for > pseudo interfaces yet, and fixing it is non-trivial and out of scope. > Going back to ifnet puts it back in line with openbsd and likely does > fix the vnet problems. However, it=E2=80=99s a radical change to the dri= ver, and > not something that I can support as a last-minute action for FreeBSD > 13.0 or for pfSense. Therefore, I=E2=80=99m advising against its immedia= te > inclusion. The final choice is not mine to make for FreeBSD, but > that=E2=80=99s my recommendation. For pfSense, I=E2=80=99ll be discussin= g this with > the rest of the engineering staff on Monday. I don't have much to say about iflib particulars as I don't really have enough knowledge about the FreeBSD network stack to form strong preferences, but I did notice there was lots of boilerplate that made usage rather weird and confusing, and it made it harder to integrate with vnets and jails. I trust Kyle's judgement about this, and seeing that he's basically the main developer now of this code, I trust his technical judgement there. As far as I can see, getting rid of iflib made things a lot cleaner and simpler, though. > - The LKML wouldn=E2=80=99t accept this kind of submission, they=E2=80=99= d insist that > it be broken down into consumable pieces, and that bug fixes be > considered and provided that don=E2=80=99t rely on massive re-writes. I= =E2=80=99ve > been dealing with linux for 20+ years and BSD for almost 30 years, > and I=E2=80=99ve got to say that despite my distaste for how the LKML is = run, > they get results. I don't think you're right about LKML. The original WireGuard submission there was quite big: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/diff/?id= =3De7096c131e5161fa3b8e52a650d7719d2857adfd But regardless, I generally agree with you that smaller commits are better -- we actually worked in smaller commits in our staging repo -- but given that this wound up being a rewrite, and the crazy rapid fire of the work we were doing, it was a lot more clear in the end to just squash this rather than having all our intermediate work, which sometimes was a bit incoherent. Moving forward, we'll certainly have smaller commits. You can already see the incremental followup commits Kyle has made. The rest of us will be working on more things too in the coming weeks and you can expect for incremental progress as such. > The Ugly: > - An accusation was made, tonight, to me, that the code Netgate > sponsored was not reviewed and was shoved into the tree at the last > minute. This grossly ignores the actual history to the point of > weakening my tolerance for this entire discussion. It shows a pretty > irrational bias against mmacy and Netgate and a gross ignorance of > the history and provenience of the work. I don't have much to say about this accusation. I don't know anything about Netgate's processes. The code certainly appeared rushed and incomplete, full of problems, but that doesn't really address the accusation. I don't know who made that but it wasn't me. If anything, I'm biased in favor of Netgate. You guys are shipping WireGuard and that's super cool! So whatever parts of my biases are irrational I think mostly serve to make me enthusiastic about what you guys are up to. > - The Netgate copyright was unilaterally removed. Yes, it was re- > instated a few minutes ago, and with good reason. Please don=E2=80=99t > do that again. There was tons of churn and cruft in our staging repo as we pushed commits rapid fire. Of course the copyright line was fixed before we pushed it to freebsd-src. I mean, gosh, this whole awesome FreeBSD wireguard project wouldn't have even existed without you guys starting it. The tone of your email sounds like you've got a very different impression, so I should really stress that I'm _incredibly grateful_ that Netgate got things rolling. > - The removal of the ASM crypto bits really confuses me. An > accusation was made, again tonight, that Netgate merely paid to > benchmark the code, that we contributed nothing to it, and that it=E2=80= =99s > bad code that can=E2=80=99t be audited. What I see is that the meat of t= he > implementation is copyrighted by Jason and others. There=E2=80=99s a > modest but non-trivial amount of glue code that has (or had) the > Netgate copyright. I=E2=80=99m not going to touch the audit nonsense. > I need data here, and I=E2=80=99m not seeing it. Again, I have no idea at *all* where that accusation is coming from. All I can comment on is the code as I found it, and it was a total mess. I'm confident we'll be able to wire up the nice AVX code properly, though. It looks like FreeBSD already has lots of this sort of thing working in opencrypto/ using code from OpenSSL (similarly to the code previously imported from the old crusty compat linux module). So let's do that properly. I wrote about it here: https://lists.freebsd.org/pipermail/freebsd-hackers/2021-March/057076.html > There seems to be a lot of bad blood, poor understanding, and > misinformation going on. I need all of this bullshit to stop Jeeze louise, I really couldn't agree more with you here. I'm really wayyyy more aligned with your perspectives and goals than the tone of your email seems to suggest. We both want freebsd's wireguard implementation to be awesome -- awesome security, awesome performance, awesome stability, awesome community support, and so on. My goal is to both write code myself and help others write code to make that happen. I've really enjoyed working with Kyle and MattD on that in the last week. And I'm happy to work on that with you and anyone else who wants to help too. I'm especially excited about potentially collaborating with the FreeBSD crypto maintainers. I hope we get a chance to talk later today. Regards, Jason From owner-dev-commits-src-all@freebsd.org Mon Mar 15 16:01:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1AD6157FA65; Mon, 15 Mar 2021 16:01:05 +0000 (UTC) (envelope-from Jason@zx2c4.com) Received: from mail.zx2c4.com (mail.zx2c4.com [104.131.123.232]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.zx2c4.com", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Dzh3j02p8z3J9k; Mon, 15 Mar 2021 16:01:04 +0000 (UTC) (envelope-from Jason@zx2c4.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1615824062; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fZZL6yvBGSr6poBEvMSUVjMx0BdrKLVWyc4NWAikSjc=; b=TSTYoLe77Koz4Z3VyA7iNFVRO3oVtgUi4qtcDXEZHVoYqHp/Yh9pWH3z1UEIk+lqwCi0cY GR3g9+t49lR0dQ9DevKhGCC23RpR31Iffl1lXoLcH1d8Slnvu7jQQ5W1l0kXw8n2BFMQsO lbEbdQF0fegIaMX8Tvy46cggULnc3Bs= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id a517e678 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Mon, 15 Mar 2021 16:01:02 +0000 (UTC) Received: by mail-yb1-f173.google.com with SMTP id m9so33739822ybk.8; Mon, 15 Mar 2021 09:01:01 -0700 (PDT) X-Gm-Message-State: AOAM531i/mQxJKyWyt/KAr2JL6zY2rgJVmtAsqwDYrMgLplTgLuN87uw aJb6okatUeBnecw8hgiR79lZuC6O0eEzMJvqw3Y= X-Google-Smtp-Source: ABdhPJzwdohqjGBsM1ed2ytkESDFrrJKiRJry23kzGdWa7JzMO89/WevMYU+j1jNwEsinOu64AquKVs7j7Y/5wXhI7U= X-Received: by 2002:a25:2d1f:: with SMTP id t31mr540925ybt.239.1615824061556; Mon, 15 Mar 2021 09:01:01 -0700 (PDT) MIME-Version: 1.0 References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> <1D0606F6-73C2-42B9-9CF5-E3EBE01CE4EE@samsco.org> In-Reply-To: <1D0606F6-73C2-42B9-9CF5-E3EBE01CE4EE@samsco.org> From: "Jason A. Donenfeld" Date: Mon, 15 Mar 2021 10:00:50 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Scott Long Cc: Kyle Evans , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4Dzh3j02p8z3J9k X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 16:01:05 -0000 On Mon, Mar 15, 2021 at 9:46 AM Scott Long wrote: > I=E2=80=99ll be looking for other ways for Netgate to > operate that don=E2=80=99t overlap with Wireguard. Just want to point out here that Kyle doesn't necessarily speak for me or on behalf of the WireGuard project, and that I don't really have super antagonistic or aggressive views about this conversation. At least from my perspective, I can't so easily see why we would be at odds. You've got a cool project at Netgate. I've got a cool project at WireGuard. We're both writing code for FreeBSD there, and even though there are technical challenges, it's lots of fun, and we're making cool stuff. From owner-dev-commits-src-all@freebsd.org Mon Mar 15 16:57:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C96515A8CAD; Mon, 15 Mar 2021 16:57:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzjJj5LTqz3MQT; Mon, 15 Mar 2021 16:57:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAB5E13F4C; Mon, 15 Mar 2021 16:57:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FGvPm1003594; Mon, 15 Mar 2021 16:57:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FGvPPj003593; Mon, 15 Mar 2021 16:57:25 GMT (envelope-from git) Date: Mon, 15 Mar 2021 16:57:25 GMT Message-Id: <202103151657.12FGvPPj003593@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: a2aac2f5e564 - main - pkg(7): when bootstrapping first search for pkg.bsd file then pkg.txz MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a2aac2f5e5642740507a3cadb98046f3dd434ce4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 16:57:25 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=a2aac2f5e5642740507a3cadb98046f3dd434ce4 commit a2aac2f5e5642740507a3cadb98046f3dd434ce4 Author: Baptiste Daroussin AuthorDate: 2021-03-12 17:36:30 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-15 16:52:22 +0000 pkg(7): when bootstrapping first search for pkg.bsd file then pkg.txz The package extension is going to be changed to .bsd to be among other things resilient to the change of compression format used and reduce the impact of all third party tool of that change. Ensure the bootstrap knows about it Reviewed by: manu Differential revision: https://reviews.freebsd.org/D29232 --- usr.sbin/pkg/pkg.c | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 1f787e3dd246..48b92049b869 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -84,6 +84,12 @@ struct fingerprint { STAILQ_ENTRY(fingerprint) next; }; +static const char *bootstrap_names [] = { + "pkg.bsd", + "pkg.txz", + NULL +}; + STAILQ_HEAD(fingerprint_list, fingerprint); static int @@ -836,6 +842,7 @@ bootstrap_pkg(bool force, const char *fetchOpts) const char *packagesite; const char *signature_type; char pkgstatic[MAXPATHLEN]; + const char *bootstrap_name; fd_sig = -1; ret = -1; @@ -858,22 +865,29 @@ bootstrap_pkg(bool force, const char *fetchOpts) if (strncmp(URL_SCHEME_PREFIX, packagesite, strlen(URL_SCHEME_PREFIX)) == 0) packagesite += strlen(URL_SCHEME_PREFIX); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz", packagesite); - - snprintf(tmppkg, MAXPATHLEN, "%s/pkg.txz.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - - if ((fd_pkg = fetch_to_fd(url, tmppkg, fetchOpts)) == -1) + for (int j = 0; bootstrap_names[j] != NULL; j++) { + bootstrap_name = bootstrap_names[j]; + + snprintf(url, MAXPATHLEN, "%s/Latest/%s", packagesite, bootstrap_name); + snprintf(tmppkg, MAXPATHLEN, "%s/%s.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + if ((fd_pkg = fetch_to_fd(url, tmppkg, fetchOpts)) != -1) + break; + bootstrap_name = NULL; + } + if (bootstrap_name == NULL) goto fetchfail; if (signature_type != NULL && strcasecmp(signature_type, "NONE") != 0) { if (strcasecmp(signature_type, "FINGERPRINTS") == 0) { - snprintf(tmpsig, MAXPATHLEN, "%s/pkg.txz.sig.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig", - packagesite); + snprintf(tmpsig, MAXPATHLEN, "%s/%s.sig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + snprintf(url, MAXPATHLEN, "%s/Latest/%s.sig", + packagesite, bootstrap_name); if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) { fprintf(stderr, "Signature for pkg not " @@ -886,10 +900,11 @@ bootstrap_pkg(bool force, const char *fetchOpts) } else if (strcasecmp(signature_type, "PUBKEY") == 0) { snprintf(tmpsig, MAXPATHLEN, - "%s/pkg.txz.pubkeysig.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.pubkeysig", - packagesite); + "%s/%s.pubkeysig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP, + bootstrap_name); + snprintf(url, MAXPATHLEN, "%s/Latest/%s.pubkeysig", + packagesite, bootstrap_name); if ((fd_sig = fetch_to_fd(url, tmpsig, fetchOpts)) == -1) { fprintf(stderr, "Signature for pkg not " From owner-dev-commits-src-all@freebsd.org Mon Mar 15 17:48:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EB2E5AA99F; Mon, 15 Mar 2021 17:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzkRQ2jZ5z3RFR; Mon, 15 Mar 2021 17:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4BFC314AF4; Mon, 15 Mar 2021 17:48:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FHmIWP069989; Mon, 15 Mar 2021 17:48:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FHmI62069988; Mon, 15 Mar 2021 17:48:18 GMT (envelope-from git) Date: Mon, 15 Mar 2021 17:48:18 GMT Message-Id: <202103151748.12FHmI62069988@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: 0ab5902e8ad9 - main - netmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET 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: 0ab5902e8ad93d0a9341dcce386b6c571ee02173 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 17:48:18 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=0ab5902e8ad93d0a9341dcce386b6c571ee02173 commit 0ab5902e8ad93d0a9341dcce386b6c571ee02173 Author: Vincenzo Maffione AuthorDate: 2021-03-15 17:39:18 +0000 Commit: Vincenzo Maffione CommitDate: 2021-03-15 17:39:18 +0000 netmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET The netmap_ioctl() function has a reference counting bug in case of NETMAP_REQ_PORT_INFO_GET command. When `hdr->nr_name[0] == '\0'`, the function does not decrease the refcount of "nmd", which is increased by netmap_mem_find(), causing a refcount leak. Reported by: Xiyu Yang Submitted by: Carl Smith MFC after: 3 days PR: 254311 --- sys/dev/netmap/netmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index f37900712046..f9698096b47a 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -2646,6 +2646,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, case NETMAP_REQ_PORT_INFO_GET: { struct nmreq_port_info_get *req = (struct nmreq_port_info_get *)(uintptr_t)hdr->nr_body; + int nmd_ref = 0; NMG_LOCK(); do { @@ -2687,6 +2688,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, error = EINVAL; break; } + nmd_ref = 1; } error = netmap_mem_get_info(nmd, &req->nr_memsize, &memflags, @@ -2704,6 +2706,8 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, req->nr_host_rx_rings = na->num_host_rx_rings; } while (0); netmap_unget_na(na, ifp); + if (nmd_ref) + netmap_mem_put(nmd); NMG_UNLOCK(); break; } From owner-dev-commits-src-all@freebsd.org Mon Mar 15 17:49:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 106235AA453 for ; Mon, 15 Mar 2021 17:49:05 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) (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 4DzkSJ6wvbz3hCj for ; Mon, 15 Mar 2021 17:49:04 +0000 (UTC) (envelope-from kevin.bowling@kev009.com) Received: by mail-yb1-xb2d.google.com with SMTP id u3so34088989ybk.6 for ; Mon, 15 Mar 2021 10:49:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kev009.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=j1yZtFDilpEOYFvFPkbXn0jho7GSu1sLkKMxw1V1zw4=; b=AmY7RDQCpMdEifdMxPQLYAs3rCg4U7p9yKG0AYlwwtvq8iXqlbHyhIkHNTuFK1gAt1 VOnsypt8GEMLbHcmgsKYU0VRdegMoSbj5yf7ZYCeT09+d+qNq4inzlmv1/ejK+cJD+rf P5tgXRJtzjaF7hoKXeiy+YpHmUqVtYVmdUcEA= 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=j1yZtFDilpEOYFvFPkbXn0jho7GSu1sLkKMxw1V1zw4=; b=c6jO8pDlm8RS2m74VIvrDs/eOq71gA69Y2b87u1jLwbJgKPy9hxjYTXHHdJdCO380w 9AFG+gOGzsw5ndYUqAdr0OdBkvRY+6zA1xI8+lSPKiJEtfRJYlxYbXwQ97YB9fGCkyiN K+80LbOXfRo6OvFAI/jaaoSEYl2KxBKqw/rrrDnrpbBiGv9w3099OJu6Ura+x8SrXLz1 D+muJ0zec5uptuVOCC/BBsVUxFQbyo2C3XvyhUYXWeCGSSIpq/DDc9vXP1p5bGoLI51y wwGLtn4vwmxgrQ0M3r9q67gfQUW9ZaNDQg2NueLhta9vW/9CNsTja3jkeS88YrCzyfXF EXHQ== X-Gm-Message-State: AOAM530c2GXzOwBV9lrZ2/RJvx+LK+pWjPNSAyVqwyaxpZQtf6bLStvY XjbO8oo0hkj3WBjYSYiTREgVeHqCmGpu9IzAqCBMdQ== X-Google-Smtp-Source: ABdhPJy1maqABrk5T+2OW9dn6zWZkXduRQkEOxLBpIMTeoG8pAZ/tgPOUmQNxsv7V3nuyvWRKVKdcpeD14Egx++oM+E= X-Received: by 2002:a25:3bc2:: with SMTP id i185mr1143897yba.87.1615830543356; Mon, 15 Mar 2021 10:49:03 -0700 (PDT) MIME-Version: 1.0 References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> In-Reply-To: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> From: Kevin Bowling Date: Mon, 15 Mar 2021 10:48:52 -0700 Message-ID: Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Kyle Evans Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4DzkSJ6wvbz3hCj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 17:49:05 -0000 Isn't this the quintessential candidate for Phabricator? By your own commit message this is code with lots of security implications. It also has (had? depending on how this goes) corporate stewardship that should be given some chance to participate. If it isn't going to re@ in time for 13.0 anyway, it does feel like an awful lot of theatrics to get in some unnecessary passive aggressiveness. You're going about it in a strange way to first accuse the original of being a rush job and unfit, to immediately heroing it without review like this and expecting assumptions of good faith. My 2c based on recent reviews discussion. On Sun, Mar 14, 2021 at 9:53 PM Kyle Evans wrote: > > The branch main has been updated by kevans: > > URL: https://cgit.FreeBSD.org/src/commit/?id=74ae3f3e33b810248da19004c58b3581cd367843 > > commit 74ae3f3e33b810248da19004c58b3581cd367843 > Author: Kyle Evans > AuthorDate: 2021-03-15 02:25:40 +0000 > Commit: Kyle Evans > CommitDate: 2021-03-15 04:52:04 +0000 > > if_wg: import latest fixup work from the wireguard-freebsd project > > This is the culmination of about a week of work from three developers to > fix a number of functional and security issues. This patch consists of > work done by the following folks: > > - Jason A. Donenfeld > - Matt Dunwoodie > - Kyle Evans > > Notable changes include: > - Packets are now correctly staged for processing once the handshake has > completed, resulting in less packet loss in the interim. > - Various race conditions have been resolved, particularly w.r.t. socket > and packet lifetime (panics) > - Various tests have been added to assure correct functionality and > tooling conformance > - Many security issues have been addressed > - if_wg now maintains jail-friendly semantics: sockets are created in > the interface's home vnet so that it can act as the sole network > connection for a jail > - if_wg no longer fails to remove peer allowed-ips of 0.0.0.0/0 > - if_wg now exports via ioctl a format that is future proof and > complete. It is additionally supported by the upstream > wireguard-tools (which we plan to merge in to base soon) > - if_wg now conforms to the WireGuard protocol and is more closely > aligned with security auditing guidelines > > Note that the driver has been rebased away from using iflib. iflib > poses a number of challenges for a cloned device trying to operate in a > vnet that are non-trivial to solve and adds complexity to the > implementation for little gain. > > The crypto implementation that was previously added to the tree was a > super complex integration of what previously appeared in an old out of > tree Linux module, which has been reduced to crypto.c containing simple > boring reference implementations. This is part of a near-to-mid term > goal to work with FreeBSD kernel crypto folks and take advantage of or > improve accelerated crypto already offered elsewhere. > > There's additional test suite effort underway out-of-tree taking > advantage of the aforementioned jail-friendly semantics to test a number > of real-world topologies, based on netns.sh. > > Also note that this is still a work in progress; work going further will > be much smaller in nature. > > MFC after: 1 month (maybe) > --- > etc/mtree/BSD.include.dist | 2 + > include/Makefile | 9 +- > sbin/ifconfig/ifwg.c | 395 +- > share/man/man4/wg.4 | 26 +- > sys/dev/if_wg/crypto.c | 1705 ++++ > sys/dev/if_wg/crypto.h | 114 + > sys/dev/if_wg/if_wg.c | 3454 ++++++++ > sys/dev/if_wg/if_wg.h | 36 + > sys/dev/if_wg/include/crypto/blake2s.h | 56 - > sys/dev/if_wg/include/crypto/curve25519.h | 74 - > sys/dev/if_wg/include/crypto/zinc.h | 15 - > sys/dev/if_wg/include/sys/if_wg_session.h | 89 - > sys/dev/if_wg/include/sys/if_wg_session_vars.h | 319 - > sys/dev/if_wg/include/sys/simd-x86_64.h | 74 - > sys/dev/if_wg/include/sys/support.h | 342 - > sys/dev/if_wg/include/sys/wg_module.h | 121 - > sys/dev/if_wg/include/sys/wg_noise.h | 286 - > sys/dev/if_wg/include/zinc/blake2s.h | 50 - > sys/dev/if_wg/include/zinc/chacha20.h | 68 - > sys/dev/if_wg/include/zinc/chacha20poly1305.h | 48 - > sys/dev/if_wg/include/zinc/curve25519.h | 28 - > sys/dev/if_wg/include/zinc/poly1305.h | 29 - > sys/dev/if_wg/module/blake2s.c | 256 - > sys/dev/if_wg/module/blake2s.h | 58 - > sys/dev/if_wg/module/chacha20-x86_64.S | 2834 ------- > .../crypto/zinc/chacha20/chacha20-arm-glue.c | 98 - > .../module/crypto/zinc/chacha20/chacha20-arm.pl | 1227 --- > .../module/crypto/zinc/chacha20/chacha20-arm64.pl | 1163 --- > .../crypto/zinc/chacha20/chacha20-mips-glue.c | 27 - > .../module/crypto/zinc/chacha20/chacha20-mips.S | 424 - > .../crypto/zinc/chacha20/chacha20-x86_64-glue.c | 132 - > .../module/crypto/zinc/chacha20/chacha20-x86_64.pl | 4106 ---------- > .../if_wg/module/crypto/zinc/chacha20/chacha20.c | 238 - > .../if_wg/module/crypto/zinc/chacha20poly1305.c | 196 - > .../crypto/zinc/poly1305/poly1305-arm-glue.c | 140 - > .../module/crypto/zinc/poly1305/poly1305-arm.pl | 1276 --- > .../module/crypto/zinc/poly1305/poly1305-arm64.pl | 974 --- > .../module/crypto/zinc/poly1305/poly1305-donna32.c | 205 - > .../module/crypto/zinc/poly1305/poly1305-donna64.c | 182 - > .../crypto/zinc/poly1305/poly1305-mips-glue.c | 37 - > .../module/crypto/zinc/poly1305/poly1305-mips.S | 407 - > .../module/crypto/zinc/poly1305/poly1305-mips64.pl | 467 -- > .../crypto/zinc/poly1305/poly1305-x86_64-glue.c | 171 - > .../module/crypto/zinc/poly1305/poly1305-x86_64.pl | 4266 ---------- > .../if_wg/module/crypto/zinc/poly1305/poly1305.c | 163 - > .../if_wg/module/crypto/zinc/selftest/blake2s.c | 2090 ----- > .../if_wg/module/crypto/zinc/selftest/chacha20.c | 2703 ------- > .../module/crypto/zinc/selftest/chacha20poly1305.c | 8443 -------------------- > .../if_wg/module/crypto/zinc/selftest/curve25519.c | 1315 --- > .../if_wg/module/crypto/zinc/selftest/poly1305.c | 1110 --- > sys/dev/if_wg/module/crypto/zinc/selftest/run.h | 43 - > sys/dev/if_wg/module/curve25519.c | 867 -- > sys/dev/if_wg/module/if_wg_session.c | 1984 ----- > sys/dev/if_wg/module/module.c | 954 --- > sys/dev/if_wg/module/poly1305-x86_64.S | 3021 ------- > sys/dev/if_wg/support.h | 56 + > sys/dev/if_wg/{module => }/wg_cookie.c | 105 +- > sys/dev/if_wg/{include/sys => }/wg_cookie.h | 81 +- > sys/dev/if_wg/{module => }/wg_noise.c | 409 +- > sys/dev/if_wg/wg_noise.h | 191 + > sys/kern/kern_jail.c | 1 + > sys/kern/uipc_socket.c | 11 + > sys/kern/uipc_syscalls.c | 4 +- > sys/modules/if_wg/Makefile | 30 +- > sys/net/if_types.h | 1 + > sys/netinet6/nd6.c | 4 +- > sys/sys/priv.h | 1 + > sys/sys/socketvar.h | 1 + > tests/sys/netinet/Makefile | 10 +- > tests/sys/netinet/if_wg_test.sh | 188 + > 70 files changed, 6333 insertions(+), 43677 deletions(-) > > diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist > index e7784cbb0a47..0f85798815d5 100644 > --- a/etc/mtree/BSD.include.dist > +++ b/etc/mtree/BSD.include.dist > @@ -64,6 +64,8 @@ > .. > iicbus > .. > + if_wg > + .. > io > .. > mfi > diff --git a/include/Makefile b/include/Makefile > index 3a34ddb8aa18..31e207f6b199 100644 > --- a/include/Makefile > +++ b/include/Makefile > @@ -44,7 +44,7 @@ LDIRS= bsm cam geom net net80211 netgraph netinet netinet6 \ > LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ > dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ > dev/hwpmc dev/hyperv \ > - dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \ > + dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ > dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ > dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ > fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ > @@ -170,6 +170,10 @@ NVPAIRDIR= ${INCLUDEDIR}/sys > MLX5= mlx5io.h > MLX5DIR= ${INCLUDEDIR}/dev/mlx5 > > +.PATH: ${SRCTOP}/sys/dev/if_wg > +WG= if_wg.h > +WGDIR= ${INCLUDEDIR}/dev/if_wg > + > INCSGROUPS= INCS \ > ACPICA \ > AGP \ > @@ -182,7 +186,8 @@ INCSGROUPS= INCS \ > PCI \ > RPC \ > TEKEN \ > - VERIEXEC > + VERIEXEC \ > + WG > > .if ${MK_IPFILTER} != "no" > INCSGROUPS+= IPFILTER > diff --git a/sbin/ifconfig/ifwg.c b/sbin/ifconfig/ifwg.c > index 86bacc59f50d..a102f392cf80 100644 > --- a/sbin/ifconfig/ifwg.c > +++ b/sbin/ifconfig/ifwg.c > @@ -46,6 +46,8 @@ __FBSDID("$FreeBSD$"); > #include > #include > > +#include > + > #include > #include > #include > @@ -65,40 +67,60 @@ __FBSDID("$FreeBSD$"); > > #include "ifconfig.h" > > -typedef enum { > - WGC_GET = 0x5, > - WGC_SET = 0x6, > -} wg_cmd_t; > +static void wgfinish(int s, void *arg); > + > +static bool wgfinish_registered; > > -static nvlist_t *nvl_params; > -static bool do_peer; > static int allowed_ips_count; > static int allowed_ips_max; > -struct allowedip { > - struct sockaddr_storage a_addr; > - struct sockaddr_storage a_mask; > -}; > -struct allowedip *allowed_ips; > +static nvlist_t **allowed_ips, *nvl_peer; > > #define ALLOWEDIPS_START 16 > -#define WG_KEY_LEN 32 > -#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1) > -#define WG_KEY_LEN_HEX (WG_KEY_LEN * 2 + 1) > +#define WG_KEY_SIZE_BASE64 ((((WG_KEY_SIZE) + 2) / 3) * 4 + 1) > +#define WG_KEY_SIZE_HEX (WG_KEY_SIZE * 2 + 1) > #define WG_MAX_STRLEN 64 > > +struct allowedip { > + union { > + struct in_addr ip4; > + struct in6_addr ip6; > + }; > +}; > + > +static void > +register_wgfinish(void) > +{ > + > + if (wgfinish_registered) > + return; > + callback_register(wgfinish, NULL); > + wgfinish_registered = true; > +} > + > +static nvlist_t * > +nvl_device(void) > +{ > + static nvlist_t *_nvl_device; > + > + if (_nvl_device == NULL) > + _nvl_device = nvlist_create(0); > + register_wgfinish(); > + return (_nvl_device); > +} > + > static bool > -key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64) > +key_from_base64(uint8_t key[static WG_KEY_SIZE], const char *base64) > { > > - if (strlen(base64) != WG_KEY_LEN_BASE64 - 1) { > - warnx("bad key len - need %d got %zu\n", WG_KEY_LEN_BASE64 - 1, strlen(base64)); > + if (strlen(base64) != WG_KEY_SIZE_BASE64 - 1) { > + warnx("bad key len - need %d got %zu\n", WG_KEY_SIZE_BASE64 - 1, strlen(base64)); > return false; > } > - if (base64[WG_KEY_LEN_BASE64 - 2] != '=') { > - warnx("bad key terminator, expected '=' got '%c'", base64[WG_KEY_LEN_BASE64 - 2]); > + if (base64[WG_KEY_SIZE_BASE64 - 2] != '=') { > + warnx("bad key terminator, expected '=' got '%c'", base64[WG_KEY_SIZE_BASE64 - 2]); > return false; > } > - return (b64_pton(base64, key, WG_KEY_LEN)); > + return (b64_pton(base64, key, WG_KEY_SIZE)); > } > > static void > @@ -128,7 +150,7 @@ parse_endpoint(const char *endpoint_) > err = getaddrinfo(endpoint, port, &hints, &res); > if (err) > errx(1, "%s", gai_strerror(err)); > - nvlist_add_binary(nvl_params, "endpoint", res->ai_addr, res->ai_addrlen); > + nvlist_add_binary(nvl_peer, "endpoint", res->ai_addr, res->ai_addrlen); > freeaddrinfo(res); > free(base); > } > @@ -227,12 +249,14 @@ in6_mask2len(struct in6_addr *mask, u_char *lim0) > } > > static bool > -parse_ip(struct allowedip *aip, const char *value) > +parse_ip(struct allowedip *aip, uint16_t *family, const char *value) > { > struct addrinfo hints, *res; > int err; > + bool ret; > > - bzero(&aip->a_addr, sizeof(aip->a_addr)); > + ret = true; > + bzero(aip, sizeof(*aip)); > bzero(&hints, sizeof(hints)); > hints.ai_family = AF_UNSPEC; > hints.ai_flags = AI_NUMERICHOST; > @@ -240,10 +264,21 @@ parse_ip(struct allowedip *aip, const char *value) > if (err) > errx(1, "%s", gai_strerror(err)); > > - memcpy(&aip->a_addr, res->ai_addr, res->ai_addrlen); > + *family = res->ai_family; > + if (res->ai_family == AF_INET) { > + struct sockaddr_in *sin = (struct sockaddr_in *)res->ai_addr; > + > + aip->ip4 = sin->sin_addr; > + } else if (res->ai_family == AF_INET6) { > + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)res->ai_addr; > + > + aip->ip6 = sin6->sin6_addr; > + } else { > + ret = false; > + } > > freeaddrinfo(res); > - return (true); > + return (ret); > } > > static void > @@ -271,61 +306,84 @@ sa_ntop(const struct sockaddr *sa, char *buf, int *port) > } > > static void > -dump_peer(const nvlist_t *nvl_peer) > +dump_peer(const nvlist_t *nvl_peer_cfg) > { > const void *key; > - const struct allowedip *aips; > const struct sockaddr *endpoint; > char outbuf[WG_MAX_STRLEN]; > char addr_buf[INET6_ADDRSTRLEN]; > - size_t size; > - int count, port; > + size_t aip_count, size; > + int port; > uint16_t persistent_keepalive; > + const nvlist_t * const *nvl_aips; > > printf("[Peer]\n"); > - if (nvlist_exists_binary(nvl_peer, "public-key")) { > - key = nvlist_get_binary(nvl_peer, "public-key", &size); > + if (nvlist_exists_binary(nvl_peer_cfg, "public-key")) { > + key = nvlist_get_binary(nvl_peer_cfg, "public-key", &size); > b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); > printf("PublicKey = %s\n", outbuf); > } > - if (nvlist_exists_binary(nvl_peer, "endpoint")) { > - endpoint = nvlist_get_binary(nvl_peer, "endpoint", &size); > + if (nvlist_exists_binary(nvl_peer_cfg, "preshared-key")) { > + key = nvlist_get_binary(nvl_peer_cfg, "preshared-key", &size); > + b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); > + printf("PresharedKey = %s\n", outbuf); > + } > + if (nvlist_exists_binary(nvl_peer_cfg, "endpoint")) { > + endpoint = nvlist_get_binary(nvl_peer_cfg, "endpoint", &size); > sa_ntop(endpoint, addr_buf, &port); > printf("Endpoint = %s:%d\n", addr_buf, ntohs(port)); > } > - if (nvlist_exists_number(nvl_peer, "persistent-keepalive-interval")) { > - persistent_keepalive = nvlist_get_number(nvl_peer, > + if (nvlist_exists_number(nvl_peer_cfg, > + "persistent-keepalive-interval")) { > + persistent_keepalive = nvlist_get_number(nvl_peer_cfg, > "persistent-keepalive-interval"); > printf("PersistentKeepalive = %d\n", persistent_keepalive); > } > - if (!nvlist_exists_binary(nvl_peer, "allowed-ips")) > + if (!nvlist_exists_nvlist_array(nvl_peer_cfg, "allowed-ips")) > return; > - aips = nvlist_get_binary(nvl_peer, "allowed-ips", &size); > - if (size == 0 || size % sizeof(struct allowedip) != 0) { > - errx(1, "size %zu not integer multiple of allowedip", size); > - } > + > + nvl_aips = nvlist_get_nvlist_array(nvl_peer_cfg, "allowed-ips", &aip_count); > + if (nvl_aips == NULL || aip_count == 0) > + return; > + > printf("AllowedIPs = "); > - count = size / sizeof(struct allowedip); > - for (int i = 0; i < count; i++) { > - int mask; > + for (size_t i = 0; i < aip_count; i++) { > + uint8_t cidr; > + struct sockaddr_storage ss; > sa_family_t family; > - void *bitmask; > - struct sockaddr *sa; > - > - sa = __DECONST(void *, &aips[i].a_addr); > - bitmask = __DECONST(void *, > - ((const struct sockaddr *)&(&aips[i])->a_mask)->sa_data); > - family = aips[i].a_addr.ss_family; > - getnameinfo(sa, sa->sa_len, addr_buf, INET6_ADDRSTRLEN, NULL, > - 0, NI_NUMERICHOST); > - if (family == AF_INET) > - mask = in_mask2len(bitmask); > - else if (family == AF_INET6) > - mask = in6_mask2len(bitmask, NULL); > - else > - errx(1, "bad family in peer %d\n", family); > - printf("%s/%d", addr_buf, mask); > - if (i < count -1) > + > + if (!nvlist_exists_number(nvl_aips[i], "cidr")) > + continue; > + cidr = nvlist_get_number(nvl_aips[i], "cidr"); > + if (nvlist_exists_binary(nvl_aips[i], "ipv4")) { > + struct sockaddr_in *sin = (struct sockaddr_in *)&ss; > + const struct in_addr *ip4; > + > + ip4 = nvlist_get_binary(nvl_aips[i], "ipv4", &size); > + if (ip4 == NULL || cidr > 32) > + continue; > + sin->sin_len = sizeof(*sin); > + sin->sin_family = AF_INET; > + sin->sin_addr = *ip4; > + } else if (nvlist_exists_binary(nvl_aips[i], "ipv6")) { > + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&ss; > + const struct in6_addr *ip6; > + > + ip6 = nvlist_get_binary(nvl_aips[i], "ipv6", &size); > + if (ip6 == NULL || cidr > 128) > + continue; > + sin6->sin6_len = sizeof(*sin6); > + sin6->sin6_family = AF_INET6; > + sin6->sin6_addr = *ip6; > + } else { > + continue; > + } > + > + family = ss.ss_family; > + getnameinfo((struct sockaddr *)&ss, ss.ss_len, addr_buf, > + INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST); > + printf("%s/%d", addr_buf, cidr); > + if (i < aip_count - 1) > printf(", "); > } > printf("\n"); > @@ -334,36 +392,34 @@ dump_peer(const nvlist_t *nvl_peer) > static int > get_nvl_out_size(int sock, u_long op, size_t *size) > { > - struct ifdrv ifd; > + struct wg_data_io wgd; > int err; > > - memset(&ifd, 0, sizeof(ifd)); > + memset(&wgd, 0, sizeof(wgd)); > > - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); > - ifd.ifd_cmd = op; > - ifd.ifd_len = 0; > - ifd.ifd_data = NULL; > + strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); > + wgd.wgd_size = 0; > + wgd.wgd_data = NULL; > > - err = ioctl(sock, SIOCGDRVSPEC, &ifd); > + err = ioctl(sock, op, &wgd); > if (err) > return (err); > - *size = ifd.ifd_len; > + *size = wgd.wgd_size; > return (0); > } > > static int > do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) > { > - struct ifdrv ifd; > + struct wg_data_io wgd; > > - memset(&ifd, 0, sizeof(ifd)); > + memset(&wgd, 0, sizeof(wgd)); > > - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); > - ifd.ifd_cmd = op; > - ifd.ifd_len = argsize; > - ifd.ifd_data = arg; > + strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); > + wgd.wgd_size = argsize; > + wgd.wgd_data = arg; > > - return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); > + return (ioctl(sock, op, &wgd)); > } > > static > @@ -371,62 +427,83 @@ DECL_CMD_FUNC(peerlist, val, d) > { > size_t size, peercount; > void *packed; > - const nvlist_t *nvl, *nvl_peer; > + const nvlist_t *nvl; > const nvlist_t *const *nvl_peerlist; > > - if (get_nvl_out_size(s, WGC_GET, &size)) > + if (get_nvl_out_size(s, SIOCGWG, &size)) > errx(1, "can't get peer list size"); > if ((packed = malloc(size)) == NULL) > errx(1, "malloc failed for peer list"); > - if (do_cmd(s, WGC_GET, packed, size, 0)) > + if (do_cmd(s, SIOCGWG, packed, size, 0)) > errx(1, "failed to obtain peer list"); > > nvl = nvlist_unpack(packed, size, 0); > - if (!nvlist_exists_nvlist_array(nvl, "peer-list")) > + if (!nvlist_exists_nvlist_array(nvl, "peers")) > return; > - nvl_peerlist = nvlist_get_nvlist_array(nvl, "peer-list", &peercount); > + nvl_peerlist = nvlist_get_nvlist_array(nvl, "peers", &peercount); > > for (int i = 0; i < peercount; i++, nvl_peerlist++) { > - nvl_peer = *nvl_peerlist; > - dump_peer(nvl_peer); > + dump_peer(*nvl_peerlist); > } > } > > static void > -peerfinish(int s, void *arg) > +wgfinish(int s, void *arg) > { > - nvlist_t *nvl, **nvl_array; > void *packed; > size_t size; > + static nvlist_t *nvl_dev; > + > + nvl_dev = nvl_device(); > + if (nvl_peer != NULL) { > + if (!nvlist_exists_binary(nvl_peer, "public-key")) > + errx(1, "must specify a public-key for adding peer"); > + if (allowed_ips_count != 0) { > + nvlist_add_nvlist_array(nvl_peer, "allowed-ips", > + (const nvlist_t * const *)allowed_ips, > + allowed_ips_count); > + for (size_t i = 0; i < allowed_ips_count; i++) { > + nvlist_destroy(allowed_ips[i]); > + } > + > + free(allowed_ips); > + } > + > + nvlist_add_nvlist_array(nvl_dev, "peers", > + (const nvlist_t * const *)&nvl_peer, 1); > + } > + > + packed = nvlist_pack(nvl_dev, &size); > > - if ((nvl = nvlist_create(0)) == NULL) > - errx(1, "failed to allocate nvlist"); > - if ((nvl_array = calloc(sizeof(void *), 1)) == NULL) > - errx(1, "failed to allocate nvl_array"); > - if (!nvlist_exists_binary(nvl_params, "public-key")) > - errx(1, "must specify a public-key for adding peer"); > - if (allowed_ips_count == 0) > - errx(1, "must specify at least one range of allowed-ips to add a peer"); > - > - nvl_array[0] = nvl_params; > - nvlist_add_nvlist_array(nvl, "peer-list", (const nvlist_t * const *)nvl_array, 1); > - packed = nvlist_pack(nvl, &size); > - > - if (do_cmd(s, WGC_SET, packed, size, true)) > - errx(1, "failed to install peer"); > + if (do_cmd(s, SIOCSWG, packed, size, true)) > + errx(1, "failed to configure"); > } > > static > DECL_CMD_FUNC(peerstart, val, d) > { > - do_peer = true; > - callback_register(peerfinish, NULL); > - allowed_ips = malloc(ALLOWEDIPS_START * sizeof(struct allowedip)); > + > + if (nvl_peer != NULL) > + errx(1, "cannot both add and remove a peer"); > + register_wgfinish(); > + nvl_peer = nvlist_create(0); > + allowed_ips = calloc(ALLOWEDIPS_START, sizeof(*allowed_ips)); > allowed_ips_max = ALLOWEDIPS_START; > if (allowed_ips == NULL) > errx(1, "failed to allocate array for allowedips"); > } > > +static > +DECL_CMD_FUNC(peerdel, val, d) > +{ > + > + if (nvl_peer != NULL) > + errx(1, "cannot both add and remove a peer"); > + register_wgfinish(); > + nvl_peer = nvlist_create(0); > + nvlist_add_bool(nvl_peer, "remove", true); > +} > + > static > DECL_CMD_FUNC(setwglistenport, val, d) > { > @@ -454,39 +531,53 @@ DECL_CMD_FUNC(setwglistenport, val, d) > errx(1, "unknown family"); > } > ul = ntohs((u_short)ul); > - nvlist_add_number(nvl_params, "listen-port", ul); > + nvlist_add_number(nvl_device(), "listen-port", ul); > } > > static > DECL_CMD_FUNC(setwgprivkey, val, d) > { > - uint8_t key[WG_KEY_LEN]; > + uint8_t key[WG_KEY_SIZE]; > > if (!key_from_base64(key, val)) > errx(1, "invalid key %s", val); > - nvlist_add_binary(nvl_params, "private-key", key, WG_KEY_LEN); > + nvlist_add_binary(nvl_device(), "private-key", key, WG_KEY_SIZE); > } > > static > DECL_CMD_FUNC(setwgpubkey, val, d) > { > - uint8_t key[WG_KEY_LEN]; > + uint8_t key[WG_KEY_SIZE]; > > - if (!do_peer) > + if (nvl_peer == NULL) > errx(1, "setting public key only valid when adding peer"); > > if (!key_from_base64(key, val)) > errx(1, "invalid key %s", val); > - nvlist_add_binary(nvl_params, "public-key", key, WG_KEY_LEN); > + nvlist_add_binary(nvl_peer, "public-key", key, WG_KEY_SIZE); > } > > +static > +DECL_CMD_FUNC(setwgpresharedkey, val, d) > +{ > + uint8_t key[WG_KEY_SIZE]; > + > + if (nvl_peer == NULL) > + errx(1, "setting preshared-key only valid when adding peer"); > + > + if (!key_from_base64(key, val)) > + errx(1, "invalid key %s", val); > + nvlist_add_binary(nvl_peer, "preshared-key", key, WG_KEY_SIZE); > +} > + > + > static > DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) > { > unsigned long persistent_keepalive; > char *endp; > > - if (!do_peer) > + if (nvl_peer == NULL) > errx(1, "setting persistent keepalive only valid when adding peer"); > > errno = 0; > @@ -496,7 +587,7 @@ DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) > if (persistent_keepalive > USHRT_MAX) > errx(1, "persistent-keepalive '%lu' too large", > persistent_keepalive); > - nvlist_add_number(nvl_params, "persistent-keepalive-interval", > + nvlist_add_number(nvl_peer, "persistent-keepalive-interval", > persistent_keepalive); > } > > @@ -506,45 +597,57 @@ DECL_CMD_FUNC(setallowedips, val, d) > char *base, *allowedip, *mask; > u_long ul; > char *endp; > - struct allowedip *aip; > + struct allowedip aip; > + nvlist_t *nvl_aip; > + uint16_t family; > > - if (!do_peer) > + if (nvl_peer == NULL) > errx(1, "setting allowed ip only valid when adding peer"); > if (allowed_ips_count == allowed_ips_max) { > - /* XXX grow array */ > + allowed_ips_max *= 2; > + allowed_ips = reallocarray(allowed_ips, allowed_ips_max, > + sizeof(*allowed_ips)); > + if (allowed_ips == NULL) > + errx(1, "failed to grow allowed ip array"); > } > - aip = &allowed_ips[allowed_ips_count]; > + > + allowed_ips[allowed_ips_count] = nvl_aip = nvlist_create(0); > + if (nvl_aip == NULL) > + errx(1, "failed to create new allowedip nvlist"); > + > base = allowedip = strdup(val); > mask = index(allowedip, '/'); > if (mask == NULL) > errx(1, "mask separator not found in allowedip %s", val); > *mask = '\0'; > mask++; > - parse_ip(aip, allowedip); > + > + parse_ip(&aip, &family, allowedip); > ul = strtoul(mask, &endp, 0); > if (*endp != '\0') > errx(1, "invalid value for allowedip mask"); > - bzero(&aip->a_mask, sizeof(aip->a_mask)); > - if (aip->a_addr.ss_family == AF_INET) > - in_len2mask((struct in_addr *)&((struct sockaddr *)&aip->a_mask)->sa_data, ul); > - else if (aip->a_addr.ss_family == AF_INET6) > - in6_prefixlen2mask((struct in6_addr *)&((struct sockaddr *)&aip->a_mask)->sa_data, ul); > - else > - errx(1, "invalid address family %d\n", aip->a_addr.ss_family); > + > + nvlist_add_number(nvl_aip, "cidr", ul); > + if (family == AF_INET) { > + nvlist_add_binary(nvl_aip, "ipv4", &aip.ip4, sizeof(aip.ip4)); > + } else if (family == AF_INET6) { > + nvlist_add_binary(nvl_aip, "ipv6", &aip.ip6, sizeof(aip.ip6)); > + } else { > + /* Shouldn't happen */ > + nvlist_destroy(nvl_aip); > + goto out; > + } > + > allowed_ips_count++; > - if (allowed_ips_count > 1) > - nvlist_free_binary(nvl_params, "allowed-ips"); > - nvlist_add_binary(nvl_params, "allowed-ips", allowed_ips, > - allowed_ips_count*sizeof(*aip)); > > - dump_peer(nvl_params); > +out: > free(base); > } > > static > DECL_CMD_FUNC(setendpoint, val, d) > { > - if (!do_peer) > + if (nvl_peer == NULL) > errx(1, "setting endpoint only valid when adding peer"); > parse_endpoint(val); > } > @@ -555,15 +658,15 @@ wireguard_status(int s) > size_t size; > void *packed; > nvlist_t *nvl; > - char buf[WG_KEY_LEN_BASE64]; > + char buf[WG_KEY_SIZE_BASE64]; > const void *key; > uint16_t listen_port; > > - if (get_nvl_out_size(s, WGC_GET, &size)) > + if (get_nvl_out_size(s, SIOCGWG, &size)) > return; > if ((packed = malloc(size)) == NULL) > return; > - if (do_cmd(s, WGC_GET, packed, size, 0)) > + if (do_cmd(s, SIOCGWG, packed, size, 0)) > return; > nvl = nvlist_unpack(packed, size, 0); > if (nvlist_exists_number(nvl, "listen-port")) { > @@ -583,10 +686,14 @@ wireguard_status(int s) > } > > static struct cmd wireguard_cmds[] = { > - DEF_CLONE_CMD_ARG("listen-port", setwglistenport), > - DEF_CLONE_CMD_ARG("private-key", setwgprivkey), > + DEF_CMD_ARG("listen-port", setwglistenport), > + DEF_CMD_ARG("private-key", setwgprivkey), > + /* XXX peer-list is deprecated. */ > DEF_CMD("peer-list", 0, peerlist), > + DEF_CMD("peers", 0, peerlist), > DEF_CMD("peer", 0, peerstart), > + DEF_CMD("-peer", 0, peerdel), > + DEF_CMD_ARG("preshared-key", setwgpresharedkey), > DEF_CMD_ARG("public-key", setwgpubkey), > DEF_CMD_ARG("persistent-keepalive", setwgpersistentkeepalive), > DEF_CMD_ARG("allowed-ips", setallowedips), > @@ -602,27 +709,10 @@ static struct afswtch af_wireguard = { > static void > wg_create(int s, struct ifreq *ifr) > { > - struct iovec iov; > - void *packed; > - size_t size; > > setproctitle("ifconfig %s create ...\n", name); > - if (!nvlist_exists_number(nvl_params, "listen-port")) > - goto legacy; > - if (!nvlist_exists_binary(nvl_params, "private-key")) > - goto legacy; > - > - packed = nvlist_pack(nvl_params, &size); > - if (packed == NULL) > - errx(1, "failed to setup create request"); > - iov.iov_len = size; > - iov.iov_base = packed; > - ifr->ifr_data = (caddr_t)&iov; > - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) > - err(1, "SIOCIFCREATE2"); > - return; > -legacy: > - ifr->ifr_data == NULL; > + > + ifr->ifr_data = NULL; > if (ioctl(s, SIOCIFCREATE, ifr) < 0) > err(1, "SIOCIFCREATE"); > } > @@ -632,7 +722,6 @@ wireguard_ctor(void) > { > int i; > > - nvl_params = nvlist_create(0); > for (i = 0; i < nitems(wireguard_cmds); i++) > cmd_register(&wireguard_cmds[i]); > af_register(&af_wireguard); > diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 > index 335d3e70b64a..29215bd438ff 100644 > --- a/share/man/man4/wg.4 > +++ b/share/man/man4/wg.4 > @@ -23,7 +23,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd March 9, 2021 > +.Dd March 12, 2021 > .Dt WG 4 > .Os > .Sh NAME > @@ -68,7 +68,7 @@ interface. > The private key of the > .Nm > interface. > -.It Cm pre-shared-key > +.It Cm preshared-key > Defines a pre-shared key for the > .Nm > interface. > @@ -76,9 +76,9 @@ interface. > A list of allowed IP addresses. > .It Cm endpoint > The IP address of the WiredGuard to connect to. > -.It Cm peer-list > +.It Cm peers > A list of peering IP addresses to connect to. > -.It Cm persistent-keepalive > +.It Cm persistent-keepalive-interval > Interval, in seconds, at which to send persistent keepalive packets. > .El > .Pp > @@ -188,6 +188,11 @@ Connect to a specific endpoint using its public-key and set the allowed IP addre > .Bd -literal -offset indent > # ifconfig wg0 peer public-key '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=' endpoint 10.0.1.100:54321 allowed-ips 192.168.2.100/32 > .Ed > +.Pp > +Remove a peer > +.Bd -literal -offset indent > +# ifconfig wg0 -peer public-key '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=' > +.Ed > .Sh DIAGNOSTICS > The > .Nm > @@ -240,14 +245,11 @@ device driver first appeared in > .Sh AUTHORS > The > .Nm > -device driver was originally written for > -.Ox > -by > -.An Matt Dunwoodie Aq Mt ncon@nconroy.net > -and ported to > -.Fx > -by > -.An Matt Macy Aq Mt mmacy@FreeBSD.org . > +device driver written by > +.An Jason A. Donenfeld Aq Mt Jason@zx2c4.com , > +.An Matt Dunwoodie Aq Mt ncon@nconroy.net , > +and > +.An Kyle Evans Aq Mt kevans@FreeBSD.org . > .Pp > This manual page was written by > .An Gordon Bergling Aq Mt gbe@FreeBSD.org > diff --git a/sys/dev/if_wg/crypto.c b/sys/dev/if_wg/crypto.c > new file mode 100644 > index 000000000000..f28585429272 > --- /dev/null > +++ b/sys/dev/if_wg/crypto.c > @@ -0,0 +1,1705 @@ > +/* > + * Copyright (C) 2015-2021 Jason A. Donenfeld . All Rights Reserved. > + * > + * Permission to use, copy, modify, and distribute this software for any > + * purpose with or without fee is hereby granted, provided that the above > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + */ > + > +#include > +#include > +#include > + > +#include "crypto.h" > + > +#ifndef ARRAY_SIZE > +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) > +#endif > +#ifndef noinline > +#define noinline __attribute__((noinline)) > +#endif > +#ifndef __aligned > +#define __aligned(x) __attribute__((aligned(x))) > +#endif > +#ifndef DIV_ROUND_UP > +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) > +#endif > + > +#define le32_to_cpup(a) le32toh(*(a)) > +#define le64_to_cpup(a) le64toh(*(a)) > +#define cpu_to_le32(a) htole32(a) > +#define cpu_to_le64(a) htole64(a) > + > +static inline uint32_t get_unaligned_le32(const uint8_t *a) > +{ > + uint32_t l; > + __builtin_memcpy(&l, a, sizeof(l)); > + return le32_to_cpup(&l); > +} > +static inline uint64_t get_unaligned_le64(const uint8_t *a) > +{ > + uint64_t l; > + __builtin_memcpy(&l, a, sizeof(l)); > + return le64_to_cpup(&l); > +} > +static inline void put_unaligned_le32(uint32_t s, uint8_t *d) > +{ > + uint32_t l = cpu_to_le32(s); > + __builtin_memcpy(d, &l, sizeof(l)); > +} > +static inline void cpu_to_le32_array(uint32_t *buf, unsigned int words) > +{ > + while (words--) { > + *buf = cpu_to_le32(*buf); > + ++buf; > + } > +} > +static inline void le32_to_cpu_array(uint32_t *buf, unsigned int words) > +{ > + while (words--) { > + *buf = le32_to_cpup(buf); > + ++buf; > + } > +} > + > +static inline uint32_t rol32(uint32_t word, unsigned int shift) > +{ > + return (word << (shift & 31)) | (word >> ((-shift) & 31)); > +} > +static inline uint32_t ror32(uint32_t word, unsigned int shift) > +{ > + return (word >> (shift & 31)) | (word << ((-shift) & 31)); > +} > + > +static void xor_cpy(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, > + size_t len) > +{ > + size_t i; > + > + for (i = 0; i < len; ++i) > + dst[i] = src1[i] ^ src2[i]; > +} > + > +#define QUARTER_ROUND(x, a, b, c, d) ( \ > + x[a] += x[b], \ > *** 50620 LINES SKIPPED *** > _______________________________________________ > dev-commits-src-main@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main > To unsubscribe, send any mail to "dev-commits-src-main-unsubscribe@freebsd.org" From owner-dev-commits-src-all@freebsd.org Mon Mar 15 17:52:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E133C5AA92E; Mon, 15 Mar 2021 17:52: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 4DzkXB65nLz3hWR; Mon, 15 Mar 2021 17:52: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 C4DC61500A; Mon, 15 Mar 2021 17:52: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 12FHqQnb082038; Mon, 15 Mar 2021 17:52:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FHqQ6H082037; Mon, 15 Mar 2021 17:52:26 GMT (envelope-from git) Date: Mon, 15 Mar 2021 17:52:26 GMT Message-Id: <202103151752.12FHqQ6H082037@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: 8ea35c45d520 - main - Include ccompile.h after opt_global.h. 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: 8ea35c45d5206ad57945ba160484f04450c88b75 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 17:52:26 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=8ea35c45d5206ad57945ba160484f04450c88b75 commit 8ea35c45d5206ad57945ba160484f04450c88b75 Author: Alexander Motin AuthorDate: 2021-03-15 17:48:50 +0000 Commit: Alexander Motin CommitDate: 2021-03-15 17:52:23 +0000 Include ccompile.h after opt_global.h. This restores INVARIANTS enabling ZFS_DEBUG when built as module. Discussed with: freqlabs MFC after: 1 week --- sys/modules/zfs/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/modules/zfs/Makefile b/sys/modules/zfs/Makefile index 0fab9f552314..983f0aa0e994 100644 --- a/sys/modules/zfs/Makefile +++ b/sys/modules/zfs/Makefile @@ -22,8 +22,6 @@ CFLAGS+= -I${INCDIR}/os/freebsd CFLAGS+= -I${INCDIR}/os/freebsd/spl CFLAGS+= -I${INCDIR}/os/freebsd/zfs CFLAGS+= -I${SRCDIR}/zstd/include -CFLAGS+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h -CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/static_ccompile.h CFLAGS+= -I${.CURDIR} CFLAGS+= -D__KERNEL__ -DFREEBSD_NAMECACHE -DBUILDING_ZFS \ @@ -284,6 +282,8 @@ SRCS+= zfs_zstd.c \ .include CFLAGS+= -include ${SRCTOP}/sys/cddl/compat/opensolaris/sys/debug_compat.h +CFLAGS+= -include ${INCDIR}/os/freebsd/spl/sys/ccompile.h +CFLAGS+= -include ${SRCTOP}/sys/modules/zfs/static_ccompile.h CWARNFLAGS+= ${OPENZFS_CWARNFLAGS} From owner-dev-commits-src-all@freebsd.org Mon Mar 15 20:33:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6E4D5AE8F3; Mon, 15 Mar 2021 20:33: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 4Dzp5z4pSfz3tmT; Mon, 15 Mar 2021 20:33: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 97A1016BEA; Mon, 15 Mar 2021 20:33: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 12FKXRS4093245; Mon, 15 Mar 2021 20:33:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FKXRjV093243; Mon, 15 Mar 2021 20:33:27 GMT (envelope-from git) Date: Mon, 15 Mar 2021 20:33:27 GMT Message-Id: <202103152033.12FKXRjV093243@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: f365c5b0e917 - stable/13 - nfsclient: add checks for a server returning the current directory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f365c5b0e917d300d9b4e85443e16b430e57cc51 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 20:33:27 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=f365c5b0e917d300d9b4e85443e16b430e57cc51 commit f365c5b0e917d300d9b4e85443e16b430e57cc51 Author: Rick Macklem AuthorDate: 2021-02-28 22:15:32 +0000 Commit: Rick Macklem CommitDate: 2021-03-15 19:31:13 +0000 nfsclient: add checks for a server returning the current directory Commit 3fe2c68ba20f dealt with a panic in cache_enter_time() where the vnode referred to the directory argument. It would also be possible to get these panics if a broken NFS server were to return the directory as an new object being created within the directory or in a Lookup reply. This patch adds checks to avoid the panics and logs messages to indicate that the server is broken for the file object creation cases. (cherry picked from commit 3e04ab36ba5ce5cbbf6d22f17a01a391a04e465f) --- sys/fs/nfsclient/nfs_clvnops.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 80317cfd7a50..fc5445ef1e76 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -1423,7 +1423,7 @@ nfs_lookup(struct vop_lookup_args *ap) } if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) cnp->cn_flags |= SAVENAME; - if ((cnp->cn_flags & MAKEENTRY) && + if ((cnp->cn_flags & MAKEENTRY) && dvp != newvp && (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN)) && attrflag != 0 && (newvp->v_type != VDIR || dattrflag != 0)) cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, @@ -1752,9 +1752,14 @@ again: } } if (!error) { - if ((cnp->cn_flags & MAKEENTRY) && attrflag) - cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, - NULL); + if ((cnp->cn_flags & MAKEENTRY) && attrflag) { + if (dvp != newvp) + cache_enter_time(dvp, newvp, cnp, + &nfsva.na_ctime, NULL); + else + printf("nfs_create: bogus NFS server returned " + "the directory as the new file object\n"); + } *ap->a_vpp = newvp; } else if (NFS_ISV4(dvp)) { error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, @@ -2126,7 +2131,11 @@ nfs_link(struct vop_link_args *ap) */ if (VFSTONFS(vp->v_mount)->nm_negnametimeo != 0 && (cnp->cn_flags & MAKEENTRY) && attrflag != 0 && error == 0) { - cache_enter_time(tdvp, vp, cnp, &nfsva.na_ctime, NULL); + if (tdvp != vp) + cache_enter_time(tdvp, vp, cnp, &nfsva.na_ctime, NULL); + else + printf("nfs_link: bogus NFS server returned " + "the directory as the new link\n"); } if (error && NFS_ISV4(vp)) error = nfscl_maperr(cnp->cn_thread, error, (uid_t)0, @@ -2205,7 +2214,12 @@ nfs_symlink(struct vop_symlink_args *ap) */ if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && (cnp->cn_flags & MAKEENTRY) && attrflag != 0 && error == 0) { - cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, NULL); + if (dvp != newvp) + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, + NULL); + else + printf("nfs_symlink: bogus NFS server returned " + "the directory as the new file object\n"); } return (error); } @@ -2278,9 +2292,15 @@ nfs_mkdir(struct vop_mkdir_args *ap) */ if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && (cnp->cn_flags & MAKEENTRY) && - attrflag != 0 && dattrflag != 0) - cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, - &dnfsva.na_ctime); + attrflag != 0 && dattrflag != 0) { + if (dvp != newvp) + cache_enter_time(dvp, newvp, cnp, + &nfsva.na_ctime, &dnfsva.na_ctime); + else + printf("nfs_mkdir: bogus NFS server returned " + "the directory that the directory was " + "created in as the new file object\n"); + } *ap->a_vpp = newvp; } return (error); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 20:36:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E53A5AEB4D; Mon, 15 Mar 2021 20:36: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 4Dzp9N72HDz3vNK; Mon, 15 Mar 2021 20:36: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 E442B16DE1; Mon, 15 Mar 2021 20:36: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 12FKaOkf093777; Mon, 15 Mar 2021 20:36:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FKaOW9093776; Mon, 15 Mar 2021 20:36:24 GMT (envelope-from git) Date: Mon, 15 Mar 2021 20:36:24 GMT Message-Id: <202103152036.12FKaOW9093776@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 3481445f20e2 - stable/13 - nfsclient: add nfs node locking around uses of n_direofoffset MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3481445f20e2e5b5013fb9b61706032d0e9f3816 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 20:36:25 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=3481445f20e2e5b5013fb9b61706032d0e9f3816 commit 3481445f20e2e5b5013fb9b61706032d0e9f3816 Author: Rick Macklem AuthorDate: 2021-02-28 22:53:54 +0000 Commit: Rick Macklem CommitDate: 2021-03-15 19:34:13 +0000 nfsclient: add nfs node locking around uses of n_direofoffset During code inspection I noticed that the n_direofoffset field of the NFS node was being manipulated without any lock being held to make it SMP safe. This patch adds locking of the NFS node's mutex around handling of n_direofoffset to make it SMP safe. I have not seen any failure that could be attributed to n_direofoffset being manipulated concurrently by multiple processors, but I think this is possible, since directories are read with shared vnode locking, plus locks only on individual buffer cache blocks. However, there have been as yet unexplained issues w.r.t reading large directories over NFS that could have conceivably been caused by concurrent manipulation of n_direofoffset. (cherry picked from commit 15bed8c46b32dec19e922cb89e12c8970867a303) --- sys/fs/nfsclient/nfs_clbio.c | 10 ++++++++++ sys/fs/nfsclient/nfs_clsubs.c | 3 ++- sys/fs/nfsclient/nfs_clvnops.c | 21 ++++++++++++++++----- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index 09fedaa47eb8..67bc3b7ce4d5 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -584,11 +584,14 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) break; case VDIR: NFSINCRGLOBAL(nfsstatsv1.biocache_readdirs); + NFSLOCKNODE(np); if (np->n_direofoffset && uio->uio_offset >= np->n_direofoffset) { + NFSUNLOCKNODE(np); error = 0; goto out; } + NFSUNLOCKNODE(np); lbn = (uoff_t)uio->uio_offset / NFS_DIRBLKSIZ; on = uio->uio_offset & (NFS_DIRBLKSIZ - 1); bp = nfs_getcacheblk(vp, lbn, NFS_DIRBLKSIZ, td); @@ -620,11 +623,14 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) * NFSERR_BAD_COOKIE (double yuch!). */ for (i = 0; i <= lbn && !error; i++) { + NFSLOCKNODE(np); if (np->n_direofoffset && (i * NFS_DIRBLKSIZ) >= np->n_direofoffset) { + NFSUNLOCKNODE(np); error = 0; goto out; } + NFSUNLOCKNODE(np); bp = nfs_getcacheblk(vp, i, NFS_DIRBLKSIZ, td); if (!bp) { error = newnfs_sigintr(nmp, td); @@ -667,11 +673,13 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) * (You need the current block first, so that you have the * directory offset cookie of the next block.) */ + NFSLOCKNODE(np); if (nmp->nm_readahead > 0 && (bp->b_flags & B_INVAL) == 0 && (np->n_direofoffset == 0 || (lbn + 1) * NFS_DIRBLKSIZ < np->n_direofoffset) && incore(&vp->v_bufobj, lbn + 1) == NULL) { + NFSUNLOCKNODE(np); rabp = nfs_getcacheblk(vp, lbn + 1, NFS_DIRBLKSIZ, td); if (rabp) { if ((rabp->b_flags & (B_CACHE|B_DELWRI)) == 0) { @@ -688,6 +696,7 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) brelse(rabp); } } + NFSLOCKNODE(np); } /* * Unlike VREG files, whos buffer size ( bp->b_bcount ) is @@ -704,6 +713,7 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) n = lmin(uio->uio_resid, NFS_DIRBLKSIZ - bp->b_resid - on); if (np->n_direofoffset && n > np->n_direofoffset - uio->uio_offset) n = np->n_direofoffset - uio->uio_offset; + NFSUNLOCKNODE(np); break; default: printf(" ncl_bioread: type %x unexpected\n", vp->v_type); diff --git a/sys/fs/nfsclient/nfs_clsubs.c b/sys/fs/nfsclient/nfs_clsubs.c index f26ad0452e07..d361c175aa8e 100644 --- a/sys/fs/nfsclient/nfs_clsubs.c +++ b/sys/fs/nfsclient/nfs_clsubs.c @@ -118,6 +118,7 @@ ncl_uninit(struct vfsconf *vfsp) #endif } +/* Returns with NFSLOCKNODE() held. */ void ncl_dircookie_lock(struct nfsnode *np) { @@ -125,7 +126,6 @@ ncl_dircookie_lock(struct nfsnode *np) while (np->n_flag & NDIRCOOKIELK) (void) msleep(&np->n_flag, &np->n_mtx, PZERO, "nfsdirlk", 0); np->n_flag |= NDIRCOOKIELK; - NFSUNLOCKNODE(np); } void @@ -330,6 +330,7 @@ ncl_invaldir(struct vnode *vp) KASSERT(vp->v_type == VDIR, ("nfs: invaldir not dir")); ncl_dircookie_lock(np); np->n_direofoffset = 0; + NFSUNLOCKNODE(np); np->n_cookieverf.nfsuquad[0] = 0; np->n_cookieverf.nfsuquad[1] = 0; if (LIST_FIRST(&np->n_cookies)) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index fc5445ef1e76..217290b080b3 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -2369,8 +2369,10 @@ nfs_readdir(struct vop_readdir_args *ap) /* * First, check for hit on the EOF offset cache */ + NFSLOCKNODE(np); if (np->n_direofoffset > 0 && uio->uio_offset >= np->n_direofoffset && (np->n_flag & NMODIFIED) == 0) { + NFSUNLOCKNODE(np); if (VOP_GETATTR(vp, &vattr, ap->a_cred) == 0) { NFSLOCKNODE(np); if ((NFS_ISV4(vp) && np->n_change == vattr.va_filerev) || @@ -2383,7 +2385,8 @@ nfs_readdir(struct vop_readdir_args *ap) } else NFSUNLOCKNODE(np); } - } + } else + NFSUNLOCKNODE(np); /* * NFS always guarantees that directory entries don't straddle @@ -2436,6 +2439,7 @@ ncl_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred, * If there is no cookie, assume directory was stale. */ ncl_dircookie_lock(dnp); + NFSUNLOCKNODE(dnp); cookiep = ncl_getcookie(dnp, uiop->uio_offset, 0); if (cookiep) { cookie = *cookiep; @@ -2458,12 +2462,15 @@ ncl_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred, * We are now either at the end of the directory or have filled * the block. */ - if (eof) + if (eof) { + NFSLOCKNODE(dnp); dnp->n_direofoffset = uiop->uio_offset; - else { + NFSUNLOCKNODE(dnp); + } else { if (uiop->uio_resid > 0) printf("EEK! readdirrpc resid > 0\n"); ncl_dircookie_lock(dnp); + NFSUNLOCKNODE(dnp); cookiep = ncl_getcookie(dnp, uiop->uio_offset, 1); *cookiep = cookie; ncl_dircookie_unlock(dnp); @@ -2496,6 +2503,7 @@ ncl_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred, * If there is no cookie, assume directory was stale. */ ncl_dircookie_lock(dnp); + NFSUNLOCKNODE(dnp); cookiep = ncl_getcookie(dnp, uiop->uio_offset, 0); if (cookiep) { cookie = *cookiep; @@ -2517,12 +2525,15 @@ ncl_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred, * We are now either at end of the directory or have filled the * the block. */ - if (eof) + if (eof) { + NFSLOCKNODE(dnp); dnp->n_direofoffset = uiop->uio_offset; - else { + NFSUNLOCKNODE(dnp); + } else { if (uiop->uio_resid > 0) printf("EEK! readdirplusrpc resid > 0\n"); ncl_dircookie_lock(dnp); + NFSUNLOCKNODE(dnp); cookiep = ncl_getcookie(dnp, uiop->uio_offset, 1); *cookiep = cookie; ncl_dircookie_unlock(dnp); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 20:38:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 665135AF090; Mon, 15 Mar 2021 20:38: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 4DzpCN2Vrjz3vPl; Mon, 15 Mar 2021 20:38:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4854B16B59; Mon, 15 Mar 2021 20:38:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FKc8Gu094141; Mon, 15 Mar 2021 20:38:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FKc8r1094140; Mon, 15 Mar 2021 20:38:08 GMT (envelope-from git) Date: Mon, 15 Mar 2021 20:38:08 GMT Message-Id: <202103152038.12FKc8r1094140@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 5d1da3a15b8d - stable/13 - nfsclient: Fix the stripe unit size for a File Layout pNFS layout MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5d1da3a15b8d62839194dbf02c24b794b43c1fc0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 20:38:08 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=5d1da3a15b8d62839194dbf02c24b794b43c1fc0 commit 5d1da3a15b8d62839194dbf02c24b794b43c1fc0 Author: Rick Macklem AuthorDate: 2021-03-01 20:49:32 +0000 Commit: Rick Macklem CommitDate: 2021-03-15 19:37:13 +0000 nfsclient: Fix the stripe unit size for a File Layout pNFS layout During a recent virtual NFSv4 testing event, a bug in the FreeBSD client was detected when doing a File Layout pNFS DS I/O operation. The size of the I/O operation was smaller than expected. The I/O size is specified as a stripe unit size in bits 6->31 of nflh_util in the layout. I had misinterpreted RFC5661 and had shifted the value right by 6 bits. The correct interpretation is to use the value as presented (it is always an exact multiple of 64), clearing bits 0->5. This patch fixes this. Without the patch, I/O through the DSs work, but the I/O size is 1/64th of what is optimal. (cherry picked from commit 94f2e42f5e0b78a7a4684d4a4eb62ea470a57eb1) --- sys/fs/nfsclient/nfs_clrpcops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index c95d4dc58e7a..0e503e34810b 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -6024,7 +6024,7 @@ nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, np = VTONFS(vp); rel_off = off - flp->nfsfl_patoff; - stripe_unit_size = (flp->nfsfl_util >> 6) & 0x3ffffff; + stripe_unit_size = flp->nfsfl_util & NFSFLAYUTIL_STRIPE_MASK; stripe_pos = (rel_off / stripe_unit_size + flp->nfsfl_stripe1) % dp->nfsdi_stripecnt; transfer = stripe_unit_size - (rel_off % stripe_unit_size); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 20:41:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B1B25AF1B9; Mon, 15 Mar 2021 20:41: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 4DzpH10HK4z3vqM; Mon, 15 Mar 2021 20:41: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 F0A8416DF9; Mon, 15 Mar 2021 20:41: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 12FKfGKZ006095; Mon, 15 Mar 2021 20:41:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FKfGsV006094; Mon, 15 Mar 2021 20:41:16 GMT (envelope-from git) Date: Mon, 15 Mar 2021 20:41:16 GMT Message-Id: <202103152041.12FKfGsV006094@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 3a0ffc48b739 - stable/13 - nfsclient: Fix ReadDS/WriteDS/CommitDS nfsstats RPC counts for a NFSv3 DS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3a0ffc48b7391ae07bc5f679e34c3facdad5cf8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 20:41:17 -0000 The branch stable/13 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=3a0ffc48b7391ae07bc5f679e34c3facdad5cf8b commit 3a0ffc48b7391ae07bc5f679e34c3facdad5cf8b Author: Rick Macklem AuthorDate: 2021-03-02 22:18:23 +0000 Commit: Rick Macklem CommitDate: 2021-03-15 19:38:49 +0000 nfsclient: Fix ReadDS/WriteDS/CommitDS nfsstats RPC counts for a NFSv3 DS During a recent virtual NFSv4 testing event, a bug in the FreeBSD client was detected when doing I/O DS operations on a Flexible File Layout pNFS server. For an NFSv3 DS, the Read/Write/Commit nfsstats were incremented instead of the ReadDS/WriteDS/CommitDS counts. This patch fixes this. Only the RPC counts reported by nfsstat(1) were affected by this bug, the I/O operations were performed correctly. (cherry picked from commit c04199affeacbd9e9dda3aaf5ca0b1b180031e78) --- sys/fs/nfs/nfsport.h | 1 + sys/fs/nfsclient/nfs_clrpcops.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h index 9f2789f57bec..255c9a47ebdf 100644 --- a/sys/fs/nfs/nfsport.h +++ b/sys/fs/nfs/nfsport.h @@ -1006,6 +1006,7 @@ bool ncl_pager_setsize(struct vnode *vp, u_quad_t *nsizep); * "out by one" without disastrous consequences. */ #define NFSINCRGLOBAL(a) ((a)++) +#define NFSDECRGLOBAL(a) ((a)--) /* * Assorted funky stuff to make things work under Darwin8. diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 0e503e34810b..527a47338b3f 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -65,6 +65,7 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, dssameconn, CTLFLAG_RW, /* * Global variables */ +extern struct nfsstatsv1 nfsstatsv1; extern int nfs_numnfscbd; extern struct timeval nfsboottime; extern u_int32_t newnfs_false, newnfs_true; @@ -6320,6 +6321,8 @@ nfsrpc_readds(vnode_t vp, struct uio *uiop, nfsv4stateid_t *stateidp, int *eofp, } else { nfscl_reqstart(nd, NFSPROC_READ, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_READ]); + NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_READDS]); NFSCL_DEBUG(4, "nfsrpc_readds: vers3\n"); } NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED * 3); @@ -6395,6 +6398,8 @@ nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, } else { nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITE]); + NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITEDS]); NFSCL_DEBUG(4, "nfsrpc_writeds: vers3\n"); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 3 * NFSX_UNSIGNED); } @@ -6522,6 +6527,8 @@ nfsrpc_writedsmir(vnode_t vp, int *iomode, int *must_commit, } else { nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITE]); + NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITEDS]); NFSCL_DEBUG(4, "nfsrpc_writedsmir: vers3\n"); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 3 * NFSX_UNSIGNED); } @@ -6737,9 +6744,12 @@ nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, struct nfsclds *dsp, nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); vers = NFS_VER4; - } else + } else { nfscl_reqstart(nd, NFSPROC_COMMIT, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_COMMIT]); + NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_COMMITDS]); + } NFSCL_DEBUG(4, "nfsrpc_commitds: vers=%d minvers=%d\n", vers, minorvers); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 20:45:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CDD55AF51F; Mon, 15 Mar 2021 20:45: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 4DzpN51Bzbz3wKc; Mon, 15 Mar 2021 20:45: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 1BFA016F57; Mon, 15 Mar 2021 20:45: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 12FKjf92006892; Mon, 15 Mar 2021 20:45:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FKjfVf006891; Mon, 15 Mar 2021 20:45:41 GMT (envelope-from git) Date: Mon, 15 Mar 2021 20:45:41 GMT Message-Id: <202103152045.12FKjfVf006891@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: c33a5277a0dd - stable/12 - nfsclient: fix panic in cache_enter_time() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: c33a5277a0dd605356f905c9f5e0934362c0c877 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 20:45:41 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=c33a5277a0dd605356f905c9f5e0934362c0c877 commit c33a5277a0dd605356f905c9f5e0934362c0c877 Author: Rick Macklem AuthorDate: 2021-02-28 01:54:05 +0000 Commit: Rick Macklem CommitDate: 2021-03-15 19:44:39 +0000 nfsclient: fix panic in cache_enter_time() Juraj Lutter (otis@) reported a panic "dvp != vp not true" in cache_enter_time() called from the NFS client's nfsrpc_readdirplus() function. This is specific to an NFSv3 mount with the "rdirplus" mount option. Unlike NFSv4, NFSv3 replies to ReaddirPlus includes entries for the current directory. This trivial patch avoids doing a cache_enter_time() call for the current directory to avoid the panic. (cherry picked from commit 3fe2c68ba20fb3365ef91e0b85f88237b5369f38) --- sys/fs/nfsclient/nfs_clrpcops.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index 901f5f7e906d..e1c5c7ff3316 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -3668,6 +3668,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, ndp->ni_vp = newvp; NFSCNHASH(cnp, HASHINIT); if (cnp->cn_namelen <= NCHNAMLEN && + ndp->ni_dvp != ndp->ni_vp && (newvp->v_type != VDIR || dctime.tv_sec != 0)) { cache_enter_time(ndp->ni_dvp, From owner-dev-commits-src-all@freebsd.org Mon Mar 15 20:48:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3E485AF729; Mon, 15 Mar 2021 20:48:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzpQm65hlz3wSV; Mon, 15 Mar 2021 20:48: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 C40AE16F58; Mon, 15 Mar 2021 20:48: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 12FKm0v7007352; Mon, 15 Mar 2021 20:48:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FKm0oM007351; Mon, 15 Mar 2021 20:48:00 GMT (envelope-from git) Date: Mon, 15 Mar 2021 20:48:00 GMT Message-Id: <202103152048.12FKm0oM007351@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: b6b901f8f8a7 - stable/12 - nfsclient: add checks for a server returning the current directory MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: b6b901f8f8a77ce37a7807ac152e971d43e2291e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 20:48:01 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=b6b901f8f8a77ce37a7807ac152e971d43e2291e commit b6b901f8f8a77ce37a7807ac152e971d43e2291e Author: Rick Macklem AuthorDate: 2021-02-28 22:15:32 +0000 Commit: Rick Macklem CommitDate: 2021-03-15 19:46:23 +0000 nfsclient: add checks for a server returning the current directory Commit 3fe2c68ba20f dealt with a panic in cache_enter_time() where the vnode referred to the directory argument. It would also be possible to get these panics if a broken NFS server were to return the directory as an new object being created within the directory or in a Lookup reply. This patch adds checks to avoid the panics and logs messages to indicate that the server is broken for the file object creation cases. (cherry picked from commit 3e04ab36ba5ce5cbbf6d22f17a01a391a04e465f) --- sys/fs/nfsclient/nfs_clvnops.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 478ee059fe84..9fbf9173434f 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -1378,7 +1378,7 @@ nfs_lookup(struct vop_lookup_args *ap) } if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) cnp->cn_flags |= SAVENAME; - if ((cnp->cn_flags & MAKEENTRY) && + if ((cnp->cn_flags & MAKEENTRY) && dvp != newvp && (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN)) && attrflag != 0 && (newvp->v_type != VDIR || dattrflag != 0)) cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, @@ -1707,9 +1707,14 @@ again: } } if (!error) { - if ((cnp->cn_flags & MAKEENTRY) && attrflag) - cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, - NULL); + if ((cnp->cn_flags & MAKEENTRY) && attrflag) { + if (dvp != newvp) + cache_enter_time(dvp, newvp, cnp, + &nfsva.na_ctime, NULL); + else + printf("nfs_create: bogus NFS server returned " + "the directory as the new file object\n"); + } *ap->a_vpp = newvp; } else if (NFS_ISV4(dvp)) { error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, @@ -2081,7 +2086,11 @@ nfs_link(struct vop_link_args *ap) */ if (VFSTONFS(vp->v_mount)->nm_negnametimeo != 0 && (cnp->cn_flags & MAKEENTRY) && attrflag != 0 && error == 0) { - cache_enter_time(tdvp, vp, cnp, &nfsva.na_ctime, NULL); + if (tdvp != vp) + cache_enter_time(tdvp, vp, cnp, &nfsva.na_ctime, NULL); + else + printf("nfs_link: bogus NFS server returned " + "the directory as the new link\n"); } if (error && NFS_ISV4(vp)) error = nfscl_maperr(cnp->cn_thread, error, (uid_t)0, @@ -2160,7 +2169,12 @@ nfs_symlink(struct vop_symlink_args *ap) */ if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && (cnp->cn_flags & MAKEENTRY) && attrflag != 0 && error == 0) { - cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, NULL); + if (dvp != newvp) + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, + NULL); + else + printf("nfs_symlink: bogus NFS server returned " + "the directory as the new file object\n"); } return (error); } @@ -2233,9 +2247,15 @@ nfs_mkdir(struct vop_mkdir_args *ap) */ if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && (cnp->cn_flags & MAKEENTRY) && - attrflag != 0 && dattrflag != 0) - cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, - &dnfsva.na_ctime); + attrflag != 0 && dattrflag != 0) { + if (dvp != newvp) + cache_enter_time(dvp, newvp, cnp, + &nfsva.na_ctime, &dnfsva.na_ctime); + else + printf("nfs_mkdir: bogus NFS server returned " + "the directory that the directory was " + "created in as the new file object\n"); + } *ap->a_vpp = newvp; } return (error); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 20:50:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 769175AF6B8; Mon, 15 Mar 2021 20:50: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 4DzpT82cVsz3wWr; Mon, 15 Mar 2021 20:50: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 4C9FE171F1; Mon, 15 Mar 2021 20:50: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 12FKo441009229; Mon, 15 Mar 2021 20:50:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FKo43t009225; Mon, 15 Mar 2021 20:50:04 GMT (envelope-from git) Date: Mon, 15 Mar 2021 20:50:04 GMT Message-Id: <202103152050.12FKo43t009225@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: a1224bee90c6 - stable/12 - nfsclient: add nfs node locking around uses of n_direofoffset MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a1224bee90c6a54909d279ec631ea2ad8241ddf4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 20:50:04 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=a1224bee90c6a54909d279ec631ea2ad8241ddf4 commit a1224bee90c6a54909d279ec631ea2ad8241ddf4 Author: Rick Macklem AuthorDate: 2021-02-28 22:53:54 +0000 Commit: Rick Macklem CommitDate: 2021-03-15 19:48:37 +0000 nfsclient: add nfs node locking around uses of n_direofoffset During code inspection I noticed that the n_direofoffset field of the NFS node was being manipulated without any lock being held to make it SMP safe. This patch adds locking of the NFS node's mutex around handling of n_direofoffset to make it SMP safe. I have not seen any failure that could be attributed to n_direofoffset being manipulated concurrently by multiple processors, but I think this is possible, since directories are read with shared vnode locking, plus locks only on individual buffer cache blocks. However, there have been as yet unexplained issues w.r.t reading large directories over NFS that could have conceivably been caused by concurrent manipulation of n_direofoffset. (cherry picked from commit 15bed8c46b32dec19e922cb89e12c8970867a303) --- sys/fs/nfsclient/nfs_clbio.c | 10 ++++++++++ sys/fs/nfsclient/nfs_clsubs.c | 3 ++- sys/fs/nfsclient/nfs_clvnops.c | 21 ++++++++++++++++----- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c index 01595eea414b..5ba75491a800 100644 --- a/sys/fs/nfsclient/nfs_clbio.c +++ b/sys/fs/nfsclient/nfs_clbio.c @@ -584,11 +584,14 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) break; case VDIR: NFSINCRGLOBAL(nfsstatsv1.biocache_readdirs); + NFSLOCKNODE(np); if (np->n_direofoffset && uio->uio_offset >= np->n_direofoffset) { + NFSUNLOCKNODE(np); error = 0; goto out; } + NFSUNLOCKNODE(np); lbn = (uoff_t)uio->uio_offset / NFS_DIRBLKSIZ; on = uio->uio_offset & (NFS_DIRBLKSIZ - 1); bp = nfs_getcacheblk(vp, lbn, NFS_DIRBLKSIZ, td); @@ -620,11 +623,14 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) * NFSERR_BAD_COOKIE (double yuch!). */ for (i = 0; i <= lbn && !error; i++) { + NFSLOCKNODE(np); if (np->n_direofoffset && (i * NFS_DIRBLKSIZ) >= np->n_direofoffset) { + NFSUNLOCKNODE(np); error = 0; goto out; } + NFSUNLOCKNODE(np); bp = nfs_getcacheblk(vp, i, NFS_DIRBLKSIZ, td); if (!bp) { error = newnfs_sigintr(nmp, td); @@ -667,11 +673,13 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) * (You need the current block first, so that you have the * directory offset cookie of the next block.) */ + NFSLOCKNODE(np); if (nmp->nm_readahead > 0 && (bp->b_flags & B_INVAL) == 0 && (np->n_direofoffset == 0 || (lbn + 1) * NFS_DIRBLKSIZ < np->n_direofoffset) && incore(&vp->v_bufobj, lbn + 1) == NULL) { + NFSUNLOCKNODE(np); rabp = nfs_getcacheblk(vp, lbn + 1, NFS_DIRBLKSIZ, td); if (rabp) { if ((rabp->b_flags & (B_CACHE|B_DELWRI)) == 0) { @@ -688,6 +696,7 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) brelse(rabp); } } + NFSLOCKNODE(np); } /* * Unlike VREG files, whos buffer size ( bp->b_bcount ) is @@ -704,6 +713,7 @@ ncl_bioread(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) n = lmin(uio->uio_resid, NFS_DIRBLKSIZ - bp->b_resid - on); if (np->n_direofoffset && n > np->n_direofoffset - uio->uio_offset) n = np->n_direofoffset - uio->uio_offset; + NFSUNLOCKNODE(np); break; default: printf(" ncl_bioread: type %x unexpected\n", vp->v_type); diff --git a/sys/fs/nfsclient/nfs_clsubs.c b/sys/fs/nfsclient/nfs_clsubs.c index 1c69d935f25f..6f6df7f938d3 100644 --- a/sys/fs/nfsclient/nfs_clsubs.c +++ b/sys/fs/nfsclient/nfs_clsubs.c @@ -118,6 +118,7 @@ ncl_uninit(struct vfsconf *vfsp) #endif } +/* Returns with NFSLOCKNODE() held. */ void ncl_dircookie_lock(struct nfsnode *np) { @@ -125,7 +126,6 @@ ncl_dircookie_lock(struct nfsnode *np) while (np->n_flag & NDIRCOOKIELK) (void) msleep(&np->n_flag, &np->n_mtx, PZERO, "nfsdirlk", 0); np->n_flag |= NDIRCOOKIELK; - NFSUNLOCKNODE(np); } void @@ -330,6 +330,7 @@ ncl_invaldir(struct vnode *vp) KASSERT(vp->v_type == VDIR, ("nfs: invaldir not dir")); ncl_dircookie_lock(np); np->n_direofoffset = 0; + NFSUNLOCKNODE(np); np->n_cookieverf.nfsuquad[0] = 0; np->n_cookieverf.nfsuquad[1] = 0; if (LIST_FIRST(&np->n_cookies)) diff --git a/sys/fs/nfsclient/nfs_clvnops.c b/sys/fs/nfsclient/nfs_clvnops.c index 9fbf9173434f..fadcf26c686a 100644 --- a/sys/fs/nfsclient/nfs_clvnops.c +++ b/sys/fs/nfsclient/nfs_clvnops.c @@ -2324,8 +2324,10 @@ nfs_readdir(struct vop_readdir_args *ap) /* * First, check for hit on the EOF offset cache */ + NFSLOCKNODE(np); if (np->n_direofoffset > 0 && uio->uio_offset >= np->n_direofoffset && (np->n_flag & NMODIFIED) == 0) { + NFSUNLOCKNODE(np); if (VOP_GETATTR(vp, &vattr, ap->a_cred) == 0) { NFSLOCKNODE(np); if ((NFS_ISV4(vp) && np->n_change == vattr.va_filerev) || @@ -2338,7 +2340,8 @@ nfs_readdir(struct vop_readdir_args *ap) } else NFSUNLOCKNODE(np); } - } + } else + NFSUNLOCKNODE(np); /* * NFS always guarantees that directory entries don't straddle @@ -2391,6 +2394,7 @@ ncl_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred, * If there is no cookie, assume directory was stale. */ ncl_dircookie_lock(dnp); + NFSUNLOCKNODE(dnp); cookiep = ncl_getcookie(dnp, uiop->uio_offset, 0); if (cookiep) { cookie = *cookiep; @@ -2413,12 +2417,15 @@ ncl_readdirrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred, * We are now either at the end of the directory or have filled * the block. */ - if (eof) + if (eof) { + NFSLOCKNODE(dnp); dnp->n_direofoffset = uiop->uio_offset; - else { + NFSUNLOCKNODE(dnp); + } else { if (uiop->uio_resid > 0) printf("EEK! readdirrpc resid > 0\n"); ncl_dircookie_lock(dnp); + NFSUNLOCKNODE(dnp); cookiep = ncl_getcookie(dnp, uiop->uio_offset, 1); *cookiep = cookie; ncl_dircookie_unlock(dnp); @@ -2451,6 +2458,7 @@ ncl_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred, * If there is no cookie, assume directory was stale. */ ncl_dircookie_lock(dnp); + NFSUNLOCKNODE(dnp); cookiep = ncl_getcookie(dnp, uiop->uio_offset, 0); if (cookiep) { cookie = *cookiep; @@ -2472,12 +2480,15 @@ ncl_readdirplusrpc(struct vnode *vp, struct uio *uiop, struct ucred *cred, * We are now either at end of the directory or have filled the * the block. */ - if (eof) + if (eof) { + NFSLOCKNODE(dnp); dnp->n_direofoffset = uiop->uio_offset; - else { + NFSUNLOCKNODE(dnp); + } else { if (uiop->uio_resid > 0) printf("EEK! readdirplusrpc resid > 0\n"); ncl_dircookie_lock(dnp); + NFSUNLOCKNODE(dnp); cookiep = ncl_getcookie(dnp, uiop->uio_offset, 1); *cookiep = cookie; ncl_dircookie_unlock(dnp); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 20:52:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1464C5AF884; Mon, 15 Mar 2021 20:52: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 4DzpWX074Gz4QnM; Mon, 15 Mar 2021 20:52: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 EBA2516F7A; Mon, 15 Mar 2021 20:52: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 12FKq7DC020029; Mon, 15 Mar 2021 20:52:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FKq7sq020028; Mon, 15 Mar 2021 20:52:07 GMT (envelope-from git) Date: Mon, 15 Mar 2021 20:52:07 GMT Message-Id: <202103152052.12FKq7sq020028@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: f419fd9ad817 - stable/12 - nfsclient: Fix the stripe unit size for a File Layout pNFS layout MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f419fd9ad81707f831a48412ecbc5c958675d38c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 20:52:08 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=f419fd9ad81707f831a48412ecbc5c958675d38c commit f419fd9ad81707f831a48412ecbc5c958675d38c Author: Rick Macklem AuthorDate: 2021-03-01 20:49:32 +0000 Commit: Rick Macklem CommitDate: 2021-03-15 19:51:26 +0000 nfsclient: Fix the stripe unit size for a File Layout pNFS layout During a recent virtual NFSv4 testing event, a bug in the FreeBSD client was detected when doing a File Layout pNFS DS I/O operation. The size of the I/O operation was smaller than expected. The I/O size is specified as a stripe unit size in bits 6->31 of nflh_util in the layout. I had misinterpreted RFC5661 and had shifted the value right by 6 bits. The correct interpretation is to use the value as presented (it is always an exact multiple of 64), clearing bits 0->5. This patch fixes this. Without the patch, I/O through the DSs work, but the I/O size is 1/64th of what is optimal. (cherry picked from commit 94f2e42f5e0b78a7a4684d4a4eb62ea470a57eb1) --- sys/fs/nfsclient/nfs_clrpcops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index e1c5c7ff3316..cab5ec4005ba 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -5911,7 +5911,7 @@ nfscl_doflayoutio(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, np = VTONFS(vp); rel_off = off - flp->nfsfl_patoff; - stripe_unit_size = (flp->nfsfl_util >> 6) & 0x3ffffff; + stripe_unit_size = flp->nfsfl_util & NFSFLAYUTIL_STRIPE_MASK; stripe_pos = (rel_off / stripe_unit_size + flp->nfsfl_stripe1) % dp->nfsdi_stripecnt; transfer = stripe_unit_size - (rel_off % stripe_unit_size); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 20:53:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CA3C5AF4FB; Mon, 15 Mar 2021 20:53: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 4DzpYM40kvz4RHD; Mon, 15 Mar 2021 20:53: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 7C2A517681; Mon, 15 Mar 2021 20:53: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 12FKrhaQ020368; Mon, 15 Mar 2021 20:53:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FKrhLi020367; Mon, 15 Mar 2021 20:53:43 GMT (envelope-from git) Date: Mon, 15 Mar 2021 20:53:43 GMT Message-Id: <202103152053.12FKrhLi020367@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 960f07a448d0 - stable/12 - nfsclient: Fix ReadDS/WriteDS/CommitDS nfsstats RPC counts for a NFSv3 DS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 960f07a448d01b09595732cf87afe7ba657564b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 20:53:43 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=960f07a448d01b09595732cf87afe7ba657564b4 commit 960f07a448d01b09595732cf87afe7ba657564b4 Author: Rick Macklem AuthorDate: 2021-03-02 22:18:23 +0000 Commit: Rick Macklem CommitDate: 2021-03-15 19:52:46 +0000 nfsclient: Fix ReadDS/WriteDS/CommitDS nfsstats RPC counts for a NFSv3 DS During a recent virtual NFSv4 testing event, a bug in the FreeBSD client was detected when doing I/O DS operations on a Flexible File Layout pNFS server. For an NFSv3 DS, the Read/Write/Commit nfsstats were incremented instead of the ReadDS/WriteDS/CommitDS counts. This patch fixes this. Only the RPC counts reported by nfsstat(1) were affected by this bug, the I/O operations were performed correctly. MFC after: 2 weeks (cherry picked from commit c04199affeacbd9e9dda3aaf5ca0b1b180031e78) --- sys/fs/nfs/nfsport.h | 1 + sys/fs/nfsclient/nfs_clrpcops.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h index 8d9f5ac42225..177fcad5443d 100644 --- a/sys/fs/nfs/nfsport.h +++ b/sys/fs/nfs/nfsport.h @@ -885,6 +885,7 @@ bool ncl_pager_setsize(struct vnode *vp, u_quad_t *nsizep); * "out by one" without disastrous consequences. */ #define NFSINCRGLOBAL(a) ((a)++) +#define NFSDECRGLOBAL(a) ((a)--) /* * Assorted funky stuff to make things work under Darwin8. diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index cab5ec4005ba..6143edb93895 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -63,6 +63,7 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, dssameconn, CTLFLAG_RW, /* * Global variables */ +extern struct nfsstatsv1 nfsstatsv1; extern int nfs_numnfscbd; extern struct timeval nfsboottime; extern u_int32_t newnfs_false, newnfs_true; @@ -6177,6 +6178,8 @@ nfsrpc_readds(vnode_t vp, struct uio *uiop, nfsv4stateid_t *stateidp, int *eofp, } else { nfscl_reqstart(nd, NFSPROC_READ, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_READ]); + NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_READDS]); NFSCL_DEBUG(4, "nfsrpc_readds: vers3\n"); } NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED * 3); @@ -6252,6 +6255,8 @@ nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, } else { nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITE]); + NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITEDS]); NFSCL_DEBUG(4, "nfsrpc_writeds: vers3\n"); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 3 * NFSX_UNSIGNED); } @@ -6378,6 +6383,8 @@ nfsrpc_writedsmir(vnode_t vp, int *iomode, int *must_commit, } else { nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITE]); + NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITEDS]); NFSCL_DEBUG(4, "nfsrpc_writedsmir: vers3\n"); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 3 * NFSX_UNSIGNED); } @@ -6600,9 +6607,12 @@ nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, struct nfsclds *dsp, nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); vers = NFS_VER4; - } else + } else { nfscl_reqstart(nd, NFSPROC_COMMIT, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_COMMIT]); + NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_COMMITDS]); + } NFSCL_DEBUG(4, "nfsrpc_commitds: vers=%d minvers=%d\n", vers, minorvers); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED); From owner-dev-commits-src-all@freebsd.org Mon Mar 15 21:24:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1D78F5AFDEA; Mon, 15 Mar 2021 21:24: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 4DzqF10DVkz4T3d; Mon, 15 Mar 2021 21:24: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 EE32A17B8B; Mon, 15 Mar 2021 21:24: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 12FLOafb060655; Mon, 15 Mar 2021 21:24:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FLOaK1060654; Mon, 15 Mar 2021 21:24:36 GMT (envelope-from git) Date: Mon, 15 Mar 2021 21:24:36 GMT Message-Id: <202103152124.12FLOaK1060654@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: e4ac3f746377 - main - Fix fib algo rebuild delay calculation. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: melifaro X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e4ac3f74637778981b2d89745188bb2a39e24e42 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 21:24:37 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=e4ac3f74637778981b2d89745188bb2a39e24e42 commit e4ac3f74637778981b2d89745188bb2a39e24e42 Author: Alexander V. Chernikov AuthorDate: 2021-03-15 21:09:07 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-15 21:09:07 +0000 Fix fib algo rebuild delay calculation. Submitted by: Marco Zec MFC after: 3 days --- sys/net/route/fib_algo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/net/route/fib_algo.c b/sys/net/route/fib_algo.c index b2aa2de087de..03c265d28d09 100644 --- a/sys/net/route/fib_algo.c +++ b/sys/net/route/fib_algo.c @@ -462,7 +462,7 @@ static void schedule_callout(struct fib_data *fd, int delay_ms) { - callout_reset_sbt(&fd->fd_callout, 0, SBT_1MS * delay_ms, + callout_reset_sbt(&fd->fd_callout, SBT_1MS * delay_ms, 0, rebuild_fd_callout, fd, 0); } From owner-dev-commits-src-all@freebsd.org Mon Mar 15 21:25:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4FBF568698; Mon, 15 Mar 2021 21:25: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 4DzqFy5DtVz4THk; Mon, 15 Mar 2021 21:25: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 A6B0017B8C; Mon, 15 Mar 2021 21:25: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 12FLPQu3060904; Mon, 15 Mar 2021 21:25:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FLPQal060903; Mon, 15 Mar 2021 21:25:26 GMT (envelope-from git) Date: Mon, 15 Mar 2021 21:25:26 GMT Message-Id: <202103152125.12FLPQal060903@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Juraj Lutter Subject: git: ffdcad758e3e - stable/12 - newsyslog(8): Implement a new 'E' flag to not rotate empty log files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: otis X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ffdcad758e3e928852992cb52645dabaa99dbd97 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 21:25:26 -0000 The branch stable/12 has been updated by otis (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=ffdcad758e3e928852992cb52645dabaa99dbd97 commit ffdcad758e3e928852992cb52645dabaa99dbd97 Author: Juraj Lutter AuthorDate: 2021-02-28 22:07:14 +0000 Commit: Juraj Lutter CommitDate: 2021-03-15 21:25:01 +0000 newsyslog(8): Implement a new 'E' flag to not rotate empty log files Based on an idea from dvl's coworker, László DANIELISZ, implement a new flag, 'E', that prevents newsyslog(8) from rotating the empty log files. This 'E' flag ist mostly usable in conjunction with 'B' flag that instructs newsyslog(8) to not insert an informational message into the log file after rotation, keeping it still empty. Reviewed by: markj, ian, manpages (rpokala) Approved by: markj, ian, manpages (rpokala) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D28940 (cherry picked from commit c7d27b225df8d7fb36a31a21737d4309593c4604) --- usr.sbin/newsyslog/newsyslog.c | 11 ++++++++++- usr.sbin/newsyslog/newsyslog.conf.5 | 14 +++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c index dc3ea51c8032..8f8bb54e9b46 100644 --- a/usr.sbin/newsyslog/newsyslog.c +++ b/usr.sbin/newsyslog/newsyslog.c @@ -114,7 +114,8 @@ __FBSDID("$FreeBSD$"); #define CE_PID2CMD 0x0400 /* Replace PID file with a shell command.*/ #define CE_PLAIN0 0x0800 /* Do not compress zero'th history file */ #define CE_RFC5424 0x1000 /* Use RFC5424 format rotation message */ - +#define CE_NOEMPTY 0x2000 /* Do not rotate the file when its size */ + /* is zero */ #define MIN_PID 5 /* Don't touch pids lower than this */ #define MAX_PID 99999 /* was lower, see /usr/include/sys/proc.h */ @@ -531,6 +532,11 @@ do_entry(struct conf_entry * ent) printf("does not exist, skipped%s.\n", temp_reason); } } else { + if (ent->flags & CE_NOEMPTY && ent->fsize == 0) { + if (verbose) + printf("--> Not rotating empty file\n"); + return (free_or_keep); + } if (ent->flags & CE_TRIMAT && !force && !rotatereq && !oversized) { diffsecs = ptimeget_diff(timenow, ent->trim_at); @@ -1291,6 +1297,9 @@ no_trimat: case 'd': working->flags |= CE_NODUMP; break; + case 'e': + working->flags |= CE_NOEMPTY; + break; case 'g': working->flags |= CE_GLOB; break; diff --git a/usr.sbin/newsyslog/newsyslog.conf.5 b/usr.sbin/newsyslog/newsyslog.conf.5 index d6b1191aa8b2..b897389b99dd 100644 --- a/usr.sbin/newsyslog/newsyslog.conf.5 +++ b/usr.sbin/newsyslog/newsyslog.conf.5 @@ -21,7 +21,7 @@ .\" the suitability of this software for any purpose. It is .\" provided "as is" without express or implied warranty. .\" -.Dd August 21, 2018 +.Dd February 26, 2021 .Dt NEWSYSLOG.CONF 5 .Os .Sh NAME @@ -286,6 +286,18 @@ this log file. This option would affect how the .Xr dump 8 command treats the log file when making a file system backup. +.It Cm E +indicates that the log file should not be rotated when its +size is zero. +The +.Cm E +flag is mostly useful in conjunction with +.Cm B +flag to prevent +.Xr newsyslog 8 +from inserting an informational +.Tn ASCII +message into the new file. .It Cm G indicates that the specified .Ar logfile_name From owner-dev-commits-src-all@freebsd.org Tue Mar 16 00:00:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34F0656C7EB; Tue, 16 Mar 2021 00:00: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 4DztjH02G7z4dbR; Tue, 16 Mar 2021 00:00: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 E87721985D; Tue, 16 Mar 2021 00:00: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 12G00o8q068392; Tue, 16 Mar 2021 00:00:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G00omA068391; Tue, 16 Mar 2021 00:00:50 GMT (envelope-from git) Date: Tue, 16 Mar 2021 00:00:50 GMT Message-Id: <202103160000.12G00omA068391@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: 283352dd4f6a - main - Stop installing kernel-only crypto headers to /usr/include/crypto. 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: 283352dd4f6a3bb2f3c7cb45ce5dca3d86f5e3f4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 00:00:51 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=283352dd4f6a3bb2f3c7cb45ce5dca3d86f5e3f4 commit 283352dd4f6a3bb2f3c7cb45ce5dca3d86f5e3f4 Author: John Baldwin AuthorDate: 2021-03-16 00:00:21 +0000 Commit: John Baldwin CommitDate: 2021-03-16 00:00:21 +0000 Stop installing kernel-only crypto headers to /usr/include/crypto. The only user-facing header from OCF is . PR: 254167 (exp-run) MFC after: 1 week Sponsored by: Chelsio Communications --- ObsoleteFiles.inc | 12 ++++++++++++ include/Makefile | 16 +--------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 8f56ef29dad5..f111a2f83064 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,18 @@ # xargs -n1 | sort | uniq -d; # done +# 20210315: Remove kernel-only crypto headers from /usr/include +OLD_FILES+=usr/include/crypto/_cryptodev.h +OLD_FILES+=usr/include/crypto/cbc_mac.h +OLD_FILES+=usr/include/crypto/deflate.h +OLD_FILES+=usr/include/crypto/gfmult.h +OLD_FILES+=usr/include/crypto/gmac.h +OLD_FILES+=usr/include/crypto/rmd160.h +OLD_FILES+=usr/include/crypto/xform.h +OLD_FILES+=usr/include/crypto/xform_auth.h +OLD_FILES+=usr/include/crypto/xform_comp.h +OLD_FILES+=usr/include/crypto/xform_enc.h + # 20210305: removed Poly1305_* symbols OLD_FILES+=usr/include/crypto/xform_poly1305.h diff --git a/include/Makefile b/include/Makefile index 31e207f6b199..8ddfd7015918 100644 --- a/include/Makefile +++ b/include/Makefile @@ -84,10 +84,6 @@ FS9660= cd9660_mount.h \ iso_rrip.h FS9660DIR= ${INCLUDEDIR}/isofs/cd9660 -.PATH: ${SRCTOP}/sys/crypto -CRYPTO= rijndael/rijndael.h -CRYPTODIR= ${INCLUDEDIR}/crypto - .PATH: ${SRCTOP}/sys/dev/evdev EVDEV= input.h \ input-event-codes.h \ @@ -105,17 +101,7 @@ HYPERV= hv_snapshot.h \ HYPERVDIR= ${INCLUDEDIR}/dev/hyperv .PATH: ${SRCTOP}/sys/opencrypto -OPENCRYPTO= _cryptodev.h \ - cbc_mac.h \ - cryptodev.h \ - deflate.h \ - gfmult.h \ - gmac.h \ - rmd160.h \ - xform.h \ - xform_auth.h \ - xform_comp.h \ - xform_enc.h +OPENCRYPTO= cryptodev.h OPENCRYPTODIR= ${INCLUDEDIR}/crypto .PATH: ${SRCTOP}/sys/dev/pci From owner-dev-commits-src-all@freebsd.org Tue Mar 16 00:07:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDBCA56C9DC; Tue, 16 Mar 2021 00:07: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 4Dztrl50Ppz4f8Y; Tue, 16 Mar 2021 00:07: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 99F3F19D1E; Tue, 16 Mar 2021 00:07: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 12G07JVA073520; Tue, 16 Mar 2021 00:07:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G07JLa073519; Tue, 16 Mar 2021 00:07:19 GMT (envelope-from git) Date: Tue, 16 Mar 2021 00:07:19 GMT Message-Id: <202103160007.12G07JLa073519@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kirk McKusick Subject: git: cf0310dfefee - stable/12 - Fix bug 253158 - Panic: snapacct_ufs2: bad block - mksnap_ffs(8) crash MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mckusick X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: cf0310dfefee8672680fb45b7ee25722e7630227 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 00:07:19 -0000 The branch stable/12 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=cf0310dfefee8672680fb45b7ee25722e7630227 commit cf0310dfefee8672680fb45b7ee25722e7630227 Author: Kirk McKusick AuthorDate: 2021-02-12 05:31:16 +0000 Commit: Kirk McKusick CommitDate: 2021-03-16 00:11:29 +0000 Fix bug 253158 - Panic: snapacct_ufs2: bad block - mksnap_ffs(8) crash PR: 253158 (cherry picked from commit 8563de2f2799b2cb6f2f06e3c9dddd48dca2a986) (cherry picked from commit c31480a1f66537e59b02e935a547bcfc76715278) --- sys/ufs/ffs/ffs_snapshot.c | 145 ++++++++++++++++++++++++--------------------- 1 file changed, 78 insertions(+), 67 deletions(-) diff --git a/sys/ufs/ffs/ffs_snapshot.c b/sys/ufs/ffs/ffs_snapshot.c index 749ab28fab56..f2c50f64f79b 100644 --- a/sys/ufs/ffs/ffs_snapshot.c +++ b/sys/ufs/ffs/ffs_snapshot.c @@ -58,6 +58,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include @@ -307,21 +310,21 @@ restart: ip = VTOI(vp); devvp = ITODEVVP(ip); /* - * Allocate and copy the last block contents so as to be able - * to set size to that of the filesystem. + * Calculate the size of the filesystem then allocate the block + * immediately following the last block of the filesystem that + * will contain the snapshot list. This operation allows us to + * set the size of the snapshot. */ numblks = howmany(fs->fs_size, fs->fs_frag); - error = UFS_BALLOC(vp, lblktosize(fs, (off_t)(numblks - 1)), + error = UFS_BALLOC(vp, lblktosize(fs, (off_t)numblks), fs->fs_bsize, KERNCRED, BA_CLRBUF, &bp); if (error) goto out; - ip->i_size = lblktosize(fs, (off_t)numblks); + bawrite(bp); + ip->i_size = lblktosize(fs, (off_t)(numblks + 1)); + vnode_pager_setsize(vp, ip->i_size); DIP_SET(ip, i_size, ip->i_size); ip->i_flag |= IN_SIZEMOD | IN_CHANGE | IN_UPDATE; - error = readblock(vp, bp, numblks - 1); - bawrite(bp); - if (error != 0) - goto out; /* * Preallocate critical data structures so that we can copy * them in without further allocation after we suspend all @@ -366,8 +369,11 @@ restart: if (error) goto out; bawrite(nbp); - if (cg % 10 == 0) - ffs_syncvnode(vp, MNT_WAIT, 0); + if (cg % 10 == 0) { + error = ffs_syncvnode(vp, MNT_WAIT, 0); + if (error != 0) + goto out; + } } /* * Copy all the cylinder group maps. Although the @@ -439,21 +445,11 @@ restart: vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); if (ip->i_effnlink == 0) { error = ENOENT; /* Snapshot file unlinked */ - goto out1; + goto resumefs; } if (collectsnapstats) nanotime(&starttime); - /* The last block might have changed. Copy it again to be sure. */ - error = UFS_BALLOC(vp, lblktosize(fs, (off_t)(numblks - 1)), - fs->fs_bsize, KERNCRED, BA_CLRBUF, &bp); - if (error != 0) - goto out1; - error = readblock(vp, bp, numblks - 1); - bp->b_flags |= B_VALIDSUSPWRT; - bawrite(bp); - if (error != 0) - goto out1; /* * First, copy all the cylinder group maps that have changed. */ @@ -464,11 +460,11 @@ restart: error = UFS_BALLOC(vp, lfragtosize(fs, cgtod(fs, cg)), fs->fs_bsize, KERNCRED, 0, &nbp); if (error) - goto out1; + goto resumefs; error = cgaccount(cg, vp, nbp, 2); bawrite(nbp); if (error) - goto out1; + goto resumefs; } /* * Grab a copy of the superblock and its summary information. @@ -496,10 +492,7 @@ restart: if ((error = bread(devvp, fsbtodb(fs, fs->fs_csaddr + loc), len, KERNCRED, &bp)) != 0) { brelse(bp); - free(copy_fs->fs_csp, M_UFSMNT); - free(copy_fs, M_UFSMNT); - copy_fs = NULL; - goto out1; + goto resumefs; } bcopy(bp->b_data, space, (u_int)len); space = (char *)space + len; @@ -521,10 +514,27 @@ restart: * Note that we skip unlinked snapshot files as they will * be handled separately below. * - * We also calculate the needed size for the snapshot list. + * We also calculate the size needed for the snapshot list. + * Initial number of entries is composed of: + * - one for each cylinder group map + * - one for each block used by superblock summary table + * - one for each snapshot inode block + * - one for the superblock + * - one for the snapshot list + * The direct block entries in the snapshot are always + * copied (see reason below). Note that the superblock and + * the first cylinder group will almost always be allocated + * in the direct blocks, but we add the slop for them in case + * they do not end up there. The snapshot list size may get + * expanded by one because of an update of an inode block for + * an unlinked but still open file when it is expunged. + * + * Because the direct block pointers are always copied, they + * are not added to the list. Instead ffs_copyonwrite() + * explicitly checks for them before checking the snapshot list. */ snaplistsize = fs->fs_ncg + howmany(fs->fs_cssize, fs->fs_bsize) + - FSMAXSNAP + 1 /* superblock */ + 1 /* last block */ + 1 /* size */; + FSMAXSNAP + /* superblock */ 1 + /* snaplist */ 1; MNT_ILOCK(mp); mp->mnt_kern_flag &= ~MNTK_SUSPENDED; MNT_IUNLOCK(mp); @@ -604,11 +614,8 @@ loop: VOP_UNLOCK(xvp, 0); vdrop(xvp); if (error) { - free(copy_fs->fs_csp, M_UFSMNT); - free(copy_fs, M_UFSMNT); - copy_fs = NULL; MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp); - goto out1; + goto resumefs; } } /* @@ -616,12 +623,8 @@ loop: */ if (fs->fs_flags & FS_SUJ) { error = softdep_journal_lookup(mp, &xvp); - if (error) { - free(copy_fs->fs_csp, M_UFSMNT); - free(copy_fs, M_UFSMNT); - copy_fs = NULL; - goto out1; - } + if (error) + goto resumefs; xp = VTOI(xvp); if (I_IS_UFS1(xp)) error = expunge_ufs1(vp, xp, copy_fs, fullacct_ufs1, @@ -672,6 +675,27 @@ loop: sn->sn_listsize = blkp - snapblklist; VI_UNLOCK(devvp); } + /* + * Preallocate all the direct blocks in the snapshot inode so + * that we never have to write the inode itself to commit an + * update to the contents of the snapshot. Note that once + * created, the size of the snapshot will never change, so + * there will never be a need to write the inode except to + * update the non-integrity-critical time fields and + * allocated-block count. + */ + for (blockno = 0; blockno < UFS_NDADDR; blockno++) { + if (DIP(ip, i_db[blockno]) != 0) + continue; + error = UFS_BALLOC(vp, lblktosize(fs, blockno), + fs->fs_bsize, KERNCRED, BA_CLRBUF, &bp); + if (error) + goto resumefs; + error = readblock(vp, bp, blockno); + bawrite(bp); + if (error != 0) + goto resumefs; + } /* * Record snapshot inode. Since this is the newest snapshot, * it must be placed at the end of the list. @@ -684,11 +708,15 @@ loop: TAILQ_INSERT_TAIL(&sn->sn_head, ip, i_nextsnap); devvp->v_vflag |= VV_COPYONWRITE; VI_UNLOCK(devvp); +resumefs: ASSERT_VOP_LOCKED(vp, "ffs_snapshot vp"); -out1: - KASSERT((sn != NULL && copy_fs != NULL && error == 0) || - (sn == NULL && copy_fs == NULL && error != 0), - ("email phk@ and mckusick@")); + if (error != 0 && copy_fs != NULL) { + free(copy_fs->fs_csp, M_UFSMNT); + free(copy_fs, M_UFSMNT); + copy_fs = NULL; + } + KASSERT(error != 0 || (sn != NULL && copy_fs != NULL), + ("missing snapshot setup parameters")); /* * Resume operation on filesystem. */ @@ -762,7 +790,7 @@ out1: aiov.iov_base = (void *)snapblklist; aiov.iov_len = snaplistsize * sizeof(daddr_t); auio.uio_resid = aiov.iov_len; - auio.uio_offset = ip->i_size; + auio.uio_offset = lblktosize(fs, (off_t)numblks); auio.uio_segflg = UIO_SYSSPACE; auio.uio_rw = UIO_WRITE; auio.uio_td = td; @@ -781,7 +809,6 @@ out1: for (loc = 0; loc < len; loc++) { error = bread(vp, blkno + loc, fs->fs_bsize, KERNCRED, &nbp); if (error) { - brelse(nbp); fs->fs_snapinum[snaploc] = 0; free(snapblklist, M_UFSMNT); goto done; @@ -810,27 +837,6 @@ out1: VI_UNLOCK(devvp); if (space != NULL) free(space, M_UFSMNT); - /* - * Preallocate all the direct blocks in the snapshot inode so - * that we never have to write the inode itself to commit an - * update to the contents of the snapshot. Note that once - * created, the size of the snapshot will never change, so - * there will never be a need to write the inode except to - * update the non-integrity-critical time fields and - * allocated-block count. - */ - for (blockno = 0; blockno < UFS_NDADDR; blockno++) { - if (DIP(ip, i_db[blockno]) != 0) - continue; - error = UFS_BALLOC(vp, lblktosize(fs, blockno), - fs->fs_bsize, KERNCRED, BA_CLRBUF, &bp); - if (error) - break; - error = readblock(vp, bp, blockno); - bawrite(bp); - if (error != 0) - break; - } done: free(copy_fs->fs_csp, M_UFSMNT); free(copy_fs, M_UFSMNT); @@ -1545,7 +1551,8 @@ mapacct_ufs2(vp, oldblkp, lastblkp, fs, lblkno, expungetype) blkno = *oldblkp; if (blkno == 0 || blkno == BLK_NOCOPY) continue; - if (acctit && expungetype == BLK_SNAP && blkno != BLK_SNAP) + if (acctit && expungetype == BLK_SNAP && blkno != BLK_SNAP && + lblkno >= UFS_NDADDR) *ip->i_snapblklist++ = lblkno; if (blkno == BLK_SNAP) blkno = blkstofrags(fs, lblkno); @@ -2281,6 +2288,10 @@ ffs_copyonwrite(devvp, bp) ip = TAILQ_FIRST(&sn->sn_head); fs = ITOFS(ip); lbn = fragstoblks(fs, dbtofsb(fs, bp->b_blkno)); + if (lbn < UFS_NDADDR) { + VI_UNLOCK(devvp); + return (0); /* Direct blocks are always copied */ + } snapblklist = sn->sn_blklist; upper = sn->sn_listsize - 1; lower = 1; From owner-dev-commits-src-all@freebsd.org Tue Mar 16 00:14:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2124056CD50; Tue, 16 Mar 2021 00:14: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 4Dzv1P0PY3z4fk2; Tue, 16 Mar 2021 00:14: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 003601A00E; Tue, 16 Mar 2021 00:14: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 12G0EmvE086624; Tue, 16 Mar 2021 00:14:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G0Emgw086623; Tue, 16 Mar 2021 00:14:48 GMT (envelope-from git) Date: Tue, 16 Mar 2021 00:14:48 GMT Message-Id: <202103160014.12G0Emgw086623@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: c2460d7cfe9f - main - factor out PT page allocation/freeing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c2460d7cfe9fab30459ce495f08544a237a5baa3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 00:14:49 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=c2460d7cfe9fab30459ce495f08544a237a5baa3 commit c2460d7cfe9fab30459ce495f08544a237a5baa3 Author: Jason A. Harmening AuthorDate: 2021-03-01 16:42:05 +0000 Commit: Jason A. Harmening CommitDate: 2021-03-16 00:14:43 +0000 factor out PT page allocation/freeing As follow-on work to e4b8deb222278b2a, move page table page allocation and freeing into their own functions. Use these functions to provide separate kernel vs. user page table page accounting, and to wrap common tasks such as management of zero-filled page state. Requested by: markj, kib Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D29151 --- sys/amd64/amd64/pmap.c | 201 +++++++++++++++++++++++++++---------------------- 1 file changed, 109 insertions(+), 92 deletions(-) diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c index d153f937b888..57d7a42800a1 100644 --- a/sys/amd64/amd64/pmap.c +++ b/sys/amd64/amd64/pmap.c @@ -115,6 +115,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -761,9 +762,15 @@ static COUNTER_U64_DEFINE_EARLY(pv_page_count); SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pv_page_count, CTLFLAG_RD, &pv_page_count, "Current number of allocated pv pages"); -static COUNTER_U64_DEFINE_EARLY(pt_page_count); -SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, pt_page_count, CTLFLAG_RD, - &pt_page_count, "Current number of allocated page table pages"); +static COUNTER_U64_DEFINE_EARLY(user_pt_page_count); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, user_pt_page_count, CTLFLAG_RD, + &user_pt_page_count, + "Current number of allocated page table pages for userspace"); + +static COUNTER_U64_DEFINE_EARLY(kernel_pt_page_count); +SYSCTL_COUNTER_U64(_vm_pmap, OID_AUTO, kernel_pt_page_count, CTLFLAG_RD, + &kernel_pt_page_count, + "Current number of allocated page table pages for the kernel"); #ifdef PV_STATS @@ -1290,6 +1297,9 @@ static void _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist *free); static int pmap_unuse_pt(pmap_t, vm_offset_t, pd_entry_t, struct spglist *); +static vm_page_t pmap_alloc_pt_page(pmap_t, vm_pindex_t, int); +static void pmap_free_pt_page(pmap_t, vm_page_t, bool); + /********************/ /* Inline functions */ /********************/ @@ -1456,22 +1466,26 @@ pmap_pte(pmap_t pmap, vm_offset_t va) } static __inline void -pmap_resident_count_inc(pmap_t pmap, int count) +pmap_resident_count_adj(pmap_t pmap, int count) { PMAP_LOCK_ASSERT(pmap, MA_OWNED); + KASSERT(pmap->pm_stats.resident_count + count >= 0, + ("pmap %p resident count underflow %ld %d", pmap, + pmap->pm_stats.resident_count, count)); pmap->pm_stats.resident_count += count; } static __inline void -pmap_resident_count_dec(pmap_t pmap, int count) +pmap_pt_page_count_adj(pmap_t pmap, int count) { - - PMAP_LOCK_ASSERT(pmap, MA_OWNED); - KASSERT(pmap->pm_stats.resident_count >= count, - ("pmap %p resident count underflow %ld %d", pmap, - pmap->pm_stats.resident_count, count)); - pmap->pm_stats.resident_count -= count; + if (pmap == kernel_pmap) + counter_u64_add(kernel_pt_page_count, count); + else { + if (pmap != NULL) + pmap_resident_count_adj(pmap, count); + counter_u64_add(user_pt_page_count, count); + } } PMAP_INLINE pt_entry_t * @@ -2138,6 +2152,7 @@ pmap_bootstrap_la57(void *arg __unused) kernel_pmap->pm_cr3 = KPML5phys; kernel_pmap->pm_pmltop = v_pml5; + pmap_pt_page_count_adj(kernel_pmap, 1); } SYSINIT(la57, SI_SUB_KMEM, SI_ORDER_ANY, pmap_bootstrap_la57, NULL); @@ -4003,7 +4018,6 @@ _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist *free) pd = pmap_pde(pmap, va); *pd = 0; } - pmap_resident_count_dec(pmap, 1); if (m->pindex < NUPDE) { /* We just released a PT, unhold the matching PD */ pdpg = PHYS_TO_VM_PAGE(*pmap_pdpe(pmap, va) & PG_FRAME); @@ -4018,7 +4032,7 @@ _pmap_unwire_ptp(pmap_t pmap, vm_offset_t va, vm_page_t m, struct spglist *free) pmap_unwire_ptp(pmap, va, pml4pg, free); } - counter_u64_add(pt_page_count, -1); + pmap_pt_page_count_adj(pmap, -1); /* * Put page on a list so that it is released after @@ -4183,6 +4197,44 @@ pmap_pinit_pml5_pti(vm_page_t pml5pgu) pmap_cache_bits(kernel_pmap, VM_MEMATTR_DEFAULT, FALSE); } +/* Allocate a page table page and do related bookkeeping */ +static vm_page_t +pmap_alloc_pt_page(pmap_t pmap, vm_pindex_t pindex, int flags) +{ + vm_page_t m; + + m = vm_page_alloc(NULL, pindex, flags | VM_ALLOC_NOOBJ); + if (__predict_false(m == NULL)) + return (NULL); + + pmap_pt_page_count_adj(pmap, 1); + + if ((flags & VM_ALLOC_ZERO) != 0 && (m->flags & PG_ZERO) == 0) + pmap_zero_page(m); + + return (m); +} + +static void +pmap_free_pt_page(pmap_t pmap, vm_page_t m, bool zerofilled) +{ + /* + * This function assumes the page will need to be unwired, + * even though the counterpart allocation in pmap_alloc_pt_page() + * doesn't enforce VM_ALLOC_WIRED. However, all current uses + * of pmap_free_pt_page() require unwiring. The case in which + * a PT page doesn't require unwiring because its ref_count has + * naturally reached 0 is handled through _pmap_unwire_ptp(). + */ + vm_page_unwire_noq(m); + if (zerofilled) + vm_page_free_zero(m); + else + vm_page_free(m); + + pmap_pt_page_count_adj(pmap, -1); +} + /* * Initialize a preallocated and zeroed pmap structure, * such as one in a vmspace structure. @@ -4197,11 +4249,9 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) /* * allocate the page directory page */ - pmltop_pg = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | + pmltop_pg = pmap_alloc_pt_page(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_WIRED | VM_ALLOC_ZERO | VM_ALLOC_WAITOK); - counter_u64_add(pt_page_count, 1); - pmltop_phys = VM_PAGE_TO_PHYS(pmltop_pg); pmap->pm_pmltop = (pml5_entry_t *)PHYS_TO_DMAP(pmltop_phys); @@ -4214,8 +4264,6 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) pmap->pm_pmltopu = NULL; pmap->pm_type = pm_type; - if ((pmltop_pg->flags & PG_ZERO) == 0) - pagezero(pmap->pm_pmltop); /* * Do not install the host kernel mappings in the nested page @@ -4231,9 +4279,9 @@ pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags) else pmap_pinit_pml4(pmltop_pg); if ((curproc->p_md.md_flags & P_MD_KPTI) != 0) { - pmltop_pgu = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | VM_ALLOC_WAITOK); - counter_u64_add(pt_page_count, 1); + pmltop_pgu = pmap_alloc_pt_page(NULL, 0, + VM_ALLOC_WIRED | VM_ALLOC_NORMAL | + VM_ALLOC_WAITOK); pmap->pm_pmltopu = (pml4_entry_t *)PHYS_TO_DMAP( VM_PAGE_TO_PHYS(pmltop_pgu)); if (pmap_is_la57(pmap)) @@ -4418,13 +4466,11 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, /* * Allocate a page table page. */ - if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) + m = pmap_alloc_pt_page(pmap, ptepindex, + VM_ALLOC_WIRED | VM_ALLOC_ZERO); + if (m == NULL) return (NULL); - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - /* * Map the pagetable page into the process address space, if * it isn't already there. @@ -4451,8 +4497,7 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, /* Wire up a new PDPE page */ pml4 = pmap_allocpte_getpml4(pmap, lockp, va, true); if (pml4 == NULL) { - vm_page_unwire_noq(m); - vm_page_free_zero(m); + pmap_free_pt_page(pmap, m, true); return (NULL); } KASSERT((*pml4 & PG_V) == 0, @@ -4479,8 +4524,7 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, /* Wire up a new PDE page */ pdp = pmap_allocpte_getpdp(pmap, lockp, va, true); if (pdp == NULL) { - vm_page_unwire_noq(m); - vm_page_free_zero(m); + pmap_free_pt_page(pmap, m, true); return (NULL); } KASSERT((*pdp & PG_V) == 0, @@ -4490,8 +4534,7 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, /* Wire up a new PTE page */ pdp = pmap_allocpte_getpdp(pmap, lockp, va, false); if (pdp == NULL) { - vm_page_unwire_noq(m); - vm_page_free_zero(m); + pmap_free_pt_page(pmap, m, true); return (NULL); } if ((*pdp & PG_V) == 0) { @@ -4500,8 +4543,7 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, lockp, va) == NULL) { pmap_allocpte_free_unref(pmap, va, pmap_pml4e(pmap, va)); - vm_page_unwire_noq(m); - vm_page_free_zero(m); + pmap_free_pt_page(pmap, m, true); return (NULL); } } else { @@ -4518,9 +4560,6 @@ pmap_allocpte_nosleep(pmap_t pmap, vm_pindex_t ptepindex, struct rwlock **lockp, *pd = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | PG_A | PG_M; } - pmap_resident_count_inc(pmap, 1); - counter_u64_add(pt_page_count, 1); - return (m); } @@ -4681,16 +4720,12 @@ pmap_release(pmap_t pmap) pmap->pm_pmltop[LMSPML4I + i] = 0; } - vm_page_unwire_noq(m); - vm_page_free_zero(m); - counter_u64_add(pt_page_count, -1); + pmap_free_pt_page(NULL, m, true); if (pmap->pm_pmltopu != NULL) { m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pmap-> pm_pmltopu)); - vm_page_unwire_noq(m); - vm_page_free(m); - counter_u64_add(pt_page_count, -1); + pmap_free_pt_page(NULL, m, false); } if (pmap->pm_type == PT_X86 && (cpu_stdext_feature2 & CPUID_STDEXT2_PKU) != 0) @@ -4799,14 +4834,11 @@ pmap_growkernel(vm_offset_t addr) pdpe = pmap_pdpe(kernel_pmap, kernel_vm_end); if ((*pdpe & X86_PG_V) == 0) { /* We need a new PDP entry */ - nkpg = vm_page_alloc(NULL, kernel_vm_end >> PDPSHIFT, - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO); + nkpg = pmap_alloc_pt_page(kernel_pmap, + kernel_vm_end >> PDPSHIFT, VM_ALLOC_WIRED | + VM_ALLOC_INTERRUPT | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - pmap_zero_page(nkpg); - counter_u64_add(pt_page_count, 1); paddr = VM_PAGE_TO_PHYS(nkpg); *pdpe = (pdp_entry_t)(paddr | X86_PG_V | X86_PG_RW | X86_PG_A | X86_PG_M); @@ -4822,14 +4854,11 @@ pmap_growkernel(vm_offset_t addr) continue; } - nkpg = vm_page_alloc(NULL, pmap_pde_pindex(kernel_vm_end), - VM_ALLOC_INTERRUPT | VM_ALLOC_NOOBJ | VM_ALLOC_WIRED | - VM_ALLOC_ZERO); + nkpg = pmap_alloc_pt_page(kernel_pmap, + pmap_pde_pindex(kernel_vm_end), VM_ALLOC_WIRED | + VM_ALLOC_INTERRUPT | VM_ALLOC_ZERO); if (nkpg == NULL) panic("pmap_growkernel: no memory to grow kernel"); - if ((nkpg->flags & PG_ZERO) == 0) - pmap_zero_page(nkpg); - counter_u64_add(pt_page_count, 1); paddr = VM_PAGE_TO_PHYS(nkpg); newpdir = paddr | X86_PG_V | X86_PG_RW | X86_PG_A | X86_PG_M; pde_store(pde, newpdir); @@ -5070,7 +5099,7 @@ reclaim_pv_chunk_domain(pmap_t locked_pmap, struct rwlock **lockp, int domain) goto next_chunk; } /* Every freed mapping is for a 4 KB page. */ - pmap_resident_count_dec(pmap, freed); + pmap_resident_count_adj(pmap, -freed); PV_STAT(counter_u64_add(pv_entry_frees, freed)); PV_STAT(counter_u64_add(pv_entry_spare, freed)); PV_STAT(counter_u64_add(pv_entry_count, -freed)); @@ -5746,9 +5775,9 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, * priority (VM_ALLOC_INTERRUPT). Otherwise, the * priority is normal. */ - mpte = vm_page_alloc(NULL, pmap_pde_pindex(va), + mpte = pmap_alloc_pt_page(pmap, pmap_pde_pindex(va), (in_kernel ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED); + VM_ALLOC_WIRED); /* * If the allocation of the new page table page fails, @@ -5759,12 +5788,8 @@ pmap_demote_pde_locked(pmap_t pmap, pd_entry_t *pde, vm_offset_t va, return (FALSE); } - counter_u64_add(pt_page_count, 1); - - if (!in_kernel) { + if (!in_kernel) mpte->ref_count = NPTEPG; - pmap_resident_count_inc(pmap, 1); - } } mptepa = VM_PAGE_TO_PHYS(mpte); firstpte = (pt_entry_t *)PHYS_TO_DMAP(mptepa); @@ -5897,7 +5922,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, pmap->pm_stats.wired_count -= NBPDR / PAGE_SIZE; if ((oldpde & PG_G) != 0) pmap_invalidate_pde_page(kernel_pmap, sva, oldpde); - pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE); + pmap_resident_count_adj(pmap, -NBPDR / PAGE_SIZE); if (oldpde & PG_MANAGED) { CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, oldpde & PG_PS_FRAME); pvh = pa_to_pvh(oldpde & PG_PS_FRAME); @@ -5922,7 +5947,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva, if (mpte != NULL) { KASSERT(mpte->valid == VM_PAGE_BITS_ALL, ("pmap_remove_pde: pte page not promoted")); - pmap_resident_count_dec(pmap, 1); + pmap_resident_count_adj(pmap, -1); KASSERT(mpte->ref_count == NPTEPG, ("pmap_remove_pde: pte page ref count error")); mpte->ref_count = 0; @@ -5951,7 +5976,7 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t va, oldpte = pte_load_clear(ptq); if (oldpte & PG_W) pmap->pm_stats.wired_count -= 1; - pmap_resident_count_dec(pmap, 1); + pmap_resident_count_adj(pmap, -1); if (oldpte & PG_MANAGED) { m = PHYS_TO_VM_PAGE(oldpte & PG_FRAME); if ((oldpte & (PG_M | PG_RW)) == (PG_M | PG_RW)) @@ -6121,7 +6146,7 @@ pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) MPASS((*pdpe & (PG_MANAGED | PG_G)) == 0); anyvalid = 1; *pdpe = 0; - pmap_resident_count_dec(pmap, NBPDP / PAGE_SIZE); + pmap_resident_count_adj(pmap, -NBPDP / PAGE_SIZE); mt = PHYS_TO_VM_PAGE(*pmap_pml4e(pmap, sva) & PG_FRAME); pmap_unwire_ptp(pmap, sva, mt, &free); continue; @@ -6258,7 +6283,7 @@ retry: PG_A = pmap_accessed_bit(pmap); PG_M = pmap_modified_bit(pmap); PG_RW = pmap_rw_bit(pmap); - pmap_resident_count_dec(pmap, 1); + pmap_resident_count_adj(pmap, -1); pde = pmap_pde(pmap, pv->pv_va); KASSERT((*pde & PG_PS) == 0, ("pmap_remove_all: found" " a 2mpage in page %p's pv list", m)); @@ -6723,7 +6748,7 @@ restart: else if ((pten & PG_W) == 0 && (origpte & PG_W) != 0) pmap->pm_stats.wired_count -= pagesizes[psind] / PAGE_SIZE; if ((origpte & PG_V) == 0) - pmap_resident_count_inc(pmap, pagesizes[psind] / PAGE_SIZE); + pmap_resident_count_adj(pmap, pagesizes[psind] / PAGE_SIZE); return (KERN_SUCCESS); @@ -6957,7 +6982,7 @@ retry: */ if ((newpte & PG_W) != 0) pmap->pm_stats.wired_count++; - pmap_resident_count_inc(pmap, 1); + pmap_resident_count_adj(pmap, 1); } /* @@ -7204,7 +7229,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t newpde, u_int flags, */ if ((newpde & PG_W) != 0) pmap->pm_stats.wired_count += NBPDR / PAGE_SIZE; - pmap_resident_count_inc(pmap, NBPDR / PAGE_SIZE); + pmap_resident_count_adj(pmap, NBPDR / PAGE_SIZE); /* * Map the superpage. (This is not a promoted mapping; there will not @@ -7364,7 +7389,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, /* * Increment counters */ - pmap_resident_count_inc(pmap, 1); + pmap_resident_count_adj(pmap, 1); newpte = VM_PAGE_TO_PHYS(m) | PG_V | pmap_cache_bits(pmap, m->md.pat_mode, 0); @@ -7473,7 +7498,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, vm_object_t object, if ((*pde & PG_V) == 0) { pde_store(pde, pa | PG_PS | PG_M | PG_A | PG_U | PG_RW | PG_V); - pmap_resident_count_inc(pmap, NBPDR / PAGE_SIZE); + pmap_resident_count_adj(pmap, NBPDR / PAGE_SIZE); counter_u64_add(pmap_pde_mappings, 1); } else { /* Continue on if the PDE is already valid. */ @@ -7677,7 +7702,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, "pdpe %#lx sva %#lx eva %#lx va_next %#lx", *pdpe, addr, end_addr, va_next)); *pdpe = srcptepaddr & ~PG_W; - pmap_resident_count_inc(dst_pmap, NBPDP / PAGE_SIZE); + pmap_resident_count_adj(dst_pmap, NBPDP / PAGE_SIZE); continue; } @@ -7700,7 +7725,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr, PMAP_ENTER_NORECLAIM, &lock))) { *pde = srcptepaddr & ~PG_W; - pmap_resident_count_inc(dst_pmap, NBPDR / + pmap_resident_count_adj(dst_pmap, NBPDR / PAGE_SIZE); counter_u64_add(pmap_pde_mappings, 1); } else @@ -7747,7 +7772,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, * (referenced) bits during the copy. */ *dst_pte = ptetemp & ~(PG_W | PG_M | PG_A); - pmap_resident_count_inc(dst_pmap, 1); + pmap_resident_count_adj(dst_pmap, 1); } else { pmap_abort_ptp(dst_pmap, addr, dstmpte); goto out; @@ -8151,7 +8176,7 @@ pmap_remove_pages(pmap_t pmap) /* Mark free */ pc->pc_map[field] |= bitmask; if (superpage) { - pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE); + pmap_resident_count_adj(pmap, -NBPDR / PAGE_SIZE); pvh = pa_to_pvh(tpte & PG_PS_FRAME); TAILQ_REMOVE(&pvh->pv_list, pv, pv_next); pvh->pv_gen++; @@ -8165,14 +8190,14 @@ pmap_remove_pages(pmap_t pmap) if (mpte != NULL) { KASSERT(mpte->valid == VM_PAGE_BITS_ALL, ("pmap_remove_pages: pte page not promoted")); - pmap_resident_count_dec(pmap, 1); + pmap_resident_count_adj(pmap, -1); KASSERT(mpte->ref_count == NPTEPG, ("pmap_remove_pages: pte page reference count error")); mpte->ref_count = 0; pmap_add_delayed_free_list(mpte, &free, FALSE); } } else { - pmap_resident_count_dec(pmap, 1); + pmap_resident_count_adj(pmap, -1); TAILQ_REMOVE(&m->md.pv_list, pv, pv_next); m->md.pv_gen++; if ((m->a.flags & PGA_WRITEABLE) != 0 && @@ -9097,13 +9122,13 @@ pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe, vm_offset_t va) oldpdpe = *pdpe; KASSERT((oldpdpe & (PG_PS | PG_V)) == (PG_PS | PG_V), ("pmap_demote_pdpe: oldpdpe is missing PG_PS and/or PG_V")); - if ((pdpg = vm_page_alloc(NULL, va >> PDPSHIFT, VM_ALLOC_INTERRUPT | - VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) { + pdpg = pmap_alloc_pt_page(pmap, va >> PDPSHIFT, + VM_ALLOC_WIRED | VM_ALLOC_INTERRUPT); + if (pdpg == NULL) { CTR2(KTR_PMAP, "pmap_demote_pdpe: failure for va %#lx" " in pmap %p", va, pmap); return (FALSE); } - counter_u64_add(pt_page_count, 1); pdpgpa = VM_PAGE_TO_PHYS(pdpg); firstpde = (pd_entry_t *)PHYS_TO_DMAP(pdpgpa); newpdpe = pdpgpa | PG_M | PG_A | (oldpdpe & PG_U) | PG_RW | PG_V; @@ -10115,16 +10140,8 @@ pmap_quick_remove_page(vm_offset_t addr) static vm_page_t pmap_large_map_getptp_unlocked(void) { - vm_page_t m; - - m = vm_page_alloc(NULL, 0, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ | - VM_ALLOC_ZERO); - if (m != NULL) { - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - counter_u64_add(pt_page_count, 1); - } - return (m); + return (pmap_alloc_pt_page(kernel_pmap, 0, + VM_ALLOC_NORMAL | VM_ALLOC_ZERO)); } static vm_page_t From owner-dev-commits-src-all@freebsd.org Tue Mar 16 00:18:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA0C056CDCA for ; Tue, 16 Mar 2021 00:18: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 4Dzv5L4QD5z4gYB; Tue, 16 Mar 2021 00:18: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 8A94719DCF; Tue, 16 Mar 2021 00:18:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12G0IEm0087259; Tue, 16 Mar 2021 00:18:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G0IEnZ087258; Tue, 16 Mar 2021 00:18:14 GMT (envelope-from git) Date: Tue, 16 Mar 2021 00:18:14 GMT Message-Id: <202103160018.12G0IEnZ087258@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Philip Paeps Subject: git: a8c31603d45d - internal/admin - Welcome Ka Ho Ng (khng) as a src committer 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/internal/admin X-Git-Reftype: branch X-Git-Commit: a8c31603d45d3154080f3fa044fbf94adf98ed84 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 00:18:14 -0000 The branch internal/admin has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=a8c31603d45d3154080f3fa044fbf94adf98ed84 commit a8c31603d45d3154080f3fa044fbf94adf98ed84 Author: Philip Paeps AuthorDate: 2021-03-16 00:12:09 +0000 Commit: Philip Paeps CommitDate: 2021-03-16 00:15:51 +0000 Welcome Ka Ho Ng (khng) as a src committer Ka Ho has been working on various things, most recently on bhyve. He has been submitting patches faster than they can be reviewed. :-) Approved by: core --- access | 1 + mentors | 1 + 2 files changed, 2 insertions(+) diff --git a/access b/access index 65fdfad3e97d..5871467795b9 100644 --- a/access +++ b/access @@ -118,6 +118,7 @@ karels ken kevans kevlo +khng kib kibab kp diff --git a/mentors b/mentors index 29854eb33f15..230b606b1126 100644 --- a/mentors +++ b/mentors @@ -18,6 +18,7 @@ gordon delphij Co-mentor: emaste jceel trasz jkh rwatson kadesai ken Co-mentor: scottl, ambrisko +khng philip mjoras rstone nick philip Co-mentor: kp rajeshasp gallatin Co-mentor: vmaffione From owner-dev-commits-src-all@freebsd.org Tue Mar 16 02:44:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B73A57493D; Tue, 16 Mar 2021 02:44:37 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 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 4DzyLF275dz4sHQ; Tue, 16 Mar 2021 02:44:37 +0000 (UTC) (envelope-from danfe@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1615862677; 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=pVKqIpCHol5Q2V2RgMSjKCOIr7dnc3L4G8xm0kve/q4=; b=vDjfe7+IS3YS6P9zIxy8y3i3D6mDweWnN93dNWpDU0d62h409ZSfiVriPNg/Ft0G5Y0zKZ 1QeRnOmcdigc3xDOLWKJ4uRCZmM8zsK72FtcXgJ0XRqHefuY4nU3bRnMnIzdkC09ieBsJy Lv8w9IGCpVhhM15DzQR6YuFnYvzFF2c9srA3HAn7Rmaq9Hs8INRQa5QMfLGCyNr4JIUsZG KRYDnhLbWnLIFY7KOij9Gm966wUauzRSl8jk2oxRBbbU/gC+bA8b0HpnGEv7RZigOYADZ7 1olrNL7Q4HaS8YCAVv/qzGMHzFrDWYuDvr7Kv4o5RhDdKHnF+CmcvoGYTQu66A== Received: by freefall.freebsd.org (Postfix, from userid 1033) id 36723F06A; Tue, 16 Mar 2021 02:44:37 +0000 (UTC) Date: Tue, 16 Mar 2021 02:44:37 +0000 From: Alexey Dokuchaev To: Scott Long Cc: Kyle Evans , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project Message-ID: <20210316024437.GA60113@FreeBSD.org> References: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13F91280-2246-4A7B-BAC2-B9ABA07B561F@samsco.org> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1615862677; 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=pVKqIpCHol5Q2V2RgMSjKCOIr7dnc3L4G8xm0kve/q4=; b=m2ZHBEEBRYb6SaadBr95wIYeMVsqZn/fEPRvQ65DFy8lxLCHnpDzjaQ+O1jOAbjCeUS77O rOUHL/OAO3B4W0dgbw8BXFO3uaRpVOH/rQ1Ptwo9gTI0UWzOaH+uqa/BOiwoACvP+IIL5l m0OCQ5x3IGFbxb04PAB5fE2d5k5SS8TnnCM9KoaYZjPIflxZsKVMGj5eh6MmKNDpV2+XDF 6jvqK2VqV8OnNqlahC5dStYEzMqoGtuaTIszxbqK5HZpH3rmOQ4Zut3579a009DiHktnox 6vYY1QKuy8sYf4FiTAUSqr3GDm4cGUkAD0XBmb3EnMYgwl0HmtB0vUNtARqrRQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1615862677; a=rsa-sha256; cv=none; b=tW1xF8EKVXMA1/Zupo93DP9Swthc2PEX22Kl4At8MFMxAAErEkJOHGHbOBPeGbO38ilpim /MWh3CpsfKTloF/sAH0b6UqxXc4aWXdeWhXh/jaXBeeaLB23nCMKKV80DVUHB1YSegVgyU u2QrrPJunbegw+AEh4XHk34Bd58FhvP7zK2Ln6cG6t0/cH7uLpivnbKBYPQh6kWdn9f02D /ljJXCXta1TUHXIyFl3EBxhv5DVj7mNRfejjwy6c3GQyDq8fBEtiiuitBUqMyRrX2HG2AT IneNZuxBmrLj4Nq8mfYq9AsLfedBgBs5OOYYpZuPt8aMsBZC24P7qG267Rh/nQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 02:44:37 -0000 On Mon, Mar 15, 2021 at 08:56:56AM -0600, Scott Long wrote: > Here is the response I sent to you and Donenfeld in private. I won't > include my direct conversation with you from Slack/IRC, but I made my > concerns and objections pretty clear. This commit is quite > disappointing. FWIW, original wireguard commit seemed more disappointing to me. > - The LKML wouldn't accept this kind of submission, they'd insist > that it be broken down into consumable pieces, and that bug fixes be > considered and provided that don't rely on massive re-writes. Didn't Linux folks also refuse to accept wireguard code until it was ported from some home-grown "hey, let's do crypto stuff ourselves!" implementation to their standard kernel APIs? > - An accusation was made, tonight, to me, that the code Netgate > sponsored was not reviewed and was shoved into the tree at the last > minute. This grossly ignores the actual history to the point of > weakening my tolerance for this entire discussion. It shows a > pretty irrational bias against mmacy [...] Slightly tangential note, but my questions to mmacy@ about original wireguard commit (and ZoL, FWIW) or Phabricator comments had not been answered; I also recall reviews being closed in "not accepted" state by him. While I appreciate the heavy-lifting, developers should be ready to explain and sometimes defend their work on public forums. > - The removal of the ASM crypto bits really confuses me. But addition of the new crypto code, bypassing our crypto framework in the first place did not? Anyway, I'm really happy to see Jason's work; looks like sanity is something FreeBSD can, once again, be known for. ;-) ./danfe From owner-dev-commits-src-all@freebsd.org Tue Mar 16 06:13:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CAB557822F; Tue, 16 Mar 2021 06:13: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 4F02z21kW5z3JT2; Tue, 16 Mar 2021 06:13: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 2E7EB1E939; Tue, 16 Mar 2021 06:13: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 12G6DIIU061934; Tue, 16 Mar 2021 06:13:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DIub061933; Tue, 16 Mar 2021 06:13:18 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:18 GMT Message-Id: <202103160613.12G6DIub061933@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: b5fc9e350ce6 - main - pkgbase: Move libicp in utilities MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b5fc9e350ce6e2a60d49cf84b83ce7c0383a65cb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:18 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=b5fc9e350ce6e2a60d49cf84b83ce7c0383a65cb commit b5fc9e350ce6e2a60d49cf84b83ce7c0383a65cb Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:12:40 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:12:40 +0000 pkgbase: Move libicp in utilities libicp is used by zdb zhack zinject zstream ztest libzpool.so.2 which are all in FreeBSD-utilities. Reviewed by: bapt, emaste Differential Revision: https://reviews.freebsd.org/D29164 MFC after: 2 weeks --- cddl/lib/libicp/Makefile | 2 +- cddl/lib/libicp_rescue/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cddl/lib/libicp/Makefile b/cddl/lib/libicp/Makefile index 36858338ac6b..253b252bc2d4 100644 --- a/cddl/lib/libicp/Makefile +++ b/cddl/lib/libicp/Makefile @@ -2,7 +2,7 @@ .PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp -PACKAGE= runtime +PACKAGE= utilities LIB= icp LIBADD= diff --git a/cddl/lib/libicp_rescue/Makefile b/cddl/lib/libicp_rescue/Makefile index 1ebe1b0ff649..a46fd6db3877 100644 --- a/cddl/lib/libicp_rescue/Makefile +++ b/cddl/lib/libicp_rescue/Makefile @@ -2,7 +2,7 @@ .PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp -PACKAGE= runtime +PACKAGE= utilities LIB= icp_rescue LIBADD= From owner-dev-commits-src-all@freebsd.org Tue Mar 16 06:13:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60D9D578231; Tue, 16 Mar 2021 06:13: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 4F02z32KSFz3JT3; Tue, 16 Mar 2021 06:13: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 430631E93A; Tue, 16 Mar 2021 06:13: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 12G6DJIs061955; Tue, 16 Mar 2021 06:13:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DJlN061954; Tue, 16 Mar 2021 06:13:19 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:19 GMT Message-Id: <202103160613.12G6DJlN061954@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 8c3eaf244a41 - main - pkgbase: Install all BSM includes with INCS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c3eaf244a417a4ee105834410a52144206102e5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:19 -0000 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 From owner-dev-commits-src-all@freebsd.org Tue Mar 16 06:13:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2FC09577D5E; Tue, 16 Mar 2021 06:13: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 4F02z45cJlz3J9K; Tue, 16 Mar 2021 06:13: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 6D61A1EB93; Tue, 16 Mar 2021 06:13: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 12G6DKVR061974; Tue, 16 Mar 2021 06:13:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DKSB061973; Tue, 16 Mar 2021 06:13:20 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:20 GMT Message-Id: <202103160613.12G6DKSB061973@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 0594b2879588 - main - pkgbase: Install all cam includes with INCS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0594b28795883579e5300ffc3e57a1504cc43117 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:21 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=0594b28795883579e5300ffc3e57a1504cc43117 commit 0594b28795883579e5300ffc3e57a1504cc43117 Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:12:49 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:12:49 +0000 pkgbase: Install all cam includes with INCS Now they are correctly taggued and put into the -dev package Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D29166 MFC after: 2 weeks --- include/Makefile | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/include/Makefile b/include/Makefile index cf760359d2f5..d47879e11c93 100644 --- a/include/Makefile +++ b/include/Makefile @@ -38,11 +38,10 @@ 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= cam geom net net80211 netgraph netinet netinet6 \ +LDIRS= geom net net80211 netgraph netinet netinet6 \ netipsec netsmb nfs nfsclient nfsserver sys vm -LSUBDIRS= cam/ata cam/mmc cam/nvme cam/scsi \ - dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ +LSUBDIRS= dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ dev/hwpmc dev/hyperv \ dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ @@ -94,6 +93,53 @@ SECAUDIT= audit.h \ SECAUDITPACKAGE= libbsm SECAUDITDIR= ${INCLUDEDIR}/security/audit +.PATH: ${SRCTOP}/sys/cam +CAM= cam.h \ + cam_ccb.h \ + cam_compat.h \ + cam_debug.h \ + cam_iosched.h \ + cam_periph.h \ + cam_queue.h \ + cam_sim.h \ + cam_xpt.h \ + cam_xpt_internal.h \ + cam_xpt_periph.h \ + cam_xpt_sim.h +CAMDIR= ${INCLUDEDIR}/cam + +.PATH: ${SRCTOP}/sys/cam/ata +CAMATA= ata_all.h +CAMATADIR= ${INCLUDEDIR}/cam/ata + +.PATH: ${SRCTOP}/sys/cam/mmc +CAMMMC= mmc.h \ + mmc_bus.h \ + mmc_all.h +CAMMMCDIR= ${INCLUDEDIR}/cam/mmc + +.PATH: ${SRCTOP}/sys/cam/nvme +CAMNVME= nvme_all.h +CAMNVMEDIR= ${INCLUDEDIR}/cam/nvme + +.PATH: ${SRCTOP}/sys/cam/scsi +CAMSCSI= scsi_all.h \ + scsi_cd.h \ + scsi_ch.h \ + scsi_da.h \ + scsi_enc.h \ + scsi_enc_internal.h \ + scsi_iu.h \ + scsi_message.h \ + scsi_pass.h \ + scsi_pt.h \ + scsi_sa.h \ + scsi_ses.h \ + scsi_sg.h \ + scsi_targetio.h \ + smp_all.h +CAMSCSIDIR= ${INCLUDEDIR}/cam/scsi + .PATH: ${SRCTOP}/sys/fs/cd9660 FS9660= cd9660_mount.h \ cd9660_node.h \ @@ -181,6 +227,11 @@ WGDIR= ${INCLUDEDIR}/dev/if_wg INCSGROUPS= INCS \ ACPICA \ AGP \ + CAM \ + CAMATA \ + CAMMMC \ + CAMNVME \ + CAMSCSI \ CRYPTO \ EVDEV \ FS9660 \ From owner-dev-commits-src-all@freebsd.org Tue Mar 16 06:13:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9045B577D5F; Tue, 16 Mar 2021 06:13: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 4F02z66TdPz3JTQ; Tue, 16 Mar 2021 06:13: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 B11BA1ECF5; Tue, 16 Mar 2021 06:13: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 12G6DMHA062018; Tue, 16 Mar 2021 06:13:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DMgn062017; Tue, 16 Mar 2021 06:13:22 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:22 GMT Message-Id: <202103160613.12G6DMgn062017@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: c76439da012f - main - pkgbase: Remove case for runtime and jail package ucl generation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c76439da012f626a83ede2988ddd690c2f95d05c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:25 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=c76439da012f626a83ede2988ddd690c2f95d05c commit c76439da012f626a83ede2988ddd690c2f95d05c Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:12:56 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:12:56 +0000 pkgbase: Remove case for runtime and jail package ucl generation They aren't needed and produce wrong package comments : We use to have "runtime-dev package" instead of "FreeBSD Base System (Development Files)" for example Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D29168 MFC after: 2 weeks --- release/packages/generate-ucl.sh | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/release/packages/generate-ucl.sh b/release/packages/generate-ucl.sh index b3d76eb4019d..e900f9991912 100755 --- a/release/packages/generate-ucl.sh +++ b/release/packages/generate-ucl.sh @@ -44,21 +44,6 @@ main() { runtime) outname="runtime" uclfile="${uclfile}" - ;; - runtime_manuals) - outname="${origname}" - pkgdeps="runtime" - ;; - runtime_*) - outname="${origname}" - uclfile="${outname##*}${uclfile}" - pkgdeps="runtime" - _descr="$(make -C ${srctree}/release/packages -f Makefile.package -V ${outname}_DESCR)" - ;; - jail_*) - outname="${origname}" - uclfile="${outname##*}${uclfile}" - pkgdeps="runtime" _descr="$(make -C ${srctree}/release/packages -f Makefile.package -V ${outname}_DESCR)" ;; *_lib32_dev) From owner-dev-commits-src-all@freebsd.org Tue Mar 16 06:13:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99CF7577D61; Tue, 16 Mar 2021 06:13: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 4F02z90W8Tz3J9W; Tue, 16 Mar 2021 06:13: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 D15511ED03; Tue, 16 Mar 2021 06:13: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 12G6DNnW062036; Tue, 16 Mar 2021 06:13:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DN5c062035; Tue, 16 Mar 2021 06:13:23 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:23 GMT Message-Id: <202103160613.12G6DN5c062035@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 839fc8cdf9b6 - main - include: Tag directly the last headers MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 839fc8cdf9b6bafe120e7da8a4b78950ad7295c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:25 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=839fc8cdf9b6bafe120e7da8a4b78950ad7295c4 commit 839fc8cdf9b6bafe120e7da8a4b78950ad7295c4 Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:13:00 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:13:00 +0000 include: Tag directly the last headers We cannot easily used the TAG here and we don't yet have something to install even .h from a diretory in bsd.prog.mk Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D29170 MFC after: 2 weeks --- include/Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/Makefile b/include/Makefile index e0df8571ae73..5618cfcacfa6 100644 --- a/include/Makefile +++ b/include/Makefile @@ -43,7 +43,7 @@ LDIRS= geom net net80211 netgraph netinet netinet6 \ LSUBDIRS= dev/an dev/ciss dev/filemon dev/firewire \ dev/hwpmc \ - dev/ic dev/iicbus if_wg dev/io dev/mfi dev/mmc dev/nvme \ + dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/pwm \ dev/smbus dev/speaker dev/tcp_log dev/vkbd \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ @@ -343,29 +343,29 @@ _installincludes: -name "*.h" -print -delete || true .for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} cd ${SRCTOP}/sys; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ + ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${SDESTDIR}${INCLUDEDIR}/$i .endfor cd ${SRCTOP}/sys/${MACHINE}/include; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/machine .if exists(${SRCTOP}/sys/${MACHINE}/include/pc) cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/machine/pc .endif .for _MARCH in ${_MARCHS} .if exists(${SRCTOP}/sys/${_MARCH}/include) - ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${INSTALL} -d -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 755 \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ cd ${SRCTOP}/sys/${_MARCH}/include; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH} .if exists(${SRCTOP}/sys/${_MARCH}/include/pc) - ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${INSTALL} -d -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 755 \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ - ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc .endif .endif From owner-dev-commits-src-all@freebsd.org Tue Mar 16 06:13:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBC35578480; Tue, 16 Mar 2021 06:13: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 4F02z55lDxz3JBw; Tue, 16 Mar 2021 06:13: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 A874C1EB94; Tue, 16 Mar 2021 06:13: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 12G6DLPR061996; Tue, 16 Mar 2021 06:13:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DLYL061995; Tue, 16 Mar 2021 06:13:21 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:21 GMT Message-Id: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 0006530aa14b - main - include: Remove symlink installation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0006530aa14b9df56f88df7d819fae89b115d865 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:22 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=0006530aa14b9df56f88df7d819fae89b115d865 commit 0006530aa14b9df56f88df7d819fae89b115d865 Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:12:53 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:12:53 +0000 include: Remove symlink installation headers could be installed as symlink to the source tree instead of copies. Remove the possibility to do that. This make the makefile easier to read and to maintain and also don't duplicate code. While here remove some directories from LSBUDIRS as we already install them using the INCS stuff. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D29167 MFC after: 2 weeks --- include/Makefile | 117 +++++-------------------------------------------------- 1 file changed, 9 insertions(+), 108 deletions(-) diff --git a/include/Makefile b/include/Makefile index d47879e11c93..e0df8571ae73 100644 --- a/include/Makefile +++ b/include/Makefile @@ -41,11 +41,11 @@ LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ LDIRS= geom net net80211 netgraph netinet netinet6 \ netipsec netsmb nfs nfsclient nfsserver sys vm -LSUBDIRS= dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ - dev/hwpmc dev/hyperv \ - dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ - dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ - dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ +LSUBDIRS= dev/an dev/ciss dev/filemon dev/firewire \ + dev/hwpmc \ + dev/ic dev/iicbus if_wg dev/io dev/mfi dev/mmc dev/nvme \ + dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/pwm \ + dev/smbus dev/speaker dev/tcp_log dev/vkbd \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ fs/procfs fs/smbfs fs/udf fs/unionfs \ geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ @@ -295,13 +295,6 @@ LSUBDIRS+= dev/usb _dev_powermac_nvram= dev/powermac_nvram .endif -# Define SHARED to indicate whether you want symbolic links to the system -# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is -# probably only useful for developers and should be avoided if you do not -# wish to tie your /usr/include and /usr/src together. -#SHARED= symlinks -SHARED?= copies - INCS+= osreldate.h SYSDIR= ${SRCTOP}/sys @@ -332,25 +325,23 @@ _MARCHS= ${MACHINE_CPUARCH} _MARCHS+= x86 .endif -META_TARGETS+= compat -stage_includes: ${SHARED} +stage_includes: _installincludes SDESTDIR= ${SYSROOT:U${DESTDIR}} +_installincludes: # Take care of stale directory-level symlinks. # Note: The "|| true" after find is needed in case one of the directories does # not exist (yet). -compat: cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} \ crypto -maxdepth 0 -mindepth 0 -type l -print -delete || true mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ -f ${SRCTOP}/etc/mtree/BSD.include.dist \ -p ${SDESTDIR}${INCLUDEDIR} > /dev/null -copies: .PHONY .META cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \ machine machine/pc ${_MARCHS} -maxdepth 1 -mindepth 1 -type l \ -name "*.h" -print -delete || true -.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} +.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} cd ${SRCTOP}/sys; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${SDESTDIR}${INCLUDEDIR}/$i @@ -380,99 +371,9 @@ copies: .PHONY .META .endif .endfor -symlinks: .PHONY .META - @${ECHO} "Setting up symlinks to kernel source tree..." -.for i in ${LDIRS} - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i -.endfor -.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i -.endfor - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../sys/dev/acpica/%s ' acpiio.h acpi_hpet.h) \ - ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/agpreg.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \ - ${SDESTDIR}${INCLUDEDIR}/dev/evdev; - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../sys/dev/hid/%s ' hid.h hidraw.h) \ - ${SDESTDIR}${INCLUDEDIR}/dev/hid; \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/hv_snapshot.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/pcireg.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/veriexec/veriexec_ioctl.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; -.for i in ${LSUBSUBDIRS} - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i -.endfor -.if ${MK_IPFILTER} != "no" - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../%s ' sys/contrib/ipfilter/netinet/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/netinet; -.endif -.if ${MK_PF} != "no" - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; -.endif - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ - ${SDESTDIR}${INCLUDEDIR}/crypto; \ - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../%s ' sys/opencrypto/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/crypto; \ - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/machine; -.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../%s ' sys/${MACHINE}/include/pc/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/machine/pc; -.endif -.for _MARCH in ${_MARCHS} -.if exists(${SRCTOP}/sys/${_MARCH}/include) - ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../%s ' sys/${_MARCH}/include/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; -.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) - ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../%s ' sys/${_MARCH}/include/pc/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; -.endif -.endif -.endfor - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../../%s ' sys/fs/cd9660/*.h) \ - ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../sys/rpc/%s ' rpcsec_tls.h types.h) \ - ${SDESTDIR}${INCLUDEDIR}/rpc; - cd ${SRCTOP}/sys/rpc; -.if ${MK_CDDL} != "no" - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - ../../../sys/contrib/openzfs/include/sys/nvpair.h \ - ${SDESTDIR}${INCLUDEDIR}/sys -.endif -.if ${MK_MLX5TOOL} != "no" - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/mlx5/mlx5io.h \ - ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 -.endif - .include -installincludes: ${SHARED} -${SHARED}: compat +installincludes: _installincludes .if ${MACHINE} == "host" && !defined(_SKIP_BUILD) # we're here because we are building a sysroot... From owner-dev-commits-src-all@freebsd.org Tue Mar 16 06:13:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8E1585780B6; Tue, 16 Mar 2021 06:13: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 4F02z91GX4z3JFP; Tue, 16 Mar 2021 06:13: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 F19871ED04; Tue, 16 Mar 2021 06:13: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 12G6DOTw062058; Tue, 16 Mar 2021 06:13:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DO1B062057; Tue, 16 Mar 2021 06:13:24 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:24 GMT Message-Id: <202103160613.12G6DO1B062057@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 8a84b3736be1 - main - bsd.lib.mk: Add a install target for .pc files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8a84b3736be137fad05fa82441b8e5553b606966 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:26 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=8a84b3736be137fad05fa82441b8e5553b606966 commit 8a84b3736be137fad05fa82441b8e5553b606966 Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:13:03 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:13:03 +0000 bsd.lib.mk: Add a install target for .pc files That way the files are correctly taggued for pkgbase Reviewed by: bapt, emaste (both earlier version) Differential Revision: https://reviews.freebsd.org/D29171 MFC after: 2 weeks --- share/mk/bsd.lib.mk | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 9a31c72255f7..db54055b7ae0 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -449,8 +449,20 @@ _SHLINSTALLSYMLINKFLAGS:= ${SHLINSTALLSYMLINKFLAGS} _SHLINSTALLFLAGS:= ${_SHLINSTALLFLAGS${ie}} .endfor +.if defined(PCFILES) +.for pcfile in ${PCFILES} +installpcfiles: installpcfiles-${pcfile} + +installpcfiles-${pcfile}: ${pcfile} + ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},dev} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${_INSTALLFLAGS} \ + ${.ALLSRC} ${DESTDIR}${LIBDATADIR}/pkgconfig +.endfor +.endif +installpcfiles: .PHONY + .if !defined(INTERNALLIB) -realinstall: _libinstall +realinstall: _libinstall installpcfiles .ORDER: beforeinstall _libinstall _libinstall: .if defined(LIB) && !empty(LIB) && ${MK_INSTALLLIB} != "no" From owner-dev-commits-src-all@freebsd.org Tue Mar 16 06:13:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B66DB5782AE; Tue, 16 Mar 2021 06:13:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F02zC1d8xz3JTk; Tue, 16 Mar 2021 06:13: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 18D0E1ED05; Tue, 16 Mar 2021 06:13: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 12G6DPtt062080; Tue, 16 Mar 2021 06:13:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DPOE062079; Tue, 16 Mar 2021 06:13:25 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:25 GMT Message-Id: <202103160613.12G6DPOE062079@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 500f4659d7c8 - main - Convert libs with pc files to use PCFILES MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 500f4659d7c8947082dba040a1d58e7d228f8d44 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:30 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=500f4659d7c8947082dba040a1d58e7d228f8d44 commit 500f4659d7c8947082dba040a1d58e7d228f8d44 Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:13:07 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:13:07 +0000 Convert libs with pc files to use PCFILES Now the .pc ends up in the correct package (-dev) Reviewed by: bapt, emaste Differential Revision: https://reviews.freebsd.org/D29172 MFC after: 2 weeks --- lib/liblzma/Makefile | 3 +-- lib/libmagic/Makefile | 3 +-- lib/libusb/Makefile | 3 +-- lib/libz/Makefile | 3 +-- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/lib/liblzma/Makefile b/lib/liblzma/Makefile index 63424bd3dcc2..4f38ef391e4a 100644 --- a/lib/liblzma/Makefile +++ b/lib/liblzma/Makefile @@ -154,8 +154,7 @@ CFLAGS+= -DSYMBOL_VERSIONING CLEANFILES+= liblzma.pc -FILES= liblzma.pc -FILESDIR= ${LIBDATADIR}/pkgconfig +PCFILES= liblzma.pc liblzma.pc: liblzma.pc.in sed -e 's,@prefix@,/usr,g ; \ diff --git a/lib/libmagic/Makefile b/lib/libmagic/Makefile index e390ff1261c6..5f967102fe02 100644 --- a/lib/libmagic/Makefile +++ b/lib/libmagic/Makefile @@ -86,7 +86,6 @@ ${inc}: ${inc}.in sed -e 's,X.YY,${FILEVER:S,",,g:S,.,,g},g' ${.ALLSRC} > ${.TARGET} .endfor -FILES+= libmagic.pc -FILESDIR_libmagic.pc= ${LIBDATADIR}/pkgconfig +PCFILES= libmagic.pc .include diff --git a/lib/libusb/Makefile b/lib/libusb/Makefile index cf263b732c35..83c9f1ade075 100644 --- a/lib/libusb/Makefile +++ b/lib/libusb/Makefile @@ -38,8 +38,7 @@ SRCS+= libusb10_io.c CFLAGS+= -DCOMPAT_32BIT .endif -FILES= libusb-0.1.pc libusb-1.0.pc libusb-2.0.pc -FILESDIR= ${LIBDATADIR}/pkgconfig +PCFILES= libusb-0.1.pc libusb-1.0.pc libusb-2.0.pc # # Cross platform support diff --git a/lib/libz/Makefile b/lib/libz/Makefile index 48e57ccc2a1a..4ece3e3e059f 100644 --- a/lib/libz/Makefile +++ b/lib/libz/Makefile @@ -75,7 +75,6 @@ test: example minigzip (export LD_LIBRARY_PATH=. ; \ echo hello world | ./minigzip | ./minigzip -d ) -FILES= zlib.pc -FILESDIR= ${LIBDATADIR}/pkgconfig +PCFILES= zlib.pc .include From owner-dev-commits-src-all@freebsd.org Tue Mar 16 06:13:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 297D7578068; Tue, 16 Mar 2021 06:13:31 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F02zD0SXyz3JFT; Tue, 16 Mar 2021 06:13: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 321271E93B; Tue, 16 Mar 2021 06:13: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 12G6DR87062098; Tue, 16 Mar 2021 06:13:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G6DRql062097; Tue, 16 Mar 2021 06:13:27 GMT (envelope-from git) Date: Tue, 16 Mar 2021 06:13:27 GMT Message-Id: <202103160613.12G6DRql062097@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: c7e6cb9e08d6 - main - pkgbase: Add an src.conf option for splitting man pages MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c7e6cb9e08d6b51e677a9f5546b8e36d678687d0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:13:31 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=c7e6cb9e08d6b51e677a9f5546b8e36d678687d0 commit c7e6cb9e08d6b51e677a9f5546b8e36d678687d0 Author: Emmanuel Vadot AuthorDate: 2021-03-16 06:11:56 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 06:13:09 +0000 pkgbase: Add an src.conf option for splitting man pages Man pages can be big in total, add an options to split man pages in -man packages so we produce smaller packages. This is useful for small jails or mfsroot produced of pkgbase. The option is off by default. Reviewed by: bapt, Mina Galić Differential Revision: https://reviews.freebsd.org/D29169 MFC after: 2 weeks --- release/packages/generate-ucl.sh | 5 +++++ share/man/man5/src.conf.5 | 4 +++- share/mk/bsd.man.mk | 9 +++++++++ share/mk/src.opts.mk | 1 + tools/build/options/WITH_MANSPLITPKG | 2 ++ 5 files changed, 20 insertions(+), 1 deletion(-) diff --git a/release/packages/generate-ucl.sh b/release/packages/generate-ucl.sh index e900f9991912..67c10e485eb7 100755 --- a/release/packages/generate-ucl.sh +++ b/release/packages/generate-ucl.sh @@ -71,6 +71,11 @@ main() { _descr="Debugging Symbols" pkgdeps="${outname}" ;; + *_man) + outname="${outname%%_man}" + _descr="Manual Pages" + pkgdeps="${outname}" + ;; ${origname}) pkgdeps="runtime" ;; diff --git a/share/man/man5/src.conf.5 b/share/man/man5/src.conf.5 index 5d211bc1cc31..98fcc427d608 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 2, 2021 +.Dd March 16, 2021 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1099,6 +1099,8 @@ is set explicitly) .It Va WITHOUT_MANCOMPRESS Set to not to 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. .It Va WITHOUT_MAN_UTILS Set to not build utilities for manual pages, .Xr apropos 1 , diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk index 1e67928a2754..21c5fe4f2424 100644 --- a/share/mk/bsd.man.mk +++ b/share/mk/bsd.man.mk @@ -50,7 +50,11 @@ .error bsd.man.mk cannot be included directly. .endif +.if ${MK_MANSPLITPKG} == "no" MINSTALL?= ${INSTALL} ${TAG_ARGS} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} +.else +MINSTALL?= ${INSTALL} ${TAG_ARGS:D${TAG_ARGS},man} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} +.endif CATDIR= ${MANDIR:H:S/$/\/cat/} CATEXT= .cat @@ -226,8 +230,13 @@ maninstall: ${MAN} .endif # ${MK_MANCOMPRESS} == "no" .endif .for l t in ${_MANLINKS} +.if ${MK_MANSPLITPKG} == "no" rm -f ${DESTDIR}${t} ${DESTDIR}${t}${MCOMPRESS_EXT}; \ ${INSTALL_MANLINK} ${TAG_ARGS} ${DESTDIR}${l}${ZEXT} ${DESTDIR}${t}${ZEXT} +.else + rm -f ${DESTDIR}${t} ${DESTDIR}${t}${MCOMPRESS_EXT}; \ + ${INSTALL_MANLINK} ${TAG_ARGS:D${TAG_ARGS},man} ${DESTDIR}${l}${ZEXT} ${DESTDIR}${t}${ZEXT} +.endif .endfor manlint: diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 619aa8f4a1d8..949dfece43e4 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -207,6 +207,7 @@ __DEFAULT_NO_OPTIONS = \ LOADER_VERBOSE \ LOADER_VERIEXEC_PASS_MANIFEST \ MALLOC_PRODUCTION \ + MANSPLITPKG \ OFED_EXTRA \ OPENLDAP \ REPRODUCIBLE_BUILD \ diff --git a/tools/build/options/WITH_MANSPLITPKG b/tools/build/options/WITH_MANSPLITPKG new file mode 100644 index 000000000000..122da24e0bb4 --- /dev/null +++ b/tools/build/options/WITH_MANSPLITPKG @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to split man pages into their own packages during make package. From owner-dev-commits-src-all@freebsd.org Tue Mar 16 06:52:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A620E5793AB; Tue, 16 Mar 2021 06:52:22 +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 4F03r61nrGz3N1S; Tue, 16 Mar 2021 06:52: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 12G6q801080785 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 16 Mar 2021 08:52:11 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 12G6q801080785 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 12G6q7j1080784; Tue, 16 Mar 2021 08:52:07 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 16 Mar 2021 08:52:07 +0200 From: Konstantin Belousov To: Emmanuel Vadot Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0006530aa14b - main - include: Remove symlink installation Message-ID: References: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202103160613.12G6DLYL061995@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: 4F03r61nrGz3N1S X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 06:52:22 -0000 On Tue, Mar 16, 2021 at 06:13:21AM +0000, Emmanuel Vadot wrote: > The branch main has been updated by manu: > > URL: https://cgit.FreeBSD.org/src/commit/?id=0006530aa14b9df56f88df7d819fae89b115d865 > > commit 0006530aa14b9df56f88df7d819fae89b115d865 > Author: Emmanuel Vadot > AuthorDate: 2021-03-16 06:12:53 +0000 > Commit: Emmanuel Vadot > CommitDate: 2021-03-16 06:12:53 +0000 > > include: Remove symlink installation > > headers could be installed as symlink to the source tree instead of copies. > Remove the possibility to do that. > This make the makefile easier to read and to maintain and also don't duplicate > code. > > While here remove some directories from LSBUDIRS as we already install them using > the INCS stuff. This might make Makefiles easier to read, but also it makes practically very hard to develop rtld/libc/libthr. After any system header modification, full buildworld or at least kernel-toolchain run is required to get buildenv populated with the new headers. > > Reviewed by: bapt > Differential Revision: https://reviews.freebsd.org/D29167 > MFC after: 2 weeks > --- > include/Makefile | 117 +++++-------------------------------------------------- > 1 file changed, 9 insertions(+), 108 deletions(-) > > diff --git a/include/Makefile b/include/Makefile > index d47879e11c93..e0df8571ae73 100644 > --- a/include/Makefile > +++ b/include/Makefile > @@ -41,11 +41,11 @@ LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ > LDIRS= geom net net80211 netgraph netinet netinet6 \ > netipsec netsmb nfs nfsclient nfsserver sys vm > > -LSUBDIRS= dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ > - dev/hwpmc dev/hyperv \ > - dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ > - dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ > - dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ > +LSUBDIRS= dev/an dev/ciss dev/filemon dev/firewire \ > + dev/hwpmc \ > + dev/ic dev/iicbus if_wg dev/io dev/mfi dev/mmc dev/nvme \ > + dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/pwm \ > + dev/smbus dev/speaker dev/tcp_log dev/vkbd \ > fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ > fs/procfs fs/smbfs fs/udf fs/unionfs \ > geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ > @@ -295,13 +295,6 @@ LSUBDIRS+= dev/usb > _dev_powermac_nvram= dev/powermac_nvram > .endif > > -# Define SHARED to indicate whether you want symbolic links to the system > -# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is > -# probably only useful for developers and should be avoided if you do not > -# wish to tie your /usr/include and /usr/src together. > -#SHARED= symlinks > -SHARED?= copies > - > INCS+= osreldate.h > > SYSDIR= ${SRCTOP}/sys > @@ -332,25 +325,23 @@ _MARCHS= ${MACHINE_CPUARCH} > _MARCHS+= x86 > .endif > > -META_TARGETS+= compat > -stage_includes: ${SHARED} > +stage_includes: _installincludes > SDESTDIR= ${SYSROOT:U${DESTDIR}} > > +_installincludes: > # Take care of stale directory-level symlinks. > # Note: The "|| true" after find is needed in case one of the directories does > # not exist (yet). > -compat: > cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} \ > crypto -maxdepth 0 -mindepth 0 -type l -print -delete || true > mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ > -f ${SRCTOP}/etc/mtree/BSD.include.dist \ > -p ${SDESTDIR}${INCLUDEDIR} > /dev/null > > -copies: .PHONY .META > cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \ > machine machine/pc ${_MARCHS} -maxdepth 1 -mindepth 1 -type l \ > -name "*.h" -print -delete || true > -.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} > +.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} > cd ${SRCTOP}/sys; \ > ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ > ${SDESTDIR}${INCLUDEDIR}/$i > @@ -380,99 +371,9 @@ copies: .PHONY .META > .endif > .endfor > > -symlinks: .PHONY .META > - @${ECHO} "Setting up symlinks to kernel source tree..." > -.for i in ${LDIRS} > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i > -.endfor > -.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i > -.endfor > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../sys/dev/acpica/%s ' acpiio.h acpi_hpet.h) \ > - ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/agpreg.h \ > - ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \ > - ${SDESTDIR}${INCLUDEDIR}/dev/evdev; > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../sys/dev/hid/%s ' hid.h hidraw.h) \ > - ${SDESTDIR}${INCLUDEDIR}/dev/hid; \ > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \ > - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/hv_snapshot.h \ > - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/pcireg.h \ > - ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/veriexec/veriexec_ioctl.h \ > - ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; > -.for i in ${LSUBSUBDIRS} > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i > -.endfor > -.if ${MK_IPFILTER} != "no" > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../%s ' sys/contrib/ipfilter/netinet/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/netinet; > -.endif > -.if ${MK_PF} != "no" > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; > -.endif > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ > - ${SDESTDIR}${INCLUDEDIR}/crypto; \ > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../%s ' sys/opencrypto/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/crypto; \ > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/machine; > -.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../%s ' sys/${MACHINE}/include/pc/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/machine/pc; > -.endif > -.for _MARCH in ${_MARCHS} > -.if exists(${SRCTOP}/sys/${_MARCH}/include) > - ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../%s ' sys/${_MARCH}/include/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; > -.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) > - ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../%s ' sys/${_MARCH}/include/pc/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; > -.endif > -.endif > -.endfor > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../../%s ' sys/fs/cd9660/*.h) \ > - ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - $$(printf '../../../sys/rpc/%s ' rpcsec_tls.h types.h) \ > - ${SDESTDIR}${INCLUDEDIR}/rpc; > - cd ${SRCTOP}/sys/rpc; > -.if ${MK_CDDL} != "no" > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > - ../../../sys/contrib/openzfs/include/sys/nvpair.h \ > - ${SDESTDIR}${INCLUDEDIR}/sys > -.endif > -.if ${MK_MLX5TOOL} != "no" > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/mlx5/mlx5io.h \ > - ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 > -.endif > - > .include > > -installincludes: ${SHARED} > -${SHARED}: compat > +installincludes: _installincludes > > .if ${MACHINE} == "host" && !defined(_SKIP_BUILD) > # we're here because we are building a sysroot... From owner-dev-commits-src-all@freebsd.org Tue Mar 16 07:12:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59E8C579C91; Tue, 16 Mar 2021 07:12:24 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F04HC6Dlhz3NgR; Tue, 16 Mar 2021 07:12:23 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1615878735; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GlekNwgD7uv5TyJVnItGZl5P8UZUIPPiNduSlvkIB7s=; b=qvGYJyPjdXhlZ5Q9MnIy7X/LrCBoApbqqmBECeCa9OdhqaNA23EWUKhBsaAl5tLLiVErGu BN7Bshcb9l0DOhSfMo5wDVztkHbYDwIYv5DRs4+X4rRPy7id4J8xg7GxgAvP/t8Ka9x1kf Oosw1GiKCBsAW43YQ+sXC1HZ0AvC3Lo= Received: from amy (lfbn-idf2-1-644-4.w86-247.abo.wanadoo.fr [86.247.100.4]) by mx.blih.net (OpenSMTPD) with ESMTPSA id de9d1ed8 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 16 Mar 2021 07:12:15 +0000 (UTC) Date: Tue, 16 Mar 2021 08:12:14 +0100 From: Emmanuel Vadot To: Konstantin Belousov Cc: Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0006530aa14b - main - include: Remove symlink installation Message-Id: <20210316081214.0ba83981a37b8b3b9e5589bd@bidouilliste.com> In-Reply-To: References: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4F04HC6Dlhz3NgR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 07:12:24 -0000 On Tue, 16 Mar 2021 08:52:07 +0200 Konstantin Belousov wrote: > On Tue, Mar 16, 2021 at 06:13:21AM +0000, Emmanuel Vadot wrote: > > The branch main has been updated by manu: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=0006530aa14b9df56f88df7d819fae89b115d865 > > > > commit 0006530aa14b9df56f88df7d819fae89b115d865 > > Author: Emmanuel Vadot > > AuthorDate: 2021-03-16 06:12:53 +0000 > > Commit: Emmanuel Vadot > > CommitDate: 2021-03-16 06:12:53 +0000 > > > > include: Remove symlink installation > > > > headers could be installed as symlink to the source tree instead of copies. > > Remove the possibility to do that. > > This make the makefile easier to read and to maintain and also don't duplicate > > code. > > > > While here remove some directories from LSBUDIRS as we already install them using > > the INCS stuff. > > This might make Makefiles easier to read, but also it makes practically > very hard to develop rtld/libc/libthr. After any system header > modification, full buildworld or at least kernel-toolchain run is > required to get buildenv populated with the new headers. Can you share what you did before so I can cook a patch that restore this behavior in a better way than it was done before ? Thanks, > > > > Reviewed by: bapt > > Differential Revision: https://reviews.freebsd.org/D29167 > > MFC after: 2 weeks > > --- > > include/Makefile | 117 +++++-------------------------------------------------- > > 1 file changed, 9 insertions(+), 108 deletions(-) > > > > diff --git a/include/Makefile b/include/Makefile > > index d47879e11c93..e0df8571ae73 100644 > > --- a/include/Makefile > > +++ b/include/Makefile > > @@ -41,11 +41,11 @@ LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ > > LDIRS= geom net net80211 netgraph netinet netinet6 \ > > netipsec netsmb nfs nfsclient nfsserver sys vm > > > > -LSUBDIRS= dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ > > - dev/hwpmc dev/hyperv \ > > - dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ > > - dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ > > - dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ > > +LSUBDIRS= dev/an dev/ciss dev/filemon dev/firewire \ > > + dev/hwpmc \ > > + dev/ic dev/iicbus if_wg dev/io dev/mfi dev/mmc dev/nvme \ > > + dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/pwm \ > > + dev/smbus dev/speaker dev/tcp_log dev/vkbd \ > > fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ > > fs/procfs fs/smbfs fs/udf fs/unionfs \ > > geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ > > @@ -295,13 +295,6 @@ LSUBDIRS+= dev/usb > > _dev_powermac_nvram= dev/powermac_nvram > > .endif > > > > -# Define SHARED to indicate whether you want symbolic links to the system > > -# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is > > -# probably only useful for developers and should be avoided if you do not > > -# wish to tie your /usr/include and /usr/src together. > > -#SHARED= symlinks > > -SHARED?= copies > > - > > INCS+= osreldate.h > > > > SYSDIR= ${SRCTOP}/sys > > @@ -332,25 +325,23 @@ _MARCHS= ${MACHINE_CPUARCH} > > _MARCHS+= x86 > > .endif > > > > -META_TARGETS+= compat > > -stage_includes: ${SHARED} > > +stage_includes: _installincludes > > SDESTDIR= ${SYSROOT:U${DESTDIR}} > > > > +_installincludes: > > # Take care of stale directory-level symlinks. > > # Note: The "|| true" after find is needed in case one of the directories does > > # not exist (yet). > > -compat: > > cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} \ > > crypto -maxdepth 0 -mindepth 0 -type l -print -delete || true > > mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ > > -f ${SRCTOP}/etc/mtree/BSD.include.dist \ > > -p ${SDESTDIR}${INCLUDEDIR} > /dev/null > > > > -copies: .PHONY .META > > cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \ > > machine machine/pc ${_MARCHS} -maxdepth 1 -mindepth 1 -type l \ > > -name "*.h" -print -delete || true > > -.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} > > +.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} > > cd ${SRCTOP}/sys; \ > > ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ > > ${SDESTDIR}${INCLUDEDIR}/$i > > @@ -380,99 +371,9 @@ copies: .PHONY .META > > .endif > > .endfor > > > > -symlinks: .PHONY .META > > - @${ECHO} "Setting up symlinks to kernel source tree..." > > -.for i in ${LDIRS} > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i > > -.endfor > > -.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i > > -.endfor > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../sys/dev/acpica/%s ' acpiio.h acpi_hpet.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/agpreg.h \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/evdev; > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../sys/dev/hid/%s ' hid.h hidraw.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/hid; \ > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/hv_snapshot.h \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/pcireg.h \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/veriexec/veriexec_ioctl.h \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; > > -.for i in ${LSUBSUBDIRS} > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i > > -.endfor > > -.if ${MK_IPFILTER} != "no" > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../%s ' sys/contrib/ipfilter/netinet/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/netinet; > > -.endif > > -.if ${MK_PF} != "no" > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; > > -.endif > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ > > - ${SDESTDIR}${INCLUDEDIR}/crypto; \ > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../%s ' sys/opencrypto/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/crypto; \ > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/machine; > > -.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../%s ' sys/${MACHINE}/include/pc/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/machine/pc; > > -.endif > > -.for _MARCH in ${_MARCHS} > > -.if exists(${SRCTOP}/sys/${_MARCH}/include) > > - ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ > > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../%s ' sys/${_MARCH}/include/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; > > -.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) > > - ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ > > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../%s ' sys/${_MARCH}/include/pc/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; > > -.endif > > -.endif > > -.endfor > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../../%s ' sys/fs/cd9660/*.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ > > - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - $$(printf '../../../sys/rpc/%s ' rpcsec_tls.h types.h) \ > > - ${SDESTDIR}${INCLUDEDIR}/rpc; > > - cd ${SRCTOP}/sys/rpc; > > -.if ${MK_CDDL} != "no" > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ > > - ../../../sys/contrib/openzfs/include/sys/nvpair.h \ > > - ${SDESTDIR}${INCLUDEDIR}/sys > > -.endif > > -.if ${MK_MLX5TOOL} != "no" > > - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/mlx5/mlx5io.h \ > > - ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 > > -.endif > > - > > .include > > > > -installincludes: ${SHARED} > > -${SHARED}: compat > > +installincludes: _installincludes > > > > .if ${MACHINE} == "host" && !defined(_SKIP_BUILD) > > # we're here because we are building a sysroot... -- Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Tue Mar 16 07:17:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 147F0579C35; Tue, 16 Mar 2021 07:17:48 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) 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 4F04PR5GXbz3NyX; Tue, 16 Mar 2021 07:17:47 +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 12G7HaLM086786 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 16 Mar 2021 09:17:39 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 12G7HaLM086786 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 12G7Ha7K086785; Tue, 16 Mar 2021 09:17:36 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 16 Mar 2021 09:17:36 +0200 From: Konstantin Belousov To: Emmanuel Vadot Cc: Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0006530aa14b - main - include: Remove symlink installation Message-ID: References: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> <20210316081214.0ba83981a37b8b3b9e5589bd@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210316081214.0ba83981a37b8b3b9e5589bd@bidouilliste.com> 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: 4F04PR5GXbz3NyX X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 07:17:48 -0000 On Tue, Mar 16, 2021 at 08:12:14AM +0100, Emmanuel Vadot wrote: > On Tue, 16 Mar 2021 08:52:07 +0200 > Konstantin Belousov wrote: > > > On Tue, Mar 16, 2021 at 06:13:21AM +0000, Emmanuel Vadot wrote: > > > The branch main has been updated by manu: > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=0006530aa14b9df56f88df7d819fae89b115d865 > > > > > > commit 0006530aa14b9df56f88df7d819fae89b115d865 > > > Author: Emmanuel Vadot > > > AuthorDate: 2021-03-16 06:12:53 +0000 > > > Commit: Emmanuel Vadot > > > CommitDate: 2021-03-16 06:12:53 +0000 > > > > > > include: Remove symlink installation > > > > > > headers could be installed as symlink to the source tree instead of copies. > > > Remove the possibility to do that. > > > This make the makefile easier to read and to maintain and also don't duplicate > > > code. > > > > > > While here remove some directories from LSBUDIRS as we already install them using > > > the INCS stuff. > > > > This might make Makefiles easier to read, but also it makes practically > > very hard to develop rtld/libc/libthr. After any system header > > modification, full buildworld or at least kernel-toolchain run is > > required to get buildenv populated with the new headers. > > Can you share what you did before so I can cook a patch that restore > this behavior in a better way than it was done before ? I did $ make buildworld <- this was done relatively irregularly $ make buildenv [Edit whatever I needed, typically in sys/sys and libexec/rtld-elf] $ cd libexec/rtld-elf $ make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all [Check built ld-elf.so.1, more edits] $ make ... Now, if I modify anything in sys/, I have to repopuate staged headers in the obj directory of buildworld. From owner-dev-commits-src-all@freebsd.org Tue Mar 16 07:39:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6666457A4AA; Tue, 16 Mar 2021 07:39:59 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F04v26YMkz3QHm; Tue, 16 Mar 2021 07:39:58 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1615880397; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v3BAIJ4GR2kRWqB6mNHE9q2IJwz6Gj3mgNxmUB/H9gk=; b=WQjRUQhiUnQgC/LvLQBTPG5ihL9Qorthbxs5yNVgm8XQEwsriGWWbQgHYQhuNRlAx5IFri hZzvqU6S1mPVA5w0i0DLMRXEUXboxckpPDbWsg1CSLR3Thx3p1HGOJsLnJmInh4fR/SUwB tbYLVU61pi/cTfy/w2bCoLXgEuDACeA= Received: from amy (lfbn-idf2-1-644-4.w86-247.abo.wanadoo.fr [86.247.100.4]) by mx.blih.net (OpenSMTPD) with ESMTPSA id edd5a809 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 16 Mar 2021 07:39:57 +0000 (UTC) Date: Tue, 16 Mar 2021 08:39:57 +0100 From: Emmanuel Vadot To: Konstantin Belousov Cc: Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0006530aa14b - main - include: Remove symlink installation Message-Id: <20210316083957.540d3978e5b0160db2104fa1@bidouilliste.com> In-Reply-To: References: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> <20210316081214.0ba83981a37b8b3b9e5589bd@bidouilliste.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4F04v26YMkz3QHm X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 07:39:59 -0000 On Tue, 16 Mar 2021 09:17:36 +0200 Konstantin Belousov wrote: > On Tue, Mar 16, 2021 at 08:12:14AM +0100, Emmanuel Vadot wrote: > > On Tue, 16 Mar 2021 08:52:07 +0200 > > Konstantin Belousov wrote: > > > > > On Tue, Mar 16, 2021 at 06:13:21AM +0000, Emmanuel Vadot wrote: > > > > The branch main has been updated by manu: > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=0006530aa14b9df56f88df7d819fae89b115d865 > > > > > > > > commit 0006530aa14b9df56f88df7d819fae89b115d865 > > > > Author: Emmanuel Vadot > > > > AuthorDate: 2021-03-16 06:12:53 +0000 > > > > Commit: Emmanuel Vadot > > > > CommitDate: 2021-03-16 06:12:53 +0000 > > > > > > > > include: Remove symlink installation > > > > > > > > headers could be installed as symlink to the source tree instead of copies. > > > > Remove the possibility to do that. > > > > This make the makefile easier to read and to maintain and also don't duplicate > > > > code. > > > > > > > > While here remove some directories from LSBUDIRS as we already install them using > > > > the INCS stuff. > > > > > > This might make Makefiles easier to read, but also it makes practically > > > very hard to develop rtld/libc/libthr. After any system header > > > modification, full buildworld or at least kernel-toolchain run is > > > required to get buildenv populated with the new headers. > > > > Can you share what you did before so I can cook a patch that restore > > this behavior in a better way than it was done before ? > > I did > $ make buildworld <- this was done relatively irregularly > $ make buildenv > [Edit whatever I needed, typically in sys/sys and libexec/rtld-elf] > $ cd libexec/rtld-elf > $ make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all > [Check built ld-elf.so.1, more edits] > $ make ... > > Now, if I modify anything in sys/, I have to repopuate staged headers in > the obj directory of buildworld. Right ok, I've missed that SHARED=symlinks was used in Makefile.inc1, I'll revert and redo a better patch. -- Emmanuel Vadot From owner-dev-commits-src-all@freebsd.org Tue Mar 16 07:41:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61B4A57A5C0; Tue, 16 Mar 2021 07:41: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 4F04ws2Lwgz3QXT; Tue, 16 Mar 2021 07:41: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 43A0A1FD91; Tue, 16 Mar 2021 07:41: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 12G7fXq1079646; Tue, 16 Mar 2021 07:41:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G7fXn7079645; Tue, 16 Mar 2021 07:41:33 GMT (envelope-from git) Date: Tue, 16 Mar 2021 07:41:33 GMT Message-Id: <202103160741.12G7fXn7079645@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 35b6d9b65e54 - main - Revert "include: Tag directly the last headers" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 35b6d9b65e54ac4ce50c380d8e5915a0d2f32346 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 07:41:33 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=35b6d9b65e54ac4ce50c380d8e5915a0d2f32346 commit 35b6d9b65e54ac4ce50c380d8e5915a0d2f32346 Author: Emmanuel Vadot AuthorDate: 2021-03-16 07:40:54 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 07:40:54 +0000 Revert "include: Tag directly the last headers" This reverts commit 839fc8cdf9b6bafe120e7da8a4b78950ad7295c4. --- include/Makefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/include/Makefile b/include/Makefile index 5618cfcacfa6..e0df8571ae73 100644 --- a/include/Makefile +++ b/include/Makefile @@ -43,7 +43,7 @@ LDIRS= geom net net80211 netgraph netinet netinet6 \ LSUBDIRS= dev/an dev/ciss dev/filemon dev/firewire \ dev/hwpmc \ - dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ + dev/ic dev/iicbus if_wg dev/io dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/pwm \ dev/smbus dev/speaker dev/tcp_log dev/vkbd \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ @@ -343,29 +343,29 @@ _installincludes: -name "*.h" -print -delete || true .for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} cd ${SRCTOP}/sys; \ - ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ + ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${SDESTDIR}${INCLUDEDIR}/$i .endfor cd ${SRCTOP}/sys/${MACHINE}/include; \ - ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/machine .if exists(${SRCTOP}/sys/${MACHINE}/include/pc) cd ${SRCTOP}/sys/${MACHINE}/include/pc; \ - ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/machine/pc .endif .for _MARCH in ${_MARCHS} .if exists(${SRCTOP}/sys/${_MARCH}/include) - ${INSTALL} -d -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ cd ${SRCTOP}/sys/${_MARCH}/include; \ - ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH} .if exists(${SRCTOP}/sys/${_MARCH}/include/pc) - ${INSTALL} -d -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${INSTALL} -d ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 755 \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ cd ${SRCTOP}/sys/${_MARCH}/include/pc; \ - ${INSTALL} -C -T package=runtime,dev -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ + ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 *.h \ ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc .endif .endif From owner-dev-commits-src-all@freebsd.org Tue Mar 16 07:41:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8437557A5C5; Tue, 16 Mar 2021 07:41: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 4F04wt3HH6z3QTx; Tue, 16 Mar 2021 07:41: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 63FA21FBAF; Tue, 16 Mar 2021 07:41: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 12G7fYpt079665; Tue, 16 Mar 2021 07:41:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12G7fYRH079664; Tue, 16 Mar 2021 07:41:34 GMT (envelope-from git) Date: Tue, 16 Mar 2021 07:41:34 GMT Message-Id: <202103160741.12G7fYRH079664@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 060f0a17bbf5 - main - Revert "include: Remove symlink installation" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 060f0a17bbf5392c16fbb7be4c834d3f27f60ad0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 07:41:34 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=060f0a17bbf5392c16fbb7be4c834d3f27f60ad0 commit 060f0a17bbf5392c16fbb7be4c834d3f27f60ad0 Author: Emmanuel Vadot AuthorDate: 2021-03-16 07:40:59 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-16 07:40:59 +0000 Revert "include: Remove symlink installation" This reverts commit 0006530aa14b9df56f88df7d819fae89b115d865. --- include/Makefile | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 108 insertions(+), 9 deletions(-) diff --git a/include/Makefile b/include/Makefile index e0df8571ae73..d47879e11c93 100644 --- a/include/Makefile +++ b/include/Makefile @@ -41,11 +41,11 @@ LHDRS= aio.h errno.h fcntl.h linker_set.h poll.h stdatomic.h stdint.h \ LDIRS= geom net net80211 netgraph netinet netinet6 \ netipsec netsmb nfs nfsclient nfsserver sys vm -LSUBDIRS= dev/an dev/ciss dev/filemon dev/firewire \ - dev/hwpmc \ - dev/ic dev/iicbus if_wg dev/io dev/mfi dev/mmc dev/nvme \ - dev/ofw dev/pbio ${_dev_powermac_nvram} dev/ppbus dev/pwm \ - dev/smbus dev/speaker dev/tcp_log dev/vkbd \ +LSUBDIRS= dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ + dev/hwpmc dev/hyperv \ + dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ + dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ + dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ fs/procfs fs/smbfs fs/udf fs/unionfs \ geom/cache geom/concat geom/eli geom/gate geom/journal geom/label \ @@ -295,6 +295,13 @@ LSUBDIRS+= dev/usb _dev_powermac_nvram= dev/powermac_nvram .endif +# Define SHARED to indicate whether you want symbolic links to the system +# source (``symlinks''), or a separate copy (``copies''). ``symlinks'' is +# probably only useful for developers and should be avoided if you do not +# wish to tie your /usr/include and /usr/src together. +#SHARED= symlinks +SHARED?= copies + INCS+= osreldate.h SYSDIR= ${SRCTOP}/sys @@ -325,23 +332,25 @@ _MARCHS= ${MACHINE_CPUARCH} _MARCHS+= x86 .endif -stage_includes: _installincludes +META_TARGETS+= compat +stage_includes: ${SHARED} SDESTDIR= ${SYSROOT:U${DESTDIR}} -_installincludes: # Take care of stale directory-level symlinks. # Note: The "|| true" after find is needed in case one of the directories does # not exist (yet). +compat: cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} machine ${_MARCHS} \ crypto -maxdepth 0 -mindepth 0 -type l -print -delete || true mtree -deU ${NO_ROOT:D-W} ${MTREE_FOLLOWS_SYMLINKS} \ -f ${SRCTOP}/etc/mtree/BSD.include.dist \ -p ${SDESTDIR}${INCLUDEDIR} > /dev/null +copies: .PHONY .META cd ${SDESTDIR}${INCLUDEDIR}; find ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} crypto \ machine machine/pc ${_MARCHS} -maxdepth 1 -mindepth 1 -type l \ -name "*.h" -print -delete || true -.for i in ${LDIRS} ${LSUBDIRS} ${LSUBSUBDIRS} +.for i in ${LDIRS} ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} ${LSUBSUBDIRS} cd ${SRCTOP}/sys; \ ${INSTALL} -C ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m 444 $i/*.h \ ${SDESTDIR}${INCLUDEDIR}/$i @@ -371,9 +380,99 @@ _installincludes: .endif .endfor +symlinks: .PHONY .META + @${ECHO} "Setting up symlinks to kernel source tree..." +.for i in ${LDIRS} + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i +.endfor +.for i in ${LSUBDIRS:Ndev/agp:Ndev/acpica:Ndev/evdev:Ndev/hid:Ndev/hyperv:Ndev/pci:Ndev/veriexec} + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i +.endfor + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../sys/dev/acpica/%s ' acpiio.h acpi_hpet.h) \ + ${SDESTDIR}${INCLUDEDIR}/dev/acpica; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/agp/agpreg.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/agp; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../sys/dev/evdev/%s ' input.h input-event-codes.h uinput.h) \ + ${SDESTDIR}${INCLUDEDIR}/dev/evdev; + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../sys/dev/hid/%s ' hid.h hidraw.h) \ + ${SDESTDIR}${INCLUDEDIR}/dev/hid; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/include/hyperv.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/hyperv/utilities/hv_snapshot.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/hyperv; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/pci/pcireg.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/pci; \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/veriexec/veriexec_ioctl.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/veriexec; +.for i in ${LSUBSUBDIRS} + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../../%s ' sys/$i/*.h) ${SDESTDIR}${INCLUDEDIR}/$i +.endfor +.if ${MK_IPFILTER} != "no" + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/contrib/ipfilter/netinet/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/netinet; +.endif +.if ${MK_PF} != "no" + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; +.endif + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ + ${SDESTDIR}${INCLUDEDIR}/crypto; \ + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/opencrypto/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/crypto; \ + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/machine; +.if exists(${SRCTOP}/sys/${MACHINE}/include/pc) + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/${MACHINE}/include/pc/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/machine/pc; +.endif +.for _MARCH in ${_MARCHS} +.if exists(${SRCTOP}/sys/${_MARCH}/include) + ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; \ + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../%s ' sys/${_MARCH}/include/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/${_MARCH}; +.if exists(${SRCTOP}/sys/${_MARCH}/include/pc) + ${INSTALL} -d ${TAG_ARGS:D${TAG_ARGS},dev} -o ${BINOWN} -g ${BINGRP} -m 755 \ + ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; \ + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/${_MARCH}/include/pc/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/${_MARCH}/pc; +.endif +.endif +.endfor + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../../%s ' sys/fs/cd9660/*.h) \ + ${SDESTDIR}${INCLUDEDIR}/isofs/cd9660; \ + cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + $$(printf '../../../sys/rpc/%s ' rpcsec_tls.h types.h) \ + ${SDESTDIR}${INCLUDEDIR}/rpc; + cd ${SRCTOP}/sys/rpc; +.if ${MK_CDDL} != "no" + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ + ../../../sys/contrib/openzfs/include/sys/nvpair.h \ + ${SDESTDIR}${INCLUDEDIR}/sys +.endif +.if ${MK_MLX5TOOL} != "no" + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../../sys/dev/mlx5/mlx5io.h \ + ${SDESTDIR}${INCLUDEDIR}/dev/mlx5 +.endif + .include -installincludes: _installincludes +installincludes: ${SHARED} +${SHARED}: compat .if ${MACHINE} == "host" && !defined(_SKIP_BUILD) # we're here because we are building a sysroot... From owner-dev-commits-src-all@freebsd.org Tue Mar 16 07:43:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F9D857A98F; Tue, 16 Mar 2021 07:43:44 +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 4F04zM6L7Nz3RCp; Tue, 16 Mar 2021 07:43:43 +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 12G7hZrf092827 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 16 Mar 2021 09:43:38 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 12G7hZrf092827 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 12G7hZ5N092826; Tue, 16 Mar 2021 09:43:35 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 16 Mar 2021 09:43:35 +0200 From: Konstantin Belousov To: Emmanuel Vadot Cc: Emmanuel Vadot , src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 0006530aa14b - main - include: Remove symlink installation Message-ID: References: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> <20210316081214.0ba83981a37b8b3b9e5589bd@bidouilliste.com> <20210316083957.540d3978e5b0160db2104fa1@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210316083957.540d3978e5b0160db2104fa1@bidouilliste.com> 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: 4F04zM6L7Nz3RCp X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 07:43:44 -0000 On Tue, Mar 16, 2021 at 08:39:57AM +0100, Emmanuel Vadot wrote: > On Tue, 16 Mar 2021 09:17:36 +0200 > Konstantin Belousov wrote: > > > On Tue, Mar 16, 2021 at 08:12:14AM +0100, Emmanuel Vadot wrote: > > > On Tue, 16 Mar 2021 08:52:07 +0200 > > > Konstantin Belousov wrote: > > > > > > > On Tue, Mar 16, 2021 at 06:13:21AM +0000, Emmanuel Vadot wrote: > > > > > The branch main has been updated by manu: > > > > > > > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=0006530aa14b9df56f88df7d819fae89b115d865 > > > > > > > > > > commit 0006530aa14b9df56f88df7d819fae89b115d865 > > > > > Author: Emmanuel Vadot > > > > > AuthorDate: 2021-03-16 06:12:53 +0000 > > > > > Commit: Emmanuel Vadot > > > > > CommitDate: 2021-03-16 06:12:53 +0000 > > > > > > > > > > include: Remove symlink installation > > > > > > > > > > headers could be installed as symlink to the source tree instead of copies. > > > > > Remove the possibility to do that. > > > > > This make the makefile easier to read and to maintain and also don't duplicate > > > > > code. > > > > > > > > > > While here remove some directories from LSBUDIRS as we already install them using > > > > > the INCS stuff. > > > > > > > > This might make Makefiles easier to read, but also it makes practically > > > > very hard to develop rtld/libc/libthr. After any system header > > > > modification, full buildworld or at least kernel-toolchain run is > > > > required to get buildenv populated with the new headers. > > > > > > Can you share what you did before so I can cook a patch that restore > > > this behavior in a better way than it was done before ? > > > > I did > > $ make buildworld <- this was done relatively irregularly > > $ make buildenv > > [Edit whatever I needed, typically in sys/sys and libexec/rtld-elf] > > $ cd libexec/rtld-elf > > $ make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all > > [Check built ld-elf.so.1, more edits] > > $ make ... > > > > Now, if I modify anything in sys/, I have to repopuate staged headers in > > the obj directory of buildworld. > > Right ok, I've missed that SHARED=symlinks was used in Makefile.inc1, > I'll revert and redo a better patch. Thank you. From owner-dev-commits-src-all@freebsd.org Tue Mar 16 10:11:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A25B057F4C9; Tue, 16 Mar 2021 10:11: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 4F08Fp4Dd8z3qQd; Tue, 16 Mar 2021 10:11: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 8449D21CBF; Tue, 16 Mar 2021 10:11: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 12GABQg1075799; Tue, 16 Mar 2021 10:11:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GABQTG075798; Tue, 16 Mar 2021 10:11:26 GMT (envelope-from git) Date: Tue, 16 Mar 2021 10:11:26 GMT Message-Id: <202103161011.12GABQTG075798@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: 15b82e00a164 - main - pf: pool/kpool conversion code 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: 15b82e00a1640d1b9a1d720c95f65e580be30187 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 10:11:26 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=15b82e00a1640d1b9a1d720c95f65e580be30187 commit 15b82e00a1640d1b9a1d720c95f65e580be30187 Author: Kristof Provost AuthorDate: 2021-03-11 10:37:05 +0000 Commit: Kristof Provost CommitDate: 2021-03-16 09:30:28 +0000 pf: pool/kpool conversion code stuct pf_pool and struct pf_kpool are different. We should not simply bcopy() them. Happily it turns out that their differences were all pointers, and the userspace provided pointers were overwritten by the kernel, so this did actually work correctly, but we should fix it anyway. Reviewed by: glebius MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29216 --- sys/netpfil/pf/pf_ioctl.c | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index c930a67ecf80..ce889c8d797e 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1465,6 +1465,39 @@ pf_pooladdr_to_kpooladdr(const struct pf_pooladdr *pool, strlcpy(kpool->ifname, pool->ifname, sizeof(kpool->ifname)); } +static void +pf_kpool_to_pool(const struct pf_kpool *kpool, struct pf_pool *pool) +{ + bzero(pool, sizeof(*pool)); + + bcopy(&kpool->key, &pool->key, sizeof(pool->key)); + bcopy(&kpool->counter, &pool->counter, sizeof(pool->counter)); + + pool->tblidx = kpool->tblidx; + pool->proxy_port[0] = kpool->proxy_port[0]; + pool->proxy_port[1] = kpool->proxy_port[1]; + pool->opts = kpool->opts; +} + +static int +pf_pool_to_kpool(const struct pf_pool *pool, struct pf_kpool *kpool) +{ + _Static_assert(sizeof(pool->key) == sizeof(kpool->key), ""); + _Static_assert(sizeof(pool->counter) == sizeof(kpool->counter), ""); + + bzero(kpool, sizeof(*kpool)); + + bcopy(&pool->key, &kpool->key, sizeof(kpool->key)); + bcopy(&pool->counter, &kpool->counter, sizeof(kpool->counter)); + + kpool->tblidx = pool->tblidx; + kpool->proxy_port[0] = pool->proxy_port[0]; + kpool->proxy_port[1] = pool->proxy_port[1]; + kpool->opts = pool->opts; + + return (0); +} + static void pf_krule_to_rule(const struct pf_krule *krule, struct pf_rule *rule) { @@ -1491,7 +1524,7 @@ pf_krule_to_rule(const struct pf_krule *krule, struct pf_rule *rule) strlcpy(rule->overload_tblname, krule->overload_tblname, sizeof(rule->overload_tblname)); - bcopy(&krule->rpool, &rule->rpool, sizeof(krule->rpool)); + pf_kpool_to_pool(&krule->rpool, &rule->rpool); rule->evaluations = counter_u64_fetch(krule->evaluations); for (int i = 0; i < 2; i++) { @@ -1628,7 +1661,9 @@ pf_rule_to_krule(const struct pf_rule *rule, struct pf_krule *krule) strlcpy(krule->overload_tblname, rule->overload_tblname, sizeof(rule->overload_tblname)); - bcopy(&rule->rpool, &krule->rpool, sizeof(krule->rpool)); + ret = pf_pool_to_kpool(&rule->rpool, &krule->rpool); + if (ret != 0) + return (ret); /* Don't allow userspace to set evaulations, packets or bytes. */ /* kif, anchor, overload_tbl are not copied over. */ From owner-dev-commits-src-all@freebsd.org Tue Mar 16 11:30:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37E845A94F2; Tue, 16 Mar 2021 11:30: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 4F0B1N181wz4Qn5; Tue, 16 Mar 2021 11:30: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 19EDA22AFD; Tue, 16 Mar 2021 11:30:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GBUmSD079950; Tue, 16 Mar 2021 11:30:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GBUm8Z079949; Tue, 16 Mar 2021 11:30:48 GMT (envelope-from git) Date: Tue, 16 Mar 2021 11:30:48 GMT Message-Id: <202103161130.12GBUm8Z079949@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: 54ac6f721efc - main - bhyve: virtio shares definitions between sys/dev/virtio 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: 54ac6f721efccdba5a09aa9f38be0a1c4ef6cf14 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 11:30:48 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=54ac6f721efccdba5a09aa9f38be0a1c4ef6cf14 commit 54ac6f721efccdba5a09aa9f38be0a1c4ef6cf14 Author: Ka Ho Ng AuthorDate: 2021-03-16 11:27:38 +0000 Commit: Ka Ho Ng CommitDate: 2021-03-16 11:29:39 +0000 bhyve: virtio shares definitions between sys/dev/virtio Definitions inside usr.sbin/bhyve/virtio.h are thrown away. Definitions in sys/dev/virtio are used instead. This reduces code duplication. Sponsored by: The FreeBSD Foundation Reviewed by: grehan Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D29084 --- sys/dev/virtio/virtio.h | 4 + sys/dev/virtio/virtio_endian.h | 3 + usr.sbin/bhyve/pci_virtio_9p.c | 2 +- usr.sbin/bhyve/pci_virtio_block.c | 2 +- usr.sbin/bhyve/pci_virtio_console.c | 2 +- usr.sbin/bhyve/pci_virtio_net.c | 2 +- usr.sbin/bhyve/pci_virtio_rnd.c | 2 +- usr.sbin/bhyve/pci_virtio_scsi.c | 2 +- usr.sbin/bhyve/virtio.c | 147 +++++++++++++++++------------------ usr.sbin/bhyve/virtio.h | 150 ++++++------------------------------ 10 files changed, 105 insertions(+), 211 deletions(-) diff --git a/sys/dev/virtio/virtio.h b/sys/dev/virtio/virtio.h index b22327351b43..8d32d5a8742f 100644 --- a/sys/dev/virtio/virtio.h +++ b/sys/dev/virtio/virtio.h @@ -35,6 +35,8 @@ #include #include +#ifdef _KERNEL + struct sbuf; struct vq_alloc_info; @@ -187,4 +189,6 @@ virtio_simple_probe(device_t dev, const struct virtio_pnp_match *match) return (BUS_PROBE_DEFAULT); } +#endif /* _KERNEL */ + #endif /* _VIRTIO_H_ */ diff --git a/sys/dev/virtio/virtio_endian.h b/sys/dev/virtio/virtio_endian.h index d0de299c7227..19d7fcc12079 100644 --- a/sys/dev/virtio/virtio_endian.h +++ b/sys/dev/virtio/virtio_endian.h @@ -32,6 +32,9 @@ #define _VIRTIO_ENDIAN_H_ #include +#ifndef _KERNEL +#include +#endif /* _KERNEL */ /* * VirtIO V1 (modern) uses little endian, while legacy VirtIO uses the guest's diff --git a/usr.sbin/bhyve/pci_virtio_9p.c b/usr.sbin/bhyve/pci_virtio_9p.c index 7e8542a46e05..4296ccd11c7f 100644 --- a/usr.sbin/bhyve/pci_virtio_9p.c +++ b/usr.sbin/bhyve/pci_virtio_9p.c @@ -325,7 +325,7 @@ pci_vt9p_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_9P); pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_STORAGE); - pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_9P); + pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_9P); pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix())) diff --git a/usr.sbin/bhyve/pci_virtio_block.c b/usr.sbin/bhyve/pci_virtio_block.c index 6be24ec8bcf1..00258d1993b0 100644 --- a/usr.sbin/bhyve/pci_virtio_block.c +++ b/usr.sbin/bhyve/pci_virtio_block.c @@ -533,7 +533,7 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_BLOCK); pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_STORAGE); - pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_BLOCK); + pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_BLOCK); pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); if (vi_intr_init(&sc->vbsc_vs, 1, fbsdrun_virtio_msix())) { diff --git a/usr.sbin/bhyve/pci_virtio_console.c b/usr.sbin/bhyve/pci_virtio_console.c index 133902ccb129..1911210fa046 100644 --- a/usr.sbin/bhyve/pci_virtio_console.c +++ b/usr.sbin/bhyve/pci_virtio_console.c @@ -644,7 +644,7 @@ pci_vtcon_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_CONSOLE); pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_SIMPLECOMM); - pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_CONSOLE); + pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_CONSOLE); pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); if (vi_intr_init(&sc->vsc_vs, 1, fbsdrun_virtio_msix())) diff --git a/usr.sbin/bhyve/pci_virtio_net.c b/usr.sbin/bhyve/pci_virtio_net.c index ac728b611c46..1c8af094b6dc 100644 --- a/usr.sbin/bhyve/pci_virtio_net.c +++ b/usr.sbin/bhyve/pci_virtio_net.c @@ -670,7 +670,7 @@ pci_vtnet_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_NET); pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_NETWORK); - pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_NET); + pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_NETWORK); pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); /* Link is up if we managed to open backend device. */ diff --git a/usr.sbin/bhyve/pci_virtio_rnd.c b/usr.sbin/bhyve/pci_virtio_rnd.c index 10ba9ddfbfaf..42feb7a2c4e0 100644 --- a/usr.sbin/bhyve/pci_virtio_rnd.c +++ b/usr.sbin/bhyve/pci_virtio_rnd.c @@ -190,7 +190,7 @@ pci_vtrnd_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_RANDOM); pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_CRYPTO); - pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_ENTROPY); + pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_ENTROPY); pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); if (vi_intr_init(&sc->vrsc_vs, 1, fbsdrun_virtio_msix())) diff --git a/usr.sbin/bhyve/pci_virtio_scsi.c b/usr.sbin/bhyve/pci_virtio_scsi.c index 92a3311b6924..1dd7b6ebcf0b 100644 --- a/usr.sbin/bhyve/pci_virtio_scsi.c +++ b/usr.sbin/bhyve/pci_virtio_scsi.c @@ -720,7 +720,7 @@ pci_vtscsi_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_set_cfgdata16(pi, PCIR_DEVICE, VIRTIO_DEV_SCSI); pci_set_cfgdata16(pi, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(pi, PCIR_CLASS, PCIC_STORAGE); - pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_TYPE_SCSI); + pci_set_cfgdata16(pi, PCIR_SUBDEV_0, VIRTIO_ID_SCSI); pci_set_cfgdata16(pi, PCIR_SUBVEND_0, VIRTIO_VENDOR); if (vi_intr_init(&sc->vss_vs, 1, fbsdrun_virtio_msix())) diff --git a/usr.sbin/bhyve/virtio.c b/usr.sbin/bhyve/virtio.c index f3deb72b081c..078a74b759df 100644 --- a/usr.sbin/bhyve/virtio.c +++ b/usr.sbin/bhyve/virtio.c @@ -36,6 +36,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -127,10 +129,10 @@ vi_set_io_bar(struct virtio_softc *vs, int barnum) size_t size; /* - * ??? should we use CFG0 if MSI-X is disabled? + * ??? should we use VIRTIO_PCI_CONFIG_OFF(0) if MSI-X is disabled? * Existing code did not... */ - size = VTCFG_R_CFG1 + vs->vs_vc->vc_cfgsize; + size = VIRTIO_PCI_CONFIG_OFF(1) + vs->vs_vc->vc_cfgsize; pci_emul_alloc_bar(vs->vs_pi, barnum, PCIBAR_IO, size); } @@ -182,12 +184,12 @@ vi_vq_init(struct virtio_softc *vs, uint32_t pfn) vq = &vs->vs_queues[vs->vs_curq]; vq->vq_pfn = pfn; phys = (uint64_t)pfn << VRING_PFN; - size = vring_size(vq->vq_qsize); + size = vring_size_aligned(vq->vq_qsize); base = paddr_guest2host(vs->vs_pi->pi_vmctx, phys, size); /* First page(s) are descriptors... */ - vq->vq_desc = (struct virtio_desc *)base; - base += vq->vq_qsize * sizeof(struct virtio_desc); + vq->vq_desc = (struct vring_desc *)base; + base += vq->vq_qsize * sizeof(struct vring_desc); /* ... immediately followed by "avail" ring (entirely uint16_t's) */ vq->vq_avail = (struct vring_avail *)base; @@ -211,15 +213,15 @@ vi_vq_init(struct virtio_softc *vs, uint32_t pfn) * descriptor. */ static inline void -_vq_record(int i, volatile struct virtio_desc *vd, struct vmctx *ctx, +_vq_record(int i, volatile struct vring_desc *vd, struct vmctx *ctx, struct iovec *iov, int n_iov, uint16_t *flags) { if (i >= n_iov) return; - iov[i].iov_base = paddr_guest2host(ctx, vd->vd_addr, vd->vd_len); - iov[i].iov_len = vd->vd_len; + iov[i].iov_base = paddr_guest2host(ctx, vd->addr, vd->len); + iov[i].iov_len = vd->len; if (flags != NULL) - flags[i] = vd->vd_flags; + flags[i] = vd->flags; } #define VQ_MAX_DESCRIPTORS 512 /* see below */ @@ -236,7 +238,7 @@ _vq_record(int i, volatile struct virtio_desc *vd, struct vmctx *ctx, * i.e., we do not count the indirect descriptors, only the "real" * ones. * - * Basically, this vets the vd_flags and vd_next field of each + * Basically, this vets the "flags" and "next" field of each * descriptor and tells you how many are involved. Since some may * be indirect, this also needs the vmctx (in the pci_devinst * at vs->vs_pi) so that it can find indirect descriptors. @@ -253,7 +255,7 @@ _vq_record(int i, volatile struct virtio_desc *vd, struct vmctx *ctx, * * If you want to verify the WRITE flag on each descriptor, pass a * non-NULL "flags" pointer to an array of "uint16_t" of the same size - * as n_iov and we'll copy each vd_flags field after unwinding any + * as n_iov and we'll copy each "flags" field after unwinding any * indirects. * * If some descriptor(s) are invalid, this prints a diagnostic message @@ -269,7 +271,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, int i; u_int ndesc, n_indir; u_int idx, next; - volatile struct virtio_desc *vdir, *vindir, *vp; + volatile struct vring_desc *vdir, *vindir, *vp; struct vmctx *ctx; struct virtio_softc *vs; const char *name; @@ -279,11 +281,11 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, /* * Note: it's the responsibility of the guest not to - * update vq->vq_avail->va_idx until all of the descriptors + * update vq->vq_avail->idx until all of the descriptors * the guest has written are valid (including all their - * vd_next fields and vd_flags). + * "next" fields and "flags"). * - * Compute (va_idx - last_avail) in integers mod 2**16. This is + * Compute (vq_avail->idx - last_avail) in integers mod 2**16. This is * the number of descriptors the device has made available * since the last time we updated vq->vq_last_avail. * @@ -291,7 +293,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, * then trim off excess bits. */ idx = vq->vq_last_avail; - ndesc = (uint16_t)((u_int)vq->vq_avail->va_idx - idx); + ndesc = (uint16_t)((u_int)vq->vq_avail->idx - idx); if (ndesc == 0) return (0); if (ndesc > vq->vq_qsize) { @@ -311,9 +313,9 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, * index, but we just abort if the count gets excessive. */ ctx = vs->vs_pi->pi_vmctx; - *pidx = next = vq->vq_avail->va_ring[idx & (vq->vq_qsize - 1)]; + *pidx = next = vq->vq_avail->ring[idx & (vq->vq_qsize - 1)]; vq->vq_last_avail++; - for (i = 0; i < VQ_MAX_DESCRIPTORS; next = vdir->vd_next) { + for (i = 0; i < VQ_MAX_DESCRIPTORS; next = vdir->next) { if (next >= vq->vq_qsize) { EPRINTLN( "%s: descriptor index %u out of range, " @@ -322,7 +324,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, return (-1); } vdir = &vq->vq_desc[next]; - if ((vdir->vd_flags & VRING_DESC_F_INDIRECT) == 0) { + if ((vdir->flags & VRING_DESC_F_INDIRECT) == 0) { _vq_record(i, vdir, ctx, iov, n_iov, flags); i++; } else if ((vs->vs_vc->vc_hv_caps & @@ -333,16 +335,16 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, name); return (-1); } else { - n_indir = vdir->vd_len / 16; - if ((vdir->vd_len & 0xf) || n_indir == 0) { + n_indir = vdir->len / 16; + if ((vdir->len & 0xf) || n_indir == 0) { EPRINTLN( "%s: invalid indir len 0x%x, " "driver confused?", - name, (u_int)vdir->vd_len); + name, (u_int)vdir->len); return (-1); } vindir = paddr_guest2host(ctx, - vdir->vd_addr, vdir->vd_len); + vdir->addr, vdir->len); /* * Indirects start at the 0th, then follow * their own embedded "next"s until those run @@ -353,7 +355,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, next = 0; for (;;) { vp = &vindir[next]; - if (vp->vd_flags & VRING_DESC_F_INDIRECT) { + if (vp->flags & VRING_DESC_F_INDIRECT) { EPRINTLN( "%s: indirect desc has INDIR flag," " driver confused?", @@ -363,9 +365,9 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, _vq_record(i, vp, ctx, iov, n_iov, flags); if (++i > VQ_MAX_DESCRIPTORS) goto loopy; - if ((vp->vd_flags & VRING_DESC_F_NEXT) == 0) + if ((vp->flags & VRING_DESC_F_NEXT) == 0) break; - next = vp->vd_next; + next = vp->next; if (next >= n_indir) { EPRINTLN( "%s: invalid next %u > %u, " @@ -375,7 +377,7 @@ vq_getchain(struct vqueue_info *vq, uint16_t *pidx, } } } - if ((vdir->vd_flags & VRING_DESC_F_NEXT) == 0) + if ((vdir->flags & VRING_DESC_F_NEXT) == 0) return (i); } loopy: @@ -402,7 +404,7 @@ void vq_relchain_prepare(struct vqueue_info *vq, uint16_t idx, uint32_t iolen) { volatile struct vring_used *vuh; - volatile struct virtio_used *vue; + volatile struct vring_used_elem *vue; uint16_t mask; /* @@ -410,16 +412,13 @@ vq_relchain_prepare(struct vqueue_info *vq, uint16_t idx, uint32_t iolen) * - mask is N-1 where N is a power of 2 so computes x % N * - vuh points to the "used" data shared with guest * - vue points to the "used" ring entry we want to update - * - * (I apologize for the two fields named vu_idx; the - * virtio spec calls the one that vue points to, "id"...) */ mask = vq->vq_qsize - 1; vuh = vq->vq_used; - vue = &vuh->vu_ring[vq->vq_next_used++ & mask]; - vue->vu_idx = idx; - vue->vu_tlen = iolen; + vue = &vuh->ring[vq->vq_next_used++ & mask]; + vue->id = idx; + vue->len = iolen; } void @@ -431,7 +430,7 @@ vq_relchain_publish(struct vqueue_info *vq) * (and even on x86 to act as a compiler barrier). */ atomic_thread_fence_rel(); - vq->vq_used->vu_idx = vq->vq_next_used; + vq->vq_used->idx = vq->vq_next_used; } /* @@ -481,12 +480,12 @@ vq_endchains(struct vqueue_info *vq, int used_all_avail) */ vs = vq->vq_vs; old_idx = vq->vq_save_used; - vq->vq_save_used = new_idx = vq->vq_used->vu_idx; + vq->vq_save_used = new_idx = vq->vq_used->idx; /* - * Use full memory barrier between vu_idx store from preceding + * Use full memory barrier between "idx" store from preceding * vq_relchain() call and the loads from VQ_USED_EVENT_IDX() or - * va_flags below. + * "flags" field below. */ atomic_thread_fence_seq_cst(); if (used_all_avail && @@ -502,7 +501,7 @@ vq_endchains(struct vqueue_info *vq, int used_all_avail) (uint16_t)(new_idx - old_idx); } else { intr = new_idx != old_idx && - !(vq->vq_avail->va_flags & VRING_AVAIL_F_NO_INTERRUPT); + !(vq->vq_avail->flags & VRING_AVAIL_F_NO_INTERRUPT); } if (intr) vq_interrupt(vs, vq); @@ -515,16 +514,16 @@ static struct config_reg { uint8_t cr_ro; /* true => reg is read only */ const char *cr_name; /* name of reg */ } config_regs[] = { - { VTCFG_R_HOSTCAP, 4, 1, "HOSTCAP" }, - { VTCFG_R_GUESTCAP, 4, 0, "GUESTCAP" }, - { VTCFG_R_PFN, 4, 0, "PFN" }, - { VTCFG_R_QNUM, 2, 1, "QNUM" }, - { VTCFG_R_QSEL, 2, 0, "QSEL" }, - { VTCFG_R_QNOTIFY, 2, 0, "QNOTIFY" }, - { VTCFG_R_STATUS, 1, 0, "STATUS" }, - { VTCFG_R_ISR, 1, 0, "ISR" }, - { VTCFG_R_CFGVEC, 2, 0, "CFGVEC" }, - { VTCFG_R_QVEC, 2, 0, "QVEC" }, + { VIRTIO_PCI_HOST_FEATURES, 4, 1, "HOST_FEATURES" }, + { VIRTIO_PCI_GUEST_FEATURES, 4, 0, "GUEST_FEATURES" }, + { VIRTIO_PCI_QUEUE_PFN, 4, 0, "QUEUE_PFN" }, + { VIRTIO_PCI_QUEUE_NUM, 2, 1, "QUEUE_NUM" }, + { VIRTIO_PCI_QUEUE_SEL, 2, 0, "QUEUE_SEL" }, + { VIRTIO_PCI_QUEUE_NOTIFY, 2, 0, "QUEUE_NOTIFY" }, + { VIRTIO_PCI_STATUS, 1, 0, "STATUS" }, + { VIRTIO_PCI_ISR, 1, 0, "ISR" }, + { VIRTIO_MSI_CONFIG_VECTOR, 2, 0, "CONFIG_VECTOR" }, + { VIRTIO_MSI_QUEUE_VECTOR, 2, 0, "QUEUE_VECTOR" }, }; static inline struct config_reg * @@ -586,10 +585,7 @@ vi_pci_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, if (size != 1 && size != 2 && size != 4) goto bad; - if (pci_msix_enabled(pi)) - virtio_config_size = VTCFG_R_CFG1; - else - virtio_config_size = VTCFG_R_CFG0; + virtio_config_size = VIRTIO_PCI_CONFIG_OFF(pci_msix_enabled(pi)); if (offset >= virtio_config_size) { /* @@ -623,39 +619,39 @@ bad: } switch (offset) { - case VTCFG_R_HOSTCAP: + case VIRTIO_PCI_HOST_FEATURES: value = vc->vc_hv_caps; break; - case VTCFG_R_GUESTCAP: + case VIRTIO_PCI_GUEST_FEATURES: value = vs->vs_negotiated_caps; break; - case VTCFG_R_PFN: + case VIRTIO_PCI_QUEUE_PFN: if (vs->vs_curq < vc->vc_nvq) value = vs->vs_queues[vs->vs_curq].vq_pfn; break; - case VTCFG_R_QNUM: + case VIRTIO_PCI_QUEUE_NUM: value = vs->vs_curq < vc->vc_nvq ? vs->vs_queues[vs->vs_curq].vq_qsize : 0; break; - case VTCFG_R_QSEL: + case VIRTIO_PCI_QUEUE_SEL: value = vs->vs_curq; break; - case VTCFG_R_QNOTIFY: + case VIRTIO_PCI_QUEUE_NOTIFY: value = 0; /* XXX */ break; - case VTCFG_R_STATUS: + case VIRTIO_PCI_STATUS: value = vs->vs_status; break; - case VTCFG_R_ISR: + case VIRTIO_PCI_ISR: value = vs->vs_isr; vs->vs_isr = 0; /* a read clears this flag */ if (value) pci_lintr_deassert(pi); break; - case VTCFG_R_CFGVEC: + case VIRTIO_MSI_CONFIG_VECTOR: value = vs->vs_msix_cfg_idx; break; - case VTCFG_R_QVEC: + case VIRTIO_MSI_QUEUE_VECTOR: value = vs->vs_curq < vc->vc_nvq ? vs->vs_queues[vs->vs_curq].vq_msix_idx : VIRTIO_MSI_NO_VECTOR; @@ -706,10 +702,7 @@ vi_pci_write(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, if (size != 1 && size != 2 && size != 4) goto bad; - if (pci_msix_enabled(pi)) - virtio_config_size = VTCFG_R_CFG1; - else - virtio_config_size = VTCFG_R_CFG0; + virtio_config_size = VIRTIO_PCI_CONFIG_OFF(pci_msix_enabled(pi)); if (offset >= virtio_config_size) { /* @@ -747,18 +740,18 @@ bad: } switch (offset) { - case VTCFG_R_GUESTCAP: + case VIRTIO_PCI_GUEST_FEATURES: vs->vs_negotiated_caps = value & vc->vc_hv_caps; if (vc->vc_apply_features) (*vc->vc_apply_features)(DEV_SOFTC(vs), vs->vs_negotiated_caps); break; - case VTCFG_R_PFN: + case VIRTIO_PCI_QUEUE_PFN: if (vs->vs_curq >= vc->vc_nvq) goto bad_qindex; vi_vq_init(vs, value); break; - case VTCFG_R_QSEL: + case VIRTIO_PCI_QUEUE_SEL: /* * Note that the guest is allowed to select an * invalid queue; we just need to return a QNUM @@ -766,7 +759,7 @@ bad: */ vs->vs_curq = value; break; - case VTCFG_R_QNOTIFY: + case VIRTIO_PCI_QUEUE_NOTIFY: if (value >= vc->vc_nvq) { EPRINTLN("%s: queue %d notify out of range", name, (int)value); @@ -782,15 +775,15 @@ bad: "%s: qnotify queue %d: missing vq/vc notify", name, (int)value); break; - case VTCFG_R_STATUS: + case VIRTIO_PCI_STATUS: vs->vs_status = value; if (value == 0) (*vc->vc_reset)(DEV_SOFTC(vs)); break; - case VTCFG_R_CFGVEC: + case VIRTIO_MSI_CONFIG_VECTOR: vs->vs_msix_cfg_idx = value; break; - case VTCFG_R_QVEC: + case VIRTIO_MSI_QUEUE_VECTOR: if (vs->vs_curq >= vc->vc_nvq) goto bad_qindex; vq = &vs->vs_queues[vs->vs_curq]; @@ -896,7 +889,7 @@ vi_pci_snapshot_queues(struct virtio_softc *vs, struct vm_snapshot_meta *meta) SNAPSHOT_VAR_OR_LEAVE(vq->vq_pfn, meta, ret, done); - addr_size = vq->vq_qsize * sizeof(struct virtio_desc); + addr_size = vq->vq_qsize * sizeof(struct vring_desc); SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(vq->vq_desc, addr_size, false, meta, ret, done); @@ -908,8 +901,8 @@ vi_pci_snapshot_queues(struct virtio_softc *vs, struct vm_snapshot_meta *meta) SNAPSHOT_GUEST2HOST_ADDR_OR_LEAVE(vq->vq_used, addr_size, false, meta, ret, done); - SNAPSHOT_BUF_OR_LEAVE(vq->vq_desc, vring_size(vq->vq_qsize), - meta, ret, done); + SNAPSHOT_BUF_OR_LEAVE(vq->vq_desc, + vring_size_aligned(vq->vq_qsize), meta, ret, done); } done: diff --git a/usr.sbin/bhyve/virtio.h b/usr.sbin/bhyve/virtio.h index b055f0c35941..c5730f71000e 100644 --- a/usr.sbin/bhyve/virtio.h +++ b/usr.sbin/bhyve/virtio.h @@ -28,11 +28,15 @@ * $FreeBSD$ */ -#ifndef _VIRTIO_H_ -#define _VIRTIO_H_ +#ifndef _BHYVE_VIRTIO_H_ +#define _BHYVE_VIRTIO_H_ #include +#include +#include +#include + /* * These are derived from several virtio specifications. * @@ -125,39 +129,6 @@ */ #define VRING_ALIGN 4096 -#define VRING_DESC_F_NEXT (1 << 0) -#define VRING_DESC_F_WRITE (1 << 1) -#define VRING_DESC_F_INDIRECT (1 << 2) - -struct virtio_desc { /* AKA vring_desc */ - uint64_t vd_addr; /* guest physical address */ - uint32_t vd_len; /* length of scatter/gather seg */ - uint16_t vd_flags; /* VRING_F_DESC_* */ - uint16_t vd_next; /* next desc if F_NEXT */ -} __packed; - -struct virtio_used { /* AKA vring_used_elem */ - uint32_t vu_idx; /* head of used descriptor chain */ - uint32_t vu_tlen; /* length written-to */ -} __packed; - -#define VRING_AVAIL_F_NO_INTERRUPT 1 - -struct vring_avail { - uint16_t va_flags; /* VRING_AVAIL_F_* */ - uint16_t va_idx; /* counts to 65535, then cycles */ - uint16_t va_ring[]; /* size N, reported in QNUM value */ -/* uint16_t va_used_event; -- after N ring entries */ -} __packed; - -#define VRING_USED_F_NO_NOTIFY 1 -struct vring_used { - uint16_t vu_flags; /* VRING_USED_F_* */ - uint16_t vu_idx; /* counts to 65535, then cycles */ - struct virtio_used vu_ring[]; /* size N */ -/* uint16_t vu_avail_event; -- after N ring entries */ -} __packed; - /* * The address of any given virtual queue is determined by a single * Page Frame Number register. The guest writes the PFN into the @@ -190,23 +161,6 @@ struct vring_used { */ #define VRING_PFN 12 -/* - * Virtio device types - * - * XXX Should really be merged with defines - */ -#define VIRTIO_TYPE_NET 1 -#define VIRTIO_TYPE_BLOCK 2 -#define VIRTIO_TYPE_CONSOLE 3 -#define VIRTIO_TYPE_ENTROPY 4 -#define VIRTIO_TYPE_BALLOON 5 -#define VIRTIO_TYPE_IOMEMORY 6 -#define VIRTIO_TYPE_RPMSG 7 -#define VIRTIO_TYPE_SCSI 8 -#define VIRTIO_TYPE_9P 9 - -/* experimental IDs start at 65535 and work down */ - /* * PCI vendor/device IDs */ @@ -218,71 +172,11 @@ struct vring_used { #define VIRTIO_DEV_SCSI 0x1008 #define VIRTIO_DEV_9P 0x1009 -/* - * PCI config space constants. - * - * If MSI-X is enabled, the ISR register is generally not used, - * and the configuration vector and queue vector appear at offsets - * 20 and 22 with the remaining configuration registers at 24. - * If MSI-X is not enabled, those two registers disappear and - * the remaining configuration registers start at offset 20. - */ -#define VTCFG_R_HOSTCAP 0 -#define VTCFG_R_GUESTCAP 4 -#define VTCFG_R_PFN 8 -#define VTCFG_R_QNUM 12 -#define VTCFG_R_QSEL 14 -#define VTCFG_R_QNOTIFY 16 -#define VTCFG_R_STATUS 18 -#define VTCFG_R_ISR 19 -#define VTCFG_R_CFGVEC 20 -#define VTCFG_R_QVEC 22 -#define VTCFG_R_CFG0 20 /* No MSI-X */ -#define VTCFG_R_CFG1 24 /* With MSI-X */ -#define VTCFG_R_MSIX 20 - -/* - * Bits in VTCFG_R_STATUS. Guests need not actually set any of these, - * but a guest writing 0 to this register means "please reset". - */ -#define VTCFG_STATUS_ACK 0x01 /* guest OS has acknowledged dev */ -#define VTCFG_STATUS_DRIVER 0x02 /* guest OS driver is loaded */ -#define VTCFG_STATUS_DRIVER_OK 0x04 /* guest OS driver ready */ -#define VTCFG_STATUS_FAILED 0x80 /* guest has given up on this dev */ - -/* - * Bits in VTCFG_R_ISR. These apply only if not using MSI-X. - * - * (We don't [yet?] ever use CONF_CHANGED.) - */ -#define VTCFG_ISR_QUEUES 0x01 /* re-scan queues */ -#define VTCFG_ISR_CONF_CHANGED 0x80 /* configuration changed */ - -#define VIRTIO_MSI_NO_VECTOR 0xFFFF - -/* - * Feature flags. - * Note: bits 0 through 23 are reserved to each device type. - */ -#define VIRTIO_F_NOTIFY_ON_EMPTY (1 << 24) -#define VIRTIO_RING_F_INDIRECT_DESC (1 << 28) -#define VIRTIO_RING_F_EVENT_IDX (1 << 29) - /* From section 2.3, "Virtqueue Configuration", of the virtio specification */ -static inline size_t -vring_size(u_int qsz) +static inline int +vring_size_aligned(u_int qsz) { - size_t size; - - /* constant 3 below = va_flags, va_idx, va_used_event */ - size = sizeof(struct virtio_desc) * qsz + sizeof(uint16_t) * (3 + qsz); - size = roundup2(size, VRING_ALIGN); - - /* constant 3 below = vu_flags, vu_idx, vu_avail_event */ - size += sizeof(uint16_t) * 3 + sizeof(struct virtio_used) * qsz; - size = roundup2(size, VRING_ALIGN); - - return (size); + return (roundup2(vring_size(qsz, VRING_ALIGN), VRING_ALIGN)); } struct vmctx; @@ -397,23 +291,23 @@ struct vqueue_info { uint16_t vq_num; /* we're the num'th queue in the softc */ uint16_t vq_flags; /* flags (see above) */ - uint16_t vq_last_avail; /* a recent value of vq_avail->va_idx */ + uint16_t vq_last_avail; /* a recent value of vq_avail->idx */ uint16_t vq_next_used; /* index of the next used slot to be filled */ - uint16_t vq_save_used; /* saved vq_used->vu_idx; see vq_endchains */ + uint16_t vq_save_used; /* saved vq_used->idx; see vq_endchains */ uint16_t vq_msix_idx; /* MSI-X index, or VIRTIO_MSI_NO_VECTOR */ uint32_t vq_pfn; /* PFN of virt queue (not shifted!) */ - volatile struct virtio_desc *vq_desc; /* descriptor array */ + volatile struct vring_desc *vq_desc; /* descriptor array */ volatile struct vring_avail *vq_avail; /* the "avail" ring */ volatile struct vring_used *vq_used; /* the "used" ring */ }; /* as noted above, these are sort of backwards, name-wise */ #define VQ_AVAIL_EVENT_IDX(vq) \ - (*(volatile uint16_t *)&(vq)->vq_used->vu_ring[(vq)->vq_qsize]) + (*(volatile uint16_t *)&(vq)->vq_used->ring[(vq)->vq_qsize]) #define VQ_USED_EVENT_IDX(vq) \ - ((vq)->vq_avail->va_ring[(vq)->vq_qsize]) + ((vq)->vq_avail->ring[(vq)->vq_qsize]) /* * Is this ring ready for I/O? @@ -434,7 +328,7 @@ vq_has_descs(struct vqueue_info *vq) { return (vq_ring_ready(vq) && vq->vq_last_avail != - vq->vq_avail->va_idx); + vq->vq_avail->idx); } /* @@ -449,7 +343,7 @@ vq_interrupt(struct virtio_softc *vs, struct vqueue_info *vq) pci_generate_msix(vs->vs_pi, vq->vq_msix_idx); else { VS_LOCK(vs); - vs->vs_isr |= VTCFG_ISR_QUEUES; + vs->vs_isr |= VIRTIO_PCI_ISR_INTR; pci_generate_msi(vs->vs_pi, 0); pci_lintr_assert(vs->vs_pi); VS_UNLOCK(vs); @@ -460,11 +354,11 @@ static inline void vq_kick_enable(struct vqueue_info *vq) { - vq->vq_used->vu_flags &= ~VRING_USED_F_NO_NOTIFY; + vq->vq_used->flags &= ~VRING_USED_F_NO_NOTIFY; /* - * Full memory barrier to make sure the store to vu_flags - * happens before the load from va_idx, which results from - * a subsequent call to vq_has_descs(). + * Full memory barrier to make sure the store to vq_used->flags + * happens before the load from vq_avail->idx, which results from a + * subsequent call to vq_has_descs(). */ atomic_thread_fence_seq_cst(); } @@ -473,7 +367,7 @@ static inline void vq_kick_disable(struct vqueue_info *vq) { - vq->vq_used->vu_flags |= VRING_USED_F_NO_NOTIFY; + vq->vq_used->flags |= VRING_USED_F_NO_NOTIFY; } struct iovec; @@ -502,4 +396,4 @@ int vi_pci_snapshot(struct vm_snapshot_meta *meta); int vi_pci_pause(struct vmctx *ctx, struct pci_devinst *pi); int vi_pci_resume(struct vmctx *ctx, struct pci_devinst *pi); #endif -#endif /* _VIRTIO_H_ */ +#endif /* _BHYVE_VIRTIO_H_ */ From owner-dev-commits-src-all@freebsd.org Tue Mar 16 15:14:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2933C5B2C0E; Tue, 16 Mar 2021 15:14: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 4F0GzS0lrbz4ggb; Tue, 16 Mar 2021 15:14: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 0CC942586E; Tue, 16 Mar 2021 15:14: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 12GFERDa074450; Tue, 16 Mar 2021 15:14:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GFERCd074449; Tue, 16 Mar 2021 15:14:27 GMT (envelope-from git) Date: Tue, 16 Mar 2021 15:14:27 GMT Message-Id: <202103161514.12GFERCd074449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 03984bdfa033 - stable/13 - vm: Round up npages and alignment for contig reclamation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 03984bdfa033efe0597aa6adac85dba6e7ddb9a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 15:14:28 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=03984bdfa033efe0597aa6adac85dba6e7ddb9a8 commit 03984bdfa033efe0597aa6adac85dba6e7ddb9a8 Author: Mark Johnston AuthorDate: 2021-03-02 15:19:53 +0000 Commit: Mark Johnston CommitDate: 2021-03-16 15:14:09 +0000 vm: Round up npages and alignment for contig reclamation When searching for runs to reclaim, we need to ensure that the entire run will be added to the buddy allocator as a single unit. Otherwise, it will not be visible to vm_phys_alloc_contig() as it is currently implemented. This is a problem for allocation requests that are not a power of 2 in size, as with 9KB jumbo mbuf clusters. Reported by: alc Reviewed by: alc Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D28924 (cherry picked from commit 0401989282d1bb9972ae2bf4862c2c6c92ae5f27) --- sys/vm/vm_page.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sys/vm/vm_page.c b/sys/vm/vm_page.c index c36b8cdc5762..da62e6795c81 100644 --- a/sys/vm/vm_page.c +++ b/sys/vm/vm_page.c @@ -2972,17 +2972,29 @@ vm_page_reclaim_contig_domain(int domain, int req, u_long npages, struct vm_domain *vmd; vm_paddr_t curr_low; vm_page_t m_run, m_runs[NRUNS]; - u_long count, reclaimed; + u_long count, minalign, reclaimed; int error, i, options, req_class; KASSERT(npages > 0, ("npages is 0")); KASSERT(powerof2(alignment), ("alignment is not a power of 2")); KASSERT(powerof2(boundary), ("boundary is not a power of 2")); - req_class = req & VM_ALLOC_CLASS_MASK; + + /* + * The caller will attempt an allocation after some runs have been + * reclaimed and added to the vm_phys buddy lists. Due to limitations + * of vm_phys_alloc_contig(), round up the requested length to the next + * power of two or maximum chunk size, and ensure that each run is + * suitably aligned. + */ + minalign = 1ul << imin(flsl(npages - 1), VM_NFREEORDER - 1); + npages = roundup2(npages, minalign); + if (alignment < ptoa(minalign)) + alignment = ptoa(minalign); /* * The page daemon is allowed to dig deeper into the free page list. */ + req_class = req & VM_ALLOC_CLASS_MASK; if (curproc == pageproc && req_class != VM_ALLOC_INTERRUPT) req_class = VM_ALLOC_SYSTEM; From owner-dev-commits-src-all@freebsd.org Tue Mar 16 15:20:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 010595B2B6D; Tue, 16 Mar 2021 15:20: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 4F0H636dJMz4h3h; Tue, 16 Mar 2021 15:20: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 D24E525E9B; Tue, 16 Mar 2021 15:20: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 12GFKBUn078712; Tue, 16 Mar 2021 15:20:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GFKBhg078704; Tue, 16 Mar 2021 15:20:11 GMT (envelope-from git) Date: Tue, 16 Mar 2021 15:20:11 GMT Message-Id: <202103161520.12GFKBhg078704@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: c244b1d8a387 - main - pkg: settle the uniq extension to .pkg instead of .bsd MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c244b1d8a38731041d0f3ff4191192a85dd8608b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 15:20:12 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=c244b1d8a38731041d0f3ff4191192a85dd8608b commit c244b1d8a38731041d0f3ff4191192a85dd8608b Author: Baptiste Daroussin AuthorDate: 2021-03-16 15:18:48 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-16 15:19:52 +0000 pkg: settle the uniq extension to .pkg instead of .bsd Requested by: many --- usr.sbin/pkg/pkg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c index 48b92049b869..04232672ac39 100644 --- a/usr.sbin/pkg/pkg.c +++ b/usr.sbin/pkg/pkg.c @@ -85,7 +85,7 @@ struct fingerprint { }; static const char *bootstrap_names [] = { - "pkg.bsd", + "pkg.pkg", "pkg.txz", NULL }; From owner-dev-commits-src-all@freebsd.org Tue Mar 16 16:02:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A36985B3B93; Tue, 16 Mar 2021 16:02: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 4F0J2K4KH1z4kM8; Tue, 16 Mar 2021 16:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8732A26662; Tue, 16 Mar 2021 16:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GG21CX040660; Tue, 16 Mar 2021 16:02:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GG21Xh040659; Tue, 16 Mar 2021 16:02:01 GMT (envelope-from git) Date: Tue, 16 Mar 2021 16:02:01 GMT Message-Id: <202103161602.12GG21Xh040659@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: 0af8a2db34cf - main - release: do not set __MAKE_CONF and SRCCONF for the chroot build 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: 0af8a2db34cff008d4f48f357da48b7379b18893 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 16:02:01 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=0af8a2db34cff008d4f48f357da48b7379b18893 commit 0af8a2db34cff008d4f48f357da48b7379b18893 Author: Glen Barber AuthorDate: 2021-03-16 16:01:48 +0000 Commit: Glen Barber CommitDate: 2021-03-16 16:01:48 +0000 release: do not set __MAKE_CONF and SRCCONF for the chroot build PR: 254319 Submitted by: truckman MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/release.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/release/release.sh b/release/release.sh index 3d7612ef6b80..aa2ef4e6b3da 100755 --- a/release/release.sh +++ b/release/release.sh @@ -171,6 +171,7 @@ env_check() { # this file, unless overridden by release.conf. In most cases, these # will not need to be changed. CONF_FILES="__MAKE_CONF=${MAKE_CONF} SRCCONF=${SRC_CONF}" + NOCONF_FILES="__MAKE_CONF=/dev/null SRCCONF=/dev/null" if [ -n "${TARGET}" ] && [ -n "${TARGET_ARCH}" ]; then ARCH_FLAGS="TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}" else @@ -194,9 +195,9 @@ env_check() { CHROOT_MAKEENV="${CHROOT_MAKEENV} \ MAKEOBJDIRPREFIX=${CHROOTDIR}/tmp/obj" - CHROOT_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${CONF_FILES}" - CHROOT_IMAKEFLAGS="${WORLD_FLAGS} ${CONF_FILES}" - CHROOT_DMAKEFLAGS="${WORLD_FLAGS} ${CONF_FILES}" + CHROOT_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${NOCONF_FILES}" + CHROOT_IMAKEFLAGS="${WORLD_FLAGS} ${NOCONF_FILES}" + CHROOT_DMAKEFLAGS="${WORLD_FLAGS} ${NOCONF_FILES}" RELEASE_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${ARCH_FLAGS} \ ${CONF_FILES}" RELEASE_KMAKEFLAGS="${MAKE_FLAGS} ${KERNEL_FLAGS} \ From owner-dev-commits-src-all@freebsd.org Tue Mar 16 17:56:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBADB5B7414; Tue, 16 Mar 2021 17:56: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 4F0LZb5vbjz4tgP; Tue, 16 Mar 2021 17:56: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 BDA272818B; Tue, 16 Mar 2021 17:56: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 12GHudle085316; Tue, 16 Mar 2021 17:56:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GHudtJ085315; Tue, 16 Mar 2021 17:56:39 GMT (envelope-from git) Date: Tue, 16 Mar 2021 17:56:39 GMT Message-Id: <202103161756.12GHudtJ085315@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: a54c346ff3e8 - stable/12 - ns8250: don't drop IER_TXRDY on bus_grab/ungrab 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/stable/12 X-Git-Reftype: branch X-Git-Commit: a54c346ff3e80ff8f2f3d0ec56b5374a7dc34429 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 17:56:39 -0000 The branch stable/12 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=a54c346ff3e80ff8f2f3d0ec56b5374a7dc34429 commit a54c346ff3e80ff8f2f3d0ec56b5374a7dc34429 Author: Mitchell Horne AuthorDate: 2021-03-10 14:57:12 +0000 Commit: Mitchell Horne CommitDate: 2021-03-16 17:56:03 +0000 ns8250: don't drop IER_TXRDY on bus_grab/ungrab It has been observed that some systems are often unable to resume from ddb after entering with debug.kdb.enter=1. Checking the status further shows the terminal is blocked waiting in tty_drain(), but it never makes progress in clearing the output queue, because sc->sc_txbusy is high. I noticed that when entering polling mode for the debugger, IER_TXRDY is set in the failure case. Since this bit is never tracked by the softc, it will not be restored by ns8250_bus_ungrab(). This creates a race in which a TX interrupt can be lost, creating the hang described above. Ensuring that this bit is restored is enough to prevent this, and resume from ddb as expected. The solution is to track this bit in the sc->ier field, for the same lifetime that TX interrupts are enabled. PR: 223917, 240122 Sponsored by: The FreeBSD Foundation (cherry picked from commit 7e7f7beee732810d3afcc83828341ac3e139b5bd) --- sys/dev/uart/uart_dev_ns8250.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index 52775a9b8a44..997eca3ea6cd 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -735,6 +735,7 @@ ns8250_bus_ipend(struct uart_softc *sc) } else { if (iir & IIR_TXRDY) { ipend |= SER_INT_TXIDLE; + ns8250->ier &= ~IER_ETXRDY; uart_setreg(bas, REG_IER, ns8250->ier); uart_barrier(bas); } else @@ -1032,7 +1033,9 @@ ns8250_bus_transmit(struct uart_softc *sc) uart_setreg(bas, REG_DATA, sc->sc_txbuf[i]); uart_barrier(bas); } - uart_setreg(bas, REG_IER, ns8250->ier | IER_ETXRDY); + if (!broken_txfifo) + ns8250->ier |= IER_ETXRDY; + uart_setreg(bas, REG_IER, ns8250->ier); uart_barrier(bas); if (broken_txfifo) ns8250_drain(bas, UART_DRAIN_TRANSMITTER); From owner-dev-commits-src-all@freebsd.org Tue Mar 16 18:03:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B90ED5B78FE; Tue, 16 Mar 2021 18:03: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 4F0LkF4w8Tz4vGx; Tue, 16 Mar 2021 18:03: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 9B6292838D; Tue, 16 Mar 2021 18:03: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 12GI3Hvw098505; Tue, 16 Mar 2021 18:03:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GI3H2K098504; Tue, 16 Mar 2021 18:03:17 GMT (envelope-from git) Date: Tue, 16 Mar 2021 18:03:17 GMT Message-Id: <202103161803.12GI3H2K098504@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 0b373f26bea1 - main - cxgbe(4): catch up with the latest cryptocaps. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0b373f26bea17e4b569531b94df30e1af6a0327b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 18:03:17 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=0b373f26bea17e4b569531b94df30e1af6a0327b commit 0b373f26bea17e4b569531b94df30e1af6a0327b Author: Navdeep Parhar AuthorDate: 2021-03-15 19:54:34 +0000 Commit: Navdeep Parhar CommitDate: 2021-03-16 17:53:52 +0000 cxgbe(4): catch up with the latest cryptocaps. There are two crypto capabilities that the driver didn't know about. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index f749fdd937d7..201a333aa431 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -6405,7 +6405,8 @@ static char *caps_decoder[] = { "\005INITIATOR_SSNOFLD\006TARGET_SSNOFLD" "\007T10DIF" "\010INITIATOR_CMDOFLD\011TARGET_CMDOFLD", - "\20\001LOOKASIDE\002TLSKEYS", /* 7: Crypto */ + "\20\001LOOKASIDE\002TLSKEYS\003IPSEC_INLINE" /* 7: Crypto */ + "\004TLS_HW", "\20\001INITIATOR\002TARGET\003CTRL_OFLD" /* 8: FCoE */ "\004PO_INITIATOR\005PO_TARGET", }; From owner-dev-commits-src-all@freebsd.org Tue Mar 16 18:30:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CDA05684B9; Tue, 16 Mar 2021 18:30: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 4F0MKG0tt9z3Cgm; Tue, 16 Mar 2021 18:30:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 117B228811; Tue, 16 Mar 2021 18:30:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GIUAPp028051; Tue, 16 Mar 2021 18:30:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GIU97h028045; Tue, 16 Mar 2021 18:30:09 GMT (envelope-from git) Date: Tue, 16 Mar 2021 18:30:09 GMT Message-Id: <202103161830.12GIU97h028045@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jung-uk Kim Subject: git: 6827435548d2 - main - pkgbase: Fix building out-of-tree manual pages MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jkim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6827435548d257c672f934db5c6ff01012d96995 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 18:30:10 -0000 The branch main has been updated by jkim: URL: https://cgit.FreeBSD.org/src/commit/?id=6827435548d257c672f934db5c6ff01012d96995 commit 6827435548d257c672f934db5c6ff01012d96995 Author: Jung-uk Kim AuthorDate: 2021-03-16 18:16:10 +0000 Commit: Jung-uk Kim CommitDate: 2021-03-16 18:29:48 +0000 pkgbase: Fix building out-of-tree manual pages c7e6cb9e08d6 introduced MK_MANSPLITPKG but it was not available for building out-of-tree manual pages. For example, x11/nvidia-driver fails with the following error: ===> doc (all) make[3]: "/usr/share/mk/bsd.man.mk" line 53: Malformed conditional (${MK_MANSPLITPKG} == "no") make[3]: Fatal errors encountered -- cannot continue Move the definition from src.opts.mk to bsd.opts.mk to make it visible. --- share/mk/bsd.opts.mk | 1 + share/mk/src.opts.mk | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/share/mk/bsd.opts.mk b/share/mk/bsd.opts.mk index 9f9889d0a0f0..33d843593427 100644 --- a/share/mk/bsd.opts.mk +++ b/share/mk/bsd.opts.mk @@ -75,6 +75,7 @@ __DEFAULT_NO_OPTIONS = \ INIT_ALL_PATTERN \ INIT_ALL_ZERO \ INSTALL_AS_USER \ + MANSPLITPKG \ RETPOLINE \ STALE_STAGED diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk index 949dfece43e4..619aa8f4a1d8 100644 --- a/share/mk/src.opts.mk +++ b/share/mk/src.opts.mk @@ -207,7 +207,6 @@ __DEFAULT_NO_OPTIONS = \ LOADER_VERBOSE \ LOADER_VERIEXEC_PASS_MANIFEST \ MALLOC_PRODUCTION \ - MANSPLITPKG \ OFED_EXTRA \ OPENLDAP \ REPRODUCIBLE_BUILD \ From owner-dev-commits-src-all@freebsd.org Tue Mar 16 18:38:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4BD13568353; Tue, 16 Mar 2021 18:38: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 4F0MVZ1gp6z3Dq3; Tue, 16 Mar 2021 18:38: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 287D328A61; Tue, 16 Mar 2021 18:38: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 12GIcEJm038847; Tue, 16 Mar 2021 18:38:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GIcE32038846; Tue, 16 Mar 2021 18:38:14 GMT (envelope-from git) Date: Tue, 16 Mar 2021 18:38:14 GMT Message-Id: <202103161838.12GIcE32038846@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 1aa6884953a9 - releng/13.0 - development(7): update to reflect Git transition 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 1aa6884953a93674368b6f02377f3a24e2702a6a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 18:38:14 -0000 The branch releng/13.0 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=1aa6884953a93674368b6f02377f3a24e2702a6a commit 1aa6884953a93674368b6f02377f3a24e2702a6a Author: Edward Tomasz Napierala AuthorDate: 2021-03-11 20:03:30 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-16 18:37:50 +0000 development(7): update to reflect Git transition Approved by: re (gjb) Reviewed By: debdrup, imp (earlier version) Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D28939 (cherry picked from commit d28cbb7944e5b1015d94a04cadc97d473838611e) (cherry picked from commit d7ef665e10dd3bc0a6f3c0a8e928cf2fe695a113) --- share/man/man7/development.7 | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/share/man/man7/development.7 b/share/man/man7/development.7 index 48b3b19384ab..3feb133e0534 100644 --- a/share/man/man7/development.7 +++ b/share/man/man7/development.7 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 19, 2020 +.Dd March 11, 2021 .Dt DEVELOPMENT 7 .Os .Sh NAME @@ -58,17 +58,25 @@ can be found at: .Lk https://www.FreeBSD.org/doc/en/articles/committers-guide/ .Pp .Fx -src development takes place in the CURRENT branch in Subversion, -located at: +src development takes place in the project-hosted +Git repository, located at: .Pp -.Lk https://svn.FreeBSD.org/base/head +.Lk https://git.FreeBSD.org/src.git .Pp -There is also a read-only GitHub mirror at: +The push URL is: .Pp -.Lk https://github.com/freebsd/freebsd +.Lk ssh://git@gitrepo.FreeBSD.org/src.git .Pp -Changes are first committed to CURRENT and then usually merged back -to STABLE. +There is also a public, read-only GitHub mirror at: +.Pp +.Lk https://github.com/freebsd/freebsd-src +.Pp +The +.Ql main +Git branch represents CURRENT; +all changes are first committed to CURRENT and then usually cherry-picked +back to STABLE, which refers to Git branches such as +.Ql stable/13 . Every few years the CURRENT branch is renamed to STABLE, and a new CURRENT is branched, with an incremented major version number. Releases are then branched off STABLE and numbered with consecutive minor @@ -114,7 +122,7 @@ the continuous integration system is at: Check out the CURRENT branch, build it, and install, overwriting the current system: .Bd -literal -offset indent -svnlite co https://svn.FreeBSD.org/base/head src +git clone https://git.FreeBSD.org/src.git src cd src make -sj8 buildworld buildkernel installkernel shutdown -r now @@ -166,7 +174,7 @@ make buildenv TARGET_ARCH=armv6 make -sj8 kernel KERNFAST=1 DESTDIR=/clients/arm .Ed .Sh SEE ALSO -.Xr svnlite 1 , +.Xr git 1 , .Xr witness 4 , .Xr build 7 , .Xr hier 7 , From owner-dev-commits-src-all@freebsd.org Tue Mar 16 18:38:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52E31568A9C; Tue, 16 Mar 2021 18:38: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 4F0MVb1y2Dz3Dbl; Tue, 16 Mar 2021 18:38: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 3599028845; Tue, 16 Mar 2021 18:38: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 12GIcFDn038866; Tue, 16 Mar 2021 18:38:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GIcFLV038865; Tue, 16 Mar 2021 18:38:15 GMT (envelope-from git) Date: Tue, 16 Mar 2021 18:38:15 GMT Message-Id: <202103161838.12GIcFLV038865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Edward Tomasz Napierala Subject: git: 56dd03e0f2b1 - releng/13.0 - linux(4): make getcwd(2) return ERANGE instead of ENOMEM 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 56dd03e0f2b17e703ba8daad8bc9ab21a761a461 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 18:38:15 -0000 The branch releng/13.0 has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=56dd03e0f2b17e703ba8daad8bc9ab21a761a461 commit 56dd03e0f2b17e703ba8daad8bc9ab21a761a461 Author: Edward Tomasz Napierala AuthorDate: 2021-03-12 15:31:37 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-16 18:37:57 +0000 linux(4): make getcwd(2) return ERANGE instead of ENOMEM For native FreeBSD binaries, the return value from __getcwd(2) doesn't really matter, as the libc wrapper takes over and returns the proper errno. Approved by: re (gjb) PR: kern/254120 Reported By: Alex S Reviewed By: kib Sponsored By: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29217 (cherry picked from commit 0dfbdd9fc269f0438ffcc31632d35234a90584ad) (cherry picked from commit ab1a91d95872e59db3d476be4fefb0b58df3afc4) --- sys/compat/linux/linux_getcwd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/compat/linux/linux_getcwd.c b/sys/compat/linux/linux_getcwd.c index c39e69c4e707..4917641be5e5 100644 --- a/sys/compat/linux/linux_getcwd.c +++ b/sys/compat/linux/linux_getcwd.c @@ -74,6 +74,8 @@ linux_getcwd(struct thread *td, struct linux_getcwd_args *uap) buf = malloc(buflen, M_TEMP, M_WAITOK); error = vn_getcwd(buf, &retbuf, &buflen); + if (error == ENOMEM) + error = ERANGE; if (error == 0) { error = copyout(retbuf, uap->buf, buflen); if (error == 0) From owner-dev-commits-src-all@freebsd.org Tue Mar 16 19:02:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 428415696C6; Tue, 16 Mar 2021 19:02:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F0N201M3Yz3G3W; Tue, 16 Mar 2021 19:02:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA56628CBB; Tue, 16 Mar 2021 19:01:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GJ1xxs074203; Tue, 16 Mar 2021 19:01:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GJ1x0r074202; Tue, 16 Mar 2021 19:01:59 GMT (envelope-from git) Date: Tue, 16 Mar 2021 19:01:59 GMT Message-Id: <202103161901.12GJ1x0r074202@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: 4aa157dd5b4e - main - link_elf_obj: Add a case missing from 5e6989ba4f26 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: 4aa157dd5b4e72b85dd07ce3c106b742ca371bca Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 19:02:00 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=4aa157dd5b4e72b85dd07ce3c106b742ca371bca commit 4aa157dd5b4e72b85dd07ce3c106b742ca371bca Author: Mark Johnston AuthorDate: 2021-03-16 19:01:41 +0000 Commit: Mark Johnston CommitDate: 2021-03-16 19:01:41 +0000 link_elf_obj: Add a case missing from 5e6989ba4f26 Fixes: 5e6989ba4f26 MFC after: 3 days Sponsored by: The FreeBSD Foundation --- sys/kern/link_elf_obj.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 337588bd5c00..65b997b513e3 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -472,6 +472,7 @@ link_elf_link_preload(linker_class_t cls, const char *filename, #ifdef __amd64__ case SHT_X86_64_UNWIND: #endif + case SHT_INIT_ARRAY: case SHT_FINI_ARRAY: if (shdr[i].sh_addr == 0) break; From owner-dev-commits-src-all@freebsd.org Tue Mar 16 19:02:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 332E8569886; Tue, 16 Mar 2021 19:02: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 4F0N2111c6z3GGs; Tue, 16 Mar 2021 19:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1667E28EA0; Tue, 16 Mar 2021 19:02:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GJ20Yv074221; Tue, 16 Mar 2021 19:02:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GJ20bt074220; Tue, 16 Mar 2021 19:02:00 GMT (envelope-from git) Date: Tue, 16 Mar 2021 19:02:00 GMT Message-Id: <202103161902.12GJ20bt074220@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: 7b1b5aad95df - main - stand: Load INIT_ARRAY and FINI_ARRAY sections 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: 7b1b5aad95df671aba3192f1669a8d96da481939 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 19:02:01 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=7b1b5aad95df671aba3192f1669a8d96da481939 commit 7b1b5aad95df671aba3192f1669a8d96da481939 Author: Mark Johnston AuthorDate: 2021-03-16 19:01:41 +0000 Commit: Mark Johnston CommitDate: 2021-03-16 19:01:41 +0000 stand: Load INIT_ARRAY and FINI_ARRAY sections This is required for preloading modules into a KASAN-configured kernel. MFC after: 1 week Sponsored by: The FreeBSD Foundation --- stand/common/load_elf_obj.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stand/common/load_elf_obj.c b/stand/common/load_elf_obj.c index 4bff74764922..78ece02433c6 100644 --- a/stand/common/load_elf_obj.c +++ b/stand/common/load_elf_obj.c @@ -264,6 +264,8 @@ __elfN(obj_loadimage)(struct preloaded_file *fp, elf_file_t ef, uint64_t off) #if defined(__i386__) || defined(__amd64__) case SHT_X86_64_UNWIND: #endif + case SHT_INIT_ARRAY: + case SHT_FINI_ARRAY: if ((shdr[i].sh_flags & SHF_ALLOC) == 0) break; lastaddr = roundup(lastaddr, shdr[i].sh_addralign); From owner-dev-commits-src-all@freebsd.org Tue Mar 16 19:21:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3257D56A306; Tue, 16 Mar 2021 19:21: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 4F0NSY0zs8z3Hqc; Tue, 16 Mar 2021 19:21: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 14A0C29506; Tue, 16 Mar 2021 19:21: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 12GJLXmS003942; Tue, 16 Mar 2021 19:21:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GJLWMc003941; Tue, 16 Mar 2021 19:21:32 GMT (envelope-from git) Date: Tue, 16 Mar 2021 19:21:32 GMT Message-Id: <202103161921.12GJLWMc003941@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Peter Jeremy Subject: git: cdac5f398bf8 - main - nfs: Cleanup dead files MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: peterj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cdac5f398bf8680677b71447465c32327767879b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 19:21:33 -0000 The branch main has been updated by peterj: URL: https://cgit.FreeBSD.org/src/commit/?id=cdac5f398bf8680677b71447465c32327767879b commit cdac5f398bf8680677b71447465c32327767879b Author: Peter Jeremy AuthorDate: 2021-03-16 19:16:31 +0000 Commit: Peter Jeremy CommitDate: 2021-03-16 19:16:31 +0000 nfs: Cleanup dead files These files are no longer used by the FreeBSD base system. They were being used by the amd port but that has also been deleted. Reviewed by: rmacklem Sponsored by: Google Differential Revision: https://reviews.freebsd.org/D29180 --- ObsoleteFiles.inc | 8 ++ sys/nfs/nfs_common.h | 137 --------------------------------- sys/nfsclient/nfsm_subs.h | 180 -------------------------------------------- sys/nfsclient/nlminfo.h | 44 ----------- sys/nfsserver/nfs_fha_old.h | 40 ---------- sys/nfsserver/nfsm_subs.h | 175 ------------------------------------------ sys/nfsserver/nfsrvcache.h | 49 ------------ 7 files changed, 8 insertions(+), 625 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index f111a2f83064..bb1a19ec5ceb 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,14 @@ # xargs -n1 | sort | uniq -d; # done +# 20210316: remove obsolete NFS headers +OLD_FILES+=usr/include/nfs/nfs_common.h +OLD_FILES+=usr/include/nfsclient/nfsm_subs.h +OLD_FILES+=usr/include/nfsclient/nlminfo.h +OLD_FILES+=usr/include/nfsserver/nfs_fha_old.h +OLD_FILES+=usr/include/nfsserver/nfsm_subs.h +OLD_FILES+=usr/include/nfsserver/nfsrvcache.h + # 20210315: Remove kernel-only crypto headers from /usr/include OLD_FILES+=usr/include/crypto/_cryptodev.h OLD_FILES+=usr/include/crypto/cbc_mac.h diff --git a/sys/nfs/nfs_common.h b/sys/nfs/nfs_common.h deleted file mode 100644 index a821934da0a2..000000000000 --- a/sys/nfs/nfs_common.h +++ /dev/null @@ -1,137 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Rick Macklem at The University of Guelph. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. - * - * @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95 - * $FreeBSD$ - */ - -#ifndef _NFS_NFS_COMMON_H_ -#define _NFS_NFS_COMMON_H_ - -extern enum vtype nv3tov_type[]; -extern nfstype nfsv3_type[]; - -#define vtonfsv2_mode(t, m) \ - txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : MAKEIMODE((t), (m))) - -#define nfsv3tov_type(a) nv3tov_type[fxdr_unsigned(u_int32_t,(a))&0x7] -#define vtonfsv3_type(a) txdr_unsigned(nfsv3_type[((int32_t)(a))]) - -int nfs_adv(struct mbuf **, caddr_t *, int, int); -void *nfsm_disct(struct mbuf **, caddr_t *, int, int, int); -int nfs_realign(struct mbuf **, int); - -/* ****************************** */ -/* Build request/reply phase macros */ - -void *nfsm_build_xx(int s, struct mbuf **mb, caddr_t *bpos); - -#define nfsm_build(c, s) \ - (c)nfsm_build_xx((s), &mb, &bpos) - -/* ****************************** */ -/* Interpretation phase macros */ - -void *nfsm_dissect_xx(int s, struct mbuf **md, caddr_t *dpos); -void *nfsm_dissect_xx_nonblock(int s, struct mbuf **md, caddr_t *dpos); -int nfsm_strsiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos); -int nfsm_adv_xx(int s, struct mbuf **md, caddr_t *dpos); - -/* Error check helpers */ -#define nfsm_dcheck(t1, mrep) \ -do { \ - if (t1 != 0) { \ - error = t1; \ - m_freem((mrep)); \ - (mrep) = NULL; \ - goto nfsmout; \ - } \ -} while (0) - -#define nfsm_dcheckp(retp, mrep) \ -do { \ - if (retp == NULL) { \ - error = EBADRPC; \ - m_freem((mrep)); \ - (mrep) = NULL; \ - goto nfsmout; \ - } \ -} while (0) - -#define nfsm_dissect(c, s) \ -({ \ - void *ret; \ - ret = nfsm_dissect_xx((s), &md, &dpos); \ - nfsm_dcheckp(ret, mrep); \ - (c)ret; \ -}) - -#define nfsm_dissect_nonblock(c, s) \ -({ \ - void *ret; \ - ret = nfsm_dissect_xx_nonblock((s), &md, &dpos); \ - nfsm_dcheckp(ret, mrep); \ - (c)ret; \ -}) - -#define nfsm_strsiz(s,m) \ -do { \ - int t1; \ - t1 = nfsm_strsiz_xx(&(s), (m), &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while(0) - -#define nfsm_mtouio(p,s) \ -do {\ - int32_t t1 = 0; \ - if ((s) > 0) \ - t1 = nfsm_mbuftouio(&md, (p), (s), &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -#define nfsm_rndup(a) (((a)+3)&(~0x3)) - -#define nfsm_adv(s) \ -do { \ - int t1; \ - t1 = nfsm_adv_xx((s), &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -#ifdef __NO_STRICT_ALIGNMENT -#define nfsm_aligned(p, t) 1 -#else -#define nfsm_aligned(p, t) ((((u_long)(p)) & (sizeof(t) - 1)) == 0) -#endif - -#endif diff --git a/sys/nfsclient/nfsm_subs.h b/sys/nfsclient/nfsm_subs.h deleted file mode 100644 index b918e78ae728..000000000000 --- a/sys/nfsclient/nfsm_subs.h +++ /dev/null @@ -1,180 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Rick Macklem at The University of Guelph. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. - * - * @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95 - * $FreeBSD$ - */ - -#ifndef _NFSCLIENT_NFSM_SUBS_H_ -#define _NFSCLIENT_NFSM_SUBS_H_ - -#include - -#define nfsv2tov_type(a) nv2tov_type[fxdr_unsigned(u_int32_t,(a))&0x7] - -struct ucred; -struct vnode; - -/* - * These macros do strange and peculiar things to mbuf chains for - * the assistance of the nfs code. To attempt to use them for any - * other purpose will be dangerous. (they make weird assumptions) - */ - -/* - * First define what the actual subs. return - */ -u_int32_t nfs_xid_gen(void); - -/* *********************************** */ -/* Request generation phase macros */ - -int nfsm_fhtom_xx(struct vnode *v, int v3, struct mbuf **mb, - caddr_t *bpos); -void nfsm_v3attrbuild_xx(struct vattr *va, int full, struct mbuf **mb, - caddr_t *bpos); -int nfsm_strtom_xx(const char *a, int s, int m, struct mbuf **mb, - caddr_t *bpos); - -#define nfsm_bcheck(t1, mreq) \ -do { \ - if (t1) { \ - error = t1; \ - m_freem(mreq); \ - goto nfsmout; \ - } \ -} while (0) - -#define nfsm_fhtom(v, v3) \ -do { \ - int32_t t1; \ - t1 = nfsm_fhtom_xx((v), (v3), &mb, &bpos); \ - nfsm_bcheck(t1, mreq); \ -} while (0) - -/* If full is true, set all fields, otherwise just set mode and time fields */ -#define nfsm_v3attrbuild(a, full) \ - nfsm_v3attrbuild_xx(a, full, &mb, &bpos) - -#define nfsm_uiotom(p, s) \ -do { \ - int t1; \ - t1 = nfsm_uiotombuf((p), &mb, (s), &bpos); \ - nfsm_bcheck(t1, mreq); \ -} while (0) - -#define nfsm_strtom(a, s, m) \ -do { \ - int t1; \ - t1 = nfsm_strtom_xx((a), (s), (m), &mb, &bpos); \ - nfsm_bcheck(t1, mreq); \ -} while (0) - -/* *********************************** */ -/* Send the request */ - -#define nfsm_request(v, t, p, c) \ -do { \ - sigset_t oldset; \ - nfs_set_sigmask(p, &oldset); \ - error = nfs_request((v), mreq, (t), (p), (c), &mrep, &md, &dpos); \ - nfs_restore_sigmask(p, &oldset); \ - if (error != 0) { \ - if (error & NFSERR_RETERR) \ - error &= ~NFSERR_RETERR; \ - else \ - goto nfsmout; \ - } \ -} while (0) - -/* *********************************** */ -/* Reply interpretation phase macros */ - -int nfsm_mtofh_xx(struct vnode *d, struct vnode **v, int v3, int *f, - struct mbuf **md, caddr_t *dpos); -int nfsm_getfh_xx(nfsfh_t **f, int *s, int v3, struct mbuf **md, - caddr_t *dpos); -int nfsm_loadattr_xx(struct vnode **v, struct vattr *va, struct mbuf **md, - caddr_t *dpos); -int nfsm_postop_attr_xx(struct vnode **v, int *f, struct vattr *va, - struct mbuf **md, caddr_t *dpos); -int nfsm_wcc_data_xx(struct vnode **v, int *f, struct mbuf **md, - caddr_t *dpos); - -#define nfsm_mtofh(d, v, v3, f) \ -do { \ - int32_t t1; \ - t1 = nfsm_mtofh_xx((d), &(v), (v3), &(f), &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -#define nfsm_getfh(f, s, v3) \ -do { \ - int32_t t1; \ - t1 = nfsm_getfh_xx(&(f), &(s), (v3), &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -#define nfsm_loadattr(v, a) \ -do { \ - int32_t t1; \ - t1 = nfsm_loadattr_xx(&v, a, &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -#define nfsm_postop_attr(v, f) \ -do { \ - int32_t t1; \ - t1 = nfsm_postop_attr_xx(&v, &f, NULL, &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -#define nfsm_postop_attr_va(v, f, va) \ -do { \ - int32_t t1; \ - t1 = nfsm_postop_attr_xx(&v, &f, va, &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -/* Used as (f) for nfsm_wcc_data() */ -#define NFSV3_WCCRATTR 0 -#define NFSV3_WCCCHK 1 - -#define nfsm_wcc_data(v, f) \ -do { \ - int32_t t1; \ - t1 = nfsm_wcc_data_xx(&v, &f, &md, &dpos); \ - nfsm_dcheck(t1, mrep); \ -} while (0) - -#endif diff --git a/sys/nfsclient/nlminfo.h b/sys/nfsclient/nlminfo.h deleted file mode 100644 index 340bdbe5faa2..000000000000 --- a/sys/nfsclient/nlminfo.h +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1998 Berkeley Software Design, Inc. All rights reserved. - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 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. Berkeley Software Design Inc's name may not be used to endorse or - * promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``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 BERKELEY SOFTWARE DESIGN INC 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. - * - * from BSDI nlminfo.h,v 2.1 1998/03/18 01:30:38 don Exp - * $FreeBSD$ - */ - -/* - * Misc NLM informationi, some needed for the master lockd process, and some - * needed by every process doing nlm based locking. - */ -struct nlminfo { - /* these are used by any process doing nlm locking */ - int msg_seq; /* sequence counter for lock requests */ - int retcode; /* return code for lock requests */ - int set_getlk_pid; - int getlk_pid; - struct timeval pid_start; /* process starting time */ -}; diff --git a/sys/nfsserver/nfs_fha_old.h b/sys/nfsserver/nfs_fha_old.h deleted file mode 100644 index c7845aca8157..000000000000 --- a/sys/nfsserver/nfs_fha_old.h +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ - * Copyright (c) 2013 Spectra Logic Corporation - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -/* $FreeBSD$ */ - -#ifndef _NFS_FHA_OLD_H -#define _NFS_FHA_OLD_H 1 - -#ifdef _KERNEL - -#define FHAOLD_SERVER_NAME "nfsrv" - -SVCTHREAD *fhaold_assign(SVCTHREAD *this_thread, struct svc_req *req); -#endif /* _KERNEL */ - -#endif /* _NFS_FHA_OLD_H */ diff --git a/sys/nfsserver/nfsm_subs.h b/sys/nfsserver/nfsm_subs.h deleted file mode 100644 index 10c34ba634ed..000000000000 --- a/sys/nfsserver/nfsm_subs.h +++ /dev/null @@ -1,175 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Rick Macklem at The University of Guelph. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. - * - * @(#)nfsm_subs.h 8.2 (Berkeley) 3/30/95 - * $FreeBSD$ - */ - -#ifndef _NFSSERVER_NFSM_SUBS_H_ -#define _NFSSERVER_NFSM_SUBS_H_ - -#include - -#define nfstov_mode(a) (fxdr_unsigned(u_int32_t, (a)) & ALLPERMS) - -/* - * These macros do strange and peculiar things to mbuf chains for - * the assistance of the nfs code. To attempt to use them for any - * other purpose will be dangerous. (they make weird assumptions) - */ - -/* - * Now for the macros that do the simple stuff and call the functions - * for the hard stuff. - * These macros use several vars. declared in nfsm_reqhead and these - * vars. must not be used elsewhere unless you are careful not to corrupt - * them. The vars. starting with pN and tN (N=1,2,3,..) are temporaries - * that may be used so long as the value is not expected to retained - * after a macro. - * I know, this is kind of dorkey, but it makes the actual op functions - * fairly clean and deals with the mess caused by the xdr discriminating - * unions. - */ - -/* ************************************* */ -/* Dissection phase macros */ - -int nfsm_srvstrsiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos); -int nfsm_srvnamesiz_xx(int *s, int m, struct mbuf **md, caddr_t *dpos); -int nfsm_srvnamesiz0_xx(int *s, int m, struct mbuf **md, caddr_t *dpos); -int nfsm_srvmtofh_xx(fhandle_t *f, int v3, struct mbuf **md, caddr_t *dpos); -int nfsm_srvsattr_xx(struct vattr *a, struct mbuf **md, caddr_t *dpos); - -#define nfsm_srvstrsiz(s, m) \ -do { \ - int t1; \ - t1 = nfsm_srvstrsiz_xx(&(s), (m), &md, &dpos); \ - if (t1) { \ - error = t1; \ - nfsm_reply(0); \ - } \ -} while (0) - -#define nfsm_srvnamesiz(s) \ -do { \ - int t1; \ - t1 = nfsm_srvnamesiz_xx(&(s), NFS_MAXNAMLEN, &md, &dpos); \ - if (t1) { \ - error = t1; \ - nfsm_reply(0); \ - } \ -} while (0) - -#define nfsm_srvpathsiz(s) \ -do { \ - int t1; \ - t1 = nfsm_srvnamesiz0_xx(&(s), NFS_MAXPATHLEN, &md, &dpos); \ - if (t1) { \ - error = t1; \ - nfsm_reply(0); \ - } \ -} while (0) - -#define nfsm_srvmtofh(f) \ -do { \ - int t1; \ - t1 = nfsm_srvmtofh_xx((f), nfsd->nd_flag & ND_NFSV3, &md, &dpos); \ - if (t1) { \ - error = t1; \ - nfsm_reply(0); \ - } \ -} while (0) - -/* XXX why is this different? */ -#define nfsm_srvsattr(a) \ -do { \ - int t1; \ - t1 = nfsm_srvsattr_xx((a), &md, &dpos); \ - if (t1) { \ - error = t1; \ - m_freem(mrep); \ - mrep = NULL; \ - goto nfsmout; \ - } \ -} while (0) - -/* ************************************* */ -/* Prepare the reply */ - -#define nfsm_reply(s) \ -do { \ - if (mrep != NULL) { \ - m_freem(mrep); \ - mrep = NULL; \ - } \ - mreq = nfs_rephead((s), nfsd, error, &mb, &bpos); \ - *mrq = mreq; \ - if (error == EBADRPC) { \ - error = 0; \ - goto nfsmout; \ - } \ -} while (0) - -#define nfsm_writereply(s) \ -do { \ - mreq = nfs_rephead((s), nfsd, error, &mb, &bpos); \ -} while(0) - -/* ************************************* */ -/* Reply phase macros - add additional reply info */ - -void nfsm_srvfhtom_xx(fhandle_t *f, int v3, struct mbuf **mb, - caddr_t *bpos); -void nfsm_srvpostop_fh_xx(fhandle_t *f, struct mbuf **mb, caddr_t *bpos); -void nfsm_clget_xx(u_int32_t **tl, struct mbuf *mb, struct mbuf **mp, - char **bp, char **be, caddr_t bpos); - -#define nfsm_srvfhtom(f, v3) \ - nfsm_srvfhtom_xx((f), (v3), &mb, &bpos) - -#define nfsm_srvpostop_fh(f) \ - nfsm_srvpostop_fh_xx((f), &mb, &bpos) - -#define nfsm_srvwcc_data(br, b, ar, a) \ - nfsm_srvwcc(nfsd, (br), (b), (ar), (a), &mb, &bpos) - -#define nfsm_srvpostop_attr(r, a) \ - nfsm_srvpostopattr(nfsd, (r), (a), &mb, &bpos) - -#define nfsm_srvfillattr(a, f) \ - nfsm_srvfattr(nfsd, (a), (f)) - -#define nfsm_clget \ - nfsm_clget_xx(&tl, mb, &mp, &bp, &be, bpos) - -#endif diff --git a/sys/nfsserver/nfsrvcache.h b/sys/nfsserver/nfsrvcache.h deleted file mode 100644 index 10dff78538cd..000000000000 --- a/sys/nfsserver/nfsrvcache.h +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Rick Macklem at The University of Guelph. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. - * - * @(#)nfsrvcache.h 8.3 (Berkeley) 3/30/95 - * $FreeBSD$ - */ - -#ifndef _NFSSERVER_NFSRVCACHE_H_ -#define _NFSSERVER_NFSRVCACHE_H_ - -#include - -/* - * Definitions for the server recent request cache - */ -#define NFSRVCACHE_MAX_SIZE 2048 -#define NFSRVCACHE_MIN_SIZE 64 - -#endif From owner-dev-commits-src-all@freebsd.org Tue Mar 16 20:29:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15CA256C595; Tue, 16 Mar 2021 20:29:43 +0000 (UTC) (envelope-from truckman@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 4F0PzC0D47z3MlV; Tue, 16 Mar 2021 20:29:43 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from mousie.catspoiler.org (unknown [76.212.85.177]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: truckman) by smtp.freebsd.org (Postfix) with ESMTPSA id EC2F8948E; Tue, 16 Mar 2021 20:29:41 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Date: Tue, 16 Mar 2021 13:29:39 -0700 (PDT) From: Don Lewis Subject: Re: git: 0af8a2db34cf - main - release: do not set __MAKE_CONF and SRCCONF for the chroot build To: Glen Barber cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org In-Reply-To: <202103161602.12GG21Xh040659@gitrepo.freebsd.org> Message-ID: References: <202103161602.12GG21Xh040659@gitrepo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; CHARSET=us-ascii Content-Disposition: INLINE X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 20:29:43 -0000 On 16 Mar, Glen Barber wrote: > The branch main has been updated by gjb: > > URL: https://cgit.FreeBSD.org/src/commit/?id=0af8a2db34cff008d4f48f357da48b7379b18893 > > commit 0af8a2db34cff008d4f48f357da48b7379b18893 > Author: Glen Barber > AuthorDate: 2021-03-16 16:01:48 +0000 > Commit: Glen Barber > CommitDate: 2021-03-16 16:01:48 +0000 > > release: do not set __MAKE_CONF and SRCCONF for the chroot build > > PR: 254319 > Submitted by: truckman > MFC after: 1 week > Sponsored by: Rubicon Communications, LLC ("Netgate") Thanks! From owner-dev-commits-src-all@freebsd.org Tue Mar 16 21:43:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50A8F56F20C; Tue, 16 Mar 2021 21:43: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 4F0RcP1qbQz3kgj; Tue, 16 Mar 2021 21:43:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31D1B2AFDD; Tue, 16 Mar 2021 21:43:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12GLhXlx088434; Tue, 16 Mar 2021 21:43:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12GLhXSe088433; Tue, 16 Mar 2021 21:43:33 GMT (envelope-from git) Date: Tue, 16 Mar 2021 21:43:33 GMT Message-Id: <202103162143.12GLhXSe088433@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: 096a84721670 - main - nlmrsa: Mark deprecated for 14. 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: 096a84721670d388e432a1f7399251e4b20714f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Mar 2021 21:43:33 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=096a84721670d388e432a1f7399251e4b20714f1 commit 096a84721670d388e432a1f7399251e4b20714f1 Author: John Baldwin AuthorDate: 2021-03-16 21:34:58 +0000 Commit: John Baldwin CommitDate: 2021-03-16 21:43:03 +0000 nlmrsa: Mark deprecated for 14. This is the only in-tree driver for the asymmetric crypto support in OCF that is already marked deprecated for 14. MFC after: 3 days Sponsored by: Chelsio Communications --- sys/mips/nlm/dev/sec/nlmrsa.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/mips/nlm/dev/sec/nlmrsa.c b/sys/mips/nlm/dev/sec/nlmrsa.c index 3252ecbed9c9..42b904d22a64 100644 --- a/sys/mips/nlm/dev/sec/nlmrsa.c +++ b/sys/mips/nlm/dev/sec/nlmrsa.c @@ -296,6 +296,7 @@ xlp_rsa_attach(device_t dev) 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: From owner-dev-commits-src-all@freebsd.org Wed Mar 17 00:10:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A052573446 for ; Wed, 17 Mar 2021 00:10: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 4F0VsV33SDz3tl9; Wed, 17 Mar 2021 00:10: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 5BCE02CE24; Wed, 17 Mar 2021 00:10: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 12H0A6Zj077442; Wed, 17 Mar 2021 00:10:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12H0A6Tt077439; Wed, 17 Mar 2021 00:10:06 GMT (envelope-from git) Date: Wed, 17 Mar 2021 00:10:06 GMT Message-Id: <202103170010.12H0A6Tt077439@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Cy Schubert Subject: git: 9e114a3b999c - vendor/wpa - wpa: import fix for P2P provision discovery processing vulnerability MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/vendor/wpa X-Git-Reftype: branch X-Git-Commit: 9e114a3b999c6db7c0863adaa50b241738e0a39a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 00:10:06 -0000 The branch vendor/wpa has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=9e114a3b999c6db7c0863adaa50b241738e0a39a commit 9e114a3b999c6db7c0863adaa50b241738e0a39a Author: Cy Schubert AuthorDate: 2021-03-17 00:06:17 +0000 Commit: Cy Schubert CommitDate: 2021-03-17 00:06:17 +0000 wpa: import fix for P2P provision discovery processing vulnerability Latest version available from: https://w1.fi/security/2021-1/ Vulnerability A vulnerability was discovered in how wpa_supplicant processes P2P (Wi-Fi Direct) provision discovery requests. Under a corner case condition, an invalid Provision Discovery Request frame could end up reaching a state where the oldest peer entry needs to be removed. With a suitably constructed invalid frame, this could result in use (read+write) of freed memory. This can result in an attacker within radio range of the device running P2P discovery being able to cause unexpected behavior, including termination of the wpa_supplicant process and potentially code execution. Vulnerable versions/configurations wpa_supplicant v1.0-v2.9 with CONFIG_P2P build option enabled An attacker (or a system controlled by the attacker) needs to be within radio range of the vulnerable system to send a set of suitably constructed management frames that trigger the corner case to be reached in the management of the P2P peer table. Note: FreeBSD base does not enable P2P. --- src/p2p/p2p_pd.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c index 3994ec03f86b..05fd593494ef 100644 --- a/src/p2p/p2p_pd.c +++ b/src/p2p/p2p_pd.c @@ -595,14 +595,12 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa, goto out; } + dev = p2p_get_device(p2p, sa); if (!dev) { - dev = p2p_get_device(p2p, sa); - if (!dev) { - p2p_dbg(p2p, - "Provision Discovery device not found " - MACSTR, MAC2STR(sa)); - goto out; - } + p2p_dbg(p2p, + "Provision Discovery device not found " + MACSTR, MAC2STR(sa)); + goto out; } } else if (msg.wfd_subelems) { wpabuf_free(dev->info.wfd_subelems); From owner-dev-commits-src-all@freebsd.org Wed Mar 17 00:11:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A258573717; Wed, 17 Mar 2021 00:11: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 4F0VvW0l25z3v8j; Wed, 17 Mar 2021 00:11: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 0C4112C8F6; Wed, 17 Mar 2021 00:11: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 12H0BoLW084030; Wed, 17 Mar 2021 00:11:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12H0Bo64084029; Wed, 17 Mar 2021 00:11:50 GMT (envelope-from git) Date: Wed, 17 Mar 2021 00:11:50 GMT Message-Id: <202103170011.12H0Bo64084029@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kyle Evans Subject: git: cb370b19715b - releng/13.0 - service(8): use an environment more consistent with init(8) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: cb370b19715b696cf6db4f7b357cf2e7f2e3adb7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 00:11:51 -0000 The branch releng/13.0 has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=cb370b19715b696cf6db4f7b357cf2e7f2e3adb7 commit cb370b19715b696cf6db4f7b357cf2e7f2e3adb7 Author: Andrew Gierth AuthorDate: 2021-03-03 18:25:11 +0000 Commit: Kyle Evans CommitDate: 2021-03-17 00:11:23 +0000 service(8): use an environment more consistent with init(8) init(8) sets the "daemon" login class without specifying a pw entry (so no substitutions are done on the variables). service(8)'s use of env -L had the effect of specifying root's pw entry, with two effects: getpwnam and getpwuid are being called, which may not be entirely safe depending on what nsswitch is up to and what stage of boot we are at, and substitutions would have been done. Fix by teaching env(8) to allow -L -/classname to set the class environment with no pw entry at all specified, and use it in service(8). PR: 253959 Approved by: re (gjb) (cherry picked from commit 55deb0a5f089c8a27cfc1666655b93881c2b47ae) (cherry picked from commit 0c1a5eaae83267365330437adb60f44e1a622a2b) (cherry picked from commit 872ec7e5b6f35d84745b49c02f58572632de22ed) --- usr.bin/env/env.1 | 7 ++++++- usr.bin/env/env.c | 25 ++++++++++++++++--------- usr.sbin/service/service.sh | 2 +- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/usr.bin/env/env.1 b/usr.bin/env/env.1 index 8c0527608506..9aff9508e47b 100644 --- a/usr.bin/env/env.1 +++ b/usr.bin/env/env.1 @@ -31,7 +31,7 @@ .\" From FreeBSD: src/usr.bin/printenv/printenv.1,v 1.17 2002/11/26 17:33:35 ru Exp .\" $FreeBSD$ .\" -.Dd November 11, 2020 +.Dd March 3, 2021 .Dt ENV 1 .Os .Sh NAME @@ -104,6 +104,11 @@ is used, then the specified user's .Pa ~/.login_conf is read as well. The user may be specified by name or by uid. +If a username of +.Sq Li \&- +is given, then no user lookup will be done, the login class will default to +.Sq Li default +if not explicitly given, and no substitutions will be done on the values. .\" -P .It Fl P Ar altpath Search the set of directories as specified by diff --git a/usr.bin/env/env.c b/usr.bin/env/env.c index e408577ea7a4..a0f55d665a9a 100644 --- a/usr.bin/env/env.c +++ b/usr.bin/env/env.c @@ -144,16 +144,23 @@ main(int argc, char **argv) login_class = strchr(login_name, '/'); if (login_class) *login_class++ = '\0'; - pw = getpwnam(login_name); - if (pw == NULL) { - char *endp = NULL; - errno = 0; - uid = strtoul(login_name, &endp, 10); - if (errno == 0 && *endp == '\0') - pw = getpwuid(uid); + if (*login_name != '\0' && strcmp(login_name, "-") != 0) { + pw = getpwnam(login_name); + if (pw == NULL) { + char *endp = NULL; + errno = 0; + uid = strtoul(login_name, &endp, 10); + if (errno == 0 && *endp == '\0') + pw = getpwuid(uid); + } + if (pw == NULL) + errx(EXIT_FAILURE, "no such user: %s", login_name); } - if (pw == NULL) - errx(EXIT_FAILURE, "no such user: %s", login_name); + /* + * Note that it is safe for pw to be null here; the libutil + * code handles that, bypassing substitution of $ and using + * the class "default" if no class name is given either. + */ if (login_class != NULL) { lc = login_getclass(login_class); if (lc == NULL) diff --git a/usr.sbin/service/service.sh b/usr.sbin/service/service.sh index 42a50fcf61b9..df2869f98a6c 100755 --- a/usr.sbin/service/service.sh +++ b/usr.sbin/service/service.sh @@ -165,7 +165,7 @@ cd / for dir in /etc/rc.d $local_startup; do if [ -x "$dir/$script" ]; then [ -n "$VERBOSE" ] && echo "$script is located in $dir" - exec env -i -L 0/daemon HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin "$dir/$script" "$@" + exec env -i -L -/daemon HOME=/ PATH=/sbin:/bin:/usr/sbin:/usr/bin "$dir/$script" "$@" fi done From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:24 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D981D5A8A7C; Wed, 17 Mar 2021 10:27: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 4F0mYm5sQ9z3F56; Wed, 17 Mar 2021 10:27: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 BBDFE50C0; Wed, 17 Mar 2021 10:27: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 12HAROmZ095721; Wed, 17 Mar 2021 10:27:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARORv095720; Wed, 17 Mar 2021 10:27:24 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:24 GMT Message-Id: <202103171027.12HARORv095720@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 8d42552e7b29 - stable/13 - msun: ctanh/ctanhf: Import fix from musl libc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8d42552e7b29eed31ec6b28d091d8c9b99d824fc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:24 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=8d42552e7b29eed31ec6b28d091d8c9b99d824fc commit 8d42552e7b29eed31ec6b28d091d8c9b99d824fc Author: Alex Richardson AuthorDate: 2021-02-15 22:06:41 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:44:16 +0000 msun: ctanh/ctanhf: Import fix from musl libc This applies musl commit b02eed9c4841913d690a2d0029737d72615384fe by Szabolcs Nagy and updates the tests accordingly. This also allows removing an XFAIL from the test. musl commit message: complex: fix ctanh(+-0+i*nan) and ctanh(+-0+-i*inf) These cases were incorrect in C11 as described by http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1886.htm PR: 217528 Reviewed By: dim MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28578 (cherry picked from commit a7b42c4b7f7ad7bd1b22ab57ed9185bdcea6f0a2) --- lib/msun/src/s_ctanh.c | 8 +++++--- lib/msun/src/s_ctanhf.c | 2 +- lib/msun/tests/ctrig_test.c | 23 ++++++++--------------- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/lib/msun/src/s_ctanh.c b/lib/msun/src/s_ctanh.c index 13eb9d40b678..93e5ad444501 100644 --- a/lib/msun/src/s_ctanh.c +++ b/lib/msun/src/s_ctanh.c @@ -111,11 +111,13 @@ ctanh(double complex z) } /* - * ctanh(x + I NaN) = d(NaN) + I d(NaN) - * ctanh(x +- I Inf) = dNaN + I dNaN + * ctanh(+-0 + i NAN) = +-0 + i NaN + * ctanh(+-0 +- i Inf) = +-0 + i NaN + * ctanh(x + i NAN) = NaN + i NaN + * ctanh(x +- i Inf) = NaN + i NaN */ if (!isfinite(y)) - return (CMPLX(y - y, y - y)); + return (CMPLX(x ? y - y : x, y - y)); /* * ctanh(+-huge +- I y) ~= +-1 +- I 2sin(2y)/exp(2x), using the diff --git a/lib/msun/src/s_ctanhf.c b/lib/msun/src/s_ctanhf.c index 7d375eafd2ae..164a2c23df9e 100644 --- a/lib/msun/src/s_ctanhf.c +++ b/lib/msun/src/s_ctanhf.c @@ -61,7 +61,7 @@ ctanhf(float complex z) } if (!isfinite(y)) - return (CMPLXF(y - y, y - y)); + return (CMPLXF(ix ? y - y : x, y - y)); if (ix >= 0x41300000) { /* |x| >= 11 */ float exp_mx = expf(-fabsf(x)); diff --git a/lib/msun/tests/ctrig_test.c b/lib/msun/tests/ctrig_test.c index 45b2b78b0416..b40373fed29b 100644 --- a/lib/msun/tests/ctrig_test.c +++ b/lib/msun/tests/ctrig_test.c @@ -138,13 +138,6 @@ ATF_TC_BODY(test_zero_input, tc) { long double complex zero = CMPLXL(0.0, 0.0); -#if defined(__amd64__) -#if defined(__clang__) && \ - ((__clang_major__ >= 4)) - atf_tc_expect_fail("test fails with clang 4.x+ - bug 217528"); -#endif -#endif - /* csinh(0) = ctanh(0) = 0; ccosh(0) = 1 (no exceptions raised) */ testall_odd(csinh, zero, zero, ALL_STD_EXCEPT, 0, CS_BOTH); testall_odd(csin, zero, zero, ALL_STD_EXCEPT, 0, CS_BOTH); @@ -171,8 +164,8 @@ ATF_TC_BODY(test_nan_inputs, tc) * NaN,finite NaN,NaN [inval] NaN,NaN [inval] NaN,NaN [inval] * NaN,Inf NaN,NaN [inval] NaN,NaN [inval] NaN,NaN [inval] * Inf,NaN +-Inf,NaN Inf,NaN 1,+-0 - * 0,NaN +-0,NaN NaN,+-0 NaN,NaN [inval] - * NaN,0 NaN,0 NaN,+-0 NaN,0 + * 0,NaN +-0,NaN NaN,+-0 +-0,NaN + * NaN,0 NaN,0 NaN,+-0 NaN,+-0 */ z = nan_nan; testall_odd(csinh, z, nan_nan, ALL_STD_EXCEPT, 0, 0); @@ -219,9 +212,9 @@ ATF_TC_BODY(test_nan_inputs, tc) testall_odd(ctan, z, nan_nan, OPT_INVALID, 0, 0); z = CMPLXL(0, NAN); - testall_odd(csinh, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, 0, 0); + testall_odd(csinh, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, 0, CS_REAL); testall_even(ccosh, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, 0); - testall_odd(ctanh, z, nan_nan, OPT_INVALID, 0, 0); + testall_odd(ctanh, z, CMPLXL(0, NAN), OPT_INVALID, 0, CS_REAL); testall_odd(csin, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, 0, CS_REAL); testall_even(ccos, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, 0); testall_odd(ctan, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, 0, CS_REAL); @@ -232,7 +225,7 @@ ATF_TC_BODY(test_nan_inputs, tc) testall_odd(ctanh, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, CS_IMAG); testall_odd(csin, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, 0); testall_even(ccos, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, 0); - testall_odd(ctan, z, nan_nan, OPT_INVALID, 0, 0); + testall_odd(ctan, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, 0, CS_IMAG); } ATF_TC(test_inf_inputs); @@ -252,7 +245,7 @@ ATF_TC_BODY(test_inf_inputs, tc) * IN CSINH CCOSH CTANH * Inf,Inf +-Inf,NaN inval +-Inf,NaN inval 1,+-0 * Inf,finite Inf cis(finite) Inf cis(finite) 1,0 sin(2 finite) - * 0,Inf +-0,NaN inval NaN,+-0 inval NaN,NaN inval + * 0,Inf +-0,NaN inval NaN,+-0 inval +-0,NaN * finite,Inf NaN,NaN inval NaN,NaN inval NaN,NaN inval */ z = CMPLXL(INFINITY, INFINITY); @@ -286,11 +279,11 @@ ATF_TC_BODY(test_inf_inputs, tc) z = CMPLXL(0, INFINITY); testall_odd(csinh, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); testall_even(ccosh, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, FE_INVALID, 0); - testall_odd(ctanh, z, CMPLXL(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); + testall_odd(ctanh, z, CMPLXL(0, NAN), ALL_STD_EXCEPT, FE_INVALID, CS_REAL); z = CMPLXL(INFINITY, 0); testall_odd(csin, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, FE_INVALID, 0); testall_even(ccos, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, FE_INVALID, 0); - testall_odd(ctan, z, CMPLXL(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); + testall_odd(ctan, z, CMPLXL(NAN, 0), ALL_STD_EXCEPT, FE_INVALID, CS_IMAG); z = CMPLXL(42, INFINITY); testall_odd(csinh, z, CMPLXL(NAN, NAN), ALL_STD_EXCEPT, FE_INVALID, 0); From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95DED5A8A7D; Wed, 17 Mar 2021 10:27: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 4F0mYp0s4Fz3Dvs; Wed, 17 Mar 2021 10:27: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 D879953E3; Wed, 17 Mar 2021 10:27: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 12HARPu0095743; Wed, 17 Mar 2021 10:27:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARPH6095742; Wed, 17 Mar 2021 10:27:25 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:25 GMT Message-Id: <202103171027.12HARPH6095742@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 4edea0540344 - stable/13 - Fix fget_only_user() to return ENOTCAPABLE on a failed capsicum check MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4edea05403443d8804155d8e3fd7ac460f491cd4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:26 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=4edea05403443d8804155d8e3fd7ac460f491cd4 commit 4edea05403443d8804155d8e3fd7ac460f491cd4 Author: Alex Richardson AuthorDate: 2021-02-15 22:09:33 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:44:17 +0000 Fix fget_only_user() to return ENOTCAPABLE on a failed capsicum check After eaad8d1303da500ed691bd774742a4555a05e729 four additional capsicum-test tests started failing. It turns out this is because fget_only_user() was returning EBADF on a failed capsicum check instead of forwarding the return value of cap_check_inline() like fget_unlocked_seq(). capsicum-test failures before this: ``` [ FAILED ] 7 tests, listed below: [ FAILED ] Capability.OperationsForked [ FAILED ] Capability.NoBypassDAC [ FAILED ] Pdfork.OtherUserForked [ FAILED ] PipePdfork.WildcardWait [ FAILED ] OpenatTest.WithFlag [ FAILED ] ForkedOpenatTest_WithFlagInCapabilityMode._ [ FAILED ] Select.LotsOFileDescriptorsForked ``` After: ``` [ FAILED ] 3 tests, listed below: [ FAILED ] Capability.NoBypassDAC [ FAILED ] Pdfork.OtherUserForked [ FAILED ] PipePdfork.WildcardWait ``` Reviewed By: mjg MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28691 (cherry picked from commit 0482d7c9e944433abc98fc27a265ae762abce9a0) --- sys/kern/kern_descrip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 31c7d3bf2188..0813b6c8f3b8 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -3214,7 +3214,7 @@ fget_only_user(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, haverights = cap_rights_fde_inline(fde); error = cap_check_inline(haverights, needrightsp); if (__predict_false(error != 0)) - return (EBADF); + return (error); *fpp = fp; return (0); } From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 616A25A9084; Wed, 17 Mar 2021 10:27: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 4F0mYq1SN6z3F9v; Wed, 17 Mar 2021 10:27: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 0EC554EF3; Wed, 17 Mar 2021 10:27: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 12HARQOo095761; Wed, 17 Mar 2021 10:27:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARQ95095760; Wed, 17 Mar 2021 10:27:26 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:26 GMT Message-Id: <202103171027.12HARQ95095760@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 55872d471d05 - stable/13 - Arch64: Clear VFP state on execve() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 55872d471d05c14207c4c4042975f602c2112956 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:27 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=55872d471d05c14207c4c4042975f602c2112956 commit 55872d471d05c14207c4c4042975f602c2112956 Author: Alex Richardson AuthorDate: 2021-03-09 19:11:40 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:44:17 +0000 Arch64: Clear VFP state on execve() I noticed that many of the math-related tests were failing on AArch64. After a lot of debugging, I noticed that the floating point exception flags were not being reset when starting a new process. This change resets the VFP inside exec_setregs() to ensure no VFP register state is leaked from parent processes to children. This commit also moves the clearing of fpcr that was added in 65618fdda0f27 from fork() to execve() since that makes more sense: fork() can retain current register values, but execve() should result in a well-defined clean state. Reviewed By: andrew MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29060 (cherry picked from commit 953a7d7c61f3b2f5351dfe668510ec782ae282e8) --- sys/arm64/arm64/elf32_machdep.c | 7 +++++++ sys/arm64/arm64/machdep.c | 7 +++++++ sys/arm64/arm64/vfp.c | 21 +++++++++++++++++++++ sys/arm64/arm64/vm_machdep.c | 1 - sys/arm64/include/vfp.h | 1 + sys/arm64/linux/linux_sysvec.c | 8 ++++++++ 6 files changed, 44 insertions(+), 1 deletion(-) diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c index 916633650d69..84b62caf8590 100644 --- a/sys/arm64/arm64/elf32_machdep.c +++ b/sys/arm64/arm64/elf32_machdep.c @@ -51,6 +51,9 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef VFP +#include +#endif #include @@ -251,6 +254,10 @@ freebsd32_setregs(struct thread *td, struct image_params *imgp, tf->tf_x[14] = imgp->entry_addr; tf->tf_elr = imgp->entry_addr; tf->tf_spsr = PSR_M_32; + +#ifdef VFP + vfp_reset_state(td, td->td_pcb); +#endif } void diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 73b06beeba7e..91f0a31ebe36 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -552,6 +552,7 @@ void exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) { struct trapframe *tf = td->td_frame; + struct pcb *pcb = td->td_pcb; memset(tf, 0, sizeof(struct trapframe)); @@ -559,6 +560,12 @@ exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) tf->tf_sp = STACKALIGN(stack); tf->tf_lr = imgp->entry_addr; tf->tf_elr = imgp->entry_addr; + +#ifdef VFP + vfp_reset_state(td, pcb); +#endif + + /* TODO: Shouldn't we also reset pcb_dbg_regs? */ } /* Sanity check these are the same size, they will be memcpy'd to and fro */ diff --git a/sys/arm64/arm64/vfp.c b/sys/arm64/arm64/vfp.c index 62244ddc80e8..6382547c8966 100644 --- a/sys/arm64/arm64/vfp.c +++ b/sys/arm64/arm64/vfp.c @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #ifdef VFP #include #include +#include #include #include #include @@ -199,6 +200,26 @@ vfp_save_state(struct thread *td, struct pcb *pcb) critical_exit(); } +/* + * Reset the FP state to avoid leaking state from the parent process across + * execve() (and to ensure that we get a consistent floating point environment + * in every new process). + */ +void +vfp_reset_state(struct thread *td, struct pcb *pcb) +{ + critical_enter(); + 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.")); + pcb->pcb_fpustate.vfp_fpcr = initial_fpcr; + pcb->pcb_fpustate.vfp_fpsr = 0; + pcb->pcb_vfpcpu = UINT_MAX; + pcb->pcb_fpflags = 0; + vfp_discard(td); + critical_exit(); +} + void vfp_restore_state(void) { diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index 9e9b588c7db1..8a48f0243abc 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -108,7 +108,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) td2->td_pcb->pcb_sp = (uintptr_t)td2->td_frame; td2->td_pcb->pcb_fpusaved = &td2->td_pcb->pcb_fpustate; td2->td_pcb->pcb_vfpcpu = UINT_MAX; - td2->td_pcb->pcb_fpusaved->vfp_fpcr = initial_fpcr; /* Setup to release spin count in fork_exit(). */ td2->td_md.md_spinlock_count = 1; diff --git a/sys/arm64/include/vfp.h b/sys/arm64/include/vfp.h index b0ba01a2a319..3632e5eaa396 100644 --- a/sys/arm64/include/vfp.h +++ b/sys/arm64/include/vfp.h @@ -68,6 +68,7 @@ struct thread; void vfp_init(void); void vfp_discard(struct thread *); +void vfp_reset_state(struct thread *, struct pcb *); void vfp_restore_state(void); void vfp_save_state(struct thread *, struct pcb *); diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 1d628ffe6ecb..67feacfa876b 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -57,6 +57,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef VFP +#include +#endif + MODULE_VERSION(linux64elf, 1); const char *linux_kplatform; @@ -360,6 +364,10 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp, regs->tf_lr = 0xffffffffffffffff; #endif regs->tf_elr = imgp->entry_addr; + +#ifdef VFP + vfp_reset_state(td, td->td_pcb); +#endif } int From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3F0F5A8F60; Wed, 17 Mar 2021 10: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 4F0mYs0Qyrz3FB5; Wed, 17 Mar 2021 10:27: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 3057052AA; Wed, 17 Mar 2021 10: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 12HARSIN095779; Wed, 17 Mar 2021 10: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 12HARSCX095778; Wed, 17 Mar 2021 10:27:28 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:28 GMT Message-Id: <202103171027.12HARSCX095778@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: d37fb0e37814 - stable/13 - AArch64: Don't set flush-subnormals-to-zero flag on startup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d37fb0e37814db8f76462b3b9f1fb0e6dfca6324 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:30 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=d37fb0e37814db8f76462b3b9f1fb0e6dfca6324 commit d37fb0e37814db8f76462b3b9f1fb0e6dfca6324 Author: Alex Richardson AuthorDate: 2021-03-01 14:27:30 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:45:56 +0000 AArch64: Don't set flush-subnormals-to-zero flag on startup This flag has been set on startup since 65618fdda0f272a823e6701966421bdca0efa301. However, This causes some of the math-related tests to fail as they report zero instead of a tiny number. This fixes at least /usr/tests/lib/msun/ldexp_test and possibly others. Additionally, setting this flag prevents printf() from printing subnormal numbers in decimal form. See also https://www.openwall.com/lists/musl/2021/02/26/1 PR: 253847 Reviewed By: mmel Differential Revision: https://reviews.freebsd.org/D28938 (cherry picked from commit 0e4ff0acbe80c547988bede738af2e227c7eb47c) --- lib/libc/tests/stdio/printfloat_test.c | 35 +++++++++++++++++++++++++++++++++- sys/arm64/arm64/vm_machdep.c | 2 +- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/lib/libc/tests/stdio/printfloat_test.c b/lib/libc/tests/stdio/printfloat_test.c index 97629fb0d2b1..736ba1b493ef 100644 --- a/lib/libc/tests/stdio/printfloat_test.c +++ b/lib/libc/tests/stdio/printfloat_test.c @@ -50,7 +50,7 @@ smash_stack(void) { static uint32_t junk = 0xdeadbeef; uint32_t buf[512]; - int i; + size_t i; for (i = 0; i < sizeof(buf) / sizeof(buf[0]); i++) buf[i] = junk; @@ -370,6 +370,37 @@ ATF_TC_BODY(hexadecimal_rounding, tc) testfmt("0x1.83p+0", "%.2a", 1.51); } +ATF_TC_WITHOUT_HEAD(subnormal_double); +ATF_TC_BODY(subnormal_double, tc) +{ + /* Regression test for https://bugs.freebsd.org/253847 */ + double positive = __DBL_DENORM_MIN__; + testfmt("4.9406564584124654418e-324", "%20.20g", positive); + testfmt("4.9406564584124654418E-324", "%20.20G", positive); + testfmt("0x1p-1074", "%a", positive); + testfmt("0X1P-1074", "%A", positive); + double negative = -__DBL_DENORM_MIN__; + testfmt("-4.9406564584124654418e-324", "%20.20g", negative); + testfmt("-4.9406564584124654418E-324", "%20.20G", negative); + testfmt("-0x1p-1074", "%a", negative); + testfmt("-0X1P-1074", "%A", negative); +} + +ATF_TC_WITHOUT_HEAD(subnormal_float); +ATF_TC_BODY(subnormal_float, tc) +{ + float positive = __FLT_DENORM_MIN__; + testfmt("1.4012984643248170709e-45", "%20.20g", positive); + testfmt("1.4012984643248170709E-45", "%20.20G", positive); + testfmt("0x1p-149", "%a", positive); + testfmt("0X1P-149", "%A", positive); + float negative = -__FLT_DENORM_MIN__; + testfmt("-1.4012984643248170709e-45", "%20.20g", negative); + testfmt("-1.4012984643248170709E-45", "%20.20G", negative); + testfmt("-0x1p-149", "%a", negative); + testfmt("-0X1P-149", "%A", negative); +} + ATF_TP_ADD_TCS(tp) { @@ -384,6 +415,8 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, decimal_rounding); ATF_TP_ADD_TC(tp, hexadecimal_floating_point); ATF_TP_ADD_TC(tp, hexadecimal_rounding); + ATF_TP_ADD_TC(tp, subnormal_double); + ATF_TP_ADD_TC(tp, subnormal_float); return (atf_no_error()); } diff --git a/sys/arm64/arm64/vm_machdep.c b/sys/arm64/arm64/vm_machdep.c index 8a48f0243abc..ac2a47597a8c 100644 --- a/sys/arm64/arm64/vm_machdep.c +++ b/sys/arm64/arm64/vm_machdep.c @@ -55,7 +55,7 @@ __FBSDID("$FreeBSD$"); #include #endif -uint32_t initial_fpcr = VFPCR_DN | VFPCR_FZ; +uint32_t initial_fpcr = VFPCR_DN; #include From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A39FA5A8E29; Wed, 17 Mar 2021 10: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 4F0mYw0tpZz3FDP; Wed, 17 Mar 2021 10:27: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 61CAF5230; Wed, 17 Mar 2021 10:27:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HARUOj095815; Wed, 17 Mar 2021 10:27:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARUjM095814; Wed, 17 Mar 2021 10:27:30 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:30 GMT Message-Id: <202103171027.12HARUjM095814@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: aa68a0b324cf - stable/13 - Create symlinks to host tools on non-FreeBSD hosts MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: aa68a0b324cfa20e0b4383bb0f1e41fe6803e535 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:33 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=aa68a0b324cfa20e0b4383bb0f1e41fe6803e535 commit aa68a0b324cfa20e0b4383bb0f1e41fe6803e535 Author: Alex Richardson AuthorDate: 2021-03-17 09:48:28 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:48:28 +0000 Create symlinks to host tools on non-FreeBSD hosts This is unnecessary when cross-building from Linux/macOS. Additionally, cp -p appears to be broken on macOS Big Sur (https://openradar.appspot.com/8957219). For some unknown reason this commit appears to fix freezes when building on macOS Big Sur. This also fixes building in docker with volume mounts with ACLs, since setting the ACL with cp -p fails otherwise. Obtained From: CheriBSD Tested By: gnn (macOS Big Sur), Nathaniel Wesley Filardo (docker) Reviewed By: jrtc27, imp Differential Revision: https://reviews.freebsd.org/D28267 (cherry picked from commit a8b20f4fabbca9bef377009429848d4f9cea18ae) --- tools/build/Makefile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tools/build/Makefile b/tools/build/Makefile index c0c1786d4bfa..48e62e6561b7 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -272,7 +272,17 @@ _host_tools_to_symlink= basename bzip2 bunzip2 chmod chown cmp comm cp date dd \ _make_abs!= which "${MAKE}" _host_abs_tools_to_symlink= ${_make_abs}:make ${_make_abs}:bmake -.if ${.MAKE.OS} != "FreeBSD" +.if ${.MAKE.OS} == "FreeBSD" +# When building on FreeBSD we always copy the host tools instead of linking +# into WORLDTMP to avoid issues with incompatible libraries (see r364030). +# Note: we could create links if we don't intend to update the current machine. +_COPY_HOST_TOOL=cp -pf +.else +# However, this is not necessary on Linux/macOS. Additionally, copying the host +# tools to another directory with cp -p results in freezes on macOS Big Sur for +# some unknown reason. It can also break building inside docker containers if +# there are ACLs on shared volumes. +_COPY_HOST_TOOL=ln -sfn _make_abs!= which "${MAKE}" _host_abs_tools_to_symlink+= ${_make_abs}:make ${_make_abs}:bmake .if ${.MAKE.OS} == "Darwin" @@ -293,7 +303,7 @@ host-symlinks: echo "Cannot find host tool '${_tool}' in PATH ($$PATH)." >&2; false; \ fi; \ rm -f "${DESTDIR}/bin/${_tool}"; \ - cp -pf "$${source_path}" "${DESTDIR}/bin/${_tool}" + ${_COPY_HOST_TOOL} "$${source_path}" "${DESTDIR}/bin/${_tool}" .endfor .for _tool in ${_host_abs_tools_to_symlink} @source_path="${_tool:S/:/ /:[1]}"; \ @@ -302,11 +312,11 @@ host-symlinks: echo "Host tool '${src_path}' is missing"; false; \ fi; \ rm -f "$${target_path}"; \ - cp -pf "$${source_path}" "$${target_path}" + ${_COPY_HOST_TOOL} "$${source_path}" "$${target_path}" .endfor .if exists(/usr/libexec/flua) rm -f ${DESTDIR}/usr/libexec/flua - cp -pf /usr/libexec/flua ${DESTDIR}/usr/libexec/flua + ${_COPY_HOST_TOOL} /usr/libexec/flua ${DESTDIR}/usr/libexec/flua .endif # Create all the directories that are needed during the legacy, bootstrap-tools From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D08A85A8CFF; Wed, 17 Mar 2021 10:27: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 4F0mYy0Xk5z3F3y; Wed, 17 Mar 2021 10:27: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 8C3695231; Wed, 17 Mar 2021 10:27: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 12HARVPW095833; Wed, 17 Mar 2021 10:27:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARVeT095832; Wed, 17 Mar 2021 10:27:31 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:31 GMT Message-Id: <202103171027.12HARVeT095832@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 79edf3d79565 - stable/13 - tmpfs: implement pathconf(_PC_SYMLINK_MAX) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 79edf3d795657c35da4adc7070aea16754e45721 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:35 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=79edf3d795657c35da4adc7070aea16754e45721 commit 79edf3d795657c35da4adc7070aea16754e45721 Author: Alex Richardson AuthorDate: 2021-03-17 09:49:49 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:49:49 +0000 tmpfs: implement pathconf(_PC_SYMLINK_MAX) This fixes one of the sys/audit tests when running them on tmpfs. Reviewed By: delphij, kib Differential Revision: https://reviews.freebsd.org/D28387 (cherry picked from commit 1d15bceae63c438e3ff7dc7a0ca8a2c538e357b9) --- sys/fs/tmpfs/tmpfs_vnops.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 7be2655dcf0b..94cb7fd868fa 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -1609,6 +1609,10 @@ tmpfs_pathconf(struct vop_pathconf_args *v) *retval = TMPFS_LINK_MAX; break; + case _PC_SYMLINK_MAX: + *retval = MAXPATHLEN; + break; + case _PC_NAME_MAX: *retval = NAME_MAX; break; From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66BFF5A8F6D; Wed, 17 Mar 2021 10:27: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 4F0mYz0mNQz3F5c; Wed, 17 Mar 2021 10:27: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 AAE305232; Wed, 17 Mar 2021 10: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 12HARW0Z095851; Wed, 17 Mar 2021 10: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 12HARWO0095850; Wed, 17 Mar 2021 10:27:32 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:32 GMT Message-Id: <202103171027.12HARWO0095850@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 2343069ab038 - stable/13 - sys/arm64/arm64/vfp.c: Fix -Wunused and -Wpointer-sign warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2343069ab038ffb66d3329db96a5d5787c4d5ce4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:35 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=2343069ab038ffb66d3329db96a5d5787c4d5ce4 commit 2343069ab038ffb66d3329db96a5d5787c4d5ce4 Author: Alex Richardson AuthorDate: 2021-03-04 14:55:29 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:51:39 +0000 sys/arm64/arm64/vfp.c: Fix -Wunused and -Wpointer-sign warnings These are off by default but were flagged by my IDE while adding some debugging printfs for D29060. (cherry picked from commit 0072e5e0f3a0bb3aa06708ba64497ef75021d431) --- sys/arm64/arm64/vfp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/arm64/arm64/vfp.c b/sys/arm64/arm64/vfp.c index 6382547c8966..5fa420e668c1 100644 --- a/sys/arm64/arm64/vfp.c +++ b/sys/arm64/arm64/vfp.c @@ -103,7 +103,7 @@ vfp_discard(struct thread *td) static void vfp_store(struct vfpstate *state) { - __int128_t *vfp_state; + __uint128_t *vfp_state; uint64_t fpcr, fpsr; vfp_state = state->vfp_regs; @@ -135,7 +135,7 @@ vfp_store(struct vfpstate *state) static void vfp_restore(struct vfpstate *state) { - __int128_t *vfp_state; + __uint128_t *vfp_state; uint64_t fpcr, fpsr; vfp_state = state->vfp_regs; @@ -378,7 +378,7 @@ fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx) } int -fpu_kern_thread(u_int flags) +fpu_kern_thread(u_int flags __unused) { struct pcb *pcb = curthread->td_pcb; @@ -393,7 +393,7 @@ fpu_kern_thread(u_int flags) } int -is_fpu_kern_thread(u_int flags) +is_fpu_kern_thread(u_int flags __unused) { struct pcb *curpcb; From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FF095A9104; Wed, 17 Mar 2021 10:27: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 4F0mZ16vbMz3FBh; Wed, 17 Mar 2021 10:27: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 E2A505233; Wed, 17 Mar 2021 10:27: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 12HARYZO095887; Wed, 17 Mar 2021 10:27:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARYCV095886; Wed, 17 Mar 2021 10:27:34 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:34 GMT Message-Id: <202103171027.12HARYCV095886@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 18994822120c - stable/13 - Silence annoying and incorrect non-default linker warning with GCC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 18994822120c82f20280853796ebe716e9509671 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:39 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=18994822120c82f20280853796ebe716e9509671 commit 18994822120c82f20280853796ebe716e9509671 Author: Alex Richardson AuthorDate: 2021-03-04 18:27:37 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:51:40 +0000 Silence annoying and incorrect non-default linker warning with GCC The CROSS_TOOLCHAIN GCC .mk files include -B${CROSS_BINUTILS_PREFIX}, so GCC will select the right linker and we don't need to warn. While here also apply 17b8b8fb5fc4acc832dabfe7ef11e3e1d399ad0f to kern.mk. Test Plan: no more warning printed with CROSS_TOOLCHAIN=mips-gcc6 Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D29015 (cherry picked from commit 172a624f0c9fbc47d74fd5178d46f771f82dc6a0) --- share/mk/bsd.sys.mk | 4 ++++ sys/conf/kern.mk | 16 ++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 497283fc95da..fad487cf5630 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -306,9 +306,13 @@ LDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W} .else # GCC does not support an absolute path for -fuse-ld so we just print this # warning instead and let the user add the required symlinks. +# However, we can avoid this warning if -B is set appropriately (e.g. for +# CROSS_TOOLCHAIN=...-gcc). +.if !(${LD:[1]:T} == "ld" && ${CC:tw:M-B${LD:[1]:H}/}) .warning LD (${LD}) is not the default linker for ${CC} but -fuse-ld= is not supported .endif .endif +.endif # Tell bmake not to mistake standard targets for things to be searched for # or expect to ever be up-to-date. diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index 8f0163a3d0a0..8cc79e6645ad 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -280,19 +280,23 @@ CFLAGS+= -std=${CSTD} # Please keep this if in sync with bsd.sys.mk .if ${LD} != "ld" && (${CC:[1]:H} != ${LD:[1]:H} || ${LD:[1]:T} != "ld") # Add -fuse-ld=${LD} if $LD is in a different directory or not called "ld". -# Note: Clang 12+ will prefer --ld-path= over -fuse-ld=. .if ${COMPILER_TYPE} == "clang" -# Note: unlike bsd.sys.mk we can't use LDFLAGS here since that is used for the -# flags required when linking the kernel. We don't need those flags when -# building the vdsos. However, we do need -fuse-ld, so use ${CCLDFLAGS} instead. -# Note: Clang does not like relative paths in -fuse-ld so we map ld.lld -> lld. -CCLDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W} +# Note: Clang does not like relative paths for ld so we map ld.lld -> lld. +.if ${COMPILER_VERSION} >= 120000 +LDFLAGS+= --ld-path=${LD:[1]:S/^ld.//1W} +.else +LDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W} +.endif .else # GCC does not support an absolute path for -fuse-ld so we just print this # warning instead and let the user add the required symlinks. +# However, we can avoid this warning if -B is set appropriately (e.g. for +# CROSS_TOOLCHAIN=...-gcc). +.if !(${LD:[1]:T} == "ld" && ${CC:tw:M-B${LD:[1]:H}/}) .warning LD (${LD}) is not the default linker for ${CC} but -fuse-ld= is not supported .endif .endif +.endif # Set target-specific linker emulation name. LD_EMULATION_aarch64=aarch64elf From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 826FA5A9189; Wed, 17 Mar 2021 10:27: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 4F0mZ64W29z3F8H; Wed, 17 Mar 2021 10:27:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5158352AB; Wed, 17 Mar 2021 10:27: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 12HARcDH095941; Wed, 17 Mar 2021 10:27:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARcBg095940; Wed, 17 Mar 2021 10:27:38 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:38 GMT Message-Id: <202103171027.12HARcBg095940@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: e0b0299057af - stable/13 - rc.d/auditd: set pidfile MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e0b0299057afb2422afa2291d9e5c42aab8f718e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:43 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=e0b0299057afb2422afa2291d9e5c42aab8f718e commit e0b0299057afb2422afa2291d9e5c42aab8f718e Author: Alex Richardson AuthorDate: 2021-01-28 17:17:07 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:53:17 +0000 rc.d/auditd: set pidfile auditd creates a pidfile so we should use it for status checks. This also seems to speed up the frequent onestatus checks used in tests/sys/audit. Reviewed By: asomers Differential Revision: https://reviews.freebsd.org/D28389 (cherry picked from commit bcc5b2445674e4691853d7533e4873a6712f67ee) --- libexec/rc/rc.d/auditd | 1 + 1 file changed, 1 insertion(+) diff --git a/libexec/rc/rc.d/auditd b/libexec/rc/rc.d/auditd index 637214282de0..084b2b764655 100755 --- a/libexec/rc/rc.d/auditd +++ b/libexec/rc/rc.d/auditd @@ -16,6 +16,7 @@ name="auditd" desc="Audit daemon" stop_cmd="auditd_stop" command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" rcvar="auditd_enable" command_args="${auditd_flags}" required_files="/etc/security/audit_class /etc/security/audit_control From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8184A5A9188; Wed, 17 Mar 2021 10:27: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 4F0mZ64W56z3FNR; Wed, 17 Mar 2021 10:27:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3623B4EF4; Wed, 17 Mar 2021 10:27: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 12HARbr9095923; Wed, 17 Mar 2021 10:27:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARbMp095922; Wed, 17 Mar 2021 10:27:37 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:37 GMT Message-Id: <202103171027.12HARbMp095922@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 372c89d4a49d - stable/13 - kerberos5: Silence compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 372c89d4a49d085a09692057f0fe40e816d4d7ae Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:43 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=372c89d4a49d085a09692057f0fe40e816d4d7ae commit 372c89d4a49d085a09692057f0fe40e816d4d7ae Author: Alex Richardson AuthorDate: 2021-01-27 10:41:57 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:53:08 +0000 kerberos5: Silence compiler warnings Building the kerberos5 subdirectory currently produces lots of warnings. Since there are many instances of these warnings and it's contrib code, this change silences the warnings instead of fixing them. Reviewed By: jhb, cy, bjk Differential Revision: https://reviews.freebsd.org/D28025 (cherry picked from commit 4f009328a2477f5f1c682629fc5708498b7c689f) --- kerberos5/Makefile.inc | 3 +-- kerberos5/libexec/kcm/Makefile | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/kerberos5/Makefile.inc b/kerberos5/Makefile.inc index 5ca8f73faf9b..0d52313977ce 100644 --- a/kerberos5/Makefile.inc +++ b/kerberos5/Makefile.inc @@ -9,8 +9,7 @@ KRB5DIR= ${SRCTOP}/crypto/heimdal CFLAGS+= -DHAVE_CONFIG_H -I${.CURDIR:H:H}/include WARNS?= 1 -CWARNFLAGS.clang+= -Wno-error=absolute-value -CWARNFLAGS+= -Wno-error=deprecated-declarations +CWARNFLAGS.clang+= -Wno-absolute-value .if ${MK_OPENLDAP} != "no" && !defined(COMPAT_32BIT) OPENLDAPBASE?= /usr/local diff --git a/kerberos5/libexec/kcm/Makefile b/kerberos5/libexec/kcm/Makefile index fa7a0cfce9cf..35165ef9e424 100644 --- a/kerberos5/libexec/kcm/Makefile +++ b/kerberos5/libexec/kcm/Makefile @@ -19,6 +19,8 @@ SRCS= acl.c \ CFLAGS+=-I${KRB5DIR}/lib/krb5 -I${KRB5DIR}/lib/asn1 -I${KRB5DIR}/lib/roken \ -I${KRB5DIR}/kcm -I${KRB5DIR}/lib/ipc ${LDAPCFLAGS} +# Avoid errors for using deprecated krb5_* APIs +CFLAGS+="-DKRB5_DEPRECATED_FUNCTION(X)=" LIBADD= krb5 roken heimntlm heimipcs crypto DPADD= ${LDAPDPADD} LDADD= ${LIBVERS} ${LDAPLDADD} From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF0D65A8FE1; Wed, 17 Mar 2021 10:27: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 4F0mZ96zkkz3FF9; Wed, 17 Mar 2021 10:27: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 B21645234; Wed, 17 Mar 2021 10:27: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 12HARfbr095995; Wed, 17 Mar 2021 10:27:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARfwk095994; Wed, 17 Mar 2021 10:27:41 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:41 GMT Message-Id: <202103171027.12HARfwk095994@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: aa1e3a13cd26 - stable/13 - tests/sys/audit: fix timeout calculation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: aa1e3a13cd26549f16efa92eace0a423d4474a4d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:47 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=aa1e3a13cd26549f16efa92eace0a423d4474a4d commit aa1e3a13cd26549f16efa92eace0a423d4474a4d Author: Alex Richardson AuthorDate: 2021-01-28 17:23:27 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:54:34 +0000 tests/sys/audit: fix timeout calculation This changes the behaviour to a 30s total timeout (needed when running on slow emulated uniprocessor systems) and timing out after 10s without any input. This also uses timespecsub() instead of ignoring the nanoseconds field. After this change the tests runs more reliably on QEMU and time out less frequently. Reviewed By: asomers Differential Revision: https://reviews.freebsd.org/D28391 (cherry picked from commit 869cc06480b75b4caea0d049e0cf7f82bb5aeed1) --- tests/sys/audit/utils.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/sys/audit/utils.c b/tests/sys/audit/utils.c index 531c99ea77da..d7a1e6792b1c 100644 --- a/tests/sys/audit/utils.c +++ b/tests/sys/audit/utils.c @@ -146,13 +146,18 @@ check_auditpipe(struct pollfd fd[], const char *auditregex, FILE *pipestream) /* Set the expire time for poll(2) while waiting for syscall audit */ ATF_REQUIRE_EQ(0, clock_gettime(CLOCK_MONOTONIC, &endtime)); - endtime.tv_sec += 10; - timeout.tv_nsec = endtime.tv_nsec; + /* Set limit to 30 seconds total and ~10s without an event. */ + endtime.tv_sec += 30; for (;;) { /* Update the time left for auditpipe to return any event */ ATF_REQUIRE_EQ(0, clock_gettime(CLOCK_MONOTONIC, &currtime)); - timeout.tv_sec = endtime.tv_sec - currtime.tv_sec; + timespecsub(&endtime, &currtime, &timeout); + timeout.tv_sec = MIN(timeout.tv_sec, 9); + if (timeout.tv_sec < 0) { + atf_tc_fail("%s not found in auditpipe within the " + "time limit", auditregex); + } switch (ppoll(fd, 1, &timeout, NULL)) { /* ppoll(2) returns, check if it's what we want */ From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82B0F5A8C6F; Wed, 17 Mar 2021 10:27: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 4F0mZ50R8Wz3F4S; Wed, 17 Mar 2021 10:27: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 0894551A6; Wed, 17 Mar 2021 10:27: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 12HARZ4C095905; Wed, 17 Mar 2021 10: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 12HARZsR095904; Wed, 17 Mar 2021 10:27:35 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:35 GMT Message-Id: <202103171027.12HARZsR095904@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 7b37bc200178 - stable/13 - kern.mk: Fix wrong variable being used for linker path after 172a624f0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7b37bc2001784210e698e98a48191e1da9dce132 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:41 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7b37bc2001784210e698e98a48191e1da9dce132 commit 7b37bc2001784210e698e98a48191e1da9dce132 Author: Alex Richardson AuthorDate: 2021-03-08 09:37:39 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:51:40 +0000 kern.mk: Fix wrong variable being used for linker path after 172a624f0 When I synchronized kern.mk with bsd.sys.mk, I accidentally changed CCLDFLAGS to LDFLAGS which is not used by the kernel builds. This commit should unbreak the GitHub actions cross-build CI. I didn't notice it locally because cheribuild already passes -fuse-ld in the linker flags as it predates this being done in the makefiles. Reported By: Jose Luis Duran Fixes: 172a624f0 ("Silence annoying and incorrect non-default linker warning with GCC") (cherry picked from commit 01fe4cac28d0b5ab2b8f4ef081fd3c81dcbb4df3) --- sys/conf/kern.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/conf/kern.mk b/sys/conf/kern.mk index 8cc79e6645ad..b0a26cd1680c 100644 --- a/sys/conf/kern.mk +++ b/sys/conf/kern.mk @@ -283,9 +283,9 @@ CFLAGS+= -std=${CSTD} .if ${COMPILER_TYPE} == "clang" # Note: Clang does not like relative paths for ld so we map ld.lld -> lld. .if ${COMPILER_VERSION} >= 120000 -LDFLAGS+= --ld-path=${LD:[1]:S/^ld.//1W} +CCLDFLAGS+= --ld-path=${LD:[1]:S/^ld.//1W} .else -LDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W} +CCLDFLAGS+= -fuse-ld=${LD:[1]:S/^ld.//1W} .endif .else # GCC does not support an absolute path for -fuse-ld so we just print this From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66CBC5A920D; Wed, 17 Mar 2021 10:27: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 4F0mZC0x2zz3F6H; Wed, 17 Mar 2021 10:27: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 DEBF751A7; Wed, 17 Mar 2021 10:27:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HARgRL096013; Wed, 17 Mar 2021 10:27:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARgQV096012; Wed, 17 Mar 2021 10:27:42 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:42 GMT Message-Id: <202103171027.12HARgQV096012@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 3b354efec1da - stable/13 - Update comment missed in 83ff5d5d98cbcf9b66dccd70022358aec8918a14 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3b354efec1daeba3677a39f799541e8367033290 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:48 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=3b354efec1daeba3677a39f799541e8367033290 commit 3b354efec1daeba3677a39f799541e8367033290 Author: Alex Richardson AuthorDate: 2021-01-29 09:19:27 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:54:50 +0000 Update comment missed in 83ff5d5d98cbcf9b66dccd70022358aec8918a14 Reported by: jrtc27 (cherry picked from commit d4a6843bb1207d71234099ded81cee75d3ae8864) --- lib/msun/tests/trig_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/msun/tests/trig_test.c b/lib/msun/tests/trig_test.c index ba1975721d3f..b725b0b9eb55 100644 --- a/lib/msun/tests/trig_test.c +++ b/lib/msun/tests/trig_test.c @@ -162,7 +162,7 @@ ATF_TC_BODY(reduction, tc) #if defined(__amd64__) && defined(__clang__) && __clang_major__ >= 7 && \ __clang_major__ < 10 && __FreeBSD_cc_version < 1300002 - atf_tc_expect_fail("test fails with clang 7+ - bug 234040"); + atf_tc_expect_fail("test fails with clang 7-9 - bug 234040"); #endif for (i = 0; i < nitems(f_pi_odd); i++) { From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FF725A90B7; Wed, 17 Mar 2021 10:27: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 4F0mZH4NKnz3FQv; Wed, 17 Mar 2021 10:27: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 64B104FE6; Wed, 17 Mar 2021 10:27: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 12HARlFG096086; Wed, 17 Mar 2021 10:27:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARlIs096085; Wed, 17 Mar 2021 10:27:47 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:47 GMT Message-Id: <202103171027.12HARlIs096085@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: da80e76821e7 - stable/13 - sbin/pfctl: fix tests after recent output changes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: da80e76821e7dc7ca2b87e711399c198d578604e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:53 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=da80e76821e7dc7ca2b87e711399c198d578604e commit da80e76821e7dc7ca2b87e711399c198d578604e Author: Alex Richardson AuthorDate: 2021-02-04 17:56:26 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:56:28 +0000 sbin/pfctl: fix tests after recent output changes The output now contains http-alt instead of 8080 and personal-agent instead of 5555. This was probably caused by 228e2087a32847fa51168f3f0c58f931cb2cb0f8. Reviewed By: kp Differential Revision: https://reviews.freebsd.org/D28481 (cherry picked from commit 58de61b9967b36f5fbd34e8b51ece7b4b772f104) --- sbin/pfctl/tests/files/pf0089.ok | 2 +- sbin/pfctl/tests/files/pf0096.ok | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/pfctl/tests/files/pf0089.ok b/sbin/pfctl/tests/files/pf0089.ok index 1f80e22b92b8..c2403e775da1 100644 --- a/sbin/pfctl/tests/files/pf0089.ok +++ b/sbin/pfctl/tests/files/pf0089.ok @@ -8,4 +8,4 @@ pass in on lo1000001 inet proto tcp from any to 10.0.0.1 port = ssh flags S/SA k pass in on lo1000001 inet proto tcp from any to 10.0.0.2 port = ssh flags S/SA keep state (source-track rule, max-src-conn 10) pass in on lo1000001 inet proto tcp from any to 10.0.0.3 port = ssh flags S/SA keep state (source-track rule, max-src-conn-rate 3/99, src.track 99) pass in on lo1000000 inet proto tcp from any to 10.0.0.1 port = http flags S/SA modulate state (source-track rule, max-src-conn 100, max-src-conn-rate 10/5, overload flush, src.track 5) -pass in on lo1000000 inet proto tcp from any to 10.0.0.1 port = 8080 flags S/SA synproxy state (source-track rule, max-src-conn 1000, max-src-conn-rate 1000/5, overload flush global, src.track 5) +pass in on lo1000000 inet proto tcp from any to 10.0.0.1 port = http-alt flags S/SA synproxy state (source-track rule, max-src-conn 1000, max-src-conn-rate 1000/5, overload flush global, src.track 5) diff --git a/sbin/pfctl/tests/files/pf0096.ok b/sbin/pfctl/tests/files/pf0096.ok index e1d9efe31f93..df7af0a3a157 100644 --- a/sbin/pfctl/tests/files/pf0096.ok +++ b/sbin/pfctl/tests/files/pf0096.ok @@ -1,5 +1,5 @@ myports = "5555 6666" moreports = "5555 6666 7777" -pass in proto tcp from any to any port = 5555 flags S/SA keep state +pass in proto tcp from any to any port = personal-agent flags S/SA keep state pass in proto tcp from any to any port = 6666 flags S/SA keep state pass in proto tcp from any to any port = 7777 flags S/SA keep state From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DBD05A8E36; Wed, 17 Mar 2021 10: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 4F0mYt6m2tz3FBC; Wed, 17 Mar 2021 10: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 46EC45127; Wed, 17 Mar 2021 10:27: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 12HARTo1095797; Wed, 17 Mar 2021 10:27:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARTsX095796; Wed, 17 Mar 2021 10:27:29 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:29 GMT Message-Id: <202103171027.12HARTsX095796@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 8dc9d6a7b09f - stable/13 - libc/qsort: Don't allow interposing recursive calls MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8dc9d6a7b09f28458c1ad2848abdeb3f944c3132 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:36 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=8dc9d6a7b09f28458c1ad2848abdeb3f944c3132 commit 8dc9d6a7b09f28458c1ad2848abdeb3f944c3132 Author: Alex Richardson AuthorDate: 2021-02-18 10:12:29 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:46:58 +0000 libc/qsort: Don't allow interposing recursive calls This causes problems when using ASAN with a runtime older than 12.0 since the intercept does not expect qsort() to call itself using an interposable function call. This results in infinite recursion and stack exhaustion when a binary compiled with -fsanitize=address calls qsort. See also https://bugs.llvm.org/show_bug.cgi?id=46832 and https://reviews.llvm.org/D84509 (ASAN runtime patch). To prevent this problem, this patch uses a static helper function for the actual qsort() implementation. This prevents interposition and allows for direct calls. As a nice side-effect, we can also move the qsort_s checks to the top-level function and out of the recursive calls. Reviewed By: kib Differential Revision: https://reviews.freebsd.org/D28133 (cherry picked from commit cbcfe28f9d5f975f97b7fb4a0d72bc9780eb0c46) --- lib/libc/stdlib/qsort.c | 98 ++++++++++++++++++++++++------------------------- 1 file changed, 48 insertions(+), 50 deletions(-) diff --git a/lib/libc/stdlib/qsort.c b/lib/libc/stdlib/qsort.c index 27d03ea8e829..cfd2d99025f0 100644 --- a/lib/libc/stdlib/qsort.c +++ b/lib/libc/stdlib/qsort.c @@ -91,41 +91,23 @@ __unused :(CMP(thunk, b, c) > 0 ? b : (CMP(thunk, a, c) < 0 ? a : c )); } +/* + * The actual qsort() implementation is static to avoid preemptible calls when + * recursing. Also give them different names for improved debugging. + */ #if defined(I_AM_QSORT_R) -void -qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp) +#define local_qsort local_qsort_r #elif defined(I_AM_QSORT_S) -errno_t -qsort_s(void *a, rsize_t n, rsize_t es, cmp_t *cmp, void *thunk) -#else -#define thunk NULL -void -qsort(void *a, size_t n, size_t es, cmp_t *cmp) +#define local_qsort local_qsort_s #endif +static void +local_qsort(void *a, size_t n, size_t es, cmp_t *cmp, void *thunk) { char *pa, *pb, *pc, *pd, *pl, *pm, *pn; size_t d1, d2; int cmp_result; int swap_cnt; -#ifdef I_AM_QSORT_S - if (n > RSIZE_MAX) { - __throw_constraint_handler_s("qsort_s : n > RSIZE_MAX", EINVAL); - return (EINVAL); - } else if (es > RSIZE_MAX) { - __throw_constraint_handler_s("qsort_s : es > RSIZE_MAX", EINVAL); - return (EINVAL); - } else if (n != 0) { - if (a == NULL) { - __throw_constraint_handler_s("qsort_s : a == NULL", EINVAL); - return (EINVAL); - } else if (cmp == NULL) { - __throw_constraint_handler_s("qsort_s : cmp == NULL", EINVAL); - return (EINVAL); - } - } -#endif - loop: swap_cnt = 0; if (n < 7) { @@ -134,11 +116,7 @@ loop: pl > (char *)a && CMP(thunk, pl - es, pl) > 0; pl -= es) swapfunc(pl, pl - es, es); -#ifdef I_AM_QSORT_S - return (0); -#else return; -#endif } pm = (char *)a + (n / 2) * es; if (n > 7) { @@ -187,11 +165,7 @@ loop: pl > (char *)a && CMP(thunk, pl - es, pl) > 0; pl -= es) swapfunc(pl, pl - es, es); -#ifdef I_AM_QSORT_S - return (0); -#else return; -#endif } pn = (char *)a + n * es; @@ -205,13 +179,7 @@ loop: if (d1 <= d2) { /* Recurse on left partition, then iterate on right partition */ if (d1 > es) { -#if defined(I_AM_QSORT_R) - qsort_r(a, d1 / es, es, thunk, cmp); -#elif defined(I_AM_QSORT_S) - qsort_s(a, d1 / es, es, cmp, thunk); -#else - qsort(a, d1 / es, es, cmp); -#endif + local_qsort(a, d1 / es, es, cmp, thunk); } if (d2 > es) { /* Iterate rather than recurse to save stack space */ @@ -223,13 +191,7 @@ loop: } else { /* Recurse on right partition, then iterate on left partition */ if (d2 > es) { -#if defined(I_AM_QSORT_R) - qsort_r(pn - d2, d2 / es, es, thunk, cmp); -#elif defined(I_AM_QSORT_S) - qsort_s(pn - d2, d2 / es, es, cmp, thunk); -#else - qsort(pn - d2, d2 / es, es, cmp); -#endif + local_qsort(pn - d2, d2 / es, es, cmp, thunk); } if (d1 > es) { /* Iterate rather than recurse to save stack space */ @@ -238,8 +200,44 @@ loop: goto loop; } } +} + +#if defined(I_AM_QSORT_R) +void +qsort_r(void *a, size_t n, size_t es, void *thunk, cmp_t *cmp) +{ + local_qsort_r(a, n, es, cmp, thunk); +} +#elif defined(I_AM_QSORT_S) +errno_t +qsort_s(void *a, rsize_t n, rsize_t es, cmp_t *cmp, void *thunk) +{ + if (n > RSIZE_MAX) { + __throw_constraint_handler_s("qsort_s : n > RSIZE_MAX", EINVAL); + return (EINVAL); + } else if (es > RSIZE_MAX) { + __throw_constraint_handler_s("qsort_s : es > RSIZE_MAX", + EINVAL); + return (EINVAL); + } else if (n != 0) { + if (a == NULL) { + __throw_constraint_handler_s("qsort_s : a == NULL", + EINVAL); + return (EINVAL); + } else if (cmp == NULL) { + __throw_constraint_handler_s("qsort_s : cmp == NULL", + EINVAL); + return (EINVAL); + } + } -#ifdef I_AM_QSORT_S + local_qsort_s(a, n, es, cmp, thunk); return (0); -#endif } +#else +void +qsort(void *a, size_t n, size_t es, cmp_t *cmp) +{ + local_qsort(a, n, es, cmp, NULL); +} +#endif From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C68255A921B; Wed, 17 Mar 2021 10:27: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 4F0mZF1qqcz3FJK; Wed, 17 Mar 2021 10:27: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 2290F53E5; Wed, 17 Mar 2021 10:27: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 12HARjdA096050; Wed, 17 Mar 2021 10:27:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARjH9096049; Wed, 17 Mar 2021 10:27:45 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:45 GMT Message-Id: <202103171027.12HARjH9096049@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 30cf33cdfb40 - stable/13 - usr.sbin/praudit: Fix tests after 5619d49e07 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 30cf33cdfb403f0f1f162b22e9a8b5905e17df4d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:50 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=30cf33cdfb403f0f1f162b22e9a8b5905e17df4d commit 30cf33cdfb403f0f1f162b22e9a8b5905e17df4d Author: Alex Richardson AuthorDate: 2021-02-03 15:26:19 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:55:40 +0000 usr.sbin/praudit: Fix tests after 5619d49e07 Commit 5619d49e07 made the getgrgid() call inside bsm work as intended so we now print "wheel" instead of a numeric 0 in the rgid field. Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D28462 (cherry picked from commit 7791ecf04b48a0c365b003447f479ec890115dfc) --- usr.sbin/praudit/tests/input/del_comma | 2 +- usr.sbin/praudit/tests/input/del_underscore | 2 +- usr.sbin/praudit/tests/input/no_args | 2 +- usr.sbin/praudit/tests/input/numeric_form | 2 +- usr.sbin/praudit/tests/input/same_line | 2 +- usr.sbin/praudit/tests/input/short_form | 2 +- usr.sbin/praudit/tests/input/xml_form | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/usr.sbin/praudit/tests/input/del_comma b/usr.sbin/praudit/tests/input/del_comma index 3dbec7bd2c5d..09f089450ac3 100644 --- a/usr.sbin/praudit/tests/input/del_comma +++ b/usr.sbin/praudit/tests/input/del_comma @@ -2,6 +2,6 @@ header,113,11,socket(2),0,Mon Jun 11 10:18:45 2018, + 380 msec argument,1,0x1c,domain argument,2,0x2,type argument,3,0x0,protocol -subject,root,root,wheel,root,0,7053,4724,37636,10.0.2.2 +subject,root,root,wheel,root,wheel,7053,4724,37636,10.0.2.2 return,success,3 trailer,113 diff --git a/usr.sbin/praudit/tests/input/del_underscore b/usr.sbin/praudit/tests/input/del_underscore index ca515ed49ef3..cfc7d4a932f0 100644 --- a/usr.sbin/praudit/tests/input/del_underscore +++ b/usr.sbin/praudit/tests/input/del_underscore @@ -2,6 +2,6 @@ header_113_11_socket(2)_0_Mon Jun 11 10:18:45 2018_ + 380 msec argument_1_0x1c_domain argument_2_0x2_type argument_3_0x0_protocol -subject_root_root_wheel_root_0_7053_4724_37636_10.0.2.2 +subject_root_root_wheel_root_wheel_7053_4724_37636_10.0.2.2 return_success_3 trailer_113 diff --git a/usr.sbin/praudit/tests/input/no_args b/usr.sbin/praudit/tests/input/no_args index 3dbec7bd2c5d..09f089450ac3 100644 --- a/usr.sbin/praudit/tests/input/no_args +++ b/usr.sbin/praudit/tests/input/no_args @@ -2,6 +2,6 @@ header,113,11,socket(2),0,Mon Jun 11 10:18:45 2018, + 380 msec argument,1,0x1c,domain argument,2,0x2,type argument,3,0x0,protocol -subject,root,root,wheel,root,0,7053,4724,37636,10.0.2.2 +subject,root,root,wheel,root,wheel,7053,4724,37636,10.0.2.2 return,success,3 trailer,113 diff --git a/usr.sbin/praudit/tests/input/numeric_form b/usr.sbin/praudit/tests/input/numeric_form index 3dbec7bd2c5d..09f089450ac3 100644 --- a/usr.sbin/praudit/tests/input/numeric_form +++ b/usr.sbin/praudit/tests/input/numeric_form @@ -2,6 +2,6 @@ header,113,11,socket(2),0,Mon Jun 11 10:18:45 2018, + 380 msec argument,1,0x1c,domain argument,2,0x2,type argument,3,0x0,protocol -subject,root,root,wheel,root,0,7053,4724,37636,10.0.2.2 +subject,root,root,wheel,root,wheel,7053,4724,37636,10.0.2.2 return,success,3 trailer,113 diff --git a/usr.sbin/praudit/tests/input/same_line b/usr.sbin/praudit/tests/input/same_line index 7662c3c6ed37..5a8f19d8901f 100644 --- a/usr.sbin/praudit/tests/input/same_line +++ b/usr.sbin/praudit/tests/input/same_line @@ -1 +1 @@ -header,113,11,socket(2),0,Mon Jun 11 10:18:45 2018, + 380 msec,argument,1,0x1c,domain,argument,2,0x2,type,argument,3,0x0,protocol,subject,root,root,wheel,root,0,7053,4724,37636,10.0.2.2,return,success,3,trailer,113, +header,113,11,socket(2),0,Mon Jun 11 10:18:45 2018, + 380 msec,argument,1,0x1c,domain,argument,2,0x2,type,argument,3,0x0,protocol,subject,root,root,wheel,root,wheel,7053,4724,37636,10.0.2.2,return,success,3,trailer,113, diff --git a/usr.sbin/praudit/tests/input/short_form b/usr.sbin/praudit/tests/input/short_form index cc1a705940bb..8e5751fd9efe 100644 --- a/usr.sbin/praudit/tests/input/short_form +++ b/usr.sbin/praudit/tests/input/short_form @@ -2,6 +2,6 @@ header,113,11,AUE_SOCKET,0,Mon Jun 11 10:18:45 2018, + 380 msec argument,1,0x1c,domain argument,2,0x2,type argument,3,0x0,protocol -subject,root,root,wheel,root,0,7053,4724,37636,10.0.2.2 +subject,root,root,wheel,root,wheel,7053,4724,37636,10.0.2.2 return,success,3 trailer,113 diff --git a/usr.sbin/praudit/tests/input/xml_form b/usr.sbin/praudit/tests/input/xml_form index e49b00c028da..d19adeed2b3f 100644 --- a/usr.sbin/praudit/tests/input/xml_form +++ b/usr.sbin/praudit/tests/input/xml_form @@ -4,7 +4,7 @@ - + From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF1235A8E61; Wed, 17 Mar 2021 10:27: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 4F0mZG1Y4bz3FCW; Wed, 17 Mar 2021 10:27: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 44E5E53E6; Wed, 17 Mar 2021 10:27: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 12HARkPX096068; Wed, 17 Mar 2021 10:27:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARklj096067; Wed, 17 Mar 2021 10:27:46 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:46 GMT Message-Id: <202103171027.12HARklj096067@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: c437c2b136f2 - stable/13 - tools/build/make.py: -DNO_CLEAN -> -DWITHOUT_CLEAN MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c437c2b136f20dbed6480d1dd01a6b28cfea4570 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:51 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=c437c2b136f20dbed6480d1dd01a6b28cfea4570 commit c437c2b136f20dbed6480d1dd01a6b28cfea4570 Author: Alex Richardson AuthorDate: 2021-02-03 15:56:03 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:56:18 +0000 tools/build/make.py: -DNO_CLEAN -> -DWITHOUT_CLEAN (cherry picked from commit 43e083be8103685e65582e002d33e861f7d5c794) --- tools/build/make.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/build/make.py b/tools/build/make.py index 146d4a7b6d47..e692fef11e05 100755 --- a/tools/build/make.py +++ b/tools/build/make.py @@ -154,10 +154,10 @@ if __name__ == "__main__": help="Print information on inferred env vars") parser.add_argument("--clean", action="store_true", help="Do a clean rebuild instead of building with " - "-DNO_CLEAN") + "-DWITHOUT_CLEAN") parser.add_argument("--no-clean", action="store_false", dest="clean", help="Do a clean rebuild instead of building with " - "-DNO_CLEAN") + "-DWITHOUT_CLEAN") try: import argcomplete # bash completion: @@ -250,10 +250,10 @@ if __name__ == "__main__": and not is_make_var_set("WITHOUT_CLEAN")): # Avoid accidentally deleting all of the build tree and wasting lots of # time cleaning directories instead of just doing a rm -rf ${.OBJDIR} - want_clean = input("You did not set -DNO_CLEAN/--clean/--no-clean." - " Did you really mean to do a clean build? y/[N] ") + want_clean = input("You did not set -DWITHOUT_CLEAN/--clean/--no-clean." + " Did you really mean to do a clean build? y/[N] ") if not want_clean.lower().startswith("y"): - bmake_args.append("-DNO_CLEAN") + bmake_args.append("-DWITHOUT_CLEAN") env_cmd_str = " ".join( shlex.quote(k + "=" + v) for k, v in new_env_vars.items()) From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEA9C5A9280; Wed, 17 Mar 2021 10:27: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 4F0mZK10Nzz3F92; Wed, 17 Mar 2021 10:27: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 8C1D452AD; Wed, 17 Mar 2021 10:27:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HARmOb096104; Wed, 17 Mar 2021 10:27:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARmUg096103; Wed, 17 Mar 2021 10:27:48 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:48 GMT Message-Id: <202103171027.12HARmUg096103@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 2f0161f405d7 - stable/13 - usr.bin/jail: Fix tests when using kyua -v parallelism=N MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2f0161f405d74974f9ac74d8502de9ce6ba31728 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:55 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=2f0161f405d74974f9ac74d8502de9ce6ba31728 commit 2f0161f405d74974f9ac74d8502de9ce6ba31728 Author: Alex Richardson AuthorDate: 2021-02-04 17:56:54 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:56:40 +0000 usr.bin/jail: Fix tests when using kyua -v parallelism=N These tests create jails with the same name, so they cannot be run in parallel. Reviewed By: lwhsu Differential Revision: https://reviews.freebsd.org/D28482 (cherry picked from commit 72692dfdfe7b4ffd894afd67959651ca1b01a105) --- usr.sbin/jail/tests/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.sbin/jail/tests/Makefile b/usr.sbin/jail/tests/Makefile index 24c0c6c05194..216a5a581980 100644 --- a/usr.sbin/jail/tests/Makefile +++ b/usr.sbin/jail/tests/Makefile @@ -5,5 +5,7 @@ PACKAGE= tests ATF_TESTS_SH+= jail_basic_test ${PACKAGE}FILES+= commands.jail.conf +# The different test cases create jails with the same name. +TEST_METADATA+= is_exclusive="true" .include From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B57D15A907F; Wed, 17 Mar 2021 10:27: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 4F0mZK38Xwz3FLh; Wed, 17 Mar 2021 10:27: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 AC5C95129; Wed, 17 Mar 2021 10:27: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 12HARnk1096122; Wed, 17 Mar 2021 10:27:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARnvI096121; Wed, 17 Mar 2021 10:27:49 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:49 GMT Message-Id: <202103171027.12HARnvI096121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: b40b1ae9d59d - stable/13 - lib/libc/tests/rpc: Correctly set timeout MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b40b1ae9d59d15ddbb2a7ddd1d5291d3b71e227b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:55 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=b40b1ae9d59d15ddbb2a7ddd1d5291d3b71e227b commit b40b1ae9d59d15ddbb2a7ddd1d5291d3b71e227b Author: Alex Richardson AuthorDate: 2021-02-13 13:52:59 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:57:00 +0000 lib/libc/tests/rpc: Correctly set timeout The rpc_control() API does not accept the CLCR_SET_RPCB_TIMEOUT command, it only accepts RPC_SVC_CONNMAXREC_GET/RPC_SVC_CONNMAXREC_SET, so it was not doing anything. Instead of incorrectly calling this API, use clnt_create_timed() instead. I noticed this because the test was timing out after 120s in the CheriBSD CI. Reviewed By: ngie Differential Revision: https://reviews.freebsd.org/D28478 (cherry picked from commit 90b5fc95832da64a5f56295e687379732c33718f) --- contrib/netbsd-tests/lib/libc/rpc/t_rpc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c b/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c index 59bcd5590764..3000f6aec98b 100644 --- a/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c +++ b/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c @@ -72,11 +72,21 @@ onehost(const char *host, const char *transp) */ tv.tv_sec = 0; tv.tv_usec = 500000; +#ifdef __FreeBSD__ + /* + * FreeBSD does not allow setting the timeout using __rpc_control, + * but does have clnt_create_timed() that allows passing a timeout. + */ + if ((clnt = clnt_create_timed(host, RPCBPROG, RPCBVERS, transp, + &tv)) == NULL) + SKIPX(, "clnt_create (%s)", clnt_spcreateerror("")); +#else #define CLCR_SET_RPCB_TIMEOUT 2 __rpc_control(CLCR_SET_RPCB_TIMEOUT, &tv); if ((clnt = clnt_create(host, RPCBPROG, RPCBVERS, transp)) == NULL) SKIPX(, "clnt_create (%s)", clnt_spcreateerror("")); +#endif tv.tv_sec = 1; tv.tv_usec = 0; From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 735805A8E7C; Wed, 17 Mar 2021 10:27: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 4F0mZM4Jb0z3FFj; Wed, 17 Mar 2021 10:27: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 DD72B512A; Wed, 17 Mar 2021 10:27: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 12HARphk096158; Wed, 17 Mar 2021 10:27:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARplq096157; Wed, 17 Mar 2021 10:27:51 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:51 GMT Message-Id: <202103171027.12HARplq096157@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: edb96bf587fe - stable/13 - Fix crossbuild bootstrap tools build with Clang 12 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: edb96bf587fe89736d87fd12409cc734c52919a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:58 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=edb96bf587fe89736d87fd12409cc734c52919a8 commit edb96bf587fe89736d87fd12409cc734c52919a8 Author: Alex Richardson AuthorDate: 2021-02-10 11:05:02 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:59:32 +0000 Fix crossbuild bootstrap tools build with Clang 12 Clang 12 no longer allows re-defining a weak symbol as non-weak. This happed here because we compile err.c with _err defined to err. To fix this, use the same approach as the libc namespace.h (cherry picked from commit 02af91c52e71e8a0f47251e637c9687f35d45dd9) --- tools/build/libc-bootstrap/namespace.h | 4 +++- tools/build/libc-bootstrap/un-namespace.h | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/build/libc-bootstrap/namespace.h b/tools/build/libc-bootstrap/namespace.h index 73e27f8cb02b..2c242f88072d 100644 --- a/tools/build/libc-bootstrap/namespace.h +++ b/tools/build/libc-bootstrap/namespace.h @@ -45,7 +45,9 @@ #define _writev(a, b, c) writev(a, b, c) #define _fsync(a) fsync(a) #define _getprogname() getprogname() -#define _err(...) err(__VA_ARGS__) +/* These two need to be renamed to build libc/gen/err.c */ +#define err _err +#define warn _warn #define _pthread_mutex_unlock pthread_mutex_unlock #define _pthread_mutex_lock pthread_mutex_lock diff --git a/tools/build/libc-bootstrap/un-namespace.h b/tools/build/libc-bootstrap/un-namespace.h index 398707791792..f08ab41ea543 100644 --- a/tools/build/libc-bootstrap/un-namespace.h +++ b/tools/build/libc-bootstrap/un-namespace.h @@ -36,5 +36,8 @@ * $FreeBSD$ */ #pragma once -/* This can be empty when building the FreeBSD compatible bootstrap files */ + +/* Undo the changes made by namespace.h */ +#undef err +#undef warn From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0AEC65A8FCC; Wed, 17 Mar 2021 10:27: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 4F0mZ0624Xz3FKc; Wed, 17 Mar 2021 10: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 C007A53E4; Wed, 17 Mar 2021 10:27: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 12HARXeC095869; Wed, 17 Mar 2021 10:27:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARXCI095868; Wed, 17 Mar 2021 10:27:33 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:33 GMT Message-Id: <202103171027.12HARXCI095868@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: ab0e7589d26b - stable/13 - readelf: Fix printing NT_FREEBSD_ARCH_TAG MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ab0e7589d26b0d85e0b79360c5a84d4640840936 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:37 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=ab0e7589d26b0d85e0b79360c5a84d4640840936 commit ab0e7589d26b0d85e0b79360c5a84d4640840936 Author: Alex Richardson AuthorDate: 2021-02-03 15:24:28 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:51:39 +0000 readelf: Fix printing NT_FREEBSD_ARCH_TAG Looking at lib/csu/arm/crt1_s.S, this should be a string and therefore the restriction to 4 characters seems wrong. Found whle updating https://reviews.llvm.org/D74393. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D28470 (cherry picked from commit 2a39919364b5368e026f656ff41861a3fdd56110) --- contrib/elftoolchain/readelf/readelf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c index ff2fe8e7245f..022c9e9066ab 100644 --- a/contrib/elftoolchain/readelf/readelf.c +++ b/contrib/elftoolchain/readelf/readelf.c @@ -3748,9 +3748,7 @@ dump_notes_data(struct readelf *re, const char *name, uint32_t type, return; /* NT_FREEBSD_NOINIT_TAG carries no data, treat as unknown. */ case NT_FREEBSD_ARCH_TAG: - if (sz != 4) - goto unknown; - printf(" Arch tag: %x\n", ubuf[0]); + printf(" Arch tag: %s\n", buf); return; case NT_FREEBSD_FEATURE_CTL: if (sz != 4) From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B85865A9222; Wed, 17 Mar 2021 10:27: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 4F0mZM08Ryz3FJj; Wed, 17 Mar 2021 10:27: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 BB36650C1; Wed, 17 Mar 2021 10:27: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 12HARoar096140; Wed, 17 Mar 2021 10:27:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARo2h096139; Wed, 17 Mar 2021 10:27:50 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:50 GMT Message-Id: <202103171027.12HARo2h096139@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: a24b7455e869 - stable/13 - bin/pkill: Fix {pgrep, pkill}-j_test.sh MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: a24b7455e86935232799f4adb4ec4c5ce115101c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:56 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=a24b7455e86935232799f4adb4ec4c5ce115101c commit a24b7455e86935232799f4adb4ec4c5ce115101c Author: Alex Richardson AuthorDate: 2021-02-13 13:53:50 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:57:15 +0000 bin/pkill: Fix {pgrep,pkill}-j_test.sh The POSIX sh case statement does not allow for pattern matching using the regex + qualifier so this case statement never matches. Instead just check for a string starting with a digit followed by any character. While touching these files also fix various shellcheck warnings. `kyua -v parallelism=4 test` failed before, succeeds now. Reviewed By: imp Differential Revision: https://reviews.freebsd.org/D28480 (cherry picked from commit 5ff2e55e0071dabbf18cdbe13a1230822d1270d4) --- bin/pkill/tests/pgrep-j_test.sh | 34 +++++++++++++++++----------------- bin/pkill/tests/pkill-j_test.sh | 37 ++++++++++++++++++++----------------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/bin/pkill/tests/pgrep-j_test.sh b/bin/pkill/tests/pgrep-j_test.sh index 0e54fd1106a7..5f44109d41b3 100644 --- a/bin/pkill/tests/pgrep-j_test.sh +++ b/bin/pkill/tests/pgrep-j_test.sh @@ -9,7 +9,7 @@ jail_name_to_jid() base=pgrep_j_test -if [ `id -u` -ne 0 ]; then +if [ "$(id -u)" -ne 0 ]; then echo "1..0 # skip Test needs uid 0." exit 0 fi @@ -28,12 +28,12 @@ jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \ command=daemon -p ${PWD}/${base}_1_2.pid $sleep $sleep_amount & sleep 0.5 -for i in `seq 1 10`; do +for i in $(seq 1 10); do jid1=$(jail_name_to_jid ${base}_1_1) jid2=$(jail_name_to_jid ${base}_1_2) jid="${jid1},${jid2}" case "$jid" in - [0-9]+,[0-9]+) + [0-9]*,[0-9]*) break ;; esac @@ -43,14 +43,14 @@ sleep 0.5 pid1="$(pgrep -f -x -j "$jid" "$sleep $sleep_amount" | sort)" pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_1_1.pid)" \ - $(cat ${PWD}/${base}_1_2.pid) | sort) + "$(cat ${PWD}/${base}_1_2.pid)" | sort) if [ "$pid1" = "$pid2" ]; then echo "ok 1 - $name" else - echo "not ok 1 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'" + echo "not ok 1 - $name # pgrep output: '$pid1', pidfile output: '$pid2'" fi -[ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid) -[ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid) +[ -f ${PWD}/${base}_1_1.pid ] && kill "$(cat ${PWD}/${base}_1_1.pid)" +[ -f ${PWD}/${base}_1_2.pid ] && kill "$(cat ${PWD}/${base}_1_2.pid)" wait name="pgrep -j any" @@ -64,14 +64,14 @@ jail -c path=/ name=${base}_2_2 ip4.addr=127.0.0.1 \ sleep 2 pid1="$(pgrep -f -x -j any "$sleep $sleep_amount" | sort)" pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_2_1.pid)" \ - $(cat ${PWD}/${base}_2_2.pid) | sort) + "$(cat ${PWD}/${base}_2_2.pid)" | sort) if [ "$pid1" = "$pid2" ]; then echo "ok 2 - $name" else - echo "not ok 2 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'" + echo "not ok 2 - $name # pgrep output: '$pid1', pidfile output: '$pid2'" fi -[ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid) -[ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid) +[ -f ${PWD}/${base}_2_1.pid ] && kill "$(cat ${PWD}/${base}_2_1.pid)" +[ -f ${PWD}/${base}_2_2.pid ] && kill "$(cat ${PWD}/${base}_2_2.pid)" wait name="pgrep -j none" @@ -84,10 +84,10 @@ pid="$(pgrep -f -x -j none "$sleep $sleep_amount")" if [ "$pid" = "$(cat ${PWD}/${base}_3_1.pid)" ]; then echo "ok 3 - $name" else - echo "not ok 3 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'" + echo "not ok 3 - $name # pgrep output: '$pid1', pidfile output: '$pid2'" fi -[ -f ${PWD}/${base}_3_1.pid ] && kill $(cat $PWD/${base}_3_1.pid) -[ -f ${PWD}/${base}_3_2.pid ] && kill $(cat $PWD/${base}_3_2.pid) +[ -f ${PWD}/${base}_3_1.pid ] && kill "$(cat $PWD/${base}_3_1.pid)" +[ -f ${PWD}/${base}_3_2.pid ] && kill "$(cat $PWD/${base}_3_2.pid)" wait # test 4 is like test 1 except with jname instead of jid. @@ -104,14 +104,14 @@ sleep 0.5 jname="${base}_4_1,${base}_4_2" pid1="$(pgrep -f -x -j "$jname" "$sleep $sleep_amount" | sort)" pid2=$(printf "%s\n%s" "$(cat ${PWD}/${base}_4_1.pid)" \ - $(cat ${PWD}/${base}_4_2.pid) | sort) + "$(cat ${PWD}/${base}_4_2.pid)" | sort) if [ "$pid1" = "$pid2" ]; then echo "ok 4 - $name" else echo "not ok 4 - $name # pgrep output: '$(echo $pid1)', pidfile output: '$(echo $pid2)'" fi -[ -f ${PWD}/${base}_4_1.pid ] && kill $(cat ${PWD}/${base}_4_1.pid) -[ -f ${PWD}/${base}_4_2.pid ] && kill $(cat ${PWD}/${base}_4_2.pid) +[ -f ${PWD}/${base}_4_1.pid ] && kill "$(cat ${PWD}/${base}_4_1.pid)" +[ -f ${PWD}/${base}_4_2.pid ] && kill "$(cat ${PWD}/${base}_4_2.pid)" wait rm -f $sleep diff --git a/bin/pkill/tests/pkill-j_test.sh b/bin/pkill/tests/pkill-j_test.sh index 442d9d23885e..1710ca04f653 100644 --- a/bin/pkill/tests/pkill-j_test.sh +++ b/bin/pkill/tests/pkill-j_test.sh @@ -9,7 +9,7 @@ jail_name_to_jid() base=pkill_j_test -if [ `id -u` -ne 0 ]; then +if [ "$(id -u)" -ne 0 ]; then echo "1..0 # skip Test needs uid 0." exit 0 fi @@ -29,28 +29,31 @@ jail -c path=/ name=${base}_1_2 ip4.addr=127.0.0.1 \ $sleep $sleep_amount & -for i in `seq 1 10`; do +for i in $(seq 1 10); do jid1=$(jail_name_to_jid ${base}_1_1) jid2=$(jail_name_to_jid ${base}_1_2) jid="${jid1},${jid2}" case "$jid" in - [0-9]+,[0-9]+) + [0-9]*,[0-9]*) break ;; + *) + echo "Did not match: '${jid}'" >&2 + ;; esac sleep 0.1 done sleep 0.5 if pkill -f -j "$jid" $sleep && sleep 0.5 && - ! -f ${PWD}/${base}_1_1.pid && - ! -f ${PWD}/${base}_1_2.pid ; then + ! test -f "${PWD}/${base}_1_1.pid" && + ! test -f "${PWD}/${base}_1_2.pid" ; then echo "ok 1 - $name" else echo "not ok 1 - $name" fi 2>/dev/null -[ -f ${PWD}/${base}_1_1.pid ] && kill $(cat ${PWD}/${base}_1_1.pid) -[ -f ${PWD}/${base}_1_2.pid ] && kill $(cat ${PWD}/${base}_1_2.pid) +[ -f ${PWD}/${base}_1_1.pid ] && kill "$(cat ${PWD}/${base}_1_1.pid)" +[ -f ${PWD}/${base}_1_2.pid ] && kill "$(cat ${PWD}/${base}_1_2.pid)" wait name="pkill -j any" @@ -65,14 +68,14 @@ $sleep $sleep_amount & chpid3=$! sleep 0.5 if pkill -f -j any $sleep && sleep 0.5 && - [ ! -f ${PWD}/${base}_2_1.pid -a - ! -f ${PWD}/${base}_2_2.pid ] && kill $chpid3; then + ! test -f ${PWD}/${base}_2_1.pid && + ! test -f ${PWD}/${base}_2_2.pid && kill $chpid3; then echo "ok 2 - $name" else echo "not ok 2 - $name" fi 2>/dev/null -[ -f ${PWD}/${base}_2_1.pid ] && kill $(cat ${PWD}/${base}_2_1.pid) -[ -f ${PWD}/${base}_2_2.pid ] && kill $(cat ${PWD}/${base}_2_2.pid) +[ -f ${PWD}/${base}_2_1.pid ] && kill "$(cat ${PWD}/${base}_2_1.pid)" +[ -f ${PWD}/${base}_2_2.pid ] && kill "$(cat ${PWD}/${base}_2_2.pid)" wait name="pkill -j none" @@ -88,8 +91,8 @@ else ls ${PWD}/*.pid echo "not ok 3 - $name" fi 2>/dev/null -[ -f ${PWD}/${base}_3_1.pid ] && kill $(cat ${base}_3_1.pid) -[ -f ${PWD}/${base}_3_2.pid ] && kill $(cat ${base}_3_2.pid) +[ -f ${PWD}/${base}_3_1.pid ] && kill "$(cat ${base}_3_1.pid)" +[ -f ${PWD}/${base}_3_2.pid ] && kill "$(cat ${base}_3_2.pid)" wait # test 4 is like test 1 except with jname instead of jid. @@ -107,14 +110,14 @@ sleep 0.5 jname="${base}_4_1,${base}_4_2" if pkill -f -j "$jname" $sleep && sleep 0.5 && - ! -f ${PWD}/${base}_4_1.pid && - ! -f ${PWD}/${base}_4_2.pid ; then + ! test -f ${PWD}/${base}_4_1.pid && + ! test -f ${PWD}/${base}_4_2.pid ; then echo "ok 4 - $name" else echo "not ok 4 - $name" fi 2>/dev/null -[ -f ${PWD}/${base}_4_1.pid ] && kill $(cat ${PWD}/${base}_4_1.pid) -[ -f ${PWD}/${base}_4_2.pid ] && kill $(cat ${PWD}/${base}_4_2.pid) +[ -f ${PWD}/${base}_4_1.pid ] && kill "$(cat ${PWD}/${base}_4_1.pid)" +[ -f ${PWD}/${base}_4_2.pid ] && kill "$(cat ${PWD}/${base}_4_2.pid)" wait rm -f $sleep From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FAC15A920A; Wed, 17 Mar 2021 10:27: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 4F0mZ75M8Cz3FHw; Wed, 17 Mar 2021 10:27: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 6FA3152AC; Wed, 17 Mar 2021 10:27: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 12HARdwA095959; Wed, 17 Mar 2021 10:27:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARdJV095958; Wed, 17 Mar 2021 10:27:39 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:39 GMT Message-Id: <202103171027.12HARdJV095958@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 5ccad26529e3 - stable/13 - Don't include libarchive fuzz tests by default MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5ccad26529e3e9c698e1b98962e79bbe8a185901 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:44 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=5ccad26529e3e9c698e1b98962e79bbe8a185901 commit 5ccad26529e3e9c698e1b98962e79bbe8a185901 Author: Alex Richardson AuthorDate: 2021-01-25 14:03:17 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:54:07 +0000 Don't include libarchive fuzz tests by default These tests are basic fuzz tests that permute input to trigger crashes rather than regression or unit tests. Additionally, some of them take a rather long time to run and should probably be run on a dedicated fuzzing job instead. Moreover, these simple tests use rand() instead of a real fuzzing tool that generates interesting inputs (e.g. LLVM libFuzzer) so are unlikely to find anything interesting when run in CI. This allows removing one BROKEN_TESTS case due to timeouts and speeds up running tests on emulated platforms such as QEMU. Reviewed By: lwhsu, mm Differential Revision: https://reviews.freebsd.org/D27153 (cherry picked from commit 3454fa118c41a588e2dad20614325297c989c60b) --- lib/libarchive/tests/Makefile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/libarchive/tests/Makefile b/lib/libarchive/tests/Makefile index fcb22af5021a..ae78eaf70826 100644 --- a/lib/libarchive/tests/Makefile +++ b/lib/libarchive/tests/Makefile @@ -90,7 +90,6 @@ TESTS_SRCS= \ test_entry_strmode.c \ test_extattr_freebsd.c \ test_filter_count.c \ - test_fuzz.c \ test_gnutar_filename_encoding.c \ test_link_resolver.c \ test_open_fd.c \ @@ -303,9 +302,18 @@ TESTS_SRCS= \ # Fails with `test_read_disk_directory_traversals.c:1094: File at has atime 886622, 1443306049 seconds ago` BROKEN_TESTS+= test_read_disk_directory_traversals +.if 0 +# test_fuzz.c is not a real test, but rather a simple fuzz-test using random(). +# Since this is not a regression/unit test, we don't include it by default. +# If you would still like to include it, comment out the `.if 0`. +TEST_SCRCS+= test_fuzz.c +${PACKAGE}FILES+= test_fuzz.cab.uu +${PACKAGE}FILES+= test_fuzz.lzh.uu +${PACKAGE}FILES+= test_fuzz_1.iso.Z.uu # Non-deterministic failures: # (Times out?) [and] crashes BROKEN_TESTS+= test_fuzz_rar +.endif # https://bugs.freebsd.org/240683 BROKEN_TESTS+= test_write_filter_zstd @@ -383,9 +391,6 @@ ${PACKAGE}FILES+= test_compat_zip_7.xps.uu ${PACKAGE}FILES+= test_compat_zip_8.zip.uu ${PACKAGE}FILES+= test_compat_zstd_1.tar.zst.uu ${PACKAGE}FILES+= test_compat_zstd_2.tar.zst.uu -${PACKAGE}FILES+= test_fuzz.cab.uu -${PACKAGE}FILES+= test_fuzz.lzh.uu -${PACKAGE}FILES+= test_fuzz_1.iso.Z.uu ${PACKAGE}FILES+= test_pax_filename_encoding.tar.uu ${PACKAGE}FILES+= test_pax_xattr_header_all.tar.uu ${PACKAGE}FILES+= test_pax_xattr_header_libarchive.tar.uu From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B0365A922A; Wed, 17 Mar 2021 10:27: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 4F0mZP4VCSz3F9M; Wed, 17 Mar 2021 10:27: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 17FED52AE; Wed, 17 Mar 2021 10:27: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 12HARqWF096176; Wed, 17 Mar 2021 10:27:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARq9M096175; Wed, 17 Mar 2021 10:27:52 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:52 GMT Message-Id: <202103171027.12HARq9M096175@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 60fd443962d8 - stable/13 - Fix bootstrap tools build on macOS after 02af91c52e71e8a0f47251e637c9687f35d45dd9 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 60fd443962d8d1119b04269a77bc6d64b0900dcc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:59 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=60fd443962d8d1119b04269a77bc6d64b0900dcc commit 60fd443962d8d1119b04269a77bc6d64b0900dcc Author: Alex Richardson AuthorDate: 2021-02-17 16:03:11 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:59:38 +0000 Fix bootstrap tools build on macOS after 02af91c52e71e8a0f47251e637c9687f35d45dd9 After changing the namespace.h header we need to provide _err on macOS, too. Previously we used the system libc err*/warn*, but that does not provide _err/_warn (which is used by other bootstrapped files from libc). To fix this problem bootstrap err.c on macOS as well. Fixes: 02af91c52 (Fix crossbuild bootstrap tools build with Clang 12) (cherry picked from commit 962a3814d4c838d21a67a4b704c64be843cb2b51) --- tools/build/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/build/Makefile b/tools/build/Makefile index 48e62e6561b7..effe8b9cb31d 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -158,6 +158,9 @@ INCS+= ${SRCTOP}/include/getopt.h # getcap.c is needed for cap_mkdb: .PATH: ${LIBC_SRCTOP}/gen SRCS+= getcap.c +# Glibc does not provide all err*/warn* functions, and for macOS we need the +# alias with the extra underscore. +SRCS+= err.c # Add various libbc functions that are not available in glibc: SRCS+= stringlist.c setmode.c SRCS+= strtonum.c merge.c heapsort.c reallocf.c @@ -172,8 +175,8 @@ SRCS+= strlcpy.c strlcat.c strmode.c SRCS+= fgetln_fallback.c fgetwln_fallback.c closefrom.c CFLAGS.closefrom.c+= -DSTDC_HEADERS -DHAVE_SYS_DIR_H -DHAVE_DIRENT_H \ -DHAVE_DIRFD -DHAVE_SYSCONF -# Provide warnc/errc/getprogname/setprograme -SRCS+= err.c progname.c +# Provide getprogname/setprograme +SRCS+= progname.c # Stub implementations of fflagstostr/strtofflags SRCS+= fflags.c .endif From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 430705A920B; Wed, 17 Mar 2021 10:27: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 4F0mZ849J0z3FL8; Wed, 17 Mar 2021 10:27: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 8DA375128; Wed, 17 Mar 2021 10:27: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 12HARexm095977; Wed, 17 Mar 2021 10:27:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HAReL7095976; Wed, 17 Mar 2021 10:27:40 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:40 GMT Message-Id: <202103171027.12HAReL7095976@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 9ea5cc1453f5 - stable/13 - Un-XFAIL two tests with Clang > 10 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 9ea5cc1453f55a327a1a5d2eae4e9ebf7c9d646b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:27:45 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=9ea5cc1453f55a327a1a5d2eae4e9ebf7c9d646b commit 9ea5cc1453f55a327a1a5d2eae4e9ebf7c9d646b Author: Alex Richardson AuthorDate: 2021-01-28 17:17:49 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:54:27 +0000 Un-XFAIL two tests with Clang > 10 SVN r343917 fixed this for in-tree clang, but when building with a newer out-of-tree clang the test was still marked as XFAIL. Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D28390 (cherry picked from commit 83ff5d5d98cbcf9b66dccd70022358aec8918a14) --- contrib/netbsd-tests/lib/libm/t_cbrt.c | 4 ++-- lib/msun/tests/trig_test.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/netbsd-tests/lib/libm/t_cbrt.c b/contrib/netbsd-tests/lib/libm/t_cbrt.c index d2cdd47a5beb..08e9faeb145c 100644 --- a/contrib/netbsd-tests/lib/libm/t_cbrt.c +++ b/contrib/netbsd-tests/lib/libm/t_cbrt.c @@ -269,8 +269,8 @@ ATF_TC_BODY(cbrtl_powl, tc) size_t i; #if defined(__amd64__) && defined(__clang__) && __clang_major__ >= 7 && \ - __FreeBSD_cc_version < 1300002 - atf_tc_expect_fail("test fails with clang 7+ - bug 234040"); + __clang_major__ < 10 && __FreeBSD_cc_version < 1300002 + atf_tc_expect_fail("test fails with clang 7-9 - bug 234040"); #endif for (i = 0; i < __arraycount(x); i++) { diff --git a/lib/msun/tests/trig_test.c b/lib/msun/tests/trig_test.c index 483a5e187d50..ba1975721d3f 100644 --- a/lib/msun/tests/trig_test.c +++ b/lib/msun/tests/trig_test.c @@ -161,7 +161,7 @@ ATF_TC_BODY(reduction, tc) unsigned i; #if defined(__amd64__) && defined(__clang__) && __clang_major__ >= 7 && \ - __FreeBSD_cc_version < 1300002 + __clang_major__ < 10 && __FreeBSD_cc_version < 1300002 atf_tc_expect_fail("test fails with clang 7+ - bug 234040"); #endif From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:35:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2E205A9F2D; Wed, 17 Mar 2021 10:35: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 4F0mkg4bFPz3Jct; Wed, 17 Mar 2021 10:35: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 ED8005235; Wed, 17 Mar 2021 10:27: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 12HARhK4096032; Wed, 17 Mar 2021 10:27:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HARhxr096031; Wed, 17 Mar 2021 10:27:43 GMT (envelope-from git) Date: Wed, 17 Mar 2021 10:27:43 GMT Message-Id: <202103171027.12HARhxr096031@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 83ffec9005c9 - stable/13 - tests/sys/audit: Skip extattr tests if extattrs are not supported MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 83ffec9005c979d228477ba70038891a5abba835 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 10:35:07 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=83ffec9005c979d228477ba70038891a5abba835 commit 83ffec9005c979d228477ba70038891a5abba835 Author: Alex Richardson AuthorDate: 2021-02-02 09:55:18 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 09:55:09 +0000 tests/sys/audit: Skip extattr tests if extattrs are not supported In the CheriBSD CI, we run the testsuite with /tmp as tmpfs. This causes the extattr audit tests to fail since tmpfs does not (yet) support extattrs. Skip those tests if the target path is on a file system that does not support extended file attributes. While touching these two files also convert the ATF_REQUIRE_EQ(-1, ...) checks to use ATF_REQURIE_ERRNO(). Reviewed By: asomers Differential Revision: https://reviews.freebsd.org/D28392 (cherry picked from commit 40407d3998d1a12cbe929721f4dbe72b4be478a6) --- tests/sys/audit/file-attribute-access.c | 129 ++++++++++++++++++-------------- tests/sys/audit/file-attribute-modify.c | 106 +++++++++++++++----------- tests/sys/audit/utils.c | 18 +++++ tests/sys/audit/utils.h | 21 ++++++ 4 files changed, 173 insertions(+), 101 deletions(-) diff --git a/tests/sys/audit/file-attribute-access.c b/tests/sys/audit/file-attribute-access.c index 016d5772b933..9f4514bc3fde 100644 --- a/tests/sys/audit/file-attribute-access.c +++ b/tests/sys/audit/file-attribute-access.c @@ -27,13 +27,15 @@ #include #include -#include #include #include #include +#include #include +#include #include +#include #include #include "utils.h" @@ -89,7 +91,7 @@ ATF_TC_BODY(stat_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, stat(errpath, &statbuff)); + ATF_REQUIRE_ERRNO(ENOENT, stat(errpath, &statbuff) == -1); check_audit(fds, failurereg, pipefd); } @@ -132,7 +134,7 @@ ATF_TC_BODY(lstat_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: symbolic link does not exist */ - ATF_REQUIRE_EQ(-1, lstat(errpath, &statbuff)); + ATF_REQUIRE_ERRNO(ENOENT, lstat(errpath, &statbuff) == -1); check_audit(fds, failurereg, pipefd); } @@ -180,7 +182,7 @@ ATF_TC_BODY(fstat_failure, tc) FILE *pipefd = setup(fds, auclass); const char *regex = "fstat.*return,failure : Bad file descriptor"; /* Failure reason: bad file descriptor */ - ATF_REQUIRE_EQ(-1, fstat(-1, &statbuff)); + ATF_REQUIRE_ERRNO(EBADF, fstat(-1, &statbuff) == -1); check_audit(fds, regex, pipefd); } @@ -224,8 +226,8 @@ ATF_TC_BODY(fstatat_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: symbolic link does not exist */ - ATF_REQUIRE_EQ(-1, fstatat(AT_FDCWD, path, &statbuff, - AT_SYMLINK_NOFOLLOW)); + ATF_REQUIRE_ERRNO(ENOENT, + fstatat(AT_FDCWD, path, &statbuff, AT_SYMLINK_NOFOLLOW) == -1); check_audit(fds, failurereg, pipefd); } @@ -269,7 +271,7 @@ ATF_TC_BODY(statfs_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, statfs(errpath, &statfsbuff)); + ATF_REQUIRE_ERRNO(ENOENT, statfs(errpath, &statfsbuff) == -1); check_audit(fds, failurereg, pipefd); } @@ -319,7 +321,7 @@ ATF_TC_BODY(fstatfs_failure, tc) FILE *pipefd = setup(fds, auclass); const char *regex = "fstatfs.*return,failure : Bad file descriptor"; /* Failure reason: bad file descriptor */ - ATF_REQUIRE_EQ(-1, fstatfs(-1, &statfsbuff)); + ATF_REQUIRE_ERRNO(EBADF, fstatfs(-1, &statfsbuff) == -1); check_audit(fds, regex, pipefd); } @@ -364,7 +366,7 @@ ATF_TC_BODY(getfsstat_failure, tc) const char *regex = "getfsstat.*return,failure : Invalid argument"; FILE *pipefd = setup(fds, auclass); /* Failure reason: Invalid value for mode */ - ATF_REQUIRE_EQ(-1, getfsstat(NULL, 0, -1)); + ATF_REQUIRE_ERRNO(EINVAL, getfsstat(NULL, 0, -1) == -1); check_audit(fds, regex, pipefd); } @@ -409,7 +411,7 @@ ATF_TC_BODY(lgetfh_failure, tc) const char *regex = "lgetfh.*return,failure"; FILE *pipefd = setup(fds, "fa"); /* Failure reason: symbolic link does not exist */ - ATF_REQUIRE_EQ(-1, lgetfh(errpath, &fht)); + ATF_REQUIRE_ERRNO(ENOENT, lgetfh(errpath, &fht) == -1); check_audit(fds, regex, pipefd); } @@ -465,7 +467,7 @@ ATF_TC_BODY(fhopen_failure, tc) * Failure reason: NULL does not represent any file handle * and O_CREAT is not allowed as the flag for fhopen(2) */ - ATF_REQUIRE_EQ(-1, fhopen(NULL, O_CREAT)); + ATF_REQUIRE_ERRNO(EINVAL, fhopen(NULL, O_CREAT) == -1); check_audit(fds, regex, pipefd); } @@ -516,7 +518,7 @@ ATF_TC_BODY(fhstat_failure, tc) const char *regex = "fhstat.*return,failure : Bad address"; FILE *pipefd = setup(fds, auclass); /* Failure reason: NULL does not represent any file handle */ - ATF_REQUIRE_EQ(-1, fhstat(NULL, NULL)); + ATF_REQUIRE_ERRNO(EFAULT, fhstat(NULL, NULL) == -1); check_audit(fds, regex, pipefd); } @@ -567,7 +569,7 @@ ATF_TC_BODY(fhstatfs_failure, tc) const char *regex = "fhstatfs.*return,failure : Bad address"; FILE *pipefd = setup(fds, auclass); /* Failure reason: NULL does not represent any file handle */ - ATF_REQUIRE_EQ(-1, fhstatfs(NULL, NULL)); + ATF_REQUIRE_ERRNO(EFAULT, fhstatfs(NULL, NULL) == -1); check_audit(fds, regex, pipefd); } @@ -611,7 +613,7 @@ ATF_TC_BODY(access_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, access(errpath, F_OK)); + ATF_REQUIRE_ERRNO(ENOENT, access(errpath, F_OK) == -1); check_audit(fds, failurereg, pipefd); } @@ -655,7 +657,7 @@ ATF_TC_BODY(eaccess_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, eaccess(errpath, F_OK)); + ATF_REQUIRE_ERRNO(ENOENT, eaccess(errpath, F_OK) == -1); check_audit(fds, failurereg, pipefd); } @@ -699,7 +701,8 @@ ATF_TC_BODY(faccessat_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, faccessat(AT_FDCWD, errpath, F_OK, AT_EACCESS)); + ATF_REQUIRE_ERRNO(ENOENT, + faccessat(AT_FDCWD, errpath, F_OK, AT_EACCESS) == -1); check_audit(fds, failurereg, pipefd); } @@ -744,7 +747,7 @@ ATF_TC_BODY(pathconf_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, pathconf(errpath, _PC_NAME_MAX)); + ATF_REQUIRE_ERRNO(ENOENT, pathconf(errpath, _PC_NAME_MAX) == -1); check_audit(fds, failurereg, pipefd); } @@ -788,7 +791,7 @@ ATF_TC_BODY(lpathconf_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: symbolic link does not exist */ - ATF_REQUIRE_EQ(-1, lpathconf(errpath, _PC_SYMLINK_MAX)); + ATF_REQUIRE_ERRNO(ENOENT, lpathconf(errpath, _PC_SYMLINK_MAX) == -1); check_audit(fds, failurereg, pipefd); } @@ -837,7 +840,7 @@ ATF_TC_BODY(fpathconf_failure, tc) FILE *pipefd = setup(fds, auclass); const char *regex = "fpathconf.*return,failure : Bad file descriptor"; /* Failure reason: Bad file descriptor */ - ATF_REQUIRE_EQ(-1, fpathconf(-1, _PC_NAME_MAX)); + ATF_REQUIRE_ERRNO(EBADF, fpathconf(-1, _PC_NAME_MAX) == -1); check_audit(fds, regex, pipefd); } @@ -858,17 +861,20 @@ ATF_TC_BODY(extattr_get_file_success, tc) { /* File needs to exist to call extattr_get_file(2) */ ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1); + skip_if_extattr_not_supported(path); + /* Set an extended attribute to be retrieved later on */ - ATF_REQUIRE_EQ(sizeof(buff), extattr_set_file(path, - EXTATTR_NAMESPACE_USER, name, buff, sizeof(buff))); + REQUIRE_EXTATTR_RESULT(sizeof(buff), + extattr_set_file(path, EXTATTR_NAMESPACE_USER, name, buff, + sizeof(buff))); /* Prepare the regex to be checked in the audit record */ snprintf(extregex, sizeof(extregex), "extattr_get_file.*%s.*%s.*return,success", path, name); FILE *pipefd = setup(fds, auclass); - ATF_REQUIRE_EQ(sizeof(buff), extattr_get_file(path, - EXTATTR_NAMESPACE_USER, name, NULL, 0)); + REQUIRE_EXTATTR_RESULT(sizeof(buff), + extattr_get_file(path, EXTATTR_NAMESPACE_USER, name, NULL, 0)); check_audit(fds, extregex, pipefd); close(filedesc); } @@ -894,8 +900,9 @@ ATF_TC_BODY(extattr_get_file_failure, tc) FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, extattr_get_file(path, - EXTATTR_NAMESPACE_USER, name, NULL, 0)); + ATF_REQUIRE_ERRNO(ENOENT, + extattr_get_file(path, EXTATTR_NAMESPACE_USER, name, NULL, 0) == + -1); check_audit(fds, extregex, pipefd); } @@ -916,17 +923,20 @@ ATF_TC_BODY(extattr_get_fd_success, tc) { /* File needs to exist to call extattr_get_fd(2) */ ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1); + skip_if_extattr_not_supported(path); + /* Set an extended attribute to be retrieved later on */ - ATF_REQUIRE_EQ(sizeof(buff), extattr_set_file(path, - EXTATTR_NAMESPACE_USER, name, buff, sizeof(buff))); + REQUIRE_EXTATTR_RESULT(sizeof(buff), + extattr_set_file(path, EXTATTR_NAMESPACE_USER, name, buff, + sizeof(buff))); /* Prepare the regex to be checked in the audit record */ snprintf(extregex, sizeof(extregex), "extattr_get_fd.*%s.*return,success", name); FILE *pipefd = setup(fds, auclass); - ATF_REQUIRE_EQ(sizeof(buff), extattr_get_fd(filedesc, - EXTATTR_NAMESPACE_USER, name, NULL, 0)); + REQUIRE_EXTATTR_RESULT(sizeof(buff), + extattr_get_fd(filedesc, EXTATTR_NAMESPACE_USER, name, NULL, 0)); check_audit(fds, extregex, pipefd); close(filedesc); } @@ -952,8 +962,8 @@ ATF_TC_BODY(extattr_get_fd_failure, tc) FILE *pipefd = setup(fds, auclass); /* Failure reason: Invalid file descriptor */ - ATF_REQUIRE_EQ(-1, extattr_get_fd(-1, - EXTATTR_NAMESPACE_USER, name, NULL, 0)); + ATF_REQUIRE_ERRNO(EBADF, + extattr_get_fd(-1, EXTATTR_NAMESPACE_USER, name, NULL, 0) == -1); check_audit(fds, extregex, pipefd); } @@ -974,17 +984,20 @@ ATF_TC_BODY(extattr_get_link_success, tc) { /* Symbolic link needs to exist to call extattr_get_link(2) */ ATF_REQUIRE_EQ(0, symlink("symlink", path)); + skip_if_extattr_not_supported("."); + /* Set an extended attribute to be retrieved later on */ - ATF_REQUIRE_EQ(sizeof(buff), extattr_set_link(path, - EXTATTR_NAMESPACE_USER, name, buff, sizeof(buff))); + REQUIRE_EXTATTR_RESULT(sizeof(buff), + extattr_set_link(path, EXTATTR_NAMESPACE_USER, name, buff, + sizeof(buff))); /* Prepare the regex to be checked in the audit record */ snprintf(extregex, sizeof(extregex), "extattr_get_link.*%s.*%s.*return,success", path, name); FILE *pipefd = setup(fds, auclass); - ATF_REQUIRE_EQ(sizeof(buff), extattr_get_link(path, - EXTATTR_NAMESPACE_USER, name, NULL, 0)); + REQUIRE_EXTATTR_RESULT(sizeof(buff), + extattr_get_link(path, EXTATTR_NAMESPACE_USER, name, NULL, 0)); check_audit(fds, extregex, pipefd); } @@ -1008,8 +1021,8 @@ ATF_TC_BODY(extattr_get_link_failure, tc) "extattr_get_link.*%s.*%s.*failure", path, name); FILE *pipefd = setup(fds, auclass); /* Failure reason: symbolic link does not exist */ - ATF_REQUIRE_EQ(-1, extattr_get_link(path, - EXTATTR_NAMESPACE_USER, name, NULL, 0)); + ATF_REQUIRE_ERRNO(ENOENT, + extattr_get_link(path, EXTATTR_NAMESPACE_USER, name, NULL, 0)); check_audit(fds, extregex, pipefd); } @@ -1028,16 +1041,17 @@ ATF_TC_HEAD(extattr_list_file_success, tc) ATF_TC_BODY(extattr_list_file_success, tc) { - int readbuff; + ssize_t readbuff; /* File needs to exist to call extattr_list_file(2) */ ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1); + skip_if_extattr_not_supported(path); FILE *pipefd = setup(fds, auclass); - ATF_REQUIRE((readbuff = extattr_list_file(path, - EXTATTR_NAMESPACE_USER, NULL, 0)) != -1); + readbuff = REQUIRE_EXTATTR_SUCCESS( + extattr_list_file(path, EXTATTR_NAMESPACE_USER, NULL, 0)); /* Prepare the regex to be checked in the audit record */ snprintf(extregex, sizeof(extregex), - "extattr_list_file.*%s.*return,success,%d", path, readbuff); + "extattr_list_file.*%s.*return,success,%zd", path, readbuff); check_audit(fds, extregex, pipefd); } @@ -1062,8 +1076,8 @@ ATF_TC_BODY(extattr_list_file_failure, tc) FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, extattr_list_file(path, - EXTATTR_NAMESPACE_USER, NULL, 0)); + ATF_REQUIRE_ERRNO(ENOENT, + extattr_list_file(path, EXTATTR_NAMESPACE_USER, NULL, 0)); check_audit(fds, extregex, pipefd); } @@ -1082,16 +1096,17 @@ ATF_TC_HEAD(extattr_list_fd_success, tc) ATF_TC_BODY(extattr_list_fd_success, tc) { - int readbuff; + ssize_t readbuff; /* File needs to exist to call extattr_list_fd(2) */ ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1); + skip_if_extattr_not_supported(path); FILE *pipefd = setup(fds, auclass); - ATF_REQUIRE((readbuff = extattr_list_fd(filedesc, - EXTATTR_NAMESPACE_USER, NULL, 0)) != -1); + readbuff = REQUIRE_EXTATTR_SUCCESS( + extattr_list_fd(filedesc, EXTATTR_NAMESPACE_USER, NULL, 0)); /* Prepare the regex to be checked in the audit record */ snprintf(extregex, sizeof(extregex), - "extattr_list_fd.*return,success,%d", readbuff); + "extattr_list_fd.*return,success,%zd", readbuff); check_audit(fds, extregex, pipefd); close(filedesc); } @@ -1117,8 +1132,8 @@ ATF_TC_BODY(extattr_list_fd_failure, tc) FILE *pipefd = setup(fds, auclass); /* Failure reason: Invalid file descriptor */ - ATF_REQUIRE_EQ(-1, - extattr_list_fd(-1, EXTATTR_NAMESPACE_USER, NULL, 0)); + ATF_REQUIRE_ERRNO(EBADF, + extattr_list_fd(-1, EXTATTR_NAMESPACE_USER, NULL, 0) == -1); check_audit(fds, extregex, pipefd); } @@ -1137,16 +1152,17 @@ ATF_TC_HEAD(extattr_list_link_success, tc) ATF_TC_BODY(extattr_list_link_success, tc) { - int readbuff; + ssize_t readbuff; /* Symbolic link needs to exist to call extattr_list_link(2) */ ATF_REQUIRE_EQ(0, symlink("symlink", path)); - FILE *pipefd = setup(fds, auclass); + skip_if_extattr_not_supported("."); - ATF_REQUIRE((readbuff = extattr_list_link(path, - EXTATTR_NAMESPACE_USER, NULL, 0)) != -1); + FILE *pipefd = setup(fds, auclass); + readbuff = REQUIRE_EXTATTR_SUCCESS( + extattr_list_link(path, EXTATTR_NAMESPACE_USER, NULL, 0)); /* Prepare the regex to be checked in the audit record */ snprintf(extregex, sizeof(extregex), - "extattr_list_link.*%s.*return,success,%d", path, readbuff); + "extattr_list_link.*%s.*return,success,%zd", path, readbuff); check_audit(fds, extregex, pipefd); } @@ -1170,8 +1186,8 @@ ATF_TC_BODY(extattr_list_link_failure, tc) "extattr_list_link.*%s.*failure", path); FILE *pipefd = setup(fds, auclass); /* Failure reason: symbolic link does not exist */ - ATF_REQUIRE_EQ(-1, extattr_list_link(path, - EXTATTR_NAMESPACE_USER, NULL, 0)); + ATF_REQUIRE_ERRNO(ENOENT, + extattr_list_link(path, EXTATTR_NAMESPACE_USER, NULL, 0) == -1); check_audit(fds, extregex, pipefd); } @@ -1236,6 +1252,5 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, extattr_list_fd_failure); ATF_TP_ADD_TC(tp, extattr_list_link_success); ATF_TP_ADD_TC(tp, extattr_list_link_failure); - return (atf_no_error()); } diff --git a/tests/sys/audit/file-attribute-modify.c b/tests/sys/audit/file-attribute-modify.c index 8df1d6d2d95f..689d7a0b8d61 100644 --- a/tests/sys/audit/file-attribute-modify.c +++ b/tests/sys/audit/file-attribute-modify.c @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -92,7 +93,7 @@ ATF_TC_BODY(flock_failure, tc) { const char *regex = "flock.*return,failure : Bad file descriptor"; FILE *pipefd = setup(fds, auclass); - ATF_REQUIRE_EQ(-1, flock(-1, LOCK_SH)); + ATF_REQUIRE_ERRNO(EBADF, flock(-1, LOCK_SH) == -1); check_audit(fds, regex, pipefd); } @@ -141,7 +142,7 @@ ATF_TC_BODY(fcntl_failure, tc) { const char *regex = "fcntl.*return,failure : Bad file descriptor"; FILE *pipefd = setup(fds, auclass); - ATF_REQUIRE_EQ(-1, fcntl(-1, F_GETFL, 0)); + ATF_REQUIRE_ERRNO(EBADF, fcntl(-1, F_GETFL, 0) == -1); check_audit(fds, regex, pipefd); } @@ -189,7 +190,7 @@ ATF_TC_BODY(fsync_failure, tc) const char *regex = "fsync.*return,failure : Bad file descriptor"; FILE *pipefd = setup(fds, auclass); /* Failure reason: Invalid file descriptor */ - ATF_REQUIRE_EQ(-1, fsync(-1)); + ATF_REQUIRE_ERRNO(EBADF, fsync(-1) == -1); check_audit(fds, regex, pipefd); } @@ -233,7 +234,7 @@ ATF_TC_BODY(chmod_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, chmod(errpath, mode)); + ATF_REQUIRE_ERRNO(ENOENT, chmod(errpath, mode) == -1); check_audit(fds, failurereg, pipefd); } @@ -281,7 +282,7 @@ ATF_TC_BODY(fchmod_failure, tc) const char *regex = "fchmod.*return,failure : Bad file descriptor"; FILE *pipefd = setup(fds, auclass); /* Failure reason: Invalid file descriptor */ - ATF_REQUIRE_EQ(-1, fchmod(-1, mode)); + ATF_REQUIRE_ERRNO(EBADF, fchmod(-1, mode) == -1); check_audit(fds, regex, pipefd); } @@ -324,7 +325,7 @@ ATF_TC_BODY(lchmod_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, lchmod(errpath, mode)); + ATF_REQUIRE_ERRNO(ENOENT, lchmod(errpath, mode) == -1); check_audit(fds, failurereg, pipefd); } @@ -368,7 +369,7 @@ ATF_TC_BODY(fchmodat_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, fchmodat(AT_FDCWD, errpath, mode, 0)); + ATF_REQUIRE_ERRNO(ENOENT, fchmodat(AT_FDCWD, errpath, mode, 0) == -1); check_audit(fds, failurereg, pipefd); } @@ -412,7 +413,7 @@ ATF_TC_BODY(chown_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, chown(errpath, uid, gid)); + ATF_REQUIRE_ERRNO(ENOENT, chown(errpath, uid, gid) == -1); check_audit(fds, failurereg, pipefd); } @@ -460,7 +461,7 @@ ATF_TC_BODY(fchown_failure, tc) const char *regex = "fchown.*return,failure : Bad file descriptor"; FILE *pipefd = setup(fds, auclass); /* Failure reason: Invalid file descriptor */ - ATF_REQUIRE_EQ(-1, fchown(-1, uid, gid)); + ATF_REQUIRE_ERRNO(EBADF, fchown(-1, uid, gid) == -1); check_audit(fds, regex, pipefd); } @@ -503,7 +504,7 @@ ATF_TC_BODY(lchown_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: Symbolic link does not exist */ - ATF_REQUIRE_EQ(-1, lchown(errpath, uid, gid)); + ATF_REQUIRE_ERRNO(ENOENT, lchown(errpath, uid, gid) == -1); check_audit(fds, failurereg, pipefd); } @@ -547,7 +548,8 @@ ATF_TC_BODY(fchownat_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, fchownat(AT_FDCWD, errpath, uid, gid, 0)); + ATF_REQUIRE_ERRNO(ENOENT, + fchownat(AT_FDCWD, errpath, uid, gid, 0) == -1); check_audit(fds, failurereg, pipefd); } @@ -591,7 +593,7 @@ ATF_TC_BODY(chflags_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, chflags(errpath, UF_OFFLINE)); + ATF_REQUIRE_ERRNO(ENOENT, chflags(errpath, UF_OFFLINE) == -1); check_audit(fds, failurereg, pipefd); } @@ -639,7 +641,7 @@ ATF_TC_BODY(fchflags_failure, tc) const char *regex = "fchflags.*return,failure : Bad file descriptor"; FILE *pipefd = setup(fds, auclass); /* Failure reason: Invalid file descriptor */ - ATF_REQUIRE_EQ(-1, fchflags(-1, UF_OFFLINE)); + ATF_REQUIRE_ERRNO(EBADF, fchflags(-1, UF_OFFLINE) == -1); check_audit(fds, regex, pipefd); } @@ -682,7 +684,7 @@ ATF_TC_BODY(lchflags_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: Symbolic link does not exist */ - ATF_REQUIRE_EQ(-1, lchflags(errpath, UF_OFFLINE)); + ATF_REQUIRE_ERRNO(ENOENT, lchflags(errpath, UF_OFFLINE) == -1); check_audit(fds, failurereg, pipefd); } @@ -726,7 +728,8 @@ ATF_TC_BODY(chflagsat_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, chflagsat(AT_FDCWD, errpath, UF_OFFLINE, 0)); + ATF_REQUIRE_ERRNO(ENOENT, + chflagsat(AT_FDCWD, errpath, UF_OFFLINE, 0) == -1); check_audit(fds, failurereg, pipefd); } @@ -770,7 +773,7 @@ ATF_TC_BODY(utimes_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, utimes(errpath, NULL)); + ATF_REQUIRE_ERRNO(ENOENT, utimes(errpath, NULL) == -1); check_audit(fds, failurereg, pipefd); } @@ -818,7 +821,7 @@ ATF_TC_BODY(futimes_failure, tc) const char *regex = "futimes.*return,failure : Bad file descriptor"; FILE *pipefd = setup(fds, auclass); /* Failure reason: Invalid file descriptor */ - ATF_REQUIRE_EQ(-1, futimes(-1, NULL)); + ATF_REQUIRE_ERRNO(EBADF, futimes(-1, NULL) == -1); check_audit(fds, regex, pipefd); } @@ -861,7 +864,7 @@ ATF_TC_BODY(lutimes_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: symbolic link does not exist */ - ATF_REQUIRE_EQ(-1, lutimes(errpath, NULL)); + ATF_REQUIRE_ERRNO(ENOENT, lutimes(errpath, NULL) == -1); check_audit(fds, failurereg, pipefd); } @@ -905,7 +908,7 @@ ATF_TC_BODY(futimesat_failure, tc) { FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, futimesat(AT_FDCWD, errpath, NULL)); + ATF_REQUIRE_ERRNO(ENOENT, futimesat(AT_FDCWD, errpath, NULL) == -1); check_audit(fds, failurereg, pipefd); } @@ -949,7 +952,8 @@ ATF_TC_BODY(mprotect_failure, tc) { const char *regex = "mprotect.*return,failure : Invalid argument"; FILE *pipefd = setup(fds, auclass); - ATF_REQUIRE_EQ(-1, mprotect((void *)SIZE_MAX, -1, PROT_NONE)); + ATF_REQUIRE_ERRNO(EINVAL, + mprotect((void *)SIZE_MAX, -1, PROT_NONE) == -1); check_audit(fds, regex, pipefd); } @@ -977,7 +981,7 @@ ATF_TC_BODY(undelete_failure, tc) FILE *pipefd = setup(fds, auclass); /* Failure reason: File does not exist */ - ATF_REQUIRE_EQ(-1, undelete(errpath)); + ATF_REQUIRE_ERRNO(ENOENT, undelete(errpath) == -1); check_audit(fds, extregex, pipefd); } @@ -998,12 +1002,14 @@ ATF_TC_BODY(extattr_set_file_success, tc) { /* File needs to exist to call extattr_set_file(2) */ ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1); + skip_if_extattr_not_supported(path); + /* Prepare the regex to be checked in the audit record */ snprintf(extregex, sizeof(extregex), "extattr_set_file.*%s.*%s.*return,success", path, name); FILE *pipefd = setup(fds, auclass); - ATF_REQUIRE_EQ(sizeof(buff), extattr_set_file(path, + REQUIRE_EXTATTR_RESULT(sizeof(buff), extattr_set_file(path, EXTATTR_NAMESPACE_USER, name, buff, sizeof(buff))); check_audit(fds, extregex, pipefd); close(filedesc); @@ -1030,8 +1036,9 @@ ATF_TC_BODY(extattr_set_file_failure, tc) FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, extattr_set_file(path, - EXTATTR_NAMESPACE_USER, name, NULL, 0)); + ATF_REQUIRE_ERRNO(ENOENT, + extattr_set_file(path, EXTATTR_NAMESPACE_USER, name, NULL, 0) == + -1); check_audit(fds, extregex, pipefd); } @@ -1052,13 +1059,14 @@ ATF_TC_BODY(extattr_set_fd_success, tc) { /* File needs to exist to call extattr_set_fd(2) */ ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1); + skip_if_extattr_not_supported(path); /* Prepare the regex to be checked in the audit record */ snprintf(extregex, sizeof(extregex), "extattr_set_fd.*%s.*return,success", name); FILE *pipefd = setup(fds, auclass); - ATF_REQUIRE_EQ(sizeof(buff), extattr_set_fd(filedesc, + REQUIRE_EXTATTR_RESULT(sizeof(buff), extattr_set_fd(filedesc, EXTATTR_NAMESPACE_USER, name, buff, sizeof(buff))); check_audit(fds, extregex, pipefd); close(filedesc); @@ -1085,8 +1093,8 @@ ATF_TC_BODY(extattr_set_fd_failure, tc) FILE *pipefd = setup(fds, auclass); /* Failure reason: Invalid file descriptor */ - ATF_REQUIRE_EQ(-1, extattr_set_fd(-1, - EXTATTR_NAMESPACE_USER, name, NULL, 0)); + ATF_REQUIRE_ERRNO(EBADF, + extattr_set_fd(-1, EXTATTR_NAMESPACE_USER, name, NULL, 0) == -1); check_audit(fds, extregex, pipefd); } @@ -1107,12 +1115,14 @@ ATF_TC_BODY(extattr_set_link_success, tc) { /* Symbolic link needs to exist to call extattr_set_link(2) */ ATF_REQUIRE_EQ(0, symlink("symlink", path)); + skip_if_extattr_not_supported("."); + /* Prepare the regex to be checked in the audit record */ snprintf(extregex, sizeof(extregex), "extattr_set_link.*%s.*%s.*return,success", path, name); FILE *pipefd = setup(fds, auclass); - ATF_REQUIRE_EQ(sizeof(buff), extattr_set_link(path, + REQUIRE_EXTATTR_RESULT(sizeof(buff), extattr_set_link(path, EXTATTR_NAMESPACE_USER, name, buff, sizeof(buff))); check_audit(fds, extregex, pipefd); @@ -1138,8 +1148,9 @@ ATF_TC_BODY(extattr_set_link_failure, tc) "extattr_set_link.*%s.*%s.*failure", path, name); FILE *pipefd = setup(fds, auclass); /* Failure reason: symbolic link does not exist */ - ATF_REQUIRE_EQ(-1, extattr_set_link(path, - EXTATTR_NAMESPACE_USER, name, NULL, 0)); + ATF_REQUIRE_ERRNO(ENOENT, + extattr_set_link(path, EXTATTR_NAMESPACE_USER, name, NULL, 0) == + -1); check_audit(fds, extregex, pipefd); } @@ -1160,12 +1171,14 @@ ATF_TC_BODY(extattr_delete_file_success, tc) { /* File needs to exist to call extattr_delete_file(2) */ ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1); - ATF_REQUIRE_EQ(sizeof(buff), extattr_set_file(path, + skip_if_extattr_not_supported(path); + + REQUIRE_EXTATTR_RESULT(sizeof(buff), extattr_set_file(path, EXTATTR_NAMESPACE_USER, name, buff, sizeof(buff))); FILE *pipefd = setup(fds, auclass); - ATF_REQUIRE((retval = extattr_delete_file(path, - EXTATTR_NAMESPACE_USER, name)) != -1); + retval = REQUIRE_EXTATTR_SUCCESS( + extattr_delete_file(path, EXTATTR_NAMESPACE_USER, name)); /* Prepare the regex to be checked in the audit record */ snprintf(extregex, sizeof(extregex), "extattr_delete_file.*%s.*return,success,%d", path, retval); @@ -1194,8 +1207,8 @@ ATF_TC_BODY(extattr_delete_file_failure, tc) FILE *pipefd = setup(fds, auclass); /* Failure reason: file does not exist */ - ATF_REQUIRE_EQ(-1, extattr_delete_file(path, - EXTATTR_NAMESPACE_USER, name)); + ATF_REQUIRE_ERRNO(ENOENT, + extattr_delete_file(path, EXTATTR_NAMESPACE_USER, name) == -1); check_audit(fds, extregex, pipefd); } @@ -1216,12 +1229,14 @@ ATF_TC_BODY(extattr_delete_fd_success, tc) { /* File needs to exist to call extattr_delete_fd(2) */ ATF_REQUIRE((filedesc = open(path, O_CREAT, mode)) != -1); - ATF_REQUIRE_EQ(sizeof(buff), extattr_set_file(path, + skip_if_extattr_not_supported(path); + + REQUIRE_EXTATTR_RESULT(sizeof(buff), extattr_set_file(path, EXTATTR_NAMESPACE_USER, name, buff, sizeof(buff))); FILE *pipefd = setup(fds, auclass); - ATF_REQUIRE((retval = extattr_delete_fd(filedesc, - EXTATTR_NAMESPACE_USER, name)) != -1); + retval = REQUIRE_EXTATTR_SUCCESS(extattr_delete_fd(filedesc, + EXTATTR_NAMESPACE_USER, name)); /* Prepare the regex to be checked in the audit record */ snprintf(extregex, sizeof(extregex), "extattr_delete_fd.*return,success,%d", retval); @@ -1250,7 +1265,8 @@ ATF_TC_BODY(extattr_delete_fd_failure, tc) FILE *pipefd = setup(fds, auclass); /* Failure reason: Invalid file descriptor */ - ATF_REQUIRE_EQ(-1, extattr_delete_fd(-1, EXTATTR_NAMESPACE_USER, name)); + ATF_REQUIRE_ERRNO(EBADF, + extattr_delete_fd(-1, EXTATTR_NAMESPACE_USER, name) == -1); check_audit(fds, extregex, pipefd); } @@ -1271,12 +1287,14 @@ ATF_TC_BODY(extattr_delete_link_success, tc) { /* Symbolic link needs to exist to call extattr_delete_link(2) */ ATF_REQUIRE_EQ(0, symlink("symlink", path)); - ATF_REQUIRE_EQ(sizeof(buff), extattr_set_link(path, + skip_if_extattr_not_supported("."); + + REQUIRE_EXTATTR_RESULT(sizeof(buff), extattr_set_link(path, EXTATTR_NAMESPACE_USER, name, buff, sizeof(buff))); FILE *pipefd = setup(fds, auclass); - ATF_REQUIRE((retval = extattr_delete_link(path, - EXTATTR_NAMESPACE_USER, name)) != -1); + retval = REQUIRE_EXTATTR_SUCCESS(extattr_delete_link(path, + EXTATTR_NAMESPACE_USER, name)); /* Prepare the regex to be checked in the audit record */ snprintf(extregex, sizeof(extregex), "extattr_delete_link.*%s.*return,success,%d", path, retval); @@ -1303,8 +1321,8 @@ ATF_TC_BODY(extattr_delete_link_failure, tc) "extattr_delete_link.*%s.*failure", path); FILE *pipefd = setup(fds, auclass); /* Failure reason: symbolic link does not exist */ - ATF_REQUIRE_EQ(-1, extattr_delete_link(path, - EXTATTR_NAMESPACE_USER, name)); + ATF_REQUIRE_ERRNO(ENOENT, + extattr_delete_link(path, EXTATTR_NAMESPACE_USER, name) == -1); check_audit(fds, extregex, pipefd); } diff --git a/tests/sys/audit/utils.c b/tests/sys/audit/utils.c index d7a1e6792b1c..be31f4138412 100644 --- a/tests/sys/audit/utils.c +++ b/tests/sys/audit/utils.c @@ -25,6 +25,8 @@ * $FreeBSD$ */ +#include +#include #include #include @@ -204,6 +206,22 @@ check_audit(struct pollfd fd[], const char *auditrgx, FILE *pipestream) { ATF_REQUIRE_EQ(0, fclose(pipestream)); } +void +skip_if_extattr_not_supported(const char *path) +{ + ssize_t result; + + /* + * Some file systems (e.g. tmpfs) do not support extattr, so we need + * skip tests that use extattrs. To detect this we can check whether + * the extattr_list_file returns EOPNOTSUPP. + */ + result = extattr_list_file(path, EXTATTR_NAMESPACE_USER, NULL, 0); + if (result == -1 && errno == EOPNOTSUPP) { + atf_tc_skip("File system does not support extattrs."); + } +} + FILE *setup(struct pollfd fd[], const char *name) { diff --git a/tests/sys/audit/utils.h b/tests/sys/audit/utils.h index 51001148c269..2f7a9e5cebb2 100644 --- a/tests/sys/audit/utils.h +++ b/tests/sys/audit/utils.h @@ -37,5 +37,26 @@ void check_audit(struct pollfd [], const char *, FILE *); FILE *setup(struct pollfd [], const char *); void cleanup(void); +void skip_if_extattr_not_supported(const char *); + +#define REQUIRE_EXTATTR_SUCCESS(call) \ + ({ \ + errno = 0; /* Reset errno before call */ \ + ssize_t result = (call); \ + if (result == -1) { \ + atf_tc_fail_requirement(__FILE__, __LINE__, \ + "%s failed with errno %d (%s)", #call, errno, \ + strerror(errno)); \ + } \ + result; \ + }) + +#define REQUIRE_EXTATTR_RESULT(_expected, expr) \ + do { \ + ssize_t expected = (_expected); \ + ssize_t _result = REQUIRE_EXTATTR_SUCCESS(expr); \ + ATF_REQUIRE_EQ_MSG(expected, _result, "%s: %zd != %zd", #expr, \ + expected, _result); \ + } while (0) #endif /* _SETUP_H_ */ From owner-dev-commits-src-all@freebsd.org Wed Mar 17 11:09:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EDC715AA708; Wed, 17 Mar 2021 11:09: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 4F0nTn6RHXz3Lrh; Wed, 17 Mar 2021 11:09: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 CF8DF58C3; Wed, 17 Mar 2021 11:09: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 12HB91Mq049483; Wed, 17 Mar 2021 11:09:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HB91Sb049482; Wed, 17 Mar 2021 11:09:01 GMT (envelope-from git) Date: Wed, 17 Mar 2021 11:09:01 GMT Message-Id: <202103171109.12HB91Sb049482@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: c96151d33509 - main - Implement sndstat nvlist-based enumeration ioctls. 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: c96151d33509655efb7fb26768cb56a041c176f1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 11:09:02 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=c96151d33509655efb7fb26768cb56a041c176f1 commit c96151d33509655efb7fb26768cb56a041c176f1 Author: Ka Ho Ng AuthorDate: 2021-03-17 10:51:58 +0000 Commit: Ka Ho Ng CommitDate: 2021-03-17 11:05:43 +0000 Implement sndstat nvlist-based enumeration ioctls. These ioctl commands aim to provide easier ways for user space applications to enumerate existing audio devices and the node they can potentially use. The exchange of device lists between user space and kernel is done on nv(9). Some ioctl commands are added to /dev/sndstat node: - SNDSTAT_REFRESH_DEVS - SNDSTAT_GET_DEVS - SNDSTAT_ADD_USER_DEVS - SNDSTAT_FLUSH_USER_DEVS Bump __FreeBSD_version to reflect the addition of the ioctls. Sponsored by: The FreeBSD Foundation Reviewed by: hselasky Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D26884 --- share/man/man4/Makefile | 1 + share/man/man4/sndstat.4 | 259 ++++++++++++++++ sys/dev/sound/pcm/sndstat.c | 738 +++++++++++++++++++++++++++++++++++++++++++- sys/dev/sound/pcm/sound.h | 1 + sys/sys/param.h | 2 +- sys/sys/sndstat.h | 95 ++++++ 6 files changed, 1086 insertions(+), 10 deletions(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 686e86cf6897..54fd89fe7590 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -526,6 +526,7 @@ MAN= aac.4 \ snd_via8233.4 \ snd_via82c686.4 \ snd_vibes.4 \ + sndstat.4 \ snp.4 \ spigen.4 \ ${_spkr.4} \ diff --git a/share/man/man4/sndstat.4 b/share/man/man4/sndstat.4 new file mode 100644 index 000000000000..ad5f4a76ea7e --- /dev/null +++ b/share/man/man4/sndstat.4 @@ -0,0 +1,259 @@ +.\" +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD +.\" +.\" This software was developed by Ka Ho Ng +.\" under sponsorship from the FreeBSD Foundation. +.\" +.\" Copyright (c) 2020 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$ +.\" +.\" Note: The date here should be updated whenever a non-trivial +.\" change is made to the manual page. +.Dd December 7, 2020 +.Dt SNDSTAT 4 +.Os +.Sh NAME +.Nm sndstat +.Nd "nvlist-based PCM audio device enumeration interface" +.Sh SYNOPSIS +To compile the driver into the kernel, +place the following lines in the +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device sound" +.Ed +.Sh DESCRIPTION +The ioctl interface provided by +.Pa /dev/sndstat +device allows callers to enumeration PCM audio devices available for use. +.Sh IOCTLS +For all ioctls requiring data exchange between the subsystem and callers, +the following structures are used to describe a serialized nvlist: +.Bd -literal -offset indent +struct sndstat_nvlbuf_arg { + size_t nbytes; + void *buf; +}; +.Ed +.Pp +Here is an example of an nvlist, with explanations of the common fields: +.Bd -literal -offset indent +dsps (NVLIST ARRAY): 1 + from_user (BOOL): FALSE + nameunit (STRING): [pcm0] + devnode (STRING): [dsp0] + desc (STRING): [Generic (0x8086) (Analog Line-out)] + pchan (NUMBER): 1 (1) (0x1) + rchan (NUMBER): 0 (0) (0x0) + pminrate (NUMBER): 48000 (48000) (0xbb80) + pmaxrate (NUMBER): 48000 (48000) (0xbb80) + pfmts (NUMBER): 2097168 (2097168) (0x200010) + provider_info (NVLIST): + unit (NUMBER): 0 (0) (0x0) + bitperfect (BOOL): FALSE + pvchan (NUMBER): 1 (1) (0x1) + rvchan (NUMBER): 0 (0) (0x0) + provider (STRING): [sound(4)] + , +.Ed +.Bl -tag -width ".Dv provider_info" +.It Dv from_user +Whether the PCM audio device node is created by in-kernel audio subsystem or +userspace providers. +.It Dv nameunit +The device identification in the form of subsystem plus a unit number. +.It Dv devnode +The PCM audio device node relative path in devfs. +.It Dv desc +The descripton of the PCM audio device. +.It Dv pchan +The number of playback channels supported by hardware. +This can be 0 if this PCM audio device does not support playback at all. +.It Dv rchan +The number of recording channels supported by hardware. +This can be 0 if this PCM audio device does not support recording at all. +.It Dv pminrate +The minimum supported playback direction sampling rate. +Only exists if pchan is greater than 0. +.It Dv pmaxrate +The maximum supported playback direction sampling rate. +Only exists if pchan is greater than 0. +.It Dv pfmts +The supported playback direction sample format. +Only exists if pchan is greater than 0. +.It Dv rminrate +The minimum supported recording direction sampling rate. +Only exists if rchan is greater than 0. +.It Dv rmaxrate +The maximum supported recording direction sampling rate. +Only exists if rchan is greater than 0. +.It Dv rfmts +The supported playback recording sample format. +Only exists if rchan is greater than 0. +.It Dv provider_info +Provider-specific fields. +This field may not exist if the PCM audio device is not provided by in-kernel +interface. +This field will not exist if the provider field is an empty string. +.It Dv provider +A string specifying the provider of the PCm audio device. +.El +.Pp +The following ioctls are providede for use: +.Bl -tag -width ".Dv SNDSTAT_FLUSH_USER_DEVS" +.It Dv SNDSTAT_REFRESH_DEVS +Drop any previously fetched PCM audio devices list snapshots. +This ioctl takes no arguments. +.It Dv SNDSTAT_GET_DEVS +Generate and/or return PCM audio devices list snapshots to callers. +This ioctl takes a pointer to +.Fa struct sndstat_nvlbuf_arg +as the first and the only argument. +Callers need to provide a sufficiently large buffer to hold a serialized +nvlist. +If there is no existing PCM audio device list snapshot available in the +internal structure of the opened sndstat. +.Fa fd , +a new PCM audio device list snapshot will be automatically generated. +Callers have to set +.Fa nbytes +to either 0 or the size of buffer provided. +In case +.Fa nbytes +is 0, the buffer size required to hold a serialized nvlist +stream of current snapshot will be returned in +.Fa nbytes , +and +.Fa buf +will be ignored. +Otherwise, if the buffer is not sufficiently large, +the ioctl returns success, and +.Fa nbytes +will be set to 0. +If the buffer provided is sufficiently large, +.Fa nbytes +will be set to the size of the serialized nvlist written to the provided buffer. +Once a PCM audio device list snapshot is returned to user-space successfully, +the snapshot stored in the subsystem's internal structure of the given +.Fa fd +will be freed. +.It Dv SNDSTAT_ADD_USER_DEVS +Add a list of PCM audio devices provided by callers to +.Pa /dev/sndstat +device. +This ioctl takes a pointer to +.Fa struct sndstat_nvlbuf_arg +as the first and the only argument. +Callers have to provide a buffer holding a serialized nvlist. +.Fa nbytes +should be set to the length in bytes of the serialized nvlist. +.Fa buf +should be pointed to a buffer storing the serialized nvlist. +Userspace-backed PCM audio device nodes should be listed inside the serialized +nvlist. +.It Dv SNDSTAT_FLUSH_USER_DEVS +Flush any PCM audio devices previously added by callers. +This ioctl takes no arguments. +.El +.Sh FILES +.Bl -tag -width ".Pa /dev/sndstat" -compact +.It Pa /dev/sndstat +.El +.Sh EXAMPLES +The following code enumerates all available PCM audio devices: +.Bd -literal -offset indent +#include +#include +#include +#include +#include +#include +#include +#include +#include + +int +main() +{ + int fd; + struct sndstat_nvlbuf_arg arg; + const nvlist_t * const *di; + size_t i, nitems; + nvlist_t *nvl; + + /* Open sndstat node in read-only first */ + fd = open("/dev/sndstat", O_RDONLY); + + if (ioctl(fd, SNDSTAT_REFRESH_DEVS, NULL)) + err(1, "ioctl(fd, SNDSTAT_REFRESH_DEVS, NULL)"); + + /* Get the size of snapshot, when nbytes = 0 */ + arg.nbytes = 0; + arg.buf = NULL; + if (ioctl(fd, SNDSTAT_GET_DEVS, &arg)) + err(1, "ioctl(fd, SNDSTAT_GET_DEVS, &arg)"); + + /* Get snapshot data */ + arg.buf = malloc(arg.nbytes); + if (arg.buf == NULL) + err(EX_OSERR, "malloc"); + if (ioctl(fd, SNDSTAT_GET_DEVS, &arg)) + err(1, "ioctl(fd, SNDSTAT_GET_DEVS, &arg)"); + + /* Deserialize the nvlist stream */ + nvl = nvlist_unpack(arg.buf, arg.nbytes, 0); + free(arg.buf); + + /* Get DSPs array */ + di = nvlist_get_nvlist_array(nvl, SNDSTAT_LABEL_DSPS, &nitems); + for (i = 0; i < nitems; i++) { + const char *nameunit, *devnode, *desc; + + /* + * Examine each device nvlist item + */ + + nameunit = nvlist_get_string(di[i], SNDSTAT_LABEL_NAMEUNIT); + devnode = nvlist_get_string(di[i], SNDSTAT_LABEL_DEVNODE); + desc = nvlist_get_string(di[i], SNDSTAT_LABEL_DESC); + printf("Name unit: `%s`, Device node: `%s`, Description: `%s`\n", + nameunit, devnode, desc); + } + + nvlist_destroy(nvl); + return (0); +} +.Ed +.Sh SEE ALSO +.Xr sound 4 , +.Xr nv 9 +.Sh HISTORY +The nvlist-based ioctls support for +.Nm +device first appeared in +.Fx 13.0 . +.Sh AUTHORS +This manual page was written by +.An Ka Ho Ng Aq Mt khng@FreeBSD.org . diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index 31c4a1b14a79..e89af772fe72 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -3,8 +3,12 @@ * * Copyright (c) 2005-2009 Ariff Abdullah * Copyright (c) 2001 Cameron Grant + * Copyright (c) 2020 The FreeBSD Foundation * All rights reserved. * + * 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: @@ -31,10 +35,20 @@ #include "opt_snd.h" #endif +#include +#include +#include +#include +#include +#include +#ifdef COMPAT_FREEBSD32 +#include +#endif + #include #include #include -#include + SND_DECLARE_FILE("$FreeBSD$"); @@ -47,12 +61,14 @@ static d_open_t sndstat_open; static void sndstat_close(void *); static d_read_t sndstat_read; static d_write_t sndstat_write; +static d_ioctl_t sndstat_ioctl; static struct cdevsw sndstat_cdevsw = { .d_version = D_VERSION, .d_open = sndstat_open, .d_read = sndstat_read, .d_write = sndstat_write, + .d_ioctl = sndstat_ioctl, .d_name = "sndstat", .d_flags = D_TRACKCLOSE, }; @@ -65,11 +81,33 @@ struct sndstat_entry { int type, unit; }; +struct sndstat_userdev { + TAILQ_ENTRY(sndstat_userdev) link; + char *provider; + char *nameunit; + char *devnode; + char *desc; + unsigned int pchan; + unsigned int rchan; + uint32_t pminrate; + uint32_t pmaxrate; + uint32_t rminrate; + uint32_t rmaxrate; + uint32_t pfmts; + uint32_t rfmts; + nvlist_t *provider_nvl; +}; + struct sndstat_file { TAILQ_ENTRY(sndstat_file) entry; struct sbuf sbuf; + struct sx lock; + void *devs_nvlbuf; /* (l) */ + size_t devs_nbytes; /* (l) */ + TAILQ_HEAD(, sndstat_userdev) userdev_list; /* (l) */ int out_offset; int in_offset; + int fflags; }; static struct sx sndstat_lock; @@ -84,6 +122,8 @@ static TAILQ_HEAD(, sndstat_file) sndstat_filelist = TAILQ_HEAD_INITIALIZER(snds int snd_verbose = 0; static int sndstat_prepare(struct sndstat_file *); +static struct sndstat_userdev * +sndstat_line2userdev(struct sndstat_file *, const char *, int); static int sysctl_hw_sndverbose(SYSCTL_HANDLER_ARGS) @@ -112,12 +152,16 @@ sndstat_open(struct cdev *i_dev, int flags, int mode, struct thread *td) pf = malloc(sizeof(*pf), M_DEVBUF, M_WAITOK | M_ZERO); - SNDSTAT_LOCK(); if (sbuf_new(&pf->sbuf, NULL, 4096, SBUF_AUTOEXTEND) == NULL) { - SNDSTAT_UNLOCK(); free(pf, M_DEVBUF); return (ENOMEM); } + + pf->fflags = flags; + TAILQ_INIT(&pf->userdev_list); + sx_init(&pf->lock, "sndstat_file"); + + SNDSTAT_LOCK(); TAILQ_INSERT_TAIL(&sndstat_filelist, pf, entry); SNDSTAT_UNLOCK(); @@ -126,6 +170,29 @@ sndstat_open(struct cdev *i_dev, int flags, int mode, struct thread *td) return (0); } +/* + * Should only be called either when: + * * Closing + * * pf->lock held + */ +static void +sndstat_remove_all_userdevs(struct sndstat_file *pf) +{ + struct sndstat_userdev *ud; + + KASSERT( + sx_xlocked(&pf->lock), ("%s: Called without pf->lock", __func__)); + while ((ud = TAILQ_FIRST(&pf->userdev_list)) != NULL) { + TAILQ_REMOVE(&pf->userdev_list, ud, link); + free(ud->provider, M_DEVBUF); + free(ud->desc, M_DEVBUF); + free(ud->devnode, M_DEVBUF); + free(ud->nameunit, M_DEVBUF); + nvlist_destroy(ud->provider_nvl); + free(ud, M_DEVBUF); + } +} + static void sndstat_close(void *sndstat_file) { @@ -136,6 +203,12 @@ sndstat_close(void *sndstat_file) TAILQ_REMOVE(&sndstat_filelist, pf, entry); SNDSTAT_UNLOCK(); + free(pf->devs_nvlbuf, M_NVLIST); + sx_xlock(&pf->lock); + sndstat_remove_all_userdevs(pf); + sx_xunlock(&pf->lock); + sx_destroy(&pf->lock); + free(pf, M_DEVBUF); } @@ -203,7 +276,10 @@ sndstat_write(struct cdev *i_dev, struct uio *buf, int flag) err = EINVAL; } else { /* only remember the last write - allows for updates */ - sbuf_clear(&pf->sbuf); + sx_xlock(&pf->lock); + sndstat_remove_all_userdevs(pf); + sx_xunlock(&pf->lock); + while (1) { len = sizeof(temp); if (len > buf->uio_resid) @@ -221,15 +297,647 @@ sndstat_write(struct cdev *i_dev, struct uio *buf, int flag) } } sbuf_finish(&pf->sbuf); - if (err == 0) + + if (err == 0) { + char *line, *str; + + str = sbuf_data(&pf->sbuf); + while ((line = strsep(&str, "\n")) != NULL) { + struct sndstat_userdev *ud; + + ud = sndstat_line2userdev(pf, line, strlen(line)); + if (ud == NULL) + continue; + + sx_xlock(&pf->lock); + TAILQ_INSERT_TAIL(&pf->userdev_list, ud, link); + sx_xunlock(&pf->lock); + } + pf->out_offset = sbuf_len(&pf->sbuf); - else + } else pf->out_offset = 0; + + sbuf_clear(&pf->sbuf); + } + SNDSTAT_UNLOCK(); + return (err); +} + +static void +sndstat_get_caps(struct snddev_info *d, bool play, uint32_t *min_rate, + uint32_t *max_rate, uint32_t *fmts) +{ + struct pcm_channel *c; + int dir; + + dir = play ? PCMDIR_PLAY : PCMDIR_REC; + *min_rate = 0; + *max_rate = 0; + *fmts = 0; + + if (play && d->pvchancount > 0) { + *min_rate = *max_rate = d->pvchanrate; + *fmts = d->pvchanformat; + return; + } else if (!play && d->rvchancount > 0) { + *min_rate = *max_rate = d->rvchanrate; + *fmts = d->rvchanformat; + return; + } + + CHN_FOREACH(c, d, channels.pcm) { + struct pcmchan_caps *caps; + + if (c->direction != dir || (c->flags & CHN_F_VIRTUAL) != 0) + continue; + + CHN_LOCK(c); + caps = chn_getcaps(c); + *min_rate = caps->minspeed; + *max_rate = caps->maxspeed; + *fmts = chn_getformats(c); + CHN_UNLOCK(c); + } +} + +static int +sndstat_build_sound4_nvlist(struct snddev_info *d, nvlist_t **dip) +{ + uint32_t maxrate, minrate, fmts; + nvlist_t *di = NULL, *sound4di = NULL; + int err; + + di = nvlist_create(0); + if (di == NULL) { + err = ENOMEM; + goto done; + } + sound4di = nvlist_create(0); + if (sound4di == NULL) { + err = ENOMEM; + goto done; + } + + nvlist_add_bool(di, SNDSTAT_LABEL_FROM_USER, false); + nvlist_add_stringf(di, SNDSTAT_LABEL_NAMEUNIT, "%s", + device_get_nameunit(d->dev)); + nvlist_add_stringf(di, SNDSTAT_LABEL_DEVNODE, "dsp%d", + device_get_unit(d->dev)); + nvlist_add_string( + di, SNDSTAT_LABEL_DESC, device_get_desc(d->dev)); + + PCM_ACQUIRE_QUICK(d); + nvlist_add_number(di, SNDSTAT_LABEL_PCHAN, d->playcount); + nvlist_add_number(di, SNDSTAT_LABEL_RCHAN, d->reccount); + if (d->playcount > 0) { + sndstat_get_caps(d, true, &minrate, &maxrate, &fmts); + nvlist_add_number(di, SNDSTAT_LABEL_PMINRATE, minrate); + nvlist_add_number(di, SNDSTAT_LABEL_PMAXRATE, maxrate); + nvlist_add_number(di, SNDSTAT_LABEL_PFMTS, fmts); + } + if (d->reccount > 0) { + sndstat_get_caps(d, false, &minrate, &maxrate, &fmts); + nvlist_add_number(di, SNDSTAT_LABEL_RMINRATE, minrate); + nvlist_add_number(di, SNDSTAT_LABEL_RMAXRATE, maxrate); + nvlist_add_number(di, SNDSTAT_LABEL_RFMTS, fmts); + } + + nvlist_add_number(sound4di, SNDSTAT_LABEL_SOUND4_UNIT, + device_get_unit(d->dev)); // XXX: I want signed integer here + nvlist_add_bool( + sound4di, SNDSTAT_LABEL_SOUND4_BITPERFECT, d->flags & SD_F_BITPERFECT); + nvlist_add_number(sound4di, SNDSTAT_LABEL_SOUND4_PVCHAN, d->pvchancount); + nvlist_add_number(sound4di, SNDSTAT_LABEL_SOUND4_RVCHAN, d->rvchancount); + nvlist_move_nvlist(di, SNDSTAT_LABEL_PROVIDER_INFO, sound4di); + sound4di = NULL; + PCM_RELEASE_QUICK(d); + nvlist_add_string(di, SNDSTAT_LABEL_PROVIDER, SNDSTAT_LABEL_SOUND4_PROVIDER); + + err = nvlist_error(di); + if (err) + goto done; + + *dip = di; + +done: + if (err) { + nvlist_destroy(sound4di); + nvlist_destroy(di); + } + return (err); +} + +static int +sndstat_build_userland_nvlist(struct sndstat_userdev *ud, nvlist_t **dip) +{ + nvlist_t *di; + int err; + + di = nvlist_create(0); + if (di == NULL) { + err = ENOMEM; + goto done; + } + + nvlist_add_bool(di, SNDSTAT_LABEL_FROM_USER, true); + nvlist_add_number(di, SNDSTAT_LABEL_PCHAN, ud->pchan); + nvlist_add_number(di, SNDSTAT_LABEL_RCHAN, ud->rchan); + nvlist_add_string(di, SNDSTAT_LABEL_NAMEUNIT, ud->nameunit); + nvlist_add_string( + di, SNDSTAT_LABEL_DEVNODE, ud->devnode); + nvlist_add_string(di, SNDSTAT_LABEL_DESC, ud->desc); + if (ud->pchan != 0) { + nvlist_add_number( + di, SNDSTAT_LABEL_PMINRATE, ud->pminrate); + nvlist_add_number( + di, SNDSTAT_LABEL_PMAXRATE, ud->pmaxrate); + nvlist_add_number( + di, SNDSTAT_LABEL_PFMTS, ud->pfmts); + } + if (ud->rchan != 0) { + nvlist_add_number( + di, SNDSTAT_LABEL_RMINRATE, ud->rminrate); + nvlist_add_number( + di, SNDSTAT_LABEL_RMAXRATE, ud->rmaxrate); + nvlist_add_number( + di, SNDSTAT_LABEL_RFMTS, ud->rfmts); + } + nvlist_add_string(di, SNDSTAT_LABEL_PROVIDER, + (ud->provider != NULL) ? ud->provider : ""); + if (ud->provider_nvl != NULL) + nvlist_add_nvlist( + di, SNDSTAT_LABEL_PROVIDER_INFO, ud->provider_nvl); + + err = nvlist_error(di); + if (err) + goto done; + + *dip = di; + +done: + if (err) + nvlist_destroy(di); + return (err); +} + +/* + * Should only be called with the following locks held: + * * sndstat_lock + */ +static int +sndstat_create_devs_nvlist(nvlist_t **nvlp) +{ + int err; + nvlist_t *nvl; + struct sndstat_entry *ent; + struct sndstat_file *pf; + + nvl = nvlist_create(0); + if (nvl == NULL) + return (ENOMEM); + + TAILQ_FOREACH(ent, &sndstat_devlist, link) { + struct snddev_info *d; + nvlist_t *di; + + if (ent->dev == NULL) + continue; + d = device_get_softc(ent->dev); + if (!PCM_REGISTERED(d)) + continue; + + err = sndstat_build_sound4_nvlist(d, &di); + if (err) + goto done; + + nvlist_append_nvlist_array(nvl, SNDSTAT_LABEL_DSPS, di); + nvlist_destroy(di); + err = nvlist_error(nvl); + if (err) + goto done; + } + + TAILQ_FOREACH(pf, &sndstat_filelist, entry) { + struct sndstat_userdev *ud; + + sx_xlock(&pf->lock); + + TAILQ_FOREACH(ud, &pf->userdev_list, link) { + nvlist_t *di; + + err = sndstat_build_userland_nvlist(ud, &di); + if (err != 0) { + sx_xunlock(&pf->lock); + goto done; + } + nvlist_append_nvlist_array(nvl, SNDSTAT_LABEL_DSPS, di); + nvlist_destroy(di); + + err = nvlist_error(nvl); + if (err != 0) { + sx_xunlock(&pf->lock); + goto done; + } + } + + sx_xunlock(&pf->lock); + } + + *nvlp = nvl; + +done: + if (err != 0) + nvlist_destroy(nvl); + return (err); +} + +static int +sndstat_refresh_devs(struct sndstat_file *pf) +{ + sx_xlock(&pf->lock); + free(pf->devs_nvlbuf, M_NVLIST); + pf->devs_nvlbuf = NULL; + pf->devs_nbytes = 0; + sx_unlock(&pf->lock); + + return (0); +} + +static int +sndstat_get_devs(struct sndstat_file *pf, caddr_t data) +{ + int err; + struct sndstat_nvlbuf_arg *arg = (struct sndstat_nvlbuf_arg *)data; + + SNDSTAT_LOCK(); + sx_xlock(&pf->lock); + + if (pf->devs_nvlbuf == NULL) { + nvlist_t *nvl; + void *nvlbuf; + size_t nbytes; + int err; + + sx_xunlock(&pf->lock); + + err = sndstat_create_devs_nvlist(&nvl); + if (err) { + SNDSTAT_UNLOCK(); + return (err); + } + + sx_xlock(&pf->lock); + + nvlbuf = nvlist_pack(nvl, &nbytes); + err = nvlist_error(nvl); + nvlist_destroy(nvl); + if (nvlbuf == NULL || err != 0) { + SNDSTAT_UNLOCK(); + sx_xunlock(&pf->lock); + if (err == 0) + return (ENOMEM); + return (err); + } + + free(pf->devs_nvlbuf, M_NVLIST); + pf->devs_nvlbuf = nvlbuf; + pf->devs_nbytes = nbytes; } + SNDSTAT_UNLOCK(); + + if (!arg->nbytes) { + arg->nbytes = pf->devs_nbytes; + err = 0; + goto done; + } + if (arg->nbytes < pf->devs_nbytes) { + arg->nbytes = 0; + err = 0; + goto done; + } + + err = copyout(pf->devs_nvlbuf, arg->buf, pf->devs_nbytes); + if (err) + goto done; + + arg->nbytes = pf->devs_nbytes; + + free(pf->devs_nvlbuf, M_NVLIST); + pf->devs_nvlbuf = NULL; + pf->devs_nbytes = 0; + +done: + sx_unlock(&pf->lock); return (err); } +static int +sndstat_unpack_user_nvlbuf(const void *unvlbuf, size_t nbytes, nvlist_t **nvl) +{ + void *nvlbuf; + int err; + + nvlbuf = malloc(nbytes, M_DEVBUF, M_WAITOK); + err = copyin(unvlbuf, nvlbuf, nbytes); + if (err != 0) { + free(nvlbuf, M_DEVBUF); + return (err); + } + *nvl = nvlist_unpack(nvlbuf, nbytes, 0); + free(nvlbuf, M_DEVBUF); + if (nvl == NULL) { + return (EINVAL); + } + + return (0); +} + +static bool +sndstat_dsp_nvlist_is_sane(const nvlist_t *nvlist) +{ + if (!(nvlist_exists_string(nvlist, SNDSTAT_LABEL_DEVNODE) && + nvlist_exists_string(nvlist, SNDSTAT_LABEL_DESC) && + nvlist_exists_number(nvlist, SNDSTAT_LABEL_PCHAN) && + nvlist_exists_number(nvlist, SNDSTAT_LABEL_RCHAN))) + return (false); + + if (nvlist_get_number(nvlist, SNDSTAT_LABEL_PCHAN) > 0) + if (!(nvlist_exists_number(nvlist, SNDSTAT_LABEL_PMINRATE) && + nvlist_exists_number(nvlist, SNDSTAT_LABEL_PMAXRATE) && + nvlist_exists_number(nvlist, SNDSTAT_LABEL_PFMTS))) + return (false); + + if (nvlist_get_number(nvlist, SNDSTAT_LABEL_RCHAN) > 0) + if (!(nvlist_exists_number(nvlist, SNDSTAT_LABEL_RMINRATE) && + nvlist_exists_number(nvlist, SNDSTAT_LABEL_RMAXRATE) && + nvlist_exists_number(nvlist, SNDSTAT_LABEL_RFMTS))) + return (false); + + return (true); + +} + +static int +sndstat_dsp_unpack_nvlist(const nvlist_t *nvlist, struct sndstat_userdev *ud) +{ + const char *nameunit, *devnode, *desc; + unsigned int pchan, rchan; + uint32_t pminrate = 0, pmaxrate = 0; + uint32_t rminrate = 0, rmaxrate = 0; + uint32_t pfmts = 0, rfmts = 0; + nvlist_t *provider_nvl = NULL; + const char *provider; + + devnode = nvlist_get_string(nvlist, SNDSTAT_LABEL_DEVNODE); + if (nvlist_exists_string(nvlist, SNDSTAT_LABEL_NAMEUNIT)) + nameunit = nvlist_get_string(nvlist, SNDSTAT_LABEL_NAMEUNIT); + else + nameunit = devnode; + desc = nvlist_get_string(nvlist, SNDSTAT_LABEL_DESC); + pchan = nvlist_get_number(nvlist, SNDSTAT_LABEL_PCHAN); + rchan = nvlist_get_number(nvlist, SNDSTAT_LABEL_RCHAN); + if (pchan != 0) { + pminrate = nvlist_get_number(nvlist, SNDSTAT_LABEL_PMINRATE); + pmaxrate = nvlist_get_number(nvlist, SNDSTAT_LABEL_PMAXRATE); + pfmts = nvlist_get_number(nvlist, SNDSTAT_LABEL_PFMTS); + } + if (rchan != 0) { + rminrate = nvlist_get_number(nvlist, SNDSTAT_LABEL_RMINRATE); + rmaxrate = nvlist_get_number(nvlist, SNDSTAT_LABEL_RMAXRATE); + rfmts = nvlist_get_number(nvlist, SNDSTAT_LABEL_RFMTS); + } + + provider = dnvlist_get_string(nvlist, SNDSTAT_LABEL_PROVIDER, ""); + if (provider[0] == '\0') + provider = NULL; + + if (provider != NULL && + nvlist_exists_nvlist(nvlist, SNDSTAT_LABEL_PROVIDER_INFO)) { + provider_nvl = nvlist_clone( + nvlist_get_nvlist(nvlist, SNDSTAT_LABEL_PROVIDER_INFO)); + if (provider_nvl == NULL) + return (ENOMEM); + } + + ud->provider = (provider != NULL) ? strdup(provider, M_DEVBUF) : NULL; + ud->devnode = strdup(devnode, M_DEVBUF); + ud->nameunit = strdup(nameunit, M_DEVBUF); + ud->desc = strdup(desc, M_DEVBUF); + ud->pchan = pchan; + ud->rchan = rchan; + ud->pminrate = pminrate; + ud->pmaxrate = pmaxrate; + ud->rminrate = rminrate; + ud->rmaxrate = rmaxrate; + ud->pfmts = pfmts; + ud->rfmts = rfmts; + ud->provider_nvl = provider_nvl; + return (0); +} + +static int +sndstat_add_user_devs(struct sndstat_file *pf, caddr_t data) +{ + int err; + nvlist_t *nvl = NULL; + const nvlist_t * const *dsps; + size_t i, ndsps; + struct sndstat_nvlbuf_arg *arg = (struct sndstat_nvlbuf_arg *)data; + + if ((pf->fflags & FWRITE) == 0) { + err = EPERM; + goto done; + } + + err = sndstat_unpack_user_nvlbuf(arg->buf, arg->nbytes, &nvl); + if (err != 0) + goto done; + + if (!nvlist_exists_nvlist_array(nvl, SNDSTAT_LABEL_DSPS)) { + err = EINVAL; + goto done; + } + dsps = nvlist_get_nvlist_array(nvl, SNDSTAT_LABEL_DSPS, &ndsps); + for (i = 0; i < ndsps; i++) { + if (!sndstat_dsp_nvlist_is_sane(dsps[i])) { + err = EINVAL; + goto done; + } + } + sx_xlock(&pf->lock); + for (i = 0; i < ndsps; i++) { + struct sndstat_userdev *ud = + malloc(sizeof(*ud), M_DEVBUF, M_WAITOK); + err = sndstat_dsp_unpack_nvlist(dsps[i], ud); + if (err) { + sx_unlock(&pf->lock); + goto done; + } + TAILQ_INSERT_TAIL(&pf->userdev_list, ud, link); + } + sx_unlock(&pf->lock); + +done: + nvlist_destroy(nvl); + return (err); +} + +static int +sndstat_flush_user_devs(struct sndstat_file *pf) +{ + if ((pf->fflags & FWRITE) == 0) + return (EPERM); + + sx_xlock(&pf->lock); + sndstat_remove_all_userdevs(pf); *** 305 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Mar 17 12:50:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 160D75ADBF1; Wed, 17 Mar 2021 12:50: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 4F0qkl05HZz3k9d; Wed, 17 Mar 2021 12:50: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 EA66E711F; Wed, 17 Mar 2021 12:50: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 12HCoM0C088120; Wed, 17 Mar 2021 12:50:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HCoMaD088119; Wed, 17 Mar 2021 12:50:22 GMT (envelope-from git) Date: Wed, 17 Mar 2021 12:50:22 GMT Message-Id: <202103171250.12HCoMaD088119@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: 1acf24a044aa - main - Implement pci_get_relaxed_ordering_enabled() helper function. 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: 1acf24a044aaa0391c61af4abe7e018c3bf8a37c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 12:50:23 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=1acf24a044aaa0391c61af4abe7e018c3bf8a37c commit 1acf24a044aaa0391c61af4abe7e018c3bf8a37c Author: Hans Petter Selasky AuthorDate: 2021-03-16 15:06:42 +0000 Commit: Hans Petter Selasky CommitDate: 2021-03-17 12:48:04 +0000 Implement pci_get_relaxed_ordering_enabled() helper function. Discussed with: kib@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking --- sys/dev/pci/pci.c | 15 +++++++++++++++ sys/dev/pci/pcivar.h | 1 + 2 files changed, 16 insertions(+) diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 1ca128a48ad0..d85ce5baa7bc 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -2182,6 +2182,21 @@ pci_ht_map_msi(device_t dev, uint64_t addr) } } +int +pci_get_relaxed_ordering_enabled(device_t dev) +{ + struct pci_devinfo *dinfo = device_get_ivars(dev); + int cap; + uint16_t val; + + cap = dinfo->cfg.pcie.pcie_location; + if (cap == 0) + return (0); + val = pci_read_config(dev, cap + PCIER_DEVICE_CTL, 2); + val &= PCIEM_CTL_RELAXED_ORD_ENABLE; + return (val != 0); +} + int pci_get_max_payload(device_t dev) { diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h index 0f04ca8f623c..74aa704635f7 100644 --- a/sys/dev/pci/pcivar.h +++ b/sys/dev/pci/pcivar.h @@ -677,6 +677,7 @@ int pci_msix_device_blacklisted(device_t dev); void pci_ht_map_msi(device_t dev, uint64_t addr); device_t pci_find_pcie_root_port(device_t dev); +int pci_get_relaxed_ordering_enabled(device_t dev); int pci_get_max_payload(device_t dev); int pci_get_max_read_req(device_t dev); void pci_restore_state(device_t dev); From owner-dev-commits-src-all@freebsd.org Wed Mar 17 13:08:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F0CC5AE738; Wed, 17 Mar 2021 13: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 4F0r7742TQz3llX; Wed, 17 Mar 2021 13: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 7D4E071E2; Wed, 17 Mar 2021 13: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 12HD83c5007706; Wed, 17 Mar 2021 13: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 12HD83S0007705; Wed, 17 Mar 2021 13:08:03 GMT (envelope-from git) Date: Wed, 17 Mar 2021 13:08:03 GMT Message-Id: <202103171308.12HD83S0007705@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Cy Schubert Subject: git: eeb26cf52c4c - main - wpa: import fix for P2P provision discovery processing vulnerability MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cy X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: eeb26cf52c4c51e1571253d57684c442aa79a98d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 13:08:03 -0000 The branch main has been updated by cy: URL: https://cgit.FreeBSD.org/src/commit/?id=eeb26cf52c4c51e1571253d57684c442aa79a98d commit eeb26cf52c4c51e1571253d57684c442aa79a98d Author: Cy Schubert AuthorDate: 2021-03-17 00:06:17 +0000 Commit: Cy Schubert CommitDate: 2021-03-17 13:06:55 +0000 wpa: import fix for P2P provision discovery processing vulnerability Latest version available from: https://w1.fi/security/2021-1/ Vulnerability A vulnerability was discovered in how wpa_supplicant processes P2P (Wi-Fi Direct) provision discovery requests. Under a corner case condition, an invalid Provision Discovery Request frame could end up reaching a state where the oldest peer entry needs to be removed. With a suitably constructed invalid frame, this could result in use (read+write) of freed memory. This can result in an attacker within radio range of the device running P2P discovery being able to cause unexpected behavior, including termination of the wpa_supplicant process and potentially code execution. Vulnerable versions/configurations wpa_supplicant v1.0-v2.9 with CONFIG_P2P build option enabled An attacker (or a system controlled by the attacker) needs to be within radio range of the vulnerable system to send a set of suitably constructed management frames that trigger the corner case to be reached in the management of the P2P peer table. Note: FreeBSD base does not enable P2P. --- contrib/wpa/src/p2p/p2p_pd.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/contrib/wpa/src/p2p/p2p_pd.c b/contrib/wpa/src/p2p/p2p_pd.c index 3994ec03f86b..05fd593494ef 100644 --- a/contrib/wpa/src/p2p/p2p_pd.c +++ b/contrib/wpa/src/p2p/p2p_pd.c @@ -595,14 +595,12 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa, goto out; } + dev = p2p_get_device(p2p, sa); if (!dev) { - dev = p2p_get_device(p2p, sa); - if (!dev) { - p2p_dbg(p2p, - "Provision Discovery device not found " - MACSTR, MAC2STR(sa)); - goto out; - } + p2p_dbg(p2p, + "Provision Discovery device not found " + MACSTR, MAC2STR(sa)); + goto out; } } else if (msg.wfd_subelems) { wpabuf_free(dev->info.wfd_subelems); From owner-dev-commits-src-all@freebsd.org Wed Mar 17 14:02:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5448C56923E; Wed, 17 Mar 2021 14:02: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 4F0sL31tj1z3rt2; Wed, 17 Mar 2021 14:02: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 33A0B10312; Wed, 17 Mar 2021 14:02: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 12HE2Zi7085450; Wed, 17 Mar 2021 14:02:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HE2Zqs085449; Wed, 17 Mar 2021 14:02:35 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:02:35 GMT Message-Id: <202103171402.12HE2Zqs085449@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 5bffdafd6c5f - main - Remove tmpfs size and properly format generated fstab for arm MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5bffdafd6c5f2a8279a57172ab760ea66ed3d7d5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:02:35 -0000 The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=5bffdafd6c5f2a8279a57172ab760ea66ed3d7d5 commit 5bffdafd6c5f2a8279a57172ab760ea66ed3d7d5 Author: Daniel Engerg AuthorDate: 2021-03-17 14:00:57 +0000 Commit: Emmanuel Vadot CommitDate: 2021-03-17 14:02:05 +0000 Remove tmpfs size and properly format generated fstab for arm Remove tmpfs size limitation, this breaks make installworld and installation of some packages Format generated fstab using tabs to make it consistent and readable MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29283 --- release/tools/arm.subr | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/release/tools/arm.subr b/release/tools/arm.subr index 2f91490c0859..811d6ddb402d 100644 --- a/release/tools/arm.subr +++ b/release/tools/arm.subr @@ -197,18 +197,18 @@ arm_install_base() { echo '# Custom /etc/fstab for FreeBSD embedded images' \ > ${CHROOTDIR}/${DESTDIR}/etc/fstab if [ "${PART_SCHEME}" == "GPT" ]; then - echo "/dev/ufs/rootfs / ufs rw 1 1" \ + echo "/dev/ufs/rootfs / ufs rw 1 1" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab - echo "/dev/msdosfs/EFI /boot/efi msdosfs rw,noatime 0 0" \ + echo "/dev/msdosfs/EFI /boot/efi msdosfs rw,noatime 0 0" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab fi if [ "${PART_SCHEME}" == "MBR" ]; then - echo "/dev/ufs/rootfs / ufs rw 1 1" \ + echo "/dev/ufs/rootfs / ufs rw 1 1" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab - echo "/dev/msdosfs/MSDOSBOOT /boot/msdos msdosfs rw,noatime 0 0" \ + echo "/dev/msdosfs/MSDOSBOOT /boot/msdos msdosfs rw,noatime 0 0" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab fi - echo "tmpfs /tmp tmpfs rw,mode=1777,size=50m 0 0" \ + echo "tmpfs /tmp tmpfs rw,mode=1777 0 0" \ >> ${CHROOTDIR}/${DESTDIR}/etc/fstab local hostname From owner-dev-commits-src-all@freebsd.org Wed Mar 17 14:05:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9544556948B; Wed, 17 Mar 2021 14:05: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 4F0sP93blDz3sXP; Wed, 17 Mar 2021 14:05: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 5D6F810489; Wed, 17 Mar 2021 14:05: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 12HE5HKq085995; Wed, 17 Mar 2021 14:05:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HE5HQN085994; Wed, 17 Mar 2021 14:05:17 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:05:17 GMT Message-Id: <202103171405.12HE5HQN085994@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: cb8330371482 - stable/13 - Import atf 0.22 snapshot ca73d08c3fc1ecffc1f1c97458c31ab82c12bb01 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cb8330371482613e150f29c8527153705fa47797 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:05:17 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=cb8330371482613e150f29c8527153705fa47797 commit cb8330371482613e150f29c8527153705fa47797 Author: Alex Richardson AuthorDate: 2021-02-04 14:48:10 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 12:21:06 +0000 Import atf 0.22 snapshot ca73d08c3fc1ecffc1f1c97458c31ab82c12bb01 This includes improvements to the atf-sh helper functions that significantly reduce the number of spawned processes for each test and therefore speeds up running the testsuite noticeably. (cherry picked from commit c203bd70b5957f85616424b6fa374479372d06e3) --- contrib/atf/.cirrus.yml | 26 ++++++ contrib/atf/.gitignore | 25 ++++++ contrib/atf/.travis.yml | 25 ++++++ contrib/atf/NEWS | 18 ++++ contrib/atf/README.md | 47 ++++++++++ contrib/atf/atf-c++/atf-c++.3 | 4 +- contrib/atf/atf-c++/detail/test_helpers.hpp | 5 ++ contrib/atf/atf-c++/tests.hpp | 2 +- contrib/atf/atf-c++/utils.cpp | 7 ++ contrib/atf/atf-c++/utils.hpp | 1 + contrib/atf/atf-c++/utils_test.cpp | 1 + contrib/atf/atf-c/.gitignore | 1 + contrib/atf/atf-c/check.c | 3 +- contrib/atf/atf-c/detail/fs_test.c | 9 +- contrib/atf/atf-c/detail/list.c | 2 +- contrib/atf/atf-c/detail/process.c | 3 +- contrib/atf/atf-c/detail/test_helpers.h | 7 ++ contrib/atf/atf-c/tc.c | 116 +++++++++++++++++++------ contrib/atf/atf-c/utils.c | 10 +++ contrib/atf/atf-c/utils.h | 1 + contrib/atf/atf-c/utils_test.c | 1 + contrib/atf/atf-sh/.gitignore | 2 + contrib/atf/atf-sh/atf-check.1 | 15 +++- contrib/atf/atf-sh/atf-check.cpp | 128 +++++++++++++++++++++++++--- contrib/atf/atf-sh/atf-sh.3 | 11 ++- contrib/atf/atf-sh/atf_check_test.sh | 24 ++++++ contrib/atf/atf-sh/libatf-sh.subr | 32 ++++++- contrib/atf/atf-sh/misc_helpers.sh | 48 +++++++++++ contrib/atf/doc/.gitignore | 1 + contrib/atf/doc/atf-test-case.4 | 17 ++-- lib/atf/libatf-c++/tests/Makefile | 2 + 31 files changed, 541 insertions(+), 53 deletions(-) diff --git a/contrib/atf/.cirrus.yml b/contrib/atf/.cirrus.yml new file mode 100644 index 000000000000..fd9b6e4a47df --- /dev/null +++ b/contrib/atf/.cirrus.yml @@ -0,0 +1,26 @@ +env: + CIRRUS_CLONE_DEPTH: 1 + ARCH: amd64 + +task: + matrix: + - name: 13.0-CURRENT + freebsd_instance: + image_family: freebsd-13-0-snap + - name: 12.2-STABLE + freebsd_instance: + image_family: freebsd-12-2-snap + - name: 12.1-RELEASE + freebsd_instance: + image_family: freebsd-12-1 + install_script: + - sed -i.bak -e 's,pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly,pkg+http://pkg.FreeBSD.org/\${ABI}/latest,' /etc/pkg/FreeBSD.conf + - ASSUME_ALWAYS_YES=yes pkg bootstrap -f + - pkg install -y autoconf automake libtool kyua + script: + - env JUNIT_OUTPUT=$(pwd)/test-results.xml ./admin/travis-build.sh + always: + junit_artifacts: + path: "test-results.xml" + type: text/xml + format: junit diff --git a/contrib/atf/.gitignore b/contrib/atf/.gitignore new file mode 100644 index 000000000000..396785ce2052 --- /dev/null +++ b/contrib/atf/.gitignore @@ -0,0 +1,25 @@ +*.la +*.lo +*.o +*.pc +*_helper +*_helpers +*_test +.deps +.dirstamp +.libs + +Makefile +Makefile.in +aclocal.m4 +autom4te.cache +config.h +config.h.in +config.h.in~ +config.log +config.status +configure +installcheck.log +libtool +stamp-h1 +testsuite.log diff --git a/contrib/atf/.travis.yml b/contrib/atf/.travis.yml new file mode 100644 index 000000000000..1949aae54468 --- /dev/null +++ b/contrib/atf/.travis.yml @@ -0,0 +1,25 @@ +language: cpp + +compiler: + - gcc + - clang + +before_install: + - ./admin/travis-install-deps.sh + +env: + - ARCH=amd64 AS_ROOT=no + - ARCH=amd64 AS_ROOT=yes + - ARCH=i386 AS_ROOT=no + +matrix: + exclude: + - compiler: clang + env: ARCH=i386 AS_ROOT=no + +script: + - ./admin/travis-build.sh + +notifications: + email: + - atf-log@googlegroups.com diff --git a/contrib/atf/NEWS b/contrib/atf/NEWS index f1764e0d9dda..671ee81ff6ff 100644 --- a/contrib/atf/NEWS +++ b/contrib/atf/NEWS @@ -1,6 +1,24 @@ Major changes between releases Automated Testing Framework =========================================================================== +Changes in version 0.22 +*********************** + +STILL UNDER DEVELOPMENT; NOT RELEASED YET. +DON'T FORGET TO BUMP THE -version-info PRE-RELEASE IF NECESSARY! + +* Issue #23: Fix double-free triggered by atf_map_insert in low memory + scenarios, caused by an overlook in the atf_list code. + +* Issue #29: Fixed various typos and formatting errors in manual pages. + +* Issue #31: Added require.progs metadata properties to the tests that + need a compiler to run. + +* Added the atf_check_not_equal function to atf-sh to check for + unequal values. + + Changes in version 0.21 *********************** diff --git a/contrib/atf/README.md b/contrib/atf/README.md new file mode 100644 index 000000000000..d245552f35c9 --- /dev/null +++ b/contrib/atf/README.md @@ -0,0 +1,47 @@ +# Welcome to the ATF project! + +ATF, or Automated Testing Framework, is a **collection of libraries** to +write test programs in **C, C++ and POSIX shell**. + +The ATF libraries offer a simple API. The API is orthogonal through the +various bindings, allowing developers to quickly learn how to write test +programs in different languages. + +ATF-based test programs offer a **consistent end-user command-line +interface** to allow both humans and automation to run the tests. + +ATF-based test programs **rely on an execution engine** to be run and +this execution engine is *not* shipped with ATF. +**[Kyua](https://github.com/jmmv/kyua/) is the engine of choice.** + +## Download + +Formal releases for source files are available for download from GitHub: + +* [atf 0.20](../../releases/tag/atf-0.20), released on February 7th, 2014. + +## Installation + +You are encouraged to install binary packages for your operating system +wherever available: + +* Fedora 20 and above: install the `atf` package with `yum install atf`. + +* FreeBSD 10.0 and above: install the `atf` package with `pkg install atf`. + +* NetBSD with pkgsrc: install the `pkgsrc/devel/atf` package. + +* OpenBSD: install the `devel/atf` package with `pkg_add atf`. + +Should you want to build and install ATF from the source tree provided +here, follow the instructions in the [INSTALL file](INSTALL). + +## Support + +Please use the +[atf-discuss mailing list](https://groups.google.com/forum/#!forum/atf-discuss) +for any support inquiries related to `atf-c`, `atf-c++` or `atf-sh`. + +If you have any questions on Kyua proper, please use the +[kyua-discuss mailing list](https://groups.google.com/forum/#!forum/kyua-discuss) +instead. diff --git a/contrib/atf/atf-c++/atf-c++.3 b/contrib/atf/atf-c++/atf-c++.3 index 601efaf6fd5b..fead776755af 100644 --- a/contrib/atf/atf-c++/atf-c++.3 +++ b/contrib/atf/atf-c++/atf-c++.3 @@ -403,8 +403,8 @@ in the collection. takes the name of an exception and a statement and raises a failure if the statement does not throw the specified exception. .Fn ATF_REQUIRE_THROW_RE -takes the name of an exception, a regular expresion and a statement and raises a -failure if the statement does not throw the specified exception and if the +takes the name of an exception, a regular expression and a statement, and raises +a failure if the statement does not throw the specified exception and if the message of the exception does not match the regular expression. .Pp .Fn ATF_CHECK_ERRNO diff --git a/contrib/atf/atf-c++/detail/test_helpers.hpp b/contrib/atf/atf-c++/detail/test_helpers.hpp index f166ee218a13..c1171801a3a7 100644 --- a/contrib/atf/atf-c++/detail/test_helpers.hpp +++ b/contrib/atf/atf-c++/detail/test_helpers.hpp @@ -36,6 +36,7 @@ #include +#include #include #define HEADER_TC(name, hdrname) \ @@ -44,6 +45,8 @@ { \ set_md_var("descr", "Tests that the " hdrname " file can be " \ "included on its own, without any prerequisites"); \ + const std::string cxx = atf::env::get("ATF_BUILD_CXX", ATF_BUILD_CXX); \ + set_md_var("require.progs", cxx); \ } \ ATF_TEST_CASE_BODY(name) \ { \ @@ -55,6 +58,8 @@ ATF_TEST_CASE_HEAD(name) \ { \ set_md_var("descr", descr); \ + const std::string cxx = atf::env::get("ATF_BUILD_CXX", ATF_BUILD_CXX); \ + set_md_var("require.progs", cxx); \ } \ ATF_TEST_CASE_BODY(name) \ { \ diff --git a/contrib/atf/atf-c++/tests.hpp b/contrib/atf/atf-c++/tests.hpp index ce2fb1d165c8..a03cc852dcf8 100644 --- a/contrib/atf/atf-c++/tests.hpp +++ b/contrib/atf/atf-c++/tests.hpp @@ -73,7 +73,7 @@ class tc { tc(const tc&); tc& operator=(const tc&); - std::auto_ptr< tc_impl > pimpl; + std::unique_ptr< tc_impl > pimpl; protected: virtual void head(void); diff --git a/contrib/atf/atf-c++/utils.cpp b/contrib/atf/atf-c++/utils.cpp index a6ab08f0d770..995d78c6542e 100644 --- a/contrib/atf/atf-c++/utils.cpp +++ b/contrib/atf/atf-c++/utils.cpp @@ -70,6 +70,13 @@ atf::utils::fork(void) return atf_utils_fork(); } +void +atf::utils::reset_resultsfile(void) +{ + + atf_utils_reset_resultsfile(); +} + bool atf::utils::grep_file(const std::string& regex, const std::string& path) { diff --git a/contrib/atf/atf-c++/utils.hpp b/contrib/atf/atf-c++/utils.hpp index 8f5c5e337455..34d77a126df7 100644 --- a/contrib/atf/atf-c++/utils.hpp +++ b/contrib/atf/atf-c++/utils.hpp @@ -41,6 +41,7 @@ void copy_file(const std::string&, const std::string&); void create_file(const std::string&, const std::string&); bool file_exists(const std::string&); pid_t fork(void); +void reset_resultsfile(void); bool grep_file(const std::string&, const std::string&); bool grep_string(const std::string&, const std::string&); void redirect(const int, const std::string&); diff --git a/contrib/atf/atf-c++/utils_test.cpp b/contrib/atf/atf-c++/utils_test.cpp index 34e0709f580a..93e16652bac1 100644 --- a/contrib/atf/atf-c++/utils_test.cpp +++ b/contrib/atf/atf-c++/utils_test.cpp @@ -335,6 +335,7 @@ fork_and_wait(const int exitstatus, const char* expout, const char* experr) std::cerr << "Some error\n"; exit(123); } + atf::utils::reset_resultsfile(); atf::utils::wait(pid, exitstatus, expout, experr); exit(EXIT_SUCCESS); } diff --git a/contrib/atf/atf-c/.gitignore b/contrib/atf/atf-c/.gitignore new file mode 100644 index 000000000000..e7f0fb647c32 --- /dev/null +++ b/contrib/atf/atf-c/.gitignore @@ -0,0 +1 @@ +defs.h diff --git a/contrib/atf/atf-c/check.c b/contrib/atf/atf-c/check.c index 38afdf3743a6..1aec01bcca6b 100644 --- a/contrib/atf/atf-c/check.c +++ b/contrib/atf/atf-c/check.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -106,7 +107,7 @@ static int const_execvp(const char *file, const char *const *argv) { -#define UNCONST(a) ((void *)(unsigned long)(const void *)(a)) +#define UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) return execvp(file, UNCONST(argv)); #undef UNCONST } diff --git a/contrib/atf/atf-c/detail/fs_test.c b/contrib/atf/atf-c/detail/fs_test.c index 3dbc4d3ba7ef..7812be0334b8 100644 --- a/contrib/atf/atf-c/detail/fs_test.c +++ b/contrib/atf/atf-c/detail/fs_test.c @@ -779,7 +779,7 @@ ATF_TC_BODY(rmdir_enotempty, tc) atf_fs_path_fini(&p); } -ATF_TC(rmdir_eperm); +ATF_TC_WITH_CLEANUP(rmdir_eperm); ATF_TC_HEAD(rmdir_eperm, tc) { atf_tc_set_md_var(tc, "descr", "Tests the atf_fs_rmdir function"); @@ -808,6 +808,13 @@ ATF_TC_BODY(rmdir_eperm, tc) atf_fs_path_fini(&p); } +ATF_TC_CLEANUP(rmdir_eperm, tc) +{ + if (chmod("test-dir", 0755) == -1) { + fprintf(stderr, "Failed to unprotect test-dir; test directory " + "cleanup will fail\n"); + } +} ATF_TC(mkdtemp_ok); ATF_TC_HEAD(mkdtemp_ok, tc) diff --git a/contrib/atf/atf-c/detail/list.c b/contrib/atf/atf-c/detail/list.c index d14216eb409f..7ac9f1fc948b 100644 --- a/contrib/atf/atf-c/detail/list.c +++ b/contrib/atf/atf-c/detail/list.c @@ -74,7 +74,7 @@ new_entry(void *object, bool managed) le->m_prev = le->m_next = NULL; le->m_object = object; le->m_managed = managed; - } else + } else if (managed) free(object); return le; diff --git a/contrib/atf/atf-c/detail/process.c b/contrib/atf/atf-c/detail/process.c index 8e08b6c57466..a6189bf78e20 100644 --- a/contrib/atf/atf-c/detail/process.c +++ b/contrib/atf/atf-c/detail/process.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -552,7 +553,7 @@ static int const_execvp(const char *file, const char *const *argv) { -#define UNCONST(a) ((void *)(unsigned long)(const void *)(a)) +#define UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) return execvp(file, UNCONST(argv)); #undef UNCONST } diff --git a/contrib/atf/atf-c/detail/test_helpers.h b/contrib/atf/atf-c/detail/test_helpers.h index a601c293ffe4..90841f803c59 100644 --- a/contrib/atf/atf-c/detail/test_helpers.h +++ b/contrib/atf/atf-c/detail/test_helpers.h @@ -33,6 +33,7 @@ #include +#include #include #include @@ -46,8 +47,11 @@ struct atf_fs_path; ATF_TC(name); \ ATF_TC_HEAD(name, tc) \ { \ + const char *cc; \ atf_tc_set_md_var(tc, "descr", "Tests that the " hdrname " file can " \ "be included on its own, without any prerequisites"); \ + cc = atf_env_get_with_default("ATF_BUILD_CC", ATF_BUILD_CC); \ + atf_tc_set_md_var(tc, "require.progs", cc); \ } \ ATF_TC_BODY(name, tc) \ { \ @@ -58,7 +62,10 @@ struct atf_fs_path; ATF_TC(name); \ ATF_TC_HEAD(name, tc) \ { \ + const char *cc; \ atf_tc_set_md_var(tc, "descr", descr); \ + cc = atf_env_get_with_default("ATF_BUILD_CC", ATF_BUILD_CC); \ + atf_tc_set_md_var(tc, "require.progs", cc); \ } \ ATF_TC_BODY(name, tc) \ { \ diff --git a/contrib/atf/atf-c/tc.c b/contrib/atf/atf-c/tc.c index 92c3e12c99b1..69b31123f3a3 100644 --- a/contrib/atf/atf-c/tc.c +++ b/contrib/atf/atf-c/tc.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -62,6 +63,7 @@ enum expect_type { struct context { const atf_tc_t *tc; const char *resfile; + int resfilefd; size_t fail_count; enum expect_type expect; @@ -73,12 +75,14 @@ struct context { }; static void context_init(struct context *, const atf_tc_t *, const char *); +static void context_set_resfile(struct context *, const char *); +static void context_close_resfile(struct context *); static void check_fatal_error(atf_error_t); static void report_fatal_error(const char *, ...) ATF_DEFS_ATTRIBUTE_NORETURN; static atf_error_t write_resfile(const int, const char *, const int, const atf_dynstr_t *); -static void create_resfile(const char *, const char *, const int, +static void create_resfile(struct context *, const char *, const int, atf_dynstr_t *); static void error_in_expect(struct context *, const char *, ...) ATF_DEFS_ATTRIBUTE_NORETURN; @@ -102,11 +106,16 @@ static void errno_test(struct context *, const char *, const size_t, static atf_error_t check_prog_in_dir(const char *, void *); static atf_error_t check_prog(struct context *, const char *); +/* No prototype in header for this one, it's a little sketchy (internal). */ +void atf_tc_set_resultsfile(const char *); + static void context_init(struct context *ctx, const atf_tc_t *tc, const char *resfile) { + ctx->tc = tc; - ctx->resfile = resfile; + ctx->resfilefd = -1; + context_set_resfile(ctx, resfile); ctx->fail_count = 0; ctx->expect = EXPECT_PASS; check_fatal_error(atf_dynstr_init(&ctx->expect_reason)); @@ -116,6 +125,41 @@ context_init(struct context *ctx, const atf_tc_t *tc, const char *resfile) ctx->expect_signo = 0; } +static void +context_set_resfile(struct context *ctx, const char *resfile) +{ + atf_error_t err; + + context_close_resfile(ctx); + ctx->resfile = resfile; + if (strcmp(resfile, "/dev/stdout") == 0) + ctx->resfilefd = STDOUT_FILENO; + else if (strcmp(resfile, "/dev/stderr") == 0) + ctx->resfilefd = STDERR_FILENO; + else + ctx->resfilefd = open(resfile, O_WRONLY | O_CREAT | O_TRUNC, + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); + if (ctx->resfilefd == -1) { + err = atf_libc_error(errno, + "Cannot create results file '%s'", resfile); + check_fatal_error(err); + } + + ctx->resfile = resfile; +} + +static void +context_close_resfile(struct context *ctx) +{ + + if (ctx->resfilefd == -1) + return; + if (ctx->resfilefd != STDOUT_FILENO && ctx->resfilefd != STDERR_FILENO) + close(ctx->resfilefd); + ctx->resfilefd = -1; + ctx->resfile = NULL; +} + static void check_fatal_error(atf_error_t err) { @@ -162,7 +206,7 @@ write_resfile(const int fd, const char *result, const int arg, INV(arg == -1 || reason != NULL); -#define UNCONST(a) ((void *)(unsigned long)(const void *)(a)) +#define UNCONST(a) ((void *)(uintptr_t)(const void *)(a)) iov[count].iov_base = UNCONST(result); iov[count++].iov_len = strlen(result); @@ -202,26 +246,23 @@ write_resfile(const int fd, const char *result, const int arg, * not return any error code. */ static void -create_resfile(const char *resfile, const char *result, const int arg, +create_resfile(struct context *ctx, const char *result, const int arg, atf_dynstr_t *reason) { atf_error_t err; - if (strcmp("/dev/stdout", resfile) == 0) { - err = write_resfile(STDOUT_FILENO, result, arg, reason); - } else if (strcmp("/dev/stderr", resfile) == 0) { - err = write_resfile(STDERR_FILENO, result, arg, reason); - } else { - const int fd = open(resfile, O_WRONLY | O_CREAT | O_TRUNC, - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - if (fd == -1) { - err = atf_libc_error(errno, "Cannot create results file '%s'", - resfile); - } else { - err = write_resfile(fd, result, arg, reason); - close(fd); - } - } + /* + * We'll attempt to truncate the results file, but only if it's not pointed + * at stdout/stderr. We could just blindly ftruncate() here, but it may + * be that stdout/stderr have been redirected to a file that we want to + * validate expectations on, for example. Kyua will want the truncation, + * but it will also redirect the results directly to some file and we'll + * have no issue here. + */ + if (ctx->resfilefd != STDOUT_FILENO && ctx->resfilefd != STDERR_FILENO && + ftruncate(ctx->resfilefd, 0) != -1) + lseek(ctx->resfilefd, 0, SEEK_SET); + err = write_resfile(ctx->resfilefd, result, arg, reason); if (reason != NULL) atf_dynstr_fini(reason); @@ -280,7 +321,8 @@ expected_failure(struct context *ctx, atf_dynstr_t *reason) { check_fatal_error(atf_dynstr_prepend_fmt(reason, "%s: ", atf_dynstr_cstring(&ctx->expect_reason))); - create_resfile(ctx->resfile, "expected_failure", -1, reason); + create_resfile(ctx, "expected_failure", -1, reason); + context_close_resfile(ctx); exit(EXIT_SUCCESS); } @@ -290,7 +332,8 @@ fail_requirement(struct context *ctx, atf_dynstr_t *reason) if (ctx->expect == EXPECT_FAIL) { expected_failure(ctx, reason); } else if (ctx->expect == EXPECT_PASS) { - create_resfile(ctx->resfile, "failed", -1, reason); + create_resfile(ctx, "failed", -1, reason); + context_close_resfile(ctx); exit(EXIT_FAILURE); } else { error_in_expect(ctx, "Test case raised a failure but was not " @@ -325,7 +368,8 @@ pass(struct context *ctx) error_in_expect(ctx, "Test case was expecting a failure but got " "a pass instead"); } else if (ctx->expect == EXPECT_PASS) { - create_resfile(ctx->resfile, "passed", -1, NULL); + create_resfile(ctx, "passed", -1, NULL); + context_close_resfile(ctx); exit(EXIT_SUCCESS); } else { error_in_expect(ctx, "Test case asked to explicitly pass but was " @@ -338,7 +382,8 @@ static void skip(struct context *ctx, atf_dynstr_t *reason) { if (ctx->expect == EXPECT_PASS) { - create_resfile(ctx->resfile, "skipped", -1, reason); + create_resfile(ctx, "skipped", -1, reason); + context_close_resfile(ctx); exit(EXIT_SUCCESS); } else { error_in_expect(ctx, "Can only skip a test case when running in " @@ -942,7 +987,7 @@ _atf_tc_expect_exit(struct context *ctx, const int exitcode, const char *reason, check_fatal_error(atf_dynstr_init_ap(&formatted, reason, ap2)); va_end(ap2); - create_resfile(ctx->resfile, "expected_exit", exitcode, &formatted); + create_resfile(ctx, "expected_exit", exitcode, &formatted); } static void @@ -959,7 +1004,7 @@ _atf_tc_expect_signal(struct context *ctx, const int signo, const char *reason, check_fatal_error(atf_dynstr_init_ap(&formatted, reason, ap2)); va_end(ap2); - create_resfile(ctx->resfile, "expected_signal", signo, &formatted); + create_resfile(ctx, "expected_signal", signo, &formatted); } static void @@ -975,7 +1020,7 @@ _atf_tc_expect_death(struct context *ctx, const char *reason, va_list ap) check_fatal_error(atf_dynstr_init_ap(&formatted, reason, ap2)); va_end(ap2); - create_resfile(ctx->resfile, "expected_death", -1, &formatted); + create_resfile(ctx, "expected_death", -1, &formatted); } static void @@ -991,7 +1036,14 @@ _atf_tc_expect_timeout(struct context *ctx, const char *reason, va_list ap) check_fatal_error(atf_dynstr_init_ap(&formatted, reason, ap2)); va_end(ap2); - create_resfile(ctx->resfile, "expected_timeout", -1, &formatted); + create_resfile(ctx, "expected_timeout", -1, &formatted); +} + +static void +_atf_tc_set_resultsfile(struct context *ctx, const char *file) +{ + + context_set_resfile(ctx, file); } /* --------------------------------------------------------------------- @@ -1215,3 +1267,13 @@ atf_tc_expect_timeout(const char *reason, ...) _atf_tc_expect_timeout(&Current, reason, ap); va_end(ap); } + +/* Internal! */ +void +atf_tc_set_resultsfile(const char *file) +{ + + PRE(Current.tc != NULL); + + _atf_tc_set_resultsfile(&Current, file); +} diff --git a/contrib/atf/atf-c/utils.c b/contrib/atf/atf-c/utils.c index 1e2aac1ed3b6..d8355bc68936 100644 --- a/contrib/atf/atf-c/utils.c +++ b/contrib/atf/atf-c/utils.c @@ -41,6 +41,9 @@ #include "atf-c/detail/dynstr.h" +/* No prototype in header for this one, it's a little sketchy (internal). */ +void atf_tc_set_resultsfile(const char *); + /** Allocate a filename to be used by atf_utils_{fork,wait}. * * In case of a failure, marks the calling test as failed when in_parent is @@ -271,6 +274,13 @@ atf_utils_fork(void) return pid; } +void +atf_utils_reset_resultsfile(void) +{ + + atf_tc_set_resultsfile("/dev/null"); +} + /** Frees an dynamically-allocated "argv" array. * * \param argv A dynamically-allocated array of dynamically-allocated diff --git a/contrib/atf/atf-c/utils.h b/contrib/atf/atf-c/utils.h index e4162b215fe5..422186a31e76 100644 --- a/contrib/atf/atf-c/utils.h +++ b/contrib/atf/atf-c/utils.h @@ -46,5 +46,6 @@ bool atf_utils_grep_string(const char *, const char *, ...) char *atf_utils_readline(int); void atf_utils_redirect(const int, const char *); void atf_utils_wait(const pid_t, const int, const char *, const char *); +void atf_utils_reset_resultsfile(void); #endif /* !defined(ATF_C_UTILS_H) */ diff --git a/contrib/atf/atf-c/utils_test.c b/contrib/atf/atf-c/utils_test.c index fb81cd3a1d9e..9d8f69683b9a 100644 --- a/contrib/atf/atf-c/utils_test.c +++ b/contrib/atf/atf-c/utils_test.c @@ -395,6 +395,7 @@ fork_and_wait(const int exitstatus, const char* expout, const char* experr) fprintf(stderr, "Some error\n"); exit(123); } + atf_utils_reset_resultsfile(); atf_utils_wait(pid, exitstatus, expout, experr); exit(EXIT_SUCCESS); } diff --git a/contrib/atf/atf-sh/.gitignore b/contrib/atf/atf-sh/.gitignore new file mode 100644 index 000000000000..a29438f1a9b8 --- /dev/null +++ b/contrib/atf/atf-sh/.gitignore @@ -0,0 +1,2 @@ +atf-check +atf-sh diff --git a/contrib/atf/atf-sh/atf-check.1 b/contrib/atf/atf-sh/atf-check.1 index a423e3ac3b1c..b03058e8442c 100644 --- a/contrib/atf/atf-sh/atf-check.1 +++ b/contrib/atf/atf-sh/atf-check.1 @@ -22,7 +22,7 @@ .\" 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 March 6, 2017 +.Dd June 21, 2020 .Dt ATF-CHECK 1 .Os .Sh NAME @@ -120,6 +120,14 @@ as a shell command line, executing it with the system shell defined by .Va ATF_SHELL . You should avoid using this flag if at all possible to prevent shell quoting issues. +.It Fl r Ar timeout[:interval] +Repeats failed checks until the +.Ar timeout +(in seconds) expires. +If unspecified, the default +.Ar interval +(in milliseconds) is 50 ms. +This can be used to wait for an expected update to the contents of a file. .El .Sh ENVIRONMENT .Bl -tag -width ATFXSHELLXX -compact @@ -157,6 +165,11 @@ atf_check -s signal:sigsegv my_program # Combined checks atf_check -o match:foo -o not-match:bar echo foo baz + +# Wait 5 seconds for a line to show up in a file +( sleep 2 ; echo "testing 123" > $test_path ) & +atf-check -o ignore -e ignore -s exit:0 -r 5 \e + grep "testing 123" $test_path .Ed .Sh SEE ALSO .Xr atf-sh 1 diff --git a/contrib/atf/atf-sh/atf-check.cpp b/contrib/atf/atf-sh/atf-check.cpp index 414b64ea91f0..38ab527aab54 100644 --- a/contrib/atf/atf-sh/atf-check.cpp +++ b/contrib/atf/atf-sh/atf-check.cpp @@ -29,6 +29,7 @@ extern "C" { #include #include +#include #include } @@ -53,6 +54,10 @@ extern "C" { #include "atf-c++/detail/sanity.hpp" #include "atf-c++/detail/text.hpp" +static const useconds_t seconds_in_useconds = (1000 * 1000); +static const useconds_t mseconds_in_useconds = 1000; +static const useconds_t useconds_in_nseconds = 1000; + // ------------------------------------------------------------------------ // Auxiliary functions. // ------------------------------------------------------------------------ @@ -162,6 +167,33 @@ public: } // anonymous namespace +static useconds_t +get_monotonic_useconds(void) +{ + struct timespec ts; + useconds_t res; + int rc; + + rc = clock_gettime(CLOCK_MONOTONIC, &ts); + if (rc != 0) + throw std::runtime_error("clock_gettime: " + + std::string(strerror(errno))); + + res = ts.tv_sec * seconds_in_useconds; + res += ts.tv_nsec / useconds_in_nseconds; + return res; +} + +static bool +timo_expired(useconds_t timeout) +{ + + if (get_monotonic_useconds() >= timeout) + return true; + return false; +} + + static int parse_exit_code(const std::string& str) { @@ -216,7 +248,7 @@ parse_signal(const std::string& str) if (signo == INT_MIN) { try { return atf::text::to_type< int >(str); - } catch (std::runtime_error) { + } catch (const std::runtime_error&) { throw atf::application::usage_error("Invalid signal name or number " "in -s option"); } @@ -306,6 +338,62 @@ parse_output_check_arg(const std::string& arg) return output_check(type, negated, arg.substr(delimiter + 1)); } +static void +parse_repeat_check_arg(const std::string& arg, useconds_t *m_timo, + useconds_t *m_interval) +{ + const std::string::size_type delimiter = arg.find(':'); + const bool has_interval = (delimiter != std::string::npos); + const std::string timo_str = arg.substr(0, delimiter); + + long l; + char *end; + + // There is no reason this couldn't be a non-integer number of seconds, + // this was just easy to do for now. + errno = 0; + l = strtol(timo_str.c_str(), &end, 10); + if (errno == ERANGE) + throw atf::application::usage_error("Bogus timeout in seconds"); + else if (errno != 0) + throw atf::application::usage_error("Timeout must be a number"); + + if (*end != 0) + throw atf::application::usage_error("Timeout must be a number"); + + *m_timo = get_monotonic_useconds() + (l * seconds_in_useconds); + // 50 milliseconds is chosen arbitrarily. There is a tradeoff between + // longer and shorter poll times. A shorter poll time makes for faster + // tests. A longer poll time makes for lower CPU overhead for the polled + // operation. 50ms is chosen with these tradeoffs in mind: on + // microcontrollers, the hope is that we can still avoid meaningful CPU use + // with a small test every 50ms. And on typical fast x86 hardware, our + // tests can be much more precise with time wasted than they typically are + // without this feature. + *m_interval = 50 * mseconds_in_useconds; + + if (!has_interval) + return; + + const std::string intv_str = arg.substr(delimiter + 1, std::string::npos); + + // Same -- this could be non-integer milliseconds. + errno = 0; + l = strtol(intv_str.c_str(), &end, 10); + if (errno == ERANGE) + throw atf::application::usage_error( + "Bogus repeat interval in milliseconds"); + else if (errno != 0) + throw atf::application::usage_error( + "Repeat interval must be a number"); + + if (*end != 0) + throw atf::application::usage_error( + "Repeat interval must be a number"); + + *m_interval = l * mseconds_in_useconds; +} + static std::string flatten_argv(char* const* argv) @@ -694,8 +782,12 @@ run_output_checks(const std::vector< output_check >& checks, namespace { class atf_check : public atf::application::app { + bool m_rflag; bool m_xflag; + useconds_t m_timo; + useconds_t m_interval; + std::vector< status_check > m_status_checks; std::vector< output_check > m_stdout_checks; std::vector< output_check > m_stderr_checks; @@ -722,6 +814,7 @@ const char* atf_check::m_description = atf_check::atf_check(void) : app(m_description, "atf-check(1)"), + m_rflag(false), m_xflag(false) { } @@ -765,6 +858,8 @@ atf_check::specific_options(void) opts.insert(option('e', "action:arg", "Handle stderr. Action must be " "one of: empty ignore file: inline: match:regexp " "save:")); + opts.insert(option('r', "timeout[:interval]", "Repeat failed check until " + "the timeout expires.")); opts.insert(option('x', "", "Execute command as a shell command")); return opts; @@ -786,6 +881,11 @@ atf_check::process_option(int ch, const char* arg) m_stderr_checks.push_back(parse_output_check_arg(arg)); break; + case 'r': + m_rflag = true; + parse_repeat_check_arg(arg, &m_timo, &m_interval); + break; + case 'x': m_xflag = true; break; @@ -803,9 +903,6 @@ atf_check::main(void) int status = EXIT_FAILURE; - std::auto_ptr< atf::check::check_result > r = - m_xflag ? execute_with_shell(m_argv) : execute(m_argv); - if (m_status_checks.empty()) m_status_checks.push_back(status_check(sc_exit, false, EXIT_SUCCESS)); else if (m_status_checks.size() > 1) { @@ -818,12 +915,23 @@ atf_check::main(void) if (m_stderr_checks.empty()) m_stderr_checks.push_back(output_check(oc_empty, false, "")); - if ((run_status_checks(m_status_checks, *r) == false) || - (run_output_checks(*r, "stderr") == false) || - (run_output_checks(*r, "stdout") == false)) - status = EXIT_FAILURE; - else - status = EXIT_SUCCESS; + do { + std::auto_ptr< atf::check::check_result > r = + m_xflag ? execute_with_shell(m_argv) : execute(m_argv); + *** 271 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Mar 17 14:05:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC4695692DE; Wed, 17 Mar 2021 14:05: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 4F0sPB4Sl1z3sXV; Wed, 17 Mar 2021 14:05: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 80EE17EF8; Wed, 17 Mar 2021 14:05: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 12HE5IvN086015; Wed, 17 Mar 2021 14:05:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HE5I3Z086014; Wed, 17 Mar 2021 14:05:18 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:05:18 GMT Message-Id: <202103171405.12HE5I3Z086014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 4643e1e84616 - stable/13 - tests/sys/vfs/lookup_cap_dotdot: No longer aborts after ATF update MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4643e1e846164be5fe0599eb9fbabdeaf87459c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:05:18 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=4643e1e846164be5fe0599eb9fbabdeaf87459c6 commit 4643e1e846164be5fe0599eb9fbabdeaf87459c6 Author: Alex Richardson AuthorDate: 2021-02-04 17:48:29 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 12:22:03 +0000 tests/sys/vfs/lookup_cap_dotdot: No longer aborts after ATF update It appears this test no longer fails after c203bd70b5957f85616424b6fa374479372d06e3. PR: 215690 (cherry picked from commit 1eec5861d52e074bc20d08aef051af59cc70040e) --- tests/sys/vfs/lookup_cap_dotdot.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/sys/vfs/lookup_cap_dotdot.c b/tests/sys/vfs/lookup_cap_dotdot.c index 6363471d55ff..dee1e0b11780 100644 --- a/tests/sys/vfs/lookup_cap_dotdot.c +++ b/tests/sys/vfs/lookup_cap_dotdot.c @@ -80,6 +80,7 @@ check_capsicum(void) { ATF_REQUIRE_FEATURE("security_capabilities"); ATF_REQUIRE_FEATURE("security_capability_mode"); + ATF_REQUIRE_SYSCTL_INT("kern.trap_enotcap", 0); } /* @@ -124,8 +125,6 @@ ATF_TC_BODY(lookup_cap_dotdot__basic, tc) cap_rights_init(&rights, CAP_LOOKUP, CAP_READ); ATF_REQUIRE(cap_rights_limit(dirfd, &rights) >= 0); - atf_tc_expect_signal(SIGABRT, "needs change done upstream in atf/kyua according to cem: bug 215690"); - ATF_REQUIRE(cap_enter() >= 0); ATF_REQUIRE_MSG(openat(dirfd, "d1/..", O_RDONLY) >= 0, "%s", @@ -146,8 +145,6 @@ ATF_TC_BODY(lookup_cap_dotdot__advanced, tc) check_capsicum(); prepare_dotdot_tests(); - atf_tc_expect_signal(SIGABRT, "needs change done upstream in atf/kyua according to cem: bug 215690"); - cap_rights_init(&rights, CAP_LOOKUP, CAP_READ); ATF_REQUIRE(cap_rights_limit(dirfd, &rights) >= 0); @@ -191,8 +188,6 @@ ATF_TC_BODY(capmode__negative, tc) check_capsicum(); prepare_dotdot_tests(); - atf_tc_expect_signal(SIGABRT, "needs change done upstream in atf/kyua according to cem: bug 215690"); - ATF_REQUIRE(cap_enter() == 0); /* open() not permitted in capability mode */ @@ -231,8 +226,6 @@ ATF_TC_BODY(lookup_cap_dotdot__negative, tc) cap_rights_init(&rights, CAP_LOOKUP, CAP_READ); ATF_REQUIRE(cap_rights_limit(dirfd, &rights) >= 0); - atf_tc_expect_signal(SIGABRT, "needs change done upstream in atf/kyua according to cem: bug 215690"); - ATF_REQUIRE(cap_enter() >= 0); ATF_REQUIRE_ERRNO(ENOTCAPABLE, openat(dirfd, "..", O_RDONLY) < 0); From owner-dev-commits-src-all@freebsd.org Wed Mar 17 14:05:23 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7EDC05694A6; Wed, 17 Mar 2021 14:05: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 4F0sPG1fyFz3srS; Wed, 17 Mar 2021 14:05: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 F1E837EF9; Wed, 17 Mar 2021 14:05: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 12HE5KTE086058; Wed, 17 Mar 2021 14:05:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HE5Kcb086057; Wed, 17 Mar 2021 14:05:20 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:05:20 GMT Message-Id: <202103171405.12HE5Kcb086057@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 1d8b72afe89c - stable/13 - libc: Fix t_spawn_fileactions test after ATF update MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1d8b72afe89c2b9d76fe94e00230c29b1e8ddea9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:05:24 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=1d8b72afe89c2b9d76fe94e00230c29b1e8ddea9 commit 1d8b72afe89c2b9d76fe94e00230c29b1e8ddea9 Author: Alex Richardson AuthorDate: 2021-02-18 10:07:51 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 12:22:24 +0000 libc: Fix t_spawn_fileactions test after ATF update Since https://github.com/freebsd/atf/commit/4581cefc1e3811dd3c926b5dd4b15fd63d2e19da ATF opens the results file on startup. This fixes problems like capsicumized tests not being able to open the file on exit. However, this test closes all file descriptors above 3 to get a deterministic fd table allocation for the child. Instead of using closefrom (which will close the ATF output file FD) I've changed this test use the lowest available fd and pass that to the helper program as a string. We could also try to re-open the results file in ATF if we get a EBADF error, but that will fail when running under Capsicum. Reviewed By: cem Differential Revision: https://reviews.freebsd.org/D28684 (cherry picked from commit 2aa3ef285a23d802f0bd6c7281612e16834e9b68) --- .../lib/libc/gen/posix_spawn/h_fileactions.c | 47 ++++++++++++++-------- .../lib/libc/gen/posix_spawn/t_fileactions.c | 22 ++++++---- 2 files changed, 45 insertions(+), 24 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/h_fileactions.c b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/h_fileactions.c index d92337074481..fd7fb21ad6f5 100644 --- a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/h_fileactions.c +++ b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/h_fileactions.c @@ -49,48 +49,61 @@ int main(int argc, char **argv) { int res = EXIT_SUCCESS; + long lowfd; char buf[BUFSIZE]; struct stat sb0, sb1; + if (argc < 2) { + fprintf(stderr, "%s: Not enough arguments: %d\n", getprogname(), + argc); + return EXIT_FAILURE; + } + lowfd = strtol(argv[1], NULL, 10); + if (lowfd < 3) { + fprintf(stderr, "%s: Invalid lowfd %d (as str: %s) \n", + getprogname(), argc, argv[1]); + return EXIT_FAILURE; + } + strcpy(buf, "test..."); - /* file desc 3 should be closed via addclose */ - if (read(3, buf, BUFSIZE) != -1 || errno != EBADF) { - fprintf(stderr, "%s: filedesc 3 is not closed\n", + /* First fd should be closed via addclose */ + if (read(lowfd, buf, BUFSIZE) != -1 || errno != EBADF) { + fprintf(stderr, "%s: first filedesc is not closed\n", getprogname()); res = EXIT_FAILURE; } - /* file desc 4 should be closed via closeonexec */ - if (read(4, buf, BUFSIZE) != -1 || errno != EBADF) { - fprintf(stderr, "%s: filedesc 4 is not closed\n", + /* Next file desc should be closed via closeonexec */ + if (read(lowfd + 1, buf, BUFSIZE) != -1 || errno != EBADF) { + fprintf(stderr, "%s: filedesc +1 is not closed\n", getprogname()); res = EXIT_FAILURE; } - /* file desc 5 remains open */ - if (write(5, buf, BUFSIZE) <= 0) { - fprintf(stderr, "%s: could not write to filedesc 5\n", + /* file desc + 2 remains open */ + if (write(lowfd + 2, buf, BUFSIZE) <= 0) { + fprintf(stderr, "%s: could not write to filedesc +2\n", getprogname()); res = EXIT_FAILURE; } - /* file desc 6 should be open (via addopen) */ - if (write(6, buf, BUFSIZE) <= 0) { - fprintf(stderr, "%s: could not write to filedesc 6\n", + /* file desc + 3 should be open (via addopen) */ + if (write(lowfd + 3, buf, BUFSIZE) <= 0) { + fprintf(stderr, "%s: could not write to filedesc +3\n", getprogname()); res = EXIT_FAILURE; } - /* file desc 7 should refer to stdout */ + /* file desc + 4 should refer to stdout */ fflush(stdout); if (fstat(fileno(stdout), &sb0) != 0) { fprintf(stderr, "%s: could not fstat stdout\n", getprogname()); res = EXIT_FAILURE; } - if (fstat(7, &sb1) != 0) { - fprintf(stderr, "%s: could not fstat filedesc 7\n", + if (fstat(lowfd + 4, &sb1) != 0) { + fprintf(stderr, "%s: could not fstat filedesc +4\n", getprogname()); res = EXIT_FAILURE; } - if (write(7, buf, strlen(buf)) <= 0) { - fprintf(stderr, "%s: could not write to filedesc 7\n", + if (write(lowfd + 4, buf, strlen(buf)) <= 0) { + fprintf(stderr, "%s: could not write to filedesc +4\n", getprogname()); res = EXIT_FAILURE; } diff --git a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c index 74009a805758..b3d364207fbb 100644 --- a/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c +++ b/contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c @@ -301,26 +301,34 @@ ATF_TC_BODY(t_spawn_fileactions, tc) { int fd1, fd2, fd3, status, err; pid_t pid; - char * const args[2] = { __UNCONST("h_fileactions"), NULL }; + char *args[3] = { __UNCONST("h_fileactions"), NULL, NULL }; + int lowfd; + char lowfdstr[32]; char helper[FILENAME_MAX]; posix_spawn_file_actions_t fa; posix_spawn_file_actions_init(&fa); - closefrom(fileno(stderr)+1); + /* Note: this assumes no gaps in the fd table */ + lowfd = open("/", O_RDONLY); + ATF_REQUIRE(lowfd > 0); + ATF_REQUIRE_EQ(0, close(lowfd)); + snprintf(lowfdstr, sizeof(lowfdstr), "%d", lowfd); + args[1] = lowfdstr; fd1 = open("/dev/null", O_RDONLY); - ATF_REQUIRE(fd1 == 3); + ATF_REQUIRE_EQ(fd1, lowfd); fd2 = open("/dev/null", O_WRONLY, O_CLOEXEC); - ATF_REQUIRE(fd2 == 4); + ATF_REQUIRE_EQ(fd2, lowfd + 1); fd3 = open("/dev/null", O_WRONLY); - ATF_REQUIRE(fd3 == 5); + ATF_REQUIRE_EQ(fd3, lowfd + 2); posix_spawn_file_actions_addclose(&fa, fd1); - posix_spawn_file_actions_addopen(&fa, 6, "/dev/null", O_RDWR, 0); - posix_spawn_file_actions_adddup2(&fa, 1, 7); + posix_spawn_file_actions_addopen(&fa, lowfd + 3, "/dev/null", O_RDWR, + 0); + posix_spawn_file_actions_adddup2(&fa, 1, lowfd + 4); snprintf(helper, sizeof helper, "%s/h_fileactions", atf_tc_get_config_var(tc, "srcdir")); From owner-dev-commits-src-all@freebsd.org Wed Mar 17 14:05:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99830569268; Wed, 17 Mar 2021 14:05: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 4F0sPJ4GwJz3skf; Wed, 17 Mar 2021 14:05: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 0D6607EFA; Wed, 17 Mar 2021 14:05: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 12HE5Ldc086076; Wed, 17 Mar 2021 14:05:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HE5Lwf086075; Wed, 17 Mar 2021 14:05:21 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:05:21 GMT Message-Id: <202103171405.12HE5Lwf086075@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 4b6082c4985c - stable/13 - atf: Fix ATF_BUILD_* values when not using the bootstrap compiler MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4b6082c4985cc3d17b22f9734357837b62587232 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:05:27 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=4b6082c4985cc3d17b22f9734357837b62587232 commit 4b6082c4985cc3d17b22f9734357837b62587232 Author: Alex Richardson AuthorDate: 2021-02-03 09:32:16 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 12:23:26 +0000 atf: Fix ATF_BUILD_* values when not using the bootstrap compiler Currently, we encode the full path and compile flags for the build compiler in libatf. However, these values are not correct when cross-compiling: For example, when I build on macOS, CC is set to the host path /usr/local/Cellar/llvm/11.0.0_1/bin/clang-11. This path will not exist on the target system. Simplify this logic and use cc/cpp/c++ since those binaries will exist on the target system unless the compiler was explicitly disabled. I'm not convinced ATF needs to encode these values, but this is a minimal fix for these tests when using a non-bootstrapped compiler. Reviewed By: ngie, brooks Differential Revision: https://reviews.freebsd.org/D28414 (cherry picked from commit 9b131f1e51a00c8bbbda32672fb5db88010400f6) --- lib/atf/libatf-c/Makefile | 23 +---------------------- lib/atf/libatf-c/Makefile.inc | 7 +++++++ lib/atf/libatf-c/tests/Makefile | 1 + 3 files changed, 9 insertions(+), 22 deletions(-) diff --git a/lib/atf/libatf-c/Makefile b/lib/atf/libatf-c/Makefile index 78b821b3c64d..7c9807c24ded 100644 --- a/lib/atf/libatf-c/Makefile +++ b/lib/atf/libatf-c/Makefile @@ -28,22 +28,6 @@ .include .include -# Store the toolchain executable in ATF_BUILD_{CC,CPP,CXX} to ensure other -# values -- like -target, -B ..., etc -- don't get leaked into the tests. -# -# Be sure to omit ${CCACHE_BIN} (if specified) from the variable as it gets -# automatically appended to the variables in bsd.compiler.mk when -# ${MK_CCACHE_BUILD} != no. -ATF_BUILD_CC:= ${CC:N${CCACHE_BIN}:[1]} -ATF_BUILD_CPP:= ${CPP:N${CCACHE_BIN}:[1]} -ATF_BUILD_CXX:= ${CXX:N${CCACHE_BIN}:[1]} - -# Only capture defines, includes, linker flags, optimization levels, warnings -# and preprocessor flags when building ATF_BUILD_{C,CPP,CXX}FLAGS. -ATF_BUILD_CFLAGS:= ${CFLAGS:M-[DILOWf]*} -ATF_BUILD_CPPFLAGS:= ${CPPFLAGS:M-[DILOWf]*} -ATF_BUILD_CXXFLAGS:= ${CXXFLAGS:M-[DILOWf]*} - PACKAGE= tests LIB= atf-c PRIVATELIB= true @@ -54,12 +38,6 @@ ATF= ${SRCTOP}/contrib/atf .PATH: ${ATF}/atf-c .PATH: ${ATF}/atf-c/detail -CFLAGS+= -DATF_BUILD_CC='"${ATF_BUILD_CC}"' -CFLAGS+= -DATF_BUILD_CFLAGS='"${ATF_BUILD_CFLAGS}"' -CFLAGS+= -DATF_BUILD_CPP='"${ATF_BUILD_CPP}"' -CFLAGS+= -DATF_BUILD_CPPFLAGS='"${ATF_BUILD_CPPFLAGS}"' -CFLAGS+= -DATF_BUILD_CXX='"${ATF_BUILD_CXX}"' -CFLAGS+= -DATF_BUILD_CXXFLAGS='"${ATF_BUILD_CXXFLAGS}"' CFLAGS+= -I${ATF} CFLAGS+= -I${.CURDIR} CFLAGS+= -I. @@ -160,5 +138,6 @@ MLINKS+= atf-c.3 atf-c-api.3 # Backwards compatibility. HAS_TESTS= SUBDIR.${MK_TESTS}+= tests +.include "Makefile.inc" .include "../common.mk" .include diff --git a/lib/atf/libatf-c/Makefile.inc b/lib/atf/libatf-c/Makefile.inc index 265f86d1ed55..f668e36b2d6a 100644 --- a/lib/atf/libatf-c/Makefile.inc +++ b/lib/atf/libatf-c/Makefile.inc @@ -1,3 +1,10 @@ # $FreeBSD$ .include "../Makefile.inc" + +CFLAGS+= -DATF_BUILD_CC='"cc"' +CFLAGS+= -DATF_BUILD_CFLAGS='"-Wall"' +CFLAGS+= -DATF_BUILD_CPP='"cpp"' +CFLAGS+= -DATF_BUILD_CPPFLAGS='""' +CFLAGS+= -DATF_BUILD_CXX='"c++"' +CFLAGS+= -DATF_BUILD_CXXFLAGS='"-Wall"' diff --git a/lib/atf/libatf-c/tests/Makefile b/lib/atf/libatf-c/tests/Makefile index c99b2d115967..3bcdfc8f7071 100644 --- a/lib/atf/libatf-c/tests/Makefile +++ b/lib/atf/libatf-c/tests/Makefile @@ -35,4 +35,5 @@ SRCS.${_T}= ${_T}.c test_helpers.c TEST_METADATA.${_T}+= required_programs="cc" .endfor +.include "Makefile.inc" .include From owner-dev-commits-src-all@freebsd.org Wed Mar 17 14:05:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95ACC5694AB; Wed, 17 Mar 2021 14:05: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 4F0sPL0Jb5z3spb; Wed, 17 Mar 2021 14:05: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 18B0B7D61; Wed, 17 Mar 2021 14:05: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 12HE5M9U086098; Wed, 17 Mar 2021 14:05:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HE5M4P086097; Wed, 17 Mar 2021 14:05:22 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:05:22 GMT Message-Id: <202103171405.12HE5M4P086097@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 6a68c094ed1b - stable/13 - ptrace_test: Add more debug output on test failures MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6a68c094ed1be74fd5556ac716c8bb12f3564f82 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:05:28 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=6a68c094ed1be74fd5556ac716c8bb12f3564f82 commit 6a68c094ed1be74fd5556ac716c8bb12f3564f82 Author: Alex Richardson AuthorDate: 2021-03-01 18:49:31 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 12:23:57 +0000 ptrace_test: Add more debug output on test failures Mostly automatic, using `CHILD_REQUIRE\(([^|&\n]*) ==` -> `CHILD_REQUIRE_EQ_INT($1,` `ATF_REQUIRE\(([^|&\n]*) ==` -> `REQUIRE_EQ_INT($1,` followed by git-clang-format -f and then manually checking ones that contain ||/&&. Test Plan: Still getting the same failure but now it prints `psr.sr_error (0) == EBADF (9) not met` instead of just failing without printing the values. PR: 243605 Reviewed By: jhb Differential Revision: https://reviews.freebsd.org/D28887 (cherry picked from commit 96a9e50e63bfcbca7309c012c2c7a477c8826824) --- tests/sys/kern/ptrace_test.c | 1516 +++++++++++++++++++++--------------------- 1 file changed, 770 insertions(+), 746 deletions(-) diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c index 5422cce80713..a5655008eaa1 100644 --- a/tests/sys/kern/ptrace_test.c +++ b/tests/sys/kern/ptrace_test.c @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -88,22 +89,45 @@ __FBSDID("$FreeBSD$"); * processes. This only works if the parent process is tripped up by * the early exit and fails some requirement itself. */ -#define CHILD_REQUIRE(exp) do { \ - if (!(exp)) \ - child_fail_require(__FILE__, __LINE__, \ - #exp " not met"); \ - } while (0) +#define CHILD_REQUIRE(exp) do { \ + if (!(exp)) \ + child_fail_require(__FILE__, __LINE__, \ + #exp " not met\n"); \ +} while (0) + +#define CHILD_REQUIRE_EQ(actual, expected) do { \ + __typeof__(expected) _e = expected; \ + __typeof__(actual) _a = actual; \ + if (_e != _a) \ + child_fail_require(__FILE__, __LINE__, #actual \ + " (%jd) == " #expected " (%jd) not met\n", \ + (intmax_t)_a, (intmax_t)_e); \ +} while (0) static __dead2 void -child_fail_require(const char *file, int line, const char *str) +child_fail_require(const char *file, int line, const char *fmt, ...) { - char buf[128]; + va_list ap; + char buf[1024]; + + /* Use write() not fprintf() to avoid possible duplicate output. */ + snprintf(buf, sizeof(buf), "%s:%d: ", file, line); + write(STDERR_FILENO, buf, strlen(buf)); + va_start(ap, fmt); + vsnprintf(buf, sizeof(buf), fmt, ap); + write(STDERR_FILENO, buf, strlen(buf)); + va_end(ap); - snprintf(buf, sizeof(buf), "%s:%d: %s\n", file, line, str); - write(2, buf, strlen(buf)); _exit(32); } +#define REQUIRE_EQ(actual, expected) do { \ + __typeof__(expected) _e = expected; \ + __typeof__(actual) _a = actual; \ + ATF_REQUIRE_MSG(_e == _a, #actual " (%jd) == " \ + #expected " (%jd) not met", (intmax_t)_a, (intmax_t)_e); \ +} while (0) + static void trace_me(void) { @@ -121,12 +145,12 @@ attach_child(pid_t pid) pid_t wpid; int status; - ATF_REQUIRE(ptrace(PT_ATTACH, pid, NULL, 0) == 0); + REQUIRE_EQ(ptrace(PT_ATTACH, pid, NULL, 0), 0); wpid = waitpid(pid, &status, 0); - ATF_REQUIRE(wpid == pid); + REQUIRE_EQ(wpid, pid); ATF_REQUIRE(WIFSTOPPED(status)); - ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + REQUIRE_EQ(WSTOPSIG(status), SIGSTOP); } static void @@ -152,7 +176,7 @@ wait_for_zombie(pid_t pid) mib[3] = pid; len = sizeof(kp); if (sysctl(mib, nitems(mib), &kp, &len, NULL, 0) == -1) { - ATF_REQUIRE(errno == ESRCH); + REQUIRE_EQ(errno, ESRCH); break; } if (kp.ki_stat == SZOMB) @@ -183,23 +207,23 @@ ATF_TC_BODY(ptrace__parent_wait_after_trace_me, tc) /* The first wait() should report the stop from SIGSTOP. */ wpid = waitpid(child, &status, 0); - ATF_REQUIRE(wpid == child); + REQUIRE_EQ(wpid, child); ATF_REQUIRE(WIFSTOPPED(status)); - ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + REQUIRE_EQ(WSTOPSIG(status), SIGSTOP); /* Continue the child ignoring the SIGSTOP. */ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1); /* The second wait() should report the exit status. */ wpid = waitpid(child, &status, 0); - ATF_REQUIRE(wpid == child); + REQUIRE_EQ(wpid, child); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 1); + REQUIRE_EQ(WEXITSTATUS(status), 1); /* The child should no longer exist. */ wpid = waitpid(child, &status, 0); - ATF_REQUIRE(wpid == -1); - ATF_REQUIRE(errno == ECHILD); + REQUIRE_EQ(wpid, -1); + REQUIRE_EQ(errno, ECHILD); } /* @@ -216,14 +240,14 @@ ATF_TC_BODY(ptrace__parent_wait_after_attach, tc) if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_skip("https://bugs.freebsd.org/244055"); - ATF_REQUIRE(pipe(cpipe) == 0); + REQUIRE_EQ(pipe(cpipe), 0); ATF_REQUIRE((child = fork()) != -1); if (child == 0) { /* Child process. */ close(cpipe[0]); /* Wait for the parent to attach. */ - CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == 0); + CHILD_REQUIRE_EQ(0, read(cpipe[1], &c, sizeof(c))); _exit(1); } @@ -242,14 +266,14 @@ ATF_TC_BODY(ptrace__parent_wait_after_attach, tc) /* The second wait() should report the exit status. */ wpid = waitpid(child, &status, 0); - ATF_REQUIRE(wpid == child); + REQUIRE_EQ(wpid, child); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 1); + REQUIRE_EQ(WEXITSTATUS(status), 1); /* The child should no longer exist. */ wpid = waitpid(child, &status, 0); - ATF_REQUIRE(wpid == -1); - ATF_REQUIRE(errno == ECHILD); + REQUIRE_EQ(wpid, -1); + REQUIRE_EQ(errno, ECHILD); } /* @@ -266,7 +290,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debugger, tc) if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_skip("https://bugs.freebsd.org/239399"); - ATF_REQUIRE(pipe(cpipe) == 0); + REQUIRE_EQ(pipe(cpipe), 0); ATF_REQUIRE((child = fork()) != -1); if (child == 0) { @@ -274,13 +298,13 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debugger, tc) close(cpipe[0]); /* Wait for parent to be ready. */ - CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c)); + CHILD_REQUIRE_EQ(read(cpipe[1], &c, sizeof(c)), sizeof(c)); _exit(1); } close(cpipe[1]); - ATF_REQUIRE(pipe(dpipe) == 0); + REQUIRE_EQ(pipe(dpipe), 0); ATF_REQUIRE((debugger = fork()) != -1); if (debugger == 0) { @@ -290,22 +314,22 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debugger, tc) CHILD_REQUIRE(ptrace(PT_ATTACH, child, NULL, 0) != -1); wpid = waitpid(child, &status, 0); - CHILD_REQUIRE(wpid == child); + CHILD_REQUIRE_EQ(wpid, child); CHILD_REQUIRE(WIFSTOPPED(status)); - CHILD_REQUIRE(WSTOPSIG(status) == SIGSTOP); + CHILD_REQUIRE_EQ(WSTOPSIG(status), SIGSTOP); CHILD_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1); /* Signal parent that debugger is attached. */ - CHILD_REQUIRE(write(dpipe[1], &c, sizeof(c)) == sizeof(c)); + CHILD_REQUIRE_EQ(write(dpipe[1], &c, sizeof(c)), sizeof(c)); /* Wait for parent's failed wait. */ - CHILD_REQUIRE(read(dpipe[1], &c, sizeof(c)) == 0); + CHILD_REQUIRE_EQ(read(dpipe[1], &c, sizeof(c)), 0); wpid = waitpid(child, &status, 0); - CHILD_REQUIRE(wpid == child); + CHILD_REQUIRE_EQ(wpid, child); CHILD_REQUIRE(WIFEXITED(status)); - CHILD_REQUIRE(WEXITSTATUS(status) == 1); + CHILD_REQUIRE_EQ(WEXITSTATUS(status), 1); _exit(0); } @@ -314,11 +338,11 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debugger, tc) /* Parent process. */ /* Wait for the debugger to attach to the child. */ - ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == sizeof(c)); + REQUIRE_EQ(read(dpipe[0], &c, sizeof(c)), sizeof(c)); /* Release the child. */ - ATF_REQUIRE(write(cpipe[0], &c, sizeof(c)) == sizeof(c)); - ATF_REQUIRE(read(cpipe[0], &c, sizeof(c)) == 0); + REQUIRE_EQ(write(cpipe[0], &c, sizeof(c)), sizeof(c)); + REQUIRE_EQ(read(cpipe[0], &c, sizeof(c)), 0); close(cpipe[0]); wait_for_zombie(child); @@ -329,22 +353,22 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debugger, tc) * until the debugger sees the exit. */ wpid = waitpid(child, &status, WNOHANG); - ATF_REQUIRE(wpid == 0); + REQUIRE_EQ(wpid, 0); /* Signal the debugger to wait for the child. */ close(dpipe[0]); /* Wait for the debugger. */ wpid = waitpid(debugger, &status, 0); - ATF_REQUIRE(wpid == debugger); + REQUIRE_EQ(wpid, debugger); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 0); + REQUIRE_EQ(WEXITSTATUS(status), 0); /* The child process should now be ready. */ wpid = waitpid(child, &status, WNOHANG); - ATF_REQUIRE(wpid == child); + REQUIRE_EQ(wpid, child); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 1); + REQUIRE_EQ(WEXITSTATUS(status), 1); } /* @@ -360,7 +384,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) int cpipe[2], dpipe[2], status; char c; - ATF_REQUIRE(pipe(cpipe) == 0); + REQUIRE_EQ(pipe(cpipe), 0); ATF_REQUIRE((child = fork()) != -1); if (child == 0) { @@ -368,13 +392,13 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) close(cpipe[0]); /* Wait for parent to be ready. */ - CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c)); + CHILD_REQUIRE_EQ(read(cpipe[1], &c, sizeof(c)), sizeof(c)); _exit(1); } close(cpipe[1]); - ATF_REQUIRE(pipe(dpipe) == 0); + REQUIRE_EQ(pipe(dpipe), 0); ATF_REQUIRE((debugger = fork()) != -1); if (debugger == 0) { @@ -394,22 +418,22 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) CHILD_REQUIRE(ptrace(PT_ATTACH, child, NULL, 0) != -1); wpid = waitpid(child, &status, 0); - CHILD_REQUIRE(wpid == child); + CHILD_REQUIRE_EQ(wpid, child); CHILD_REQUIRE(WIFSTOPPED(status)); - CHILD_REQUIRE(WSTOPSIG(status) == SIGSTOP); + CHILD_REQUIRE_EQ(WSTOPSIG(status), SIGSTOP); CHILD_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1); /* Signal parent that debugger is attached. */ - CHILD_REQUIRE(write(dpipe[1], &c, sizeof(c)) == sizeof(c)); + CHILD_REQUIRE_EQ(write(dpipe[1], &c, sizeof(c)), sizeof(c)); /* Wait for parent's failed wait. */ - CHILD_REQUIRE(read(dpipe[1], &c, sizeof(c)) == sizeof(c)); + CHILD_REQUIRE_EQ(read(dpipe[1], &c, sizeof(c)), sizeof(c)); wpid = waitpid(child, &status, 0); - CHILD_REQUIRE(wpid == child); + CHILD_REQUIRE_EQ(wpid, child); CHILD_REQUIRE(WIFEXITED(status)); - CHILD_REQUIRE(WEXITSTATUS(status) == 1); + CHILD_REQUIRE_EQ(WEXITSTATUS(status), 1); _exit(0); } @@ -419,20 +443,20 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) /* Wait for the debugger parent process to exit. */ wpid = waitpid(debugger, &status, 0); - ATF_REQUIRE(wpid == debugger); + REQUIRE_EQ(wpid, debugger); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 2); + REQUIRE_EQ(WEXITSTATUS(status), 2); /* A WNOHANG wait here should see the non-exited child. */ wpid = waitpid(child, &status, WNOHANG); - ATF_REQUIRE(wpid == 0); + REQUIRE_EQ(wpid, 0); /* Wait for the debugger to attach to the child. */ - ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == sizeof(c)); + REQUIRE_EQ(read(dpipe[0], &c, sizeof(c)), sizeof(c)); /* Release the child. */ - ATF_REQUIRE(write(cpipe[0], &c, sizeof(c)) == sizeof(c)); - ATF_REQUIRE(read(cpipe[0], &c, sizeof(c)) == 0); + REQUIRE_EQ(write(cpipe[0], &c, sizeof(c)), sizeof(c)); + REQUIRE_EQ(read(cpipe[0], &c, sizeof(c)), 0); close(cpipe[0]); wait_for_zombie(child); @@ -443,20 +467,20 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) * until the debugger sees the exit. */ wpid = waitpid(child, &status, WNOHANG); - ATF_REQUIRE(wpid == 0); + REQUIRE_EQ(wpid, 0); /* Signal the debugger to wait for the child. */ - ATF_REQUIRE(write(dpipe[0], &c, sizeof(c)) == sizeof(c)); + REQUIRE_EQ(write(dpipe[0], &c, sizeof(c)), sizeof(c)); /* Wait for the debugger. */ - ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == 0); + REQUIRE_EQ(read(dpipe[0], &c, sizeof(c)), 0); close(dpipe[0]); /* The child process should now be ready. */ wpid = waitpid(child, &status, WNOHANG); - ATF_REQUIRE(wpid == child); + REQUIRE_EQ(wpid, child); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 1); + REQUIRE_EQ(WEXITSTATUS(status), 1); } /* @@ -472,11 +496,11 @@ ATF_TC_BODY(ptrace__parent_exits_before_child, tc) if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_skip("https://bugs.freebsd.org/244056"); - ATF_REQUIRE(pipe(cpipe1) == 0); - ATF_REQUIRE(pipe(cpipe2) == 0); - ATF_REQUIRE(pipe(gcpipe) == 0); + REQUIRE_EQ(pipe(cpipe1), 0); + REQUIRE_EQ(pipe(cpipe2), 0); + REQUIRE_EQ(pipe(gcpipe), 0); - ATF_REQUIRE(procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == 0); + REQUIRE_EQ(procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL), 0); ATF_REQUIRE((child = fork()) != -1); if (child == 0) { @@ -496,31 +520,31 @@ ATF_TC_BODY(ptrace__parent_exits_before_child, tc) _exit(status); } - ATF_REQUIRE(read(cpipe1[0], &gchild, sizeof(gchild)) == sizeof(gchild)); + REQUIRE_EQ(read(cpipe1[0], &gchild, sizeof(gchild)), sizeof(gchild)); - ATF_REQUIRE(ptrace(PT_ATTACH, gchild, NULL, 0) == 0); + REQUIRE_EQ(ptrace(PT_ATTACH, gchild, NULL, 0), 0); status = 0; - ATF_REQUIRE(write(cpipe2[1], &status, sizeof(status)) == - sizeof(status)); - ATF_REQUIRE(waitpid(child, &status, 0) == child); - ATF_REQUIRE(WIFEXITED(status) && WEXITSTATUS(status) == 0); + REQUIRE_EQ(write(cpipe2[1], &status, sizeof(status)), sizeof(status)); + REQUIRE_EQ(waitpid(child, &status, 0), child); + ATF_REQUIRE(WIFEXITED(status)); + REQUIRE_EQ(WEXITSTATUS(status), 0); status = 0; - ATF_REQUIRE(write(gcpipe[1], &status, sizeof(status)) == - sizeof(status)); - ATF_REQUIRE(waitpid(gchild, &status, 0) == gchild); + REQUIRE_EQ(write(gcpipe[1], &status, sizeof(status)), sizeof(status)); + REQUIRE_EQ(waitpid(gchild, &status, 0), gchild); ATF_REQUIRE(WIFSTOPPED(status)); - ATF_REQUIRE(ptrace(PT_DETACH, gchild, (caddr_t)1, 0) == 0); - ATF_REQUIRE(waitpid(gchild, &status, 0) == gchild); - ATF_REQUIRE(WIFEXITED(status) && WEXITSTATUS(status) == 0); - - ATF_REQUIRE(close(cpipe1[0]) == 0); - ATF_REQUIRE(close(cpipe1[1]) == 0); - ATF_REQUIRE(close(cpipe2[0]) == 0); - ATF_REQUIRE(close(cpipe2[1]) == 0); - ATF_REQUIRE(close(gcpipe[0]) == 0); - ATF_REQUIRE(close(gcpipe[1]) == 0); + REQUIRE_EQ(ptrace(PT_DETACH, gchild, (caddr_t)1, 0), 0); + REQUIRE_EQ(waitpid(gchild, &status, 0), gchild); + ATF_REQUIRE(WIFEXITED(status)); + REQUIRE_EQ(WEXITSTATUS(status), 0); + + REQUIRE_EQ(close(cpipe1[0]), 0); + REQUIRE_EQ(close(cpipe1[1]), 0); + REQUIRE_EQ(close(cpipe2[0]), 0); + REQUIRE_EQ(close(cpipe2[1]), 0); + REQUIRE_EQ(close(gcpipe[0]), 0); + REQUIRE_EQ(close(gcpipe[1]), 0); } /* @@ -543,9 +567,9 @@ follow_fork_parent(bool use_vfork) _exit(2); wpid = waitpid(fpid, &status, 0); - CHILD_REQUIRE(wpid == fpid); + CHILD_REQUIRE_EQ(wpid, fpid); CHILD_REQUIRE(WIFEXITED(status)); - CHILD_REQUIRE(WEXITSTATUS(status) == 2); + CHILD_REQUIRE_EQ(WEXITSTATUS(status), 2); _exit(1); } @@ -585,23 +609,23 @@ handle_fork_events(pid_t parent, struct ptrace_lwpinfo *ppl) (PL_FLAG_FORKED | PL_FLAG_CHILD)); if (pl.pl_flags & PL_FLAG_CHILD) { ATF_REQUIRE(wpid != parent); - ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + REQUIRE_EQ(WSTOPSIG(status), SIGSTOP); ATF_REQUIRE(!fork_reported[1]); if (child == -1) child = wpid; else - ATF_REQUIRE(child == wpid); + REQUIRE_EQ(child, wpid); if (ppl != NULL) ppl[1] = pl; fork_reported[1] = true; } else { - ATF_REQUIRE(wpid == parent); - ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + REQUIRE_EQ(wpid, parent); + REQUIRE_EQ(WSTOPSIG(status), SIGTRAP); ATF_REQUIRE(!fork_reported[0]); if (child == -1) child = pl.pl_child_pid; else - ATF_REQUIRE(child == pl.pl_child_pid); + REQUIRE_EQ(child, pl.pl_child_pid); if (ppl != NULL) ppl[0] = pl; fork_reported[0] = true; @@ -633,9 +657,9 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached, tc) /* The first wait() should report the stop from SIGSTOP. */ wpid = waitpid(children[0], &status, 0); - ATF_REQUIRE(wpid == children[0]); + REQUIRE_EQ(wpid, children[0]); ATF_REQUIRE(WIFSTOPPED(status)); - ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + REQUIRE_EQ(WSTOPSIG(status), SIGSTOP); ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1); @@ -653,18 +677,18 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached, tc) * grandchild should report its exit first to the debugger. */ wpid = wait(&status); - ATF_REQUIRE(wpid == children[1]); + REQUIRE_EQ(wpid, children[1]); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 2); + REQUIRE_EQ(WEXITSTATUS(status), 2); wpid = wait(&status); - ATF_REQUIRE(wpid == children[0]); + REQUIRE_EQ(wpid, children[0]); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 1); + REQUIRE_EQ(WEXITSTATUS(status), 1); wpid = wait(&status); - ATF_REQUIRE(wpid == -1); - ATF_REQUIRE(errno == ECHILD); + REQUIRE_EQ(wpid, -1); + REQUIRE_EQ(errno, ECHILD); } /* @@ -689,9 +713,9 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached, tc) /* The first wait() should report the stop from SIGSTOP. */ wpid = waitpid(children[0], &status, 0); - ATF_REQUIRE(wpid == children[0]); + REQUIRE_EQ(wpid, children[0]); ATF_REQUIRE(WIFSTOPPED(status)); - ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + REQUIRE_EQ(WSTOPSIG(status), SIGSTOP); ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1); @@ -709,13 +733,13 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached, tc) * child. */ wpid = wait(&status); - ATF_REQUIRE(wpid == children[0]); + REQUIRE_EQ(wpid, children[0]); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 1); + REQUIRE_EQ(WEXITSTATUS(status), 1); wpid = wait(&status); - ATF_REQUIRE(wpid == -1); - ATF_REQUIRE(errno == ECHILD); + REQUIRE_EQ(wpid, -1); + REQUIRE_EQ(errno, ECHILD); } /* @@ -740,9 +764,9 @@ ATF_TC_BODY(ptrace__follow_fork_parent_detached, tc) /* The first wait() should report the stop from SIGSTOP. */ wpid = waitpid(children[0], &status, 0); - ATF_REQUIRE(wpid == children[0]); + REQUIRE_EQ(wpid, children[0]); ATF_REQUIRE(WIFSTOPPED(status)); - ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + REQUIRE_EQ(WSTOPSIG(status), SIGSTOP); ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1); @@ -764,18 +788,18 @@ ATF_TC_BODY(ptrace__follow_fork_parent_detached, tc) * after the grandchild. */ wpid = wait(&status); - ATF_REQUIRE(wpid == children[1]); + REQUIRE_EQ(wpid, children[1]); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 2); + REQUIRE_EQ(WEXITSTATUS(status), 2); wpid = wait(&status); - ATF_REQUIRE(wpid == children[0]); + REQUIRE_EQ(wpid, children[0]); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 1); + REQUIRE_EQ(WEXITSTATUS(status), 1); wpid = wait(&status); - ATF_REQUIRE(wpid == -1); - ATF_REQUIRE(errno == ECHILD); + REQUIRE_EQ(wpid, -1); + REQUIRE_EQ(errno, ECHILD); } static void @@ -792,10 +816,10 @@ attach_fork_parent(int cpipe[2]) /* Send the pid of the disassociated child to the debugger. */ fpid = getpid(); - CHILD_REQUIRE(write(cpipe[1], &fpid, sizeof(fpid)) == sizeof(fpid)); + CHILD_REQUIRE_EQ(write(cpipe[1], &fpid, sizeof(fpid)), sizeof(fpid)); /* Wait for the debugger to attach. */ - CHILD_REQUIRE(read(cpipe[1], &fpid, sizeof(fpid)) == 0); + CHILD_REQUIRE_EQ(read(cpipe[1], &fpid, sizeof(fpid)), 0); } /* @@ -813,7 +837,7 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelated_debugger, tc) if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_skip("https://bugs.freebsd.org/239397"); - ATF_REQUIRE(pipe(cpipe) == 0); + REQUIRE_EQ(pipe(cpipe), 0); ATF_REQUIRE((fpid = fork()) != -1); if (fpid == 0) { attach_fork_parent(cpipe); @@ -825,12 +849,12 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelated_debugger, tc) /* Wait for the direct child to exit. */ wpid = waitpid(fpid, &status, 0); - ATF_REQUIRE(wpid == fpid); + REQUIRE_EQ(wpid, fpid); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 3); + REQUIRE_EQ(WEXITSTATUS(status), 3); /* Read the pid of the fork parent. */ - ATF_REQUIRE(read(cpipe[0], &children[0], sizeof(children[0])) == + REQUIRE_EQ(read(cpipe[0], &children[0], sizeof(children[0])), sizeof(children[0])); /* Attach to the fork parent. */ @@ -855,18 +879,18 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelated_debugger, tc) * so the child should report its exit first to the debugger. */ wpid = wait(&status); - ATF_REQUIRE(wpid == children[1]); + REQUIRE_EQ(wpid, children[1]); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 2); + REQUIRE_EQ(WEXITSTATUS(status), 2); wpid = wait(&status); - ATF_REQUIRE(wpid == children[0]); + REQUIRE_EQ(wpid, children[0]); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 1); + REQUIRE_EQ(WEXITSTATUS(status), 1); wpid = wait(&status); - ATF_REQUIRE(wpid == -1); - ATF_REQUIRE(errno == ECHILD); + REQUIRE_EQ(wpid, -1); + REQUIRE_EQ(errno, ECHILD); } /* @@ -884,7 +908,7 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelated_debugger, tc) if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_skip("https://bugs.freebsd.org/239292"); - ATF_REQUIRE(pipe(cpipe) == 0); + REQUIRE_EQ(pipe(cpipe), 0); ATF_REQUIRE((fpid = fork()) != -1); if (fpid == 0) { attach_fork_parent(cpipe); @@ -896,12 +920,12 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelated_debugger, tc) /* Wait for the direct child to exit. */ wpid = waitpid(fpid, &status, 0); - ATF_REQUIRE(wpid == fpid); + REQUIRE_EQ(wpid, fpid); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 3); + REQUIRE_EQ(WEXITSTATUS(status), 3); /* Read the pid of the fork parent. */ - ATF_REQUIRE(read(cpipe[0], &children[0], sizeof(children[0])) == + REQUIRE_EQ(read(cpipe[0], &children[0], sizeof(children[0])), sizeof(children[0])); /* Attach to the fork parent. */ @@ -926,13 +950,13 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelated_debugger, tc) * parent. */ wpid = wait(&status); - ATF_REQUIRE(wpid == children[0]); + REQUIRE_EQ(wpid, children[0]); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 1); + REQUIRE_EQ(WEXITSTATUS(status), 1); wpid = wait(&status); - ATF_REQUIRE(wpid == -1); - ATF_REQUIRE(errno == ECHILD); + REQUIRE_EQ(wpid, -1); + REQUIRE_EQ(errno, ECHILD); } /* @@ -950,7 +974,7 @@ ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrelated_debugger, tc) if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_skip("https://bugs.freebsd.org/239425"); - ATF_REQUIRE(pipe(cpipe) == 0); + REQUIRE_EQ(pipe(cpipe), 0); ATF_REQUIRE((fpid = fork()) != -1); if (fpid == 0) { attach_fork_parent(cpipe); @@ -962,12 +986,12 @@ ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrelated_debugger, tc) /* Wait for the direct child to exit. */ wpid = waitpid(fpid, &status, 0); - ATF_REQUIRE(wpid == fpid); + REQUIRE_EQ(wpid, fpid); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 3); + REQUIRE_EQ(WEXITSTATUS(status), 3); /* Read the pid of the fork parent. */ - ATF_REQUIRE(read(cpipe[0], &children[0], sizeof(children[0])) == + REQUIRE_EQ(read(cpipe[0], &children[0], sizeof(children[0])), sizeof(children[0])); /* Attach to the fork parent. */ @@ -992,13 +1016,13 @@ ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrelated_debugger, tc) * the child. */ wpid = wait(&status); - ATF_REQUIRE(wpid == children[1]); + REQUIRE_EQ(wpid, children[1]); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 2); + REQUIRE_EQ(WEXITSTATUS(status), 2); wpid = wait(&status); - ATF_REQUIRE(wpid == -1); - ATF_REQUIRE(errno == ECHILD); + REQUIRE_EQ(wpid, -1); + REQUIRE_EQ(errno, ECHILD); } /* @@ -1015,8 +1039,7 @@ ATF_TC_BODY(ptrace__getppid, tc) if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_skip("https://bugs.freebsd.org/240510"); - - ATF_REQUIRE(pipe(cpipe) == 0); + REQUIRE_EQ(pipe(cpipe), 0); ATF_REQUIRE((child = fork()) != -1); if (child == 0) { @@ -1024,7 +1047,7 @@ ATF_TC_BODY(ptrace__getppid, tc) close(cpipe[0]); /* Wait for parent to be ready. */ - CHILD_REQUIRE(read(cpipe[1], &c, sizeof(c)) == sizeof(c)); + CHILD_REQUIRE_EQ(read(cpipe[1], &c, sizeof(c)), sizeof(c)); /* Report the parent PID to the parent. */ ppid = getppid(); @@ -1035,7 +1058,7 @@ ATF_TC_BODY(ptrace__getppid, tc) } close(cpipe[1]); - ATF_REQUIRE(pipe(dpipe) == 0); + REQUIRE_EQ(pipe(dpipe), 0); ATF_REQUIRE((debugger = fork()) != -1); if (debugger == 0) { @@ -1045,20 +1068,20 @@ ATF_TC_BODY(ptrace__getppid, tc) CHILD_REQUIRE(ptrace(PT_ATTACH, child, NULL, 0) != -1); wpid = waitpid(child, &status, 0); - CHILD_REQUIRE(wpid == child); + CHILD_REQUIRE_EQ(wpid, child); CHILD_REQUIRE(WIFSTOPPED(status)); - CHILD_REQUIRE(WSTOPSIG(status) == SIGSTOP); + CHILD_REQUIRE_EQ(WSTOPSIG(status), SIGSTOP); CHILD_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1); /* Signal parent that debugger is attached. */ - CHILD_REQUIRE(write(dpipe[1], &c, sizeof(c)) == sizeof(c)); + CHILD_REQUIRE_EQ(write(dpipe[1], &c, sizeof(c)), sizeof(c)); /* Wait for traced child to exit. */ wpid = waitpid(child, &status, 0); - CHILD_REQUIRE(wpid == child); + CHILD_REQUIRE_EQ(wpid, child); CHILD_REQUIRE(WIFEXITED(status)); - CHILD_REQUIRE(WEXITSTATUS(status) == 1); + CHILD_REQUIRE_EQ(WEXITSTATUS(status), 1); _exit(0); } @@ -1067,28 +1090,28 @@ ATF_TC_BODY(ptrace__getppid, tc) /* Parent process. */ /* Wait for the debugger to attach to the child. */ - ATF_REQUIRE(read(dpipe[0], &c, sizeof(c)) == sizeof(c)); + REQUIRE_EQ(read(dpipe[0], &c, sizeof(c)), sizeof(c)); /* Release the child. */ - ATF_REQUIRE(write(cpipe[0], &c, sizeof(c)) == sizeof(c)); + REQUIRE_EQ(write(cpipe[0], &c, sizeof(c)), sizeof(c)); /* Read the parent PID from the child. */ - ATF_REQUIRE(read(cpipe[0], &ppid, sizeof(ppid)) == sizeof(ppid)); + REQUIRE_EQ(read(cpipe[0], &ppid, sizeof(ppid)), sizeof(ppid)); close(cpipe[0]); - ATF_REQUIRE(ppid == getpid()); + REQUIRE_EQ(ppid, getpid()); /* Wait for the debugger. */ wpid = waitpid(debugger, &status, 0); - ATF_REQUIRE(wpid == debugger); + REQUIRE_EQ(wpid, debugger); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 0); + REQUIRE_EQ(WEXITSTATUS(status), 0); /* The child process should now be ready. */ wpid = waitpid(child, &status, WNOHANG); - ATF_REQUIRE(wpid == child); + REQUIRE_EQ(wpid, child); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 1); + REQUIRE_EQ(WEXITSTATUS(status), 1); } /* @@ -1113,9 +1136,9 @@ ATF_TC_BODY(ptrace__new_child_pl_syscall_code_fork, tc) /* The first wait() should report the stop from SIGSTOP. */ wpid = waitpid(children[0], &status, 0); - ATF_REQUIRE(wpid == children[0]); + REQUIRE_EQ(wpid, children[0]); ATF_REQUIRE(WIFSTOPPED(status)); - ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + REQUIRE_EQ(WSTOPSIG(status), SIGSTOP); ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1); @@ -1128,9 +1151,9 @@ ATF_TC_BODY(ptrace__new_child_pl_syscall_code_fork, tc) ATF_REQUIRE((pl[0].pl_flags & PL_FLAG_SCX) != 0); ATF_REQUIRE((pl[1].pl_flags & PL_FLAG_SCX) != 0); - ATF_REQUIRE(pl[0].pl_syscall_code == SYS_fork); - ATF_REQUIRE(pl[0].pl_syscall_code == pl[1].pl_syscall_code); - ATF_REQUIRE(pl[0].pl_syscall_narg == pl[1].pl_syscall_narg); + REQUIRE_EQ(pl[0].pl_syscall_code, SYS_fork); + REQUIRE_EQ(pl[0].pl_syscall_code, pl[1].pl_syscall_code); + REQUIRE_EQ(pl[0].pl_syscall_narg, pl[1].pl_syscall_narg); ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); ATF_REQUIRE(ptrace(PT_CONTINUE, children[1], (caddr_t)1, 0) != -1); @@ -1140,18 +1163,18 @@ ATF_TC_BODY(ptrace__new_child_pl_syscall_code_fork, tc) * grandchild should report its exit first to the debugger. */ wpid = wait(&status); - ATF_REQUIRE(wpid == children[1]); + REQUIRE_EQ(wpid, children[1]); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 2); + REQUIRE_EQ(WEXITSTATUS(status), 2); wpid = wait(&status); - ATF_REQUIRE(wpid == children[0]); + REQUIRE_EQ(wpid, children[0]); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 1); + REQUIRE_EQ(WEXITSTATUS(status), 1); wpid = wait(&status); - ATF_REQUIRE(wpid == -1); - ATF_REQUIRE(errno == ECHILD); + REQUIRE_EQ(wpid, -1); + REQUIRE_EQ(errno, ECHILD); } /* @@ -1176,9 +1199,9 @@ ATF_TC_BODY(ptrace__new_child_pl_syscall_code_vfork, tc) /* The first wait() should report the stop from SIGSTOP. */ wpid = waitpid(children[0], &status, 0); - ATF_REQUIRE(wpid == children[0]); + REQUIRE_EQ(wpid, children[0]); ATF_REQUIRE(WIFSTOPPED(status)); - ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + REQUIRE_EQ(WSTOPSIG(status), SIGSTOP); ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1); @@ -1191,9 +1214,9 @@ ATF_TC_BODY(ptrace__new_child_pl_syscall_code_vfork, tc) ATF_REQUIRE((pl[0].pl_flags & PL_FLAG_SCX) != 0); ATF_REQUIRE((pl[1].pl_flags & PL_FLAG_SCX) != 0); - ATF_REQUIRE(pl[0].pl_syscall_code == SYS_vfork); - ATF_REQUIRE(pl[0].pl_syscall_code == pl[1].pl_syscall_code); - ATF_REQUIRE(pl[0].pl_syscall_narg == pl[1].pl_syscall_narg); + REQUIRE_EQ(pl[0].pl_syscall_code, SYS_vfork); + REQUIRE_EQ(pl[0].pl_syscall_code, pl[1].pl_syscall_code); + REQUIRE_EQ(pl[0].pl_syscall_narg, pl[1].pl_syscall_narg); ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); ATF_REQUIRE(ptrace(PT_CONTINUE, children[1], (caddr_t)1, 0) != -1); @@ -1203,18 +1226,18 @@ ATF_TC_BODY(ptrace__new_child_pl_syscall_code_vfork, tc) * grandchild should report its exit first to the debugger. */ wpid = wait(&status); - ATF_REQUIRE(wpid == children[1]); + REQUIRE_EQ(wpid, children[1]); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 2); + REQUIRE_EQ(WEXITSTATUS(status), 2); wpid = wait(&status); - ATF_REQUIRE(wpid == children[0]); + REQUIRE_EQ(wpid, children[0]); ATF_REQUIRE(WIFEXITED(status)); - ATF_REQUIRE(WEXITSTATUS(status) == 1); + REQUIRE_EQ(WEXITSTATUS(status), 1); wpid = wait(&status); - ATF_REQUIRE(wpid == -1); - ATF_REQUIRE(errno == ECHILD); + REQUIRE_EQ(wpid, -1); + REQUIRE_EQ(errno, ECHILD); } static void * @@ -1229,8 +1252,8 @@ simple_thread_main(void) { pthread_t thread; - CHILD_REQUIRE(pthread_create(&thread, NULL, simple_thread, NULL) == 0); - CHILD_REQUIRE(pthread_join(thread, NULL) == 0); + CHILD_REQUIRE_EQ(pthread_create(&thread, NULL, simple_thread, NULL), 0); + CHILD_REQUIRE_EQ(pthread_join(thread, NULL), 0); exit(1); } @@ -1254,9 +1277,9 @@ ATF_TC_BODY(ptrace__new_child_pl_syscall_code_thread, tc) /* The first wait() should report the stop from SIGSTOP. */ wpid = waitpid(fpid, &status, 0); - ATF_REQUIRE(wpid == fpid); + REQUIRE_EQ(wpid, fpid); ATF_REQUIRE(WIFSTOPPED(status)); - ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + REQUIRE_EQ(WSTOPSIG(status), SIGSTOP); ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); @@ -1277,10 +1300,10 @@ ATF_TC_BODY(ptrace__new_child_pl_syscall_code_thread, tc) */ for (;;) { wpid = waitpid(fpid, &status, 0); - ATF_REQUIRE(wpid == fpid); + REQUIRE_EQ(wpid, fpid); ATF_REQUIRE(WIFSTOPPED(status)); - ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); - + REQUIRE_EQ(WSTOPSIG(status), SIGTRAP); + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); ATF_REQUIRE((pl.pl_flags & PL_FLAG_SCX) != 0); @@ -1289,27 +1312,27 @@ ATF_TC_BODY(ptrace__new_child_pl_syscall_code_thread, tc) /* New thread seen. */ break; - ATF_REQUIRE(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0) == 0); *** 2629 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Mar 17 14:05:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 152C2569503; Wed, 17 Mar 2021 14:05: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 4F0sPM5d1Vz3stg; Wed, 17 Mar 2021 14:05: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 63A02103BB; Wed, 17 Mar 2021 14:05: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 12HE5Ou6086120; Wed, 17 Mar 2021 14:05:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HE5O5E086119; Wed, 17 Mar 2021 14:05:24 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:05:24 GMT Message-Id: <202103171405.12HE5O5E086119@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 80c34bad1979 - stable/13 - Remove atf_tc_skip calls from ptrace_test MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 80c34bad19795b6f4ddf9d6e339cf600118f05b0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:05:29 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=80c34bad19795b6f4ddf9d6e339cf600118f05b0 commit 80c34bad19795b6f4ddf9d6e339cf600118f05b0 Author: Alex Richardson AuthorDate: 2021-03-01 18:51:02 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 12:24:02 +0000 Remove atf_tc_skip calls from ptrace_test I've run these tests many times in a loop on multiple architectures and it works reliably for me, maybe it's time to retire these skips? This also adds an additional waitpid to one of the tests to avoid a potential race condition (suggested by markj@). PR: 239397, 244056, 239425, 240510, 220841, 243605 Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D28888 (cherry picked from commit 1032131464f1196ad674b30c14a9e611789a1061) --- tests/sys/kern/ptrace_test.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c index a5655008eaa1..c6183ed573fd 100644 --- a/tests/sys/kern/ptrace_test.c +++ b/tests/sys/kern/ptrace_test.c @@ -237,9 +237,6 @@ ATF_TC_BODY(ptrace__parent_wait_after_attach, tc) int cpipe[2], status; char c; - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_skip("https://bugs.freebsd.org/244055"); - REQUIRE_EQ(pipe(cpipe), 0); ATF_REQUIRE((child = fork()) != -1); if (child == 0) { @@ -287,9 +284,6 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debugger, tc) int cpipe[2], dpipe[2], status; char c; - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_skip("https://bugs.freebsd.org/239399"); - REQUIRE_EQ(pipe(cpipe), 0); ATF_REQUIRE((child = fork()) != -1); @@ -493,9 +487,6 @@ ATF_TC_BODY(ptrace__parent_exits_before_child, tc) int cpipe1[2], cpipe2[2], gcpipe[2], status; pid_t child, gchild; - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_skip("https://bugs.freebsd.org/244056"); - REQUIRE_EQ(pipe(cpipe1), 0); REQUIRE_EQ(pipe(cpipe2), 0); REQUIRE_EQ(pipe(gcpipe), 0); @@ -834,9 +825,6 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelated_debugger, tc) pid_t children[2], fpid, wpid; int cpipe[2], status; - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_skip("https://bugs.freebsd.org/239397"); - REQUIRE_EQ(pipe(cpipe), 0); ATF_REQUIRE((fpid = fork()) != -1); if (fpid == 0) { @@ -905,9 +893,6 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelated_debugger, tc) pid_t children[2], fpid, wpid; int cpipe[2], status; - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_skip("https://bugs.freebsd.org/239292"); - REQUIRE_EQ(pipe(cpipe), 0); ATF_REQUIRE((fpid = fork()) != -1); if (fpid == 0) { @@ -971,9 +956,6 @@ ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrelated_debugger, tc) pid_t children[2], fpid, wpid; int cpipe[2], status; - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_skip("https://bugs.freebsd.org/239425"); - REQUIRE_EQ(pipe(cpipe), 0); ATF_REQUIRE((fpid = fork()) != -1); if (fpid == 0) { @@ -1036,9 +1018,6 @@ ATF_TC_BODY(ptrace__getppid, tc) int cpipe[2], dpipe[2], status; char c; - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_skip("https://bugs.freebsd.org/240510"); - REQUIRE_EQ(pipe(cpipe), 0); ATF_REQUIRE((child = fork()) != -1); @@ -2123,9 +2102,6 @@ ATF_TC_BODY(ptrace__PT_KILL_competing_stop, tc) struct ptrace_lwpinfo pl; struct sched_param sched_param; - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_skip("https://bugs.freebsd.org/220841"); - ATF_REQUIRE((fpid = fork()) != -1); if (fpid == 0) { trace_me(); @@ -4219,9 +4195,6 @@ ATF_TC_BODY(ptrace__procdesc_reparent_wait_child, tc) pid_t traced, debuger, wpid; int pd, status; - if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) - atf_tc_skip("https://bugs.freebsd.org/243605"); - traced = pdfork(&pd, 0); ATF_REQUIRE(traced >= 0); if (traced == 0) { @@ -4230,6 +4203,8 @@ ATF_TC_BODY(ptrace__procdesc_reparent_wait_child, tc) } ATF_REQUIRE(pd >= 0); + /* Wait until the child process has stopped before fork()ing again. */ + REQUIRE_EQ(traced, waitpid(traced, &status, WSTOPPED)); debuger = fork(); ATF_REQUIRE(debuger >= 0); if (debuger == 0) { From owner-dev-commits-src-all@freebsd.org Wed Mar 17 14:05:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3564156944C; Wed, 17 Mar 2021 14:05: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 4F0sPD1NRgz3sXZ; Wed, 17 Mar 2021 14:05: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 A95D07F9F; Wed, 17 Mar 2021 14:05: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 12HE5JGM086036; Wed, 17 Mar 2021 14:05:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HE5J1x086035; Wed, 17 Mar 2021 14:05:19 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:05:19 GMT Message-Id: <202103171405.12HE5J1x086035@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: d97a4cb221d5 - stable/13 - Fix two failing tests after ATF update MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: d97a4cb221d5f52a92473a4709aa97f812739f34 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:05:21 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=d97a4cb221d5f52a92473a4709aa97f812739f34 commit d97a4cb221d5f52a92473a4709aa97f812739f34 Author: Alex Richardson AuthorDate: 2021-02-15 22:11:30 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 12:22:15 +0000 Fix two failing tests after ATF update Since https://github.com/freebsd/atf/commit/4581cefc1e3811dd3c926b5dd4b15fd63d2e19da ATF opens the results file on startup. This fixes problems like capsicumized tests not being able to open the file on exit. However, this test closes all file descriptors just to check that socketpair returns fd 3+4 and thereby also closes the ATF results file. This then results in an EBADF when writing the result so the test is reported as broken. While system calls that create new file descriptors (must?) use the lowest available file descriptor number, it does not seem useful to test this property here. Drop the check for FD==3/4 to unbreak the testsuite. We could also try to re-open the results file in ATF if we get a EBADF error, but that will fail when running under Capsicum. Reviewed By: cem Differential Revision: https://reviews.freebsd.org/D28683 (cherry picked from commit 10fc4c3218381fef7189a5b8d46a757cd1989dff) --- contrib/netbsd-tests/lib/libc/sys/t_pipe2.c | 8 +++++--- contrib/netbsd-tests/lib/libc/sys/t_socketpair.c | 21 ++++++++++++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c b/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c index 48f973488c7a..1b62fa630fd5 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_pipe2.c @@ -53,17 +53,19 @@ run(int flags) while ((i = open("/", O_RDONLY)) < 3) ATF_REQUIRE(i != -1); -#ifdef __FreeBSD__ - closefrom(3); -#else +#ifdef __NetBSD__ + /* This check is harmful since it closes atf's output file */ ATF_REQUIRE_MSG(closefrom(3) != -1, "closefrom failed: %s", strerror(errno)); #endif ATF_REQUIRE(pipe2(fd, flags) == 0); +#ifdef __NetBSD__ + /* This check is harmful since it requires closing atf's output file */ ATF_REQUIRE(fd[0] == 3); ATF_REQUIRE(fd[1] == 4); +#endif if (flags & O_CLOEXEC) { ATF_REQUIRE((fcntl(fd[0], F_GETFD) & FD_CLOEXEC) != 0); diff --git a/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c b/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c index 246b584d496a..165a42971d64 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_socketpair.c @@ -63,16 +63,18 @@ run(int domain, int type, int flags) while ((i = open("/", O_RDONLY)) < 3) ATF_REQUIRE(i != -1); -#ifdef __FreeBSD__ - closefrom(3); -#else +#ifdef __NetBSD__ + /* This check is harmful since it closes atf's output file */ ATF_REQUIRE(closefrom(3) != -1); #endif ATF_REQUIRE(socketpair(domain, type | flags, 0, fd) == 0); +#if __NetBSD__ + /* This check is harmful since it requires closing atf's output file */ ATF_REQUIRE(fd[0] == 3); ATF_REQUIRE(fd[1] == 4); +#endif connected(fd[0]); connected(fd[1]); @@ -125,12 +127,25 @@ ATF_TC_BODY(null_sv, tc) { int fd; +#ifdef __NetBSD__ + /* This check is harmful since it closes atf's output file */ closefrom(3); +#else + int lowfd = open("/", O_RDONLY); + ATF_REQUIRE(lowfd > 0); + ATF_REQUIRE_EQ(0, close(lowfd)); +#endif ATF_REQUIRE_EQ(socketpair(AF_UNIX, SOCK_DGRAM, 0, NULL), -1); ATF_REQUIRE_EQ(EFAULT, errno); fd = open("/", O_RDONLY); +#ifdef __NetBSD__ ATF_REQUIRE_EQ_MSG(fd, 3, "socketpair(..., NULL) allocated descriptors"); +#else + ATF_REQUIRE_EQ_MSG(fd, lowfd, + "socketpair(..., NULL) allocated descriptors: fd=%d, lowfd=%d", + fd, lowfd); +#endif } ATF_TC(socketpair_basic); From owner-dev-commits-src-all@freebsd.org Wed Mar 17 14:05:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1389A569456; Wed, 17 Mar 2021 14:05: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 4F0sPM5t7Yz3stj; Wed, 17 Mar 2021 14:05: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 557C97D62; Wed, 17 Mar 2021 14:05: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 12HE5PaB086140; Wed, 17 Mar 2021 14:05:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HE5PZg086139; Wed, 17 Mar 2021 14:05:25 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:05:25 GMT Message-Id: <202103171405.12HE5PZg086139@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 2726b46353a9 - stable/13 - Fix ptrace_test:ptrace__syscall_args after ATF upgrade MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2726b46353a9faa2a0dbdf707693252b33ef5501 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:05:29 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=2726b46353a9faa2a0dbdf707693252b33ef5501 commit 2726b46353a9faa2a0dbdf707693252b33ef5501 Author: Alex Richardson AuthorDate: 2021-02-23 12:51:35 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 12:24:10 +0000 Fix ptrace_test:ptrace__syscall_args after ATF upgrade ATF now opens the results file (without CLOEXEC), so the child actually has a valid file descriptor 3. To fix this simply use a large number that will definitely not be a valid file descriptor. Reviewed by: jhb, cem, lwhsu Differential Revision: https://reviews.freebsd.org/D28889 (cherry picked from commit 17cc20092cd7a45adb6d772e0f449617007a82d9) --- tests/sys/kern/ptrace_test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c index c6183ed573fd..944be3d31e04 100644 --- a/tests/sys/kern/ptrace_test.c +++ b/tests/sys/kern/ptrace_test.c @@ -3947,7 +3947,8 @@ ATF_TC_BODY(ptrace__syscall_args, tc) if (fpid == 0) { trace_me(); kill(getpid(), 0); - close(3); + /* Close a fd that should not exist. */ + close(12345); exit(1); } @@ -4049,7 +4050,7 @@ ATF_TC_BODY(ptrace__syscall_args, tc) ATF_REQUIRE(ptrace(PT_GET_SC_ARGS, wpid, (caddr_t)args, sizeof(args)) != -1); - REQUIRE_EQ(args[0], 3); + REQUIRE_EQ(args[0], 12345); REQUIRE_EQ(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0); From owner-dev-commits-src-all@freebsd.org Wed Mar 17 14:05:29 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A969569430; Wed, 17 Mar 2021 14:05: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 4F0sPP1xpFz3srn; Wed, 17 Mar 2021 14:05: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 76E2710141; Wed, 17 Mar 2021 14:05: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 12HE5QpD086160; Wed, 17 Mar 2021 14:05:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HE5QcT086159; Wed, 17 Mar 2021 14:05:26 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:05:26 GMT Message-Id: <202103171405.12HE5QcT086159@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: db3b5695e61b - stable/13 - Fix GCC build of ptrace_test after 96a9e50e63bfc MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: db3b5695e61b1f23c65d0235a9f1707ed1df5227 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:05:29 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=db3b5695e61b1f23c65d0235a9f1707ed1df5227 commit db3b5695e61b1f23c65d0235a9f1707ed1df5227 Author: Alex Richardson AuthorDate: 2021-03-03 11:21:04 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 12:24:45 +0000 Fix GCC build of ptrace_test after 96a9e50e63bfc It seems like GCC's -Wsign-compare is stricter and also warns for constants. Appease GCC by adding the required casts. Fixes: 96a9e50e63bfc ("ptrace_test: Add more debug output on test failures") Reported by: Jenkins CI (cherry picked from commit 1fcbddec14dd693acf6a4be579f8d9e10b6a06a4) --- tests/sys/kern/ptrace_test.c | 89 +++++++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 39 deletions(-) diff --git a/tests/sys/kern/ptrace_test.c b/tests/sys/kern/ptrace_test.c index 944be3d31e04..16c047db574a 100644 --- a/tests/sys/kern/ptrace_test.c +++ b/tests/sys/kern/ptrace_test.c @@ -292,7 +292,8 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debugger, tc) close(cpipe[0]); /* Wait for parent to be ready. */ - CHILD_REQUIRE_EQ(read(cpipe[1], &c, sizeof(c)), sizeof(c)); + CHILD_REQUIRE_EQ(read(cpipe[1], &c, sizeof(c)), + (ssize_t)sizeof(c)); _exit(1); } @@ -315,7 +316,8 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debugger, tc) CHILD_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1); /* Signal parent that debugger is attached. */ - CHILD_REQUIRE_EQ(write(dpipe[1], &c, sizeof(c)), sizeof(c)); + CHILD_REQUIRE_EQ(write(dpipe[1], &c, sizeof(c)), + (ssize_t)sizeof(c)); /* Wait for parent's failed wait. */ CHILD_REQUIRE_EQ(read(dpipe[1], &c, sizeof(c)), 0); @@ -332,10 +334,10 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debugger, tc) /* Parent process. */ /* Wait for the debugger to attach to the child. */ - REQUIRE_EQ(read(dpipe[0], &c, sizeof(c)), sizeof(c)); + REQUIRE_EQ(read(dpipe[0], &c, sizeof(c)), (ssize_t)sizeof(c)); /* Release the child. */ - REQUIRE_EQ(write(cpipe[0], &c, sizeof(c)), sizeof(c)); + REQUIRE_EQ(write(cpipe[0], &c, sizeof(c)), (ssize_t)sizeof(c)); REQUIRE_EQ(read(cpipe[0], &c, sizeof(c)), 0); close(cpipe[0]); @@ -386,7 +388,8 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) close(cpipe[0]); /* Wait for parent to be ready. */ - CHILD_REQUIRE_EQ(read(cpipe[1], &c, sizeof(c)), sizeof(c)); + CHILD_REQUIRE_EQ(read(cpipe[1], &c, sizeof(c)), + (ssize_t)sizeof(c)); _exit(1); } @@ -419,10 +422,12 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) CHILD_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1); /* Signal parent that debugger is attached. */ - CHILD_REQUIRE_EQ(write(dpipe[1], &c, sizeof(c)), sizeof(c)); + CHILD_REQUIRE_EQ(write(dpipe[1], &c, sizeof(c)), + (ssize_t)sizeof(c)); /* Wait for parent's failed wait. */ - CHILD_REQUIRE_EQ(read(dpipe[1], &c, sizeof(c)), sizeof(c)); + CHILD_REQUIRE_EQ(read(dpipe[1], &c, sizeof(c)), + (ssize_t)sizeof(c)); wpid = waitpid(child, &status, 0); CHILD_REQUIRE_EQ(wpid, child); @@ -446,10 +451,10 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) REQUIRE_EQ(wpid, 0); /* Wait for the debugger to attach to the child. */ - REQUIRE_EQ(read(dpipe[0], &c, sizeof(c)), sizeof(c)); + REQUIRE_EQ(read(dpipe[0], &c, sizeof(c)), (ssize_t)sizeof(c)); /* Release the child. */ - REQUIRE_EQ(write(cpipe[0], &c, sizeof(c)), sizeof(c)); + REQUIRE_EQ(write(cpipe[0], &c, sizeof(c)), (ssize_t)sizeof(c)); REQUIRE_EQ(read(cpipe[0], &c, sizeof(c)), 0); close(cpipe[0]); @@ -464,7 +469,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_unrelated_debugger, tc) REQUIRE_EQ(wpid, 0); /* Signal the debugger to wait for the child. */ - REQUIRE_EQ(write(dpipe[0], &c, sizeof(c)), sizeof(c)); + REQUIRE_EQ(write(dpipe[0], &c, sizeof(c)), (ssize_t)sizeof(c)); /* Wait for the debugger. */ REQUIRE_EQ(read(dpipe[0], &c, sizeof(c)), 0); @@ -504,25 +509,28 @@ ATF_TC_BODY(ptrace__parent_exits_before_child, tc) _exit(status); } - CHILD_REQUIRE(write(cpipe1[1], &gchild, sizeof(gchild)) == - sizeof(gchild)); - CHILD_REQUIRE(read(cpipe2[0], &status, sizeof(status)) == - sizeof(status)); + CHILD_REQUIRE_EQ(write(cpipe1[1], &gchild, sizeof(gchild)), + (ssize_t)sizeof(gchild)); + CHILD_REQUIRE_EQ(read(cpipe2[0], &status, sizeof(status)), + (ssize_t)sizeof(status)); _exit(status); } - REQUIRE_EQ(read(cpipe1[0], &gchild, sizeof(gchild)), sizeof(gchild)); + REQUIRE_EQ(read(cpipe1[0], &gchild, sizeof(gchild)), + (ssize_t)sizeof(gchild)); REQUIRE_EQ(ptrace(PT_ATTACH, gchild, NULL, 0), 0); status = 0; - REQUIRE_EQ(write(cpipe2[1], &status, sizeof(status)), sizeof(status)); + REQUIRE_EQ(write(cpipe2[1], &status, sizeof(status)), + (ssize_t)sizeof(status)); REQUIRE_EQ(waitpid(child, &status, 0), child); ATF_REQUIRE(WIFEXITED(status)); REQUIRE_EQ(WEXITSTATUS(status), 0); status = 0; - REQUIRE_EQ(write(gcpipe[1], &status, sizeof(status)), sizeof(status)); + REQUIRE_EQ(write(gcpipe[1], &status, sizeof(status)), + (ssize_t)sizeof(status)); REQUIRE_EQ(waitpid(gchild, &status, 0), gchild); ATF_REQUIRE(WIFSTOPPED(status)); REQUIRE_EQ(ptrace(PT_DETACH, gchild, (caddr_t)1, 0), 0); @@ -807,7 +815,8 @@ attach_fork_parent(int cpipe[2]) /* Send the pid of the disassociated child to the debugger. */ fpid = getpid(); - CHILD_REQUIRE_EQ(write(cpipe[1], &fpid, sizeof(fpid)), sizeof(fpid)); + CHILD_REQUIRE_EQ(write(cpipe[1], &fpid, sizeof(fpid)), + (ssize_t)sizeof(fpid)); /* Wait for the debugger to attach. */ CHILD_REQUIRE_EQ(read(cpipe[1], &fpid, sizeof(fpid)), 0); @@ -843,7 +852,7 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelated_debugger, tc) /* Read the pid of the fork parent. */ REQUIRE_EQ(read(cpipe[0], &children[0], sizeof(children[0])), - sizeof(children[0])); + (ssize_t)sizeof(children[0])); /* Attach to the fork parent. */ attach_child(children[0]); @@ -911,7 +920,7 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelated_debugger, tc) /* Read the pid of the fork parent. */ REQUIRE_EQ(read(cpipe[0], &children[0], sizeof(children[0])), - sizeof(children[0])); + (ssize_t)sizeof(children[0])); /* Attach to the fork parent. */ attach_child(children[0]); @@ -974,7 +983,7 @@ ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrelated_debugger, tc) /* Read the pid of the fork parent. */ REQUIRE_EQ(read(cpipe[0], &children[0], sizeof(children[0])), - sizeof(children[0])); + (ssize_t)sizeof(children[0])); /* Attach to the fork parent. */ attach_child(children[0]); @@ -1026,12 +1035,13 @@ ATF_TC_BODY(ptrace__getppid, tc) close(cpipe[0]); /* Wait for parent to be ready. */ - CHILD_REQUIRE_EQ(read(cpipe[1], &c, sizeof(c)), sizeof(c)); + CHILD_REQUIRE_EQ(read(cpipe[1], &c, sizeof(c)), + (ssize_t)sizeof(c)); /* Report the parent PID to the parent. */ ppid = getppid(); - CHILD_REQUIRE(write(cpipe[1], &ppid, sizeof(ppid)) == - sizeof(ppid)); + CHILD_REQUIRE_EQ(write(cpipe[1], &ppid, sizeof(ppid)), + (ssize_t)sizeof(ppid)); _exit(1); } @@ -1054,7 +1064,8 @@ ATF_TC_BODY(ptrace__getppid, tc) CHILD_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1); /* Signal parent that debugger is attached. */ - CHILD_REQUIRE_EQ(write(dpipe[1], &c, sizeof(c)), sizeof(c)); + CHILD_REQUIRE_EQ(write(dpipe[1], &c, sizeof(c)), + (ssize_t)sizeof(c)); /* Wait for traced child to exit. */ wpid = waitpid(child, &status, 0); @@ -1069,13 +1080,13 @@ ATF_TC_BODY(ptrace__getppid, tc) /* Parent process. */ /* Wait for the debugger to attach to the child. */ - REQUIRE_EQ(read(dpipe[0], &c, sizeof(c)), sizeof(c)); + REQUIRE_EQ(read(dpipe[0], &c, sizeof(c)), (ssize_t)sizeof(c)); /* Release the child. */ - REQUIRE_EQ(write(cpipe[0], &c, sizeof(c)), sizeof(c)); + REQUIRE_EQ(write(cpipe[0], &c, sizeof(c)), (ssize_t)sizeof(c)); /* Read the parent PID from the child. */ - REQUIRE_EQ(read(cpipe[0], &ppid, sizeof(ppid)), sizeof(ppid)); + REQUIRE_EQ(read(cpipe[0], &ppid, sizeof(ppid)), (ssize_t)sizeof(ppid)); close(cpipe[0]); REQUIRE_EQ(ppid, getpid()); @@ -1130,7 +1141,7 @@ ATF_TC_BODY(ptrace__new_child_pl_syscall_code_fork, tc) ATF_REQUIRE((pl[0].pl_flags & PL_FLAG_SCX) != 0); ATF_REQUIRE((pl[1].pl_flags & PL_FLAG_SCX) != 0); - REQUIRE_EQ(pl[0].pl_syscall_code, SYS_fork); + REQUIRE_EQ(pl[0].pl_syscall_code, (unsigned)SYS_fork); REQUIRE_EQ(pl[0].pl_syscall_code, pl[1].pl_syscall_code); REQUIRE_EQ(pl[0].pl_syscall_narg, pl[1].pl_syscall_narg); @@ -1193,7 +1204,7 @@ ATF_TC_BODY(ptrace__new_child_pl_syscall_code_vfork, tc) ATF_REQUIRE((pl[0].pl_flags & PL_FLAG_SCX) != 0); ATF_REQUIRE((pl[1].pl_flags & PL_FLAG_SCX) != 0); - REQUIRE_EQ(pl[0].pl_syscall_code, SYS_vfork); + REQUIRE_EQ(pl[0].pl_syscall_code, (unsigned)SYS_vfork); REQUIRE_EQ(pl[0].pl_syscall_code, pl[1].pl_syscall_code); REQUIRE_EQ(pl[0].pl_syscall_narg, pl[1].pl_syscall_narg); @@ -2861,7 +2872,7 @@ ATF_TC_BODY(ptrace__PT_CONTINUE_with_signal_kqueue, tc) continue; CHILD_REQUIRE(nevents > 0); CHILD_REQUIRE_EQ(kev.filter, EVFILT_SIGNAL); - CHILD_REQUIRE_EQ(kev.ident, SIGUSR1); + CHILD_REQUIRE_EQ(kev.ident, (uintptr_t)SIGUSR1); break; } @@ -3974,7 +3985,7 @@ ATF_TC_BODY(ptrace__syscall_args, tc) ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE); - REQUIRE_EQ(pl.pl_syscall_code, SYS_getpid); + REQUIRE_EQ(pl.pl_syscall_code, (unsigned)SYS_getpid); REQUIRE_EQ(ptrace(PT_CONTINUE, fpid, (caddr_t)1, 0), 0); @@ -3988,7 +3999,7 @@ ATF_TC_BODY(ptrace__syscall_args, tc) ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCX); - REQUIRE_EQ(pl.pl_syscall_code, SYS_getpid); + REQUIRE_EQ(pl.pl_syscall_code, (unsigned)SYS_getpid); ATF_REQUIRE(ptrace(PT_GET_SC_RET, wpid, (caddr_t)&psr, sizeof(psr)) != -1); @@ -4007,8 +4018,8 @@ ATF_TC_BODY(ptrace__syscall_args, tc) ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE); - REQUIRE_EQ(pl.pl_syscall_code, SYS_kill); - REQUIRE_EQ(pl.pl_syscall_narg, 2); + REQUIRE_EQ(pl.pl_syscall_code, (unsigned)SYS_kill); + REQUIRE_EQ(pl.pl_syscall_narg, 2u); ATF_REQUIRE(ptrace(PT_GET_SC_ARGS, wpid, (caddr_t)args, sizeof(args)) != -1); @@ -4027,7 +4038,7 @@ ATF_TC_BODY(ptrace__syscall_args, tc) ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCX); - REQUIRE_EQ(pl.pl_syscall_code, SYS_kill); + REQUIRE_EQ(pl.pl_syscall_code, (unsigned)SYS_kill); ATF_REQUIRE(ptrace(PT_GET_SC_RET, wpid, (caddr_t)&psr, sizeof(psr)) != -1); @@ -4045,8 +4056,8 @@ ATF_TC_BODY(ptrace__syscall_args, tc) ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCE); - REQUIRE_EQ(pl.pl_syscall_code, SYS_close); - REQUIRE_EQ(pl.pl_syscall_narg, 1); + REQUIRE_EQ(pl.pl_syscall_code, (unsigned)SYS_close); + REQUIRE_EQ(pl.pl_syscall_narg, 1u); ATF_REQUIRE(ptrace(PT_GET_SC_ARGS, wpid, (caddr_t)args, sizeof(args)) != -1); @@ -4064,7 +4075,7 @@ ATF_TC_BODY(ptrace__syscall_args, tc) ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, sizeof(pl)) != -1); ATF_REQUIRE(pl.pl_flags & PL_FLAG_SCX); - REQUIRE_EQ(pl.pl_syscall_code, SYS_close); + REQUIRE_EQ(pl.pl_syscall_code, (unsigned)SYS_close); ATF_REQUIRE(ptrace(PT_GET_SC_RET, wpid, (caddr_t)&psr, sizeof(psr)) != -1); From owner-dev-commits-src-all@freebsd.org Wed Mar 17 14:15:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 653FF56A345; Wed, 17 Mar 2021 14:15: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 4F0sd22Ndvz3vYD; Wed, 17 Mar 2021 14:15: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 445D3103F8; Wed, 17 Mar 2021 14:15: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 12HEFY9v099754; Wed, 17 Mar 2021 14:15:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HEFYAh099753; Wed, 17 Mar 2021 14:15:34 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:15:34 GMT Message-Id: <202103171415.12HEFYAh099753@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: f187d6dfbf63 - main - base: remove if_wg(4) and associated utilities, manpage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f187d6dfbf633665ba6740fe22742aec60ce02a2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:15:34 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=f187d6dfbf633665ba6740fe22742aec60ce02a2 commit f187d6dfbf633665ba6740fe22742aec60ce02a2 Author: Kyle Evans AuthorDate: 2021-03-16 02:38:23 +0000 Commit: Kyle Evans CommitDate: 2021-03-17 14:14:48 +0000 base: remove if_wg(4) and associated utilities, manpage After length decisions, we've decided that the if_wg(4) driver and related work is not yet ready to live in the tree. This driver has larger security implications than many, and thus will be held to more scrutiny than other drivers. Please also see the related message sent to the freebsd-hackers@ and freebsd-arch@ lists by Kyle Evans on 2021/03/16, with the subject line "Removing WireGuard Support From Base" for additional context. --- etc/mtree/BSD.include.dist | 2 - include/Makefile | 9 +- sbin/ifconfig/Makefile | 1 - sbin/ifconfig/ifwg.c | 731 --------- share/man/man4/Makefile | 2 - share/man/man4/wg.4 | 259 --- sys/dev/if_wg/crypto.c | 1705 ------------------- sys/dev/if_wg/crypto.h | 114 -- sys/dev/if_wg/if_wg.c | 3462 --------------------------------------- sys/dev/if_wg/if_wg.h | 36 - sys/dev/if_wg/support.h | 56 - sys/dev/if_wg/wg_cookie.c | 438 ----- sys/dev/if_wg/wg_cookie.h | 125 -- sys/dev/if_wg/wg_noise.c | 963 ----------- sys/dev/if_wg/wg_noise.h | 191 --- sys/kern/kern_jail.c | 1 - sys/kern/uipc_socket.c | 11 - sys/kern/uipc_syscalls.c | 4 +- sys/modules/Makefile | 1 - sys/modules/if_wg/Makefile | 12 - sys/net/if_types.h | 1 - sys/netinet6/nd6.c | 4 +- sys/sys/priv.h | 1 - sys/sys/socketvar.h | 1 - tests/sys/netinet/Makefile | 10 +- tests/sys/netinet/if_wg_test.sh | 188 --- 26 files changed, 8 insertions(+), 8320 deletions(-) diff --git a/etc/mtree/BSD.include.dist b/etc/mtree/BSD.include.dist index 0f85798815d5..e7784cbb0a47 100644 --- a/etc/mtree/BSD.include.dist +++ b/etc/mtree/BSD.include.dist @@ -64,8 +64,6 @@ .. iicbus .. - if_wg - .. io .. mfi diff --git a/include/Makefile b/include/Makefile index d47879e11c93..eebc7f0e121f 100644 --- a/include/Makefile +++ b/include/Makefile @@ -43,7 +43,7 @@ LDIRS= geom net net80211 netgraph netinet netinet6 \ LSUBDIRS= dev/acpica dev/agp dev/an dev/ciss dev/filemon dev/firewire \ dev/hwpmc dev/hyperv \ - dev/ic dev/iicbus dev/if_wg dev/io dev/mfi dev/mmc dev/nvme \ + dev/ic dev/iicbus dev/io dev/mfi dev/mmc dev/nvme \ dev/ofw dev/pbio dev/pci ${_dev_powermac_nvram} dev/ppbus dev/pwm \ dev/smbus dev/speaker dev/tcp_log dev/veriexec dev/vkbd \ fs/devfs fs/fdescfs fs/msdosfs fs/nfs fs/nullfs \ @@ -220,10 +220,6 @@ NVPAIRDIR= ${INCLUDEDIR}/sys MLX5= mlx5io.h MLX5DIR= ${INCLUDEDIR}/dev/mlx5 -.PATH: ${SRCTOP}/sys/dev/if_wg -WG= if_wg.h -WGDIR= ${INCLUDEDIR}/dev/if_wg - INCSGROUPS= INCS \ ACPICA \ AGP \ @@ -241,8 +237,7 @@ INCSGROUPS= INCS \ PCI \ RPC \ TEKEN \ - VERIEXEC \ - WG + VERIEXEC .if ${MK_AUDIT} != "no" INCSGROUPS+= BSM diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile index 61cb8ab933fd..b178dc0c7e6a 100644 --- a/sbin/ifconfig/Makefile +++ b/sbin/ifconfig/Makefile @@ -35,7 +35,6 @@ SRCS+= ifvxlan.c # VXLAN support SRCS+= ifgre.c # GRE keys etc SRCS+= ifgif.c # GIF reversed header workaround SRCS+= ifipsec.c # IPsec VTI -SRCS+= ifwg.c # Wireguard SRCS+= sfp.c # SFP/SFP+ information LIBADD+= ifconfig m util diff --git a/sbin/ifconfig/ifwg.c b/sbin/ifconfig/ifwg.c deleted file mode 100644 index a102f392cf80..000000000000 --- a/sbin/ifconfig/ifwg.c +++ /dev/null @@ -1,731 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2020 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$"); - -#ifndef RESCUE -#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 -#include /* NB: for offsetof */ -#include -#include -#include - -#include "ifconfig.h" - -static void wgfinish(int s, void *arg); - -static bool wgfinish_registered; - -static int allowed_ips_count; -static int allowed_ips_max; -static nvlist_t **allowed_ips, *nvl_peer; - -#define ALLOWEDIPS_START 16 -#define WG_KEY_SIZE_BASE64 ((((WG_KEY_SIZE) + 2) / 3) * 4 + 1) -#define WG_KEY_SIZE_HEX (WG_KEY_SIZE * 2 + 1) -#define WG_MAX_STRLEN 64 - -struct allowedip { - union { - struct in_addr ip4; - struct in6_addr ip6; - }; -}; - -static void -register_wgfinish(void) -{ - - if (wgfinish_registered) - return; - callback_register(wgfinish, NULL); - wgfinish_registered = true; -} - -static nvlist_t * -nvl_device(void) -{ - static nvlist_t *_nvl_device; - - if (_nvl_device == NULL) - _nvl_device = nvlist_create(0); - register_wgfinish(); - return (_nvl_device); -} - -static bool -key_from_base64(uint8_t key[static WG_KEY_SIZE], const char *base64) -{ - - if (strlen(base64) != WG_KEY_SIZE_BASE64 - 1) { - warnx("bad key len - need %d got %zu\n", WG_KEY_SIZE_BASE64 - 1, strlen(base64)); - return false; - } - if (base64[WG_KEY_SIZE_BASE64 - 2] != '=') { - warnx("bad key terminator, expected '=' got '%c'", base64[WG_KEY_SIZE_BASE64 - 2]); - return false; - } - return (b64_pton(base64, key, WG_KEY_SIZE)); -} - -static void -parse_endpoint(const char *endpoint_) -{ - int err; - char *base, *endpoint, *port, *colon, *tmp; - struct addrinfo hints, *res; - - endpoint = base = strdup(endpoint_); - colon = rindex(endpoint, ':'); - if (colon == NULL) - errx(1, "bad endpoint format %s - no port delimiter found", endpoint); - *colon = '\0'; - port = colon + 1; - - /* [::]:<> */ - if (endpoint[0] == '[') { - endpoint++; - tmp = index(endpoint, ']'); - if (tmp == NULL) - errx(1, "bad endpoint format %s - '[' found with no matching ']'", endpoint); - *tmp = '\0'; - } - bzero(&hints, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - err = getaddrinfo(endpoint, port, &hints, &res); - if (err) - errx(1, "%s", gai_strerror(err)); - nvlist_add_binary(nvl_peer, "endpoint", res->ai_addr, res->ai_addrlen); - freeaddrinfo(res); - free(base); -} - -static void -in_len2mask(struct in_addr *mask, u_int len) -{ - u_int i; - u_char *p; - - p = (u_char *)mask; - memset(mask, 0, sizeof(*mask)); - for (i = 0; i < len / NBBY; i++) - p[i] = 0xff; - if (len % NBBY) - p[i] = (0xff00 >> (len % NBBY)) & 0xff; -} - -static u_int -in_mask2len(struct in_addr *mask) -{ - u_int x, y; - u_char *p; - - p = (u_char *)mask; - for (x = 0; x < sizeof(*mask); x++) { - if (p[x] != 0xff) - break; - } - y = 0; - if (x < sizeof(*mask)) { - for (y = 0; y < NBBY; y++) { - if ((p[x] & (0x80 >> y)) == 0) - break; - } - } - return x * NBBY + y; -} - -static void -in6_prefixlen2mask(struct in6_addr *maskp, int len) -{ - static const u_char maskarray[NBBY] = {0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff}; - int bytelen, bitlen, i; - - /* sanity check */ - if (len < 0 || len > 128) { - errx(1, "in6_prefixlen2mask: invalid prefix length(%d)\n", - len); - return; - } - - memset(maskp, 0, sizeof(*maskp)); - bytelen = len / NBBY; - bitlen = len % NBBY; - for (i = 0; i < bytelen; i++) - maskp->s6_addr[i] = 0xff; - if (bitlen) - maskp->s6_addr[bytelen] = maskarray[bitlen - 1]; -} - -static int -in6_mask2len(struct in6_addr *mask, u_char *lim0) -{ - int x = 0, y; - u_char *lim = lim0, *p; - - /* ignore the scope_id part */ - if (lim0 == NULL || lim0 - (u_char *)mask > sizeof(*mask)) - lim = (u_char *)mask + sizeof(*mask); - for (p = (u_char *)mask; p < lim; x++, p++) { - if (*p != 0xff) - break; - } - y = 0; - if (p < lim) { - for (y = 0; y < NBBY; y++) { - if ((*p & (0x80 >> y)) == 0) - break; - } - } - - /* - * when the limit pointer is given, do a stricter check on the - * remaining bits. - */ - if (p < lim) { - if (y != 0 && (*p & (0x00ff >> y)) != 0) - return -1; - for (p = p + 1; p < lim; p++) - if (*p != 0) - return -1; - } - - return x * NBBY + y; -} - -static bool -parse_ip(struct allowedip *aip, uint16_t *family, const char *value) -{ - struct addrinfo hints, *res; - int err; - bool ret; - - ret = true; - bzero(aip, sizeof(*aip)); - bzero(&hints, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_flags = AI_NUMERICHOST; - err = getaddrinfo(value, NULL, &hints, &res); - if (err) - errx(1, "%s", gai_strerror(err)); - - *family = res->ai_family; - if (res->ai_family == AF_INET) { - struct sockaddr_in *sin = (struct sockaddr_in *)res->ai_addr; - - aip->ip4 = sin->sin_addr; - } else if (res->ai_family == AF_INET6) { - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)res->ai_addr; - - aip->ip6 = sin6->sin6_addr; - } else { - ret = false; - } - - freeaddrinfo(res); - return (ret); -} - -static void -sa_ntop(const struct sockaddr *sa, char *buf, int *port) -{ - const struct sockaddr_in *sin; - const struct sockaddr_in6 *sin6; - int err; - - err = getnameinfo(sa, sa->sa_len, buf, INET6_ADDRSTRLEN, NULL, - 0, NI_NUMERICHOST); - - if (sa->sa_family == AF_INET) { - sin = (const struct sockaddr_in *)sa; - if (port) - *port = sin->sin_port; - } else if (sa->sa_family == AF_INET6) { - sin6 = (const struct sockaddr_in6 *)sa; - if (port) - *port = sin6->sin6_port; - } - - if (err) - errx(1, "%s", gai_strerror(err)); -} - -static void -dump_peer(const nvlist_t *nvl_peer_cfg) -{ - const void *key; - const struct sockaddr *endpoint; - char outbuf[WG_MAX_STRLEN]; - char addr_buf[INET6_ADDRSTRLEN]; - size_t aip_count, size; - int port; - uint16_t persistent_keepalive; - const nvlist_t * const *nvl_aips; - - printf("[Peer]\n"); - if (nvlist_exists_binary(nvl_peer_cfg, "public-key")) { - key = nvlist_get_binary(nvl_peer_cfg, "public-key", &size); - b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); - printf("PublicKey = %s\n", outbuf); - } - if (nvlist_exists_binary(nvl_peer_cfg, "preshared-key")) { - key = nvlist_get_binary(nvl_peer_cfg, "preshared-key", &size); - b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); - printf("PresharedKey = %s\n", outbuf); - } - if (nvlist_exists_binary(nvl_peer_cfg, "endpoint")) { - endpoint = nvlist_get_binary(nvl_peer_cfg, "endpoint", &size); - sa_ntop(endpoint, addr_buf, &port); - printf("Endpoint = %s:%d\n", addr_buf, ntohs(port)); - } - if (nvlist_exists_number(nvl_peer_cfg, - "persistent-keepalive-interval")) { - persistent_keepalive = nvlist_get_number(nvl_peer_cfg, - "persistent-keepalive-interval"); - printf("PersistentKeepalive = %d\n", persistent_keepalive); - } - if (!nvlist_exists_nvlist_array(nvl_peer_cfg, "allowed-ips")) - return; - - nvl_aips = nvlist_get_nvlist_array(nvl_peer_cfg, "allowed-ips", &aip_count); - if (nvl_aips == NULL || aip_count == 0) - return; - - printf("AllowedIPs = "); - for (size_t i = 0; i < aip_count; i++) { - uint8_t cidr; - struct sockaddr_storage ss; - sa_family_t family; - - if (!nvlist_exists_number(nvl_aips[i], "cidr")) - continue; - cidr = nvlist_get_number(nvl_aips[i], "cidr"); - if (nvlist_exists_binary(nvl_aips[i], "ipv4")) { - struct sockaddr_in *sin = (struct sockaddr_in *)&ss; - const struct in_addr *ip4; - - ip4 = nvlist_get_binary(nvl_aips[i], "ipv4", &size); - if (ip4 == NULL || cidr > 32) - continue; - sin->sin_len = sizeof(*sin); - sin->sin_family = AF_INET; - sin->sin_addr = *ip4; - } else if (nvlist_exists_binary(nvl_aips[i], "ipv6")) { - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&ss; - const struct in6_addr *ip6; - - ip6 = nvlist_get_binary(nvl_aips[i], "ipv6", &size); - if (ip6 == NULL || cidr > 128) - continue; - sin6->sin6_len = sizeof(*sin6); - sin6->sin6_family = AF_INET6; - sin6->sin6_addr = *ip6; - } else { - continue; - } - - family = ss.ss_family; - getnameinfo((struct sockaddr *)&ss, ss.ss_len, addr_buf, - INET6_ADDRSTRLEN, NULL, 0, NI_NUMERICHOST); - printf("%s/%d", addr_buf, cidr); - if (i < aip_count - 1) - printf(", "); - } - printf("\n"); -} - -static int -get_nvl_out_size(int sock, u_long op, size_t *size) -{ - struct wg_data_io wgd; - int err; - - memset(&wgd, 0, sizeof(wgd)); - - strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); - wgd.wgd_size = 0; - wgd.wgd_data = NULL; - - err = ioctl(sock, op, &wgd); - if (err) - return (err); - *size = wgd.wgd_size; - return (0); -} - -static int -do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) -{ - struct wg_data_io wgd; - - memset(&wgd, 0, sizeof(wgd)); - - strlcpy(wgd.wgd_name, name, sizeof(wgd.wgd_name)); - wgd.wgd_size = argsize; - wgd.wgd_data = arg; - - return (ioctl(sock, op, &wgd)); -} - -static -DECL_CMD_FUNC(peerlist, val, d) -{ - size_t size, peercount; - void *packed; - const nvlist_t *nvl; - const nvlist_t *const *nvl_peerlist; - - if (get_nvl_out_size(s, SIOCGWG, &size)) - errx(1, "can't get peer list size"); - if ((packed = malloc(size)) == NULL) - errx(1, "malloc failed for peer list"); - if (do_cmd(s, SIOCGWG, packed, size, 0)) - errx(1, "failed to obtain peer list"); - - nvl = nvlist_unpack(packed, size, 0); - if (!nvlist_exists_nvlist_array(nvl, "peers")) - return; - nvl_peerlist = nvlist_get_nvlist_array(nvl, "peers", &peercount); - - for (int i = 0; i < peercount; i++, nvl_peerlist++) { - dump_peer(*nvl_peerlist); - } -} - -static void -wgfinish(int s, void *arg) -{ - void *packed; - size_t size; - static nvlist_t *nvl_dev; - - nvl_dev = nvl_device(); - if (nvl_peer != NULL) { - if (!nvlist_exists_binary(nvl_peer, "public-key")) - errx(1, "must specify a public-key for adding peer"); - if (allowed_ips_count != 0) { - nvlist_add_nvlist_array(nvl_peer, "allowed-ips", - (const nvlist_t * const *)allowed_ips, - allowed_ips_count); - for (size_t i = 0; i < allowed_ips_count; i++) { - nvlist_destroy(allowed_ips[i]); - } - - free(allowed_ips); - } - - nvlist_add_nvlist_array(nvl_dev, "peers", - (const nvlist_t * const *)&nvl_peer, 1); - } - - packed = nvlist_pack(nvl_dev, &size); - - if (do_cmd(s, SIOCSWG, packed, size, true)) - errx(1, "failed to configure"); -} - -static -DECL_CMD_FUNC(peerstart, val, d) -{ - - if (nvl_peer != NULL) - errx(1, "cannot both add and remove a peer"); - register_wgfinish(); - nvl_peer = nvlist_create(0); - allowed_ips = calloc(ALLOWEDIPS_START, sizeof(*allowed_ips)); - allowed_ips_max = ALLOWEDIPS_START; - if (allowed_ips == NULL) - errx(1, "failed to allocate array for allowedips"); -} - -static -DECL_CMD_FUNC(peerdel, val, d) -{ - - if (nvl_peer != NULL) - errx(1, "cannot both add and remove a peer"); - register_wgfinish(); - nvl_peer = nvlist_create(0); - nvlist_add_bool(nvl_peer, "remove", true); -} - -static -DECL_CMD_FUNC(setwglistenport, val, d) -{ - struct addrinfo hints, *res; - const struct sockaddr_in *sin; - const struct sockaddr_in6 *sin6; - - u_long ul; - int err; - - bzero(&hints, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_flags = AI_NUMERICHOST; - err = getaddrinfo(NULL, val, &hints, &res); - if (err) - errx(1, "%s", gai_strerror(err)); - - if (res->ai_family == AF_INET) { - sin = (struct sockaddr_in *)res->ai_addr; - ul = sin->sin_port; - } else if (res->ai_family == AF_INET6) { - sin6 = (struct sockaddr_in6 *)res->ai_addr; - ul = sin6->sin6_port; - } else { - errx(1, "unknown family"); - } - ul = ntohs((u_short)ul); - nvlist_add_number(nvl_device(), "listen-port", ul); -} - -static -DECL_CMD_FUNC(setwgprivkey, val, d) -{ - uint8_t key[WG_KEY_SIZE]; - - if (!key_from_base64(key, val)) - errx(1, "invalid key %s", val); - nvlist_add_binary(nvl_device(), "private-key", key, WG_KEY_SIZE); -} - -static -DECL_CMD_FUNC(setwgpubkey, val, d) -{ - uint8_t key[WG_KEY_SIZE]; - - if (nvl_peer == NULL) - errx(1, "setting public key only valid when adding peer"); - - if (!key_from_base64(key, val)) - errx(1, "invalid key %s", val); - nvlist_add_binary(nvl_peer, "public-key", key, WG_KEY_SIZE); -} - -static -DECL_CMD_FUNC(setwgpresharedkey, val, d) -{ - uint8_t key[WG_KEY_SIZE]; - - if (nvl_peer == NULL) - errx(1, "setting preshared-key only valid when adding peer"); - - if (!key_from_base64(key, val)) - errx(1, "invalid key %s", val); - nvlist_add_binary(nvl_peer, "preshared-key", key, WG_KEY_SIZE); -} - - -static -DECL_CMD_FUNC(setwgpersistentkeepalive, val, d) -{ - unsigned long persistent_keepalive; - char *endp; - - if (nvl_peer == NULL) - errx(1, "setting persistent keepalive only valid when adding peer"); - - errno = 0; - persistent_keepalive = strtoul(val, &endp, 0); - if (errno != 0 || *endp != '\0') - errx(1, "persistent-keepalive must be numeric (seconds)"); - if (persistent_keepalive > USHRT_MAX) - errx(1, "persistent-keepalive '%lu' too large", - persistent_keepalive); - nvlist_add_number(nvl_peer, "persistent-keepalive-interval", - persistent_keepalive); -} - -static -DECL_CMD_FUNC(setallowedips, val, d) -{ - char *base, *allowedip, *mask; - u_long ul; - char *endp; - struct allowedip aip; - nvlist_t *nvl_aip; - uint16_t family; - - if (nvl_peer == NULL) - errx(1, "setting allowed ip only valid when adding peer"); - if (allowed_ips_count == allowed_ips_max) { - allowed_ips_max *= 2; - allowed_ips = reallocarray(allowed_ips, allowed_ips_max, - sizeof(*allowed_ips)); - if (allowed_ips == NULL) - errx(1, "failed to grow allowed ip array"); - } - - allowed_ips[allowed_ips_count] = nvl_aip = nvlist_create(0); - if (nvl_aip == NULL) - errx(1, "failed to create new allowedip nvlist"); - - base = allowedip = strdup(val); - mask = index(allowedip, '/'); - if (mask == NULL) - errx(1, "mask separator not found in allowedip %s", val); - *mask = '\0'; - mask++; - - parse_ip(&aip, &family, allowedip); - ul = strtoul(mask, &endp, 0); - if (*endp != '\0') - errx(1, "invalid value for allowedip mask"); - - nvlist_add_number(nvl_aip, "cidr", ul); - if (family == AF_INET) { - nvlist_add_binary(nvl_aip, "ipv4", &aip.ip4, sizeof(aip.ip4)); - } else if (family == AF_INET6) { - nvlist_add_binary(nvl_aip, "ipv6", &aip.ip6, sizeof(aip.ip6)); - } else { - /* Shouldn't happen */ - nvlist_destroy(nvl_aip); - goto out; - } - - allowed_ips_count++; - -out: - free(base); -} - -static -DECL_CMD_FUNC(setendpoint, val, d) -{ - if (nvl_peer == NULL) - errx(1, "setting endpoint only valid when adding peer"); - parse_endpoint(val); -} - -static void -wireguard_status(int s) -{ - size_t size; - void *packed; - nvlist_t *nvl; - char buf[WG_KEY_SIZE_BASE64]; - const void *key; - uint16_t listen_port; - - if (get_nvl_out_size(s, SIOCGWG, &size)) - return; - if ((packed = malloc(size)) == NULL) - return; - if (do_cmd(s, SIOCGWG, packed, size, 0)) - return; - nvl = nvlist_unpack(packed, size, 0); - if (nvlist_exists_number(nvl, "listen-port")) { - listen_port = nvlist_get_number(nvl, "listen-port"); - printf("\tlisten-port: %d\n", listen_port); - } - if (nvlist_exists_binary(nvl, "private-key")) { - key = nvlist_get_binary(nvl, "private-key", &size); - b64_ntop((const uint8_t *)key, size, buf, WG_MAX_STRLEN); - printf("\tprivate-key: %s\n", buf); - } - if (nvlist_exists_binary(nvl, "public-key")) { - key = nvlist_get_binary(nvl, "public-key", &size); - b64_ntop((const uint8_t *)key, size, buf, WG_MAX_STRLEN); - printf("\tpublic-key: %s\n", buf); - } -} - -static struct cmd wireguard_cmds[] = { - DEF_CMD_ARG("listen-port", setwglistenport), - DEF_CMD_ARG("private-key", setwgprivkey), - /* XXX peer-list is deprecated. */ - DEF_CMD("peer-list", 0, peerlist), - DEF_CMD("peers", 0, peerlist), - DEF_CMD("peer", 0, peerstart), - DEF_CMD("-peer", 0, peerdel), - DEF_CMD_ARG("preshared-key", setwgpresharedkey), - DEF_CMD_ARG("public-key", setwgpubkey), - DEF_CMD_ARG("persistent-keepalive", setwgpersistentkeepalive), - DEF_CMD_ARG("allowed-ips", setallowedips), - DEF_CMD_ARG("endpoint", setendpoint), -}; - -static struct afswtch af_wireguard = { - .af_name = "af_wireguard", - .af_af = AF_UNSPEC, - .af_other_status = wireguard_status, -}; - -static void -wg_create(int s, struct ifreq *ifr) -{ - - setproctitle("ifconfig %s create ...\n", name); - - ifr->ifr_data = NULL; - if (ioctl(s, SIOCIFCREATE, ifr) < 0) - err(1, "SIOCIFCREATE"); -} - -static __constructor void -wireguard_ctor(void) -{ - int i; - - for (i = 0; i < nitems(wireguard_cmds); i++) - cmd_register(&wireguard_cmds[i]); - af_register(&af_wireguard); - clone_setdefcallback_prefix("wg", wg_create); -} - -#endif diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 54fd89fe7590..c29bb80c7a58 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -585,7 +585,6 @@ MAN= aac.4 \ vtnet.4 \ watchdog.4 \ ${_wbwd.4} \ - wg.4 \ witness.4 \ wlan.4 \ wlan_acl.4 \ @@ -768,7 +767,6 @@ MLINKS+=vr.4 if_vr.4 MLINKS+=vte.4 if_vte.4 MLINKS+=vtnet.4 if_vtnet.4 MLINKS+=watchdog.4 SW_WATCHDOG.4 -MLINKS+=wg.4 if_wg.4 MLINKS+=${_wpi.4} ${_if_wpi.4} MLINKS+=xl.4 if_xl.4 diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 deleted file mode 100644 index 29215bd438ff..000000000000 --- a/share/man/man4/wg.4 +++ /dev/null @@ -1,259 +0,0 @@ -.\" Copyright (c) 2020 Gordon Bergling -.\" -.\" 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$ -.\" -.Dd March 12, 2021 -.Dt WG 4 -.Os -.Sh NAME -.Nm wg -.Nd "WireGuard - pseudo-device" -.Sh SYNOPSIS -To load the driver as a module at boot time, place the following line in -.Xr loader.conf 5 : -.Bd -literal -offset indent -if_wg_load="YES" -.Ed -.Sh DESCRIPTION -The -.Nm -driver provides Virtual Private Network (VPN) interfaces for the secure -exchange of layer 3 traffic with other WireGuard peers using the WireGuard -protocol. -.Pp -A -.Nm -interface recognises one or more peers, establishes a secure tunnel with -each on demand, and tracks each peer's UDP endpoint for exchanging encrypted -traffic with. -.Pp -The interfaces can be created at runtime using the -.Ic ifconfig Cm wg Ns Ar N Cm create -command. -The interface itself can be configured with -.Xr ifconfig 8 . -.Pp -The following parameters are available: -.Bl -tag -width indent -.It Cm listen-port -The listing port of the -.Nm -interface. -.It Cm public-key -The public key of the -.Nm -interface. -.It Cm private-key -The private key of the -.Nm -interface. -.It Cm preshared-key -Defines a pre-shared key for the -.Nm -interface. -.It Cm allowed-ips -A list of allowed IP addresses. -.It Cm endpoint -The IP address of the WiredGuard to connect to. -.It Cm peers -A list of peering IP addresses to connect to. -.It Cm persistent-keepalive-interval -Interval, in seconds, at which to send persistent keepalive packets. -.El -.Pp -The -.Nm -interfaces support the following -.Xr ioctl 2 Ns s : -.Bl -tag -width Ds -offset indent -.It Dv SIOCSWG Fa "struct wg_device_io *" -Set the device configuration. -.It Dv SIOCGWG Fa "struct wg_device_io *" -Get the device configuration. -.El -.Pp -The following glossary provides a brief overview of WireGuard -terminology: -.Bl -tag -width indent -offset 3n -.It Peer -Peers exchange IPv4 or IPv6 traffic over secure tunnels. -Each -.Nm -interface may be configured to recognise one or more peers. -.It Key -Each peer uses its private key and corresponding public key to -identify itself to others. -A peer configures a -.Nm -interface with its own private key and with the public keys of its peers. -.It Pre-shared key -In addition to the public keys, each peer pair may be configured with a -unique pre-shared symmetric key. -This is used in their handshake to guard against future compromise of the -peers' encrypted tunnel if a quantum-computational attack on their -Diffie-Hellman exchange becomes feasible. *** 7633 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Mar 17 14:35:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A75156AF82; Wed, 17 Mar 2021 14:35: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 4F0t4S0mC4z4RkC; Wed, 17 Mar 2021 14:35: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 0CEEA10A05; Wed, 17 Mar 2021 14:35: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 12HEZphP025806; Wed, 17 Mar 2021 14:35:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HEZppO025805; Wed, 17 Mar 2021 14:35:51 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:35:51 GMT Message-Id: <202103171435.12HEZppO025805@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: 4fbbe523653b - main - nvme: Replace potentially long DELAY() with pause(). 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: 4fbbe523653b6d2a0186aca38224efcab941deaa Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:35:52 -0000 The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=4fbbe523653b6d2a0186aca38224efcab941deaa commit 4fbbe523653b6d2a0186aca38224efcab941deaa Author: Alexander Motin AuthorDate: 2021-03-17 14:30:40 +0000 Commit: Alexander Motin CommitDate: 2021-03-17 14:35:49 +0000 nvme: Replace potentially long DELAY() with pause(). In some cases like broken hardware nvme(4) may wait minutes for controller response before timeout. Doing so in a tight spin loop made whole system unresponsive. Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29309 Sponsored by: iXsystems, Inc. --- sys/dev/nvme/nvme_ctrlr.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 9e45c0e2d19e..b6befb2c88d0 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -255,10 +255,9 @@ nvme_ctrlr_fail_req_task(void *arg, int pending) static int nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val) { - int ms_waited; + int timeout = ticks + (uint64_t)ctrlr->ready_timeout_in_ms * hz / 1000; uint32_t csts; - ms_waited = 0; while (1) { csts = nvme_mmio_read_4(ctrlr, csts); if (csts == NVME_GONE) /* Hot unplug. */ @@ -266,12 +265,12 @@ nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val) if (((csts >> NVME_CSTS_REG_RDY_SHIFT) & NVME_CSTS_REG_RDY_MASK) == desired_val) break; - if (ms_waited++ > ctrlr->ready_timeout_in_ms) { + if (timeout - ticks < 0) { nvme_printf(ctrlr, "controller ready did not become %d " "within %d ms\n", desired_val, ctrlr->ready_timeout_in_ms); return (ENXIO); } - DELAY(1000); + pause("nvmerdy", 1); } return (0); @@ -410,7 +409,7 @@ nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr) nvme_ctrlr_disable_qpairs(ctrlr); - DELAY(100*1000); + pause("nvmehwreset", hz / 10); err = nvme_ctrlr_disable(ctrlr); if (err != 0) @@ -1536,27 +1535,26 @@ nvme_ctrlr_shutdown(struct nvme_controller *ctrlr) { uint32_t cc; uint32_t csts; - int ticks = 0, timeout; + int timeout; cc = nvme_mmio_read_4(ctrlr, cc); cc &= ~(NVME_CC_REG_SHN_MASK << NVME_CC_REG_SHN_SHIFT); cc |= NVME_SHN_NORMAL << NVME_CC_REG_SHN_SHIFT; nvme_mmio_write_4(ctrlr, cc, cc); - timeout = ctrlr->cdata.rtd3e == 0 ? 5 * hz : - ((uint64_t)ctrlr->cdata.rtd3e * hz + 999999) / 1000000; + timeout = ticks + (ctrlr->cdata.rtd3e == 0 ? 5 * hz : + ((uint64_t)ctrlr->cdata.rtd3e * hz + 999999) / 1000000); while (1) { csts = nvme_mmio_read_4(ctrlr, csts); if (csts == NVME_GONE) /* Hot unplug. */ break; if (NVME_CSTS_GET_SHST(csts) == NVME_SHST_COMPLETE) break; - if (ticks++ > timeout) { - nvme_printf(ctrlr, "did not complete shutdown within" - " %d ticks of notification\n", timeout); + if (timeout - ticks < 0) { + nvme_printf(ctrlr, "shutdown timeout\n"); break; } - pause("nvme shn", 1); + pause("nvmeshut", 1); } } @@ -1633,7 +1631,7 @@ nvme_ctrlr_suspend(struct nvme_controller *ctrlr) */ nvme_ctrlr_delete_qpairs(ctrlr); nvme_ctrlr_disable_qpairs(ctrlr); - DELAY(100*1000); + pause("nvmesusp", hz / 10); nvme_ctrlr_shutdown(ctrlr); return (0); From owner-dev-commits-src-all@freebsd.org Wed Mar 17 14:57:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52ECE56B9BF; Wed, 17 Mar 2021 14:57: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 4F0tYh1w4Xz4Tls; Wed, 17 Mar 2021 14:57: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 3497010F02; Wed, 17 Mar 2021 14:57: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 12HEviU6052515; Wed, 17 Mar 2021 14:57:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HEviWL052514; Wed, 17 Mar 2021 14:57:44 GMT (envelope-from git) Date: Wed, 17 Mar 2021 14:57:44 GMT Message-Id: <202103171457.12HEviWL052514@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: e5c6913a8d23 - main - release: sync 'git count' logic with newvers.sh 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: e5c6913a8d23ebe49c9e8f95c5236c7a0d8dbac5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 14:57:44 -0000 The branch main has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=e5c6913a8d23ebe49c9e8f95c5236c7a0d8dbac5 commit e5c6913a8d23ebe49c9e8f95c5236c7a0d8dbac5 Author: Glen Barber AuthorDate: 2021-03-17 14:57:32 +0000 Commit: Glen Barber CommitDate: 2021-03-17 14:57:32 +0000 release: sync 'git count' logic with newvers.sh Sync determining the git count with newvers.sh by adding the --first-parent argument. This ensures uname(1) reflects the file name for snapshots. Reported by: Mark Millard MFC after: 3 days Sponsored by: Rubicon Communications, LLC ("Netgate") --- release/Makefile.inc1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/Makefile.inc1 b/release/Makefile.inc1 index a97dee9994b6..99d61a45e700 100644 --- a/release/Makefile.inc1 +++ b/release/Makefile.inc1 @@ -22,7 +22,7 @@ GITREV!= ${GIT_CMD} -C ${.CURDIR} rev-parse --verify --short HEAD 2>/dev/null || . export GITREV . endif . if !defined(GITCOUNT) || empty(GITCOUNT) -GITCOUNT!= ${GIT_CMD} -C ${.CURDIR} rev-list --count HEAD 2>/dev/null || true +GITCOUNT!= ${GIT_CMD} -C ${.CURDIR} rev-list --first-parent --count HEAD 2>/dev/null || true . export GITCOUNT . endif .else From owner-dev-commits-src-all@freebsd.org Wed Mar 17 16:44:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39638570535; Wed, 17 Mar 2021 16:44: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 4F0wwQ18Szz4hkT; Wed, 17 Mar 2021 16:44: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 1A551126AB; Wed, 17 Mar 2021 16:44: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 12HGi5QU096800; Wed, 17 Mar 2021 16:44:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HGi5sB096799; Wed, 17 Mar 2021 16:44:05 GMT (envelope-from git) Date: Wed, 17 Mar 2021 16:44:05 GMT Message-Id: <202103171644.12HGi5sB096799@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: e9f029831fa5 - main - fix panic when rescue retransmission and FIN overlap 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: e9f029831fa5747ae1b405f5716c52cb4ebf1e04 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 16:44:06 -0000 The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=e9f029831fa5747ae1b405f5716c52cb4ebf1e04 commit e9f029831fa5747ae1b405f5716c52cb4ebf1e04 Author: Richard Scheffenegger AuthorDate: 2021-03-17 15:44:29 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-17 16:12:04 +0000 fix panic when rescue retransmission and FIN overlap PR: 254244 PR: 254309 Reviewed By: #transport, hselasky, tuexen MFC after: 3 days Sponsored By: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29315 --- sys/netinet/tcp_sack.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index 37db30007580..f8d983da723b 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -831,8 +831,18 @@ tcp_sack_partialack(struct tcpcb *tp, struct tcphdr *th) (tp->snd_recover == tp->snd_max) && TAILQ_EMPTY(&tp->snd_holes) && (tp->sackhint.delivered_data > 0)) { - struct sackhole *hole; - hole = tcp_sackhole_insert(tp, SEQ_MAX(th->th_ack, tp->snd_max - maxseg), tp->snd_max, NULL); + /* + * Exclude FIN sequence space in + * the hole for the rescue retransmission, + * and also don't create a hole, if only + * the ACK for a FIN is outstanding. + */ + tcp_seq highdata = tp->snd_max; + if (tp->t_flags & TF_SENTFIN) + highdata--; + if (th->th_ack != highdata) + (void)tcp_sackhole_insert(tp, SEQ_MAX(th->th_ack, + highdata - maxseg), highdata, NULL); } (void) tp->t_fb->tfb_tcp_output(tp); } From owner-dev-commits-src-all@freebsd.org Wed Mar 17 19:21:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE24E575BC2; Wed, 17 Mar 2021 19:21: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 4F10Py628tz3C3p; Wed, 17 Mar 2021 19:21: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 C1F86145D6; Wed, 17 Mar 2021 19:21: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 12HJLQxr007698; Wed, 17 Mar 2021 19:21:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HJLQNJ007697; Wed, 17 Mar 2021 19:21:26 GMT (envelope-from git) Date: Wed, 17 Mar 2021 19:21:26 GMT Message-Id: <202103171921.12HJLQNJ007697@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: 9f2e5184173f - main - pfsync: Unconditionally push packets when requesting state updates 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: 9f2e5184173f6af70306678b018270df9a9600f2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 19:21:26 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=9f2e5184173f6af70306678b018270df9a9600f2 commit 9f2e5184173f6af70306678b018270df9a9600f2 Author: Thomas Kurschel AuthorDate: 2021-03-15 13:28:52 +0000 Commit: Kristof Provost CommitDate: 2021-03-17 18:18:14 +0000 pfsync: Unconditionally push packets when requesting state updates When we request a bulk sync we need to ensure we actually send out that request, not just buffer it until we have enough data to send a full packet. PR: 254236 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29271 --- sys/netpfil/pf/if_pfsync.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index cf2ff2ef0926..06bad556e885 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1960,7 +1960,7 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) nlen += sizeof(struct pfsync_subheader); if (b->b_len + nlen > sc->sc_ifp->if_mtu) { - pfsync_sendout(1, 0); + pfsync_sendout(0, 0); nlen = sizeof(struct pfsync_subheader) + sizeof(struct pfsync_upd_req); @@ -1968,6 +1968,8 @@ pfsync_request_update(u_int32_t creatorid, u_int64_t id) TAILQ_INSERT_TAIL(&b->b_upd_req_list, item, ur_entry); b->b_len += nlen; + + pfsync_push(b); } static bool From owner-dev-commits-src-all@freebsd.org Wed Mar 17 19:21:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DD165757F9; Wed, 17 Mar 2021 19:21: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 4F10Q00GCRz3Bsl; Wed, 17 Mar 2021 19:21: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 E67AE145D7; Wed, 17 Mar 2021 19:21: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 12HJLRFW007719; Wed, 17 Mar 2021 19:21:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HJLRdF007718; Wed, 17 Mar 2021 19:21:27 GMT (envelope-from git) Date: Wed, 17 Mar 2021 19:21:27 GMT Message-Id: <202103171921.12HJLRdF007718@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: 8ad7d25dfc80 - main - pf tests: pfsync bulk update test 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: 8ad7d25dfc808ca00300f7553a9b28dfc0e99c18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 19:21:28 -0000 The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8ad7d25dfc808ca00300f7553a9b28dfc0e99c18 commit 8ad7d25dfc808ca00300f7553a9b28dfc0e99c18 Author: Kristof Provost AuthorDate: 2021-03-15 13:10:55 +0000 Commit: Kristof Provost CommitDate: 2021-03-17 18:18:14 +0000 pf tests: pfsync bulk update test Test that pfsync works as expected with bulk updates. That is, create some state before setting up the second firewall. Let that firewall request a bulk update so it can catch up, and check that it got the state which was created before it enable pfsync. PR: 254236 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D29272 --- tests/sys/netpfil/pf/pfsync.sh | 68 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/tests/sys/netpfil/pf/pfsync.sh b/tests/sys/netpfil/pf/pfsync.sh index d8cb0a13efb7..a6fc7ec9f7e9 100644 --- a/tests/sys/netpfil/pf/pfsync.sh +++ b/tests/sys/netpfil/pf/pfsync.sh @@ -112,8 +112,76 @@ defer_cleanup() pfsynct_cleanup } +atf_test_case "bulk" "cleanup" +bulk_head() +{ + atf_set descr 'Test bulk updates' + atf_set require.user root +} + +bulk_body() +{ + pfsynct_init + + epair_sync=$(vnet_mkepair) + epair_one=$(vnet_mkepair) + epair_two=$(vnet_mkepair) + + vnet_mkjail one ${epair_one}a ${epair_sync}a + vnet_mkjail two ${epair_two}a ${epair_sync}b + + # pfsync interface + jexec one ifconfig ${epair_sync}a 192.0.2.1/24 up + jexec one ifconfig ${epair_one}a 198.51.100.1/24 up + jexec one ifconfig pfsync0 \ + syncdev ${epair_sync}a \ + maxupd 1\ + up + jexec two ifconfig ${epair_two}a 198.51.100.2/24 up + jexec two ifconfig ${epair_sync}b 192.0.2.2/24 up + + # Enable pf + jexec one pfctl -e + pft_set_rules one \ + "set skip on ${epair_sync}a" \ + "pass keep state" + jexec two pfctl -e + pft_set_rules two \ + "set skip on ${epair_sync}b" \ + "pass keep state" + + ifconfig ${epair_one}b 198.51.100.254/24 up + + # Create state prior to setting up pfsync + ping -c 1 -S 198.51.100.254 198.51.100.1 + + # Wait before setting up pfsync on two, so we don't accidentally catch + # the update anyway. + sleep 1 + + # Now set up pfsync in jail two + jexec two ifconfig pfsync0 \ + syncdev ${epair_sync}b \ + up + + # Give pfsync time to do its thing + sleep 2 + + jexec two pfctl -s states + if ! jexec two pfctl -s states | grep icmp | grep 198.51.100.1 | \ + grep 198.51.100.2 ; then + atf_fail "state not found on synced host" + fi +} + +bulk_cleanup() +{ + pfsynct_cleanup +} + atf_init_test_cases() { atf_add_test_case "basic" atf_add_test_case "defer" + atf_add_test_case "bulk" } From owner-dev-commits-src-all@freebsd.org Wed Mar 17 19:32:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 528075763AD; Wed, 17 Mar 2021 19:32: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 4F10gB6Bwpz3Cyg; Wed, 17 Mar 2021 19:32:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CD2F14469; Wed, 17 Mar 2021 19:32:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HJWrtf021531; Wed, 17 Mar 2021 19:32:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HJWrBH021530; Wed, 17 Mar 2021 19:32:53 GMT (envelope-from git) Date: Wed, 17 Mar 2021 19:32:53 GMT Message-Id: <202103171932.12HJWrBH021530@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Richard Scheffenegger Subject: git: 703419774f86 - stable/13 - fix panic when rescue retransmission and FIN overlap MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 703419774f86525a2441d615733993a6fddcd047 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 19:32:56 -0000 The branch stable/13 has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=703419774f86525a2441d615733993a6fddcd047 commit 703419774f86525a2441d615733993a6fddcd047 Author: Richard Scheffenegger AuthorDate: 2021-03-17 15:44:29 +0000 Commit: Richard Scheffenegger CommitDate: 2021-03-17 19:05:33 +0000 fix panic when rescue retransmission and FIN overlap PR: 254244 PR: 254309 Reviewed By: #transport, hselasky, tuexen Approved by: re (cperciva) MFC after: immediately Sponsored By: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D29315 (cherry picked from commit e9f029831fa5747ae1b405f5716c52cb4ebf1e04) --- sys/netinet/tcp_sack.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index 37db30007580..f8d983da723b 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -831,8 +831,18 @@ tcp_sack_partialack(struct tcpcb *tp, struct tcphdr *th) (tp->snd_recover == tp->snd_max) && TAILQ_EMPTY(&tp->snd_holes) && (tp->sackhint.delivered_data > 0)) { - struct sackhole *hole; - hole = tcp_sackhole_insert(tp, SEQ_MAX(th->th_ack, tp->snd_max - maxseg), tp->snd_max, NULL); + /* + * Exclude FIN sequence space in + * the hole for the rescue retransmission, + * and also don't create a hole, if only + * the ACK for a FIN is outstanding. + */ + tcp_seq highdata = tp->snd_max; + if (tp->t_flags & TF_SENTFIN) + highdata--; + if (th->th_ack != highdata) + (void)tcp_sackhole_insert(tp, SEQ_MAX(th->th_ack, + highdata - maxseg), highdata, NULL); } (void) tp->t_fb->tfb_tcp_output(tp); } From owner-dev-commits-src-all@freebsd.org Wed Mar 17 20:20:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DF19577D8C; Wed, 17 Mar 2021 20:20: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 4F11k11wPgz3H6k; Wed, 17 Mar 2021 20:20: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 307531503D; Wed, 17 Mar 2021 20:20:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HKKPQv082866; Wed, 17 Mar 2021 20:20:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HKKPB1082865; Wed, 17 Mar 2021 20:20:25 GMT (envelope-from git) Date: Wed, 17 Mar 2021 20:20:25 GMT Message-Id: <202103172020.12HKKPB1082865@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: 0723b409150a - main - aarch64: Clear TLS registers during exec(). 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: 0723b409150ae302eb021cbde86a5f77348a1bb4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 20:20:25 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=0723b409150ae302eb021cbde86a5f77348a1bb4 commit 0723b409150ae302eb021cbde86a5f77348a1bb4 Author: John Baldwin AuthorDate: 2021-03-17 20:19:04 +0000 Commit: John Baldwin CommitDate: 2021-03-17 20:19:04 +0000 aarch64: Clear TLS registers during exec(). These are not stored in the trapframe so must be cleared explicitly. This is similar to one of the MIPS changes in 822d2d6ac94f. Reviewed by: andrew Obtained from: CheriBSD MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D28711 --- sys/arm64/arm64/machdep.c | 5 +++++ sys/arm64/linux/linux_sysvec.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 91f0a31ebe36..97f97392e43f 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -561,6 +561,11 @@ exec_setregs(struct thread *td, struct image_params *imgp, uintptr_t stack) tf->tf_lr = imgp->entry_addr; tf->tf_elr = imgp->entry_addr; + td->td_pcb->pcb_tpidr_el0 = 0; + td->td_pcb->pcb_tpidrro_el0 = 0; + WRITE_SPECIALREG(tpidrro_el0, 0); + WRITE_SPECIALREG(tpidr_el0, 0); + #ifdef VFP vfp_reset_state(td, pcb); #endif diff --git a/sys/arm64/linux/linux_sysvec.c b/sys/arm64/linux/linux_sysvec.c index 67feacfa876b..df16db4040a7 100644 --- a/sys/arm64/linux/linux_sysvec.c +++ b/sys/arm64/linux/linux_sysvec.c @@ -365,6 +365,11 @@ linux_exec_setregs(struct thread *td, struct image_params *imgp, #endif regs->tf_elr = imgp->entry_addr; + td->td_pcb->pcb_tpidr_el0 = 0; + td->td_pcb->pcb_tpidrro_el0 = 0; + WRITE_SPECIALREG(tpidrro_el0, 0); + WRITE_SPECIALREG(tpidr_el0, 0); + #ifdef VFP vfp_reset_state(td, td->td_pcb); #endif From owner-dev-commits-src-all@freebsd.org Wed Mar 17 20:48:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C9939578C94; Wed, 17 Mar 2021 20:48:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F12Ld453dz3KK1; Wed, 17 Mar 2021 20:48: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 7F39E15A06; Wed, 17 Mar 2021 20:48: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 12HKmf6o014645; Wed, 17 Mar 2021 20:48:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HKmfsJ014644; Wed, 17 Mar 2021 20:48:41 GMT (envelope-from git) Date: Wed, 17 Mar 2021 20:48:41 GMT Message-Id: <202103172048.12HKmfsJ014644@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: 5be27cbf16c8 - main - arm64: implement COMPAT_FREEBSD32 fill/set dbregs/fpregs 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: 5be27cbf16c85ce95d21db57349f61494f851821 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 20:48:41 -0000 The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=5be27cbf16c85ce95d21db57349f61494f851821 commit 5be27cbf16c85ce95d21db57349f61494f851821 Author: Ed Maste AuthorDate: 2021-03-17 14:10:41 +0000 Commit: Ed Maste CommitDate: 2021-03-17 20:46:50 +0000 arm64: implement COMPAT_FREEBSD32 fill/set dbregs/fpregs On FreeBSD/arm fill_fpregs, fill_dbregs are stubs that zero the reg struct and return success. set_fpregs and set_dbregs do nothing and return success. Provide the same implementation for arm64 COMPAT_FREEBSD32. Reviewed by: andrew MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29314 --- sys/arm64/arm64/machdep.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 97f97392e43f..8a1e7520aacb 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -489,36 +489,35 @@ set_regs32(struct thread *td, struct reg32 *regs) return (0); } +/* XXX fill/set dbregs/fpregs are stubbed on 32-bit arm. */ int fill_fpregs32(struct thread *td, struct fpreg32 *regs) { - printf("ARM64TODO: fill_fpregs32"); - return (EDOOFUS); + memset(regs, 0, sizeof(*regs)); + return (0); } int set_fpregs32(struct thread *td, struct fpreg32 *regs) { - printf("ARM64TODO: set_fpregs32"); - return (EDOOFUS); + return (0); } int fill_dbregs32(struct thread *td, struct dbreg32 *regs) { - printf("ARM64TODO: fill_dbregs32"); - return (EDOOFUS); + memset(regs, 0, sizeof(*regs)); + return (0); } int set_dbregs32(struct thread *td, struct dbreg32 *regs) { - printf("ARM64TODO: set_dbregs32"); - return (EDOOFUS); + return (0); } #endif From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:22:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDC5757AAD8; Wed, 17 Mar 2021 22:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F14RP5zglz3QCQ; Wed, 17 Mar 2021 22:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C02AA16A26; Wed, 17 Mar 2021 22:22:57 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HMMvZV045822; Wed, 17 Mar 2021 22:22:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMMvZO045821; Wed, 17 Mar 2021 22:22:57 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:22:57 GMT Message-Id: <202103172222.12HMMvZO045821@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: eb52de783a1c - stable/13 - tests/sys/audit: Avoid race caused by starting auditd(8) for testing MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: eb52de783a1c079b2ef4d674090322886cc22fc0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:22:57 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=eb52de783a1c079b2ef4d674090322886cc22fc0 commit eb52de783a1c079b2ef4d674090322886cc22fc0 Author: Alex Richardson AuthorDate: 2021-02-18 10:14:27 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 22:22:48 +0000 tests/sys/audit: Avoid race caused by starting auditd(8) for testing In the CheriBSD CI we reproducibly see the first test in sys/audit (administrative:acct_failure) fail due to a missing startup message. It appears this is caused by a race condition when starting auditd: `service auditd onestart` returns as soon as the initial auditd() parent exits (after the daemon(3) call). We can avoid this problem by setting up the auditd infrastructure in-process: libauditd contains audit_quick_{start,stop}() functions that look like they are ideally suited to this task. This patch also avoids forking lots of shell processes for each of the 418 tests by using `auditon(A_SENDTRIGGER, &trigger, sizeof(trigger))` to check for a running auditd(8) instead of using `service auditd onestatus`. With these two changes (and D28388 to fix the XFAIL'd test) I can now boot and run `cd /usr/tests/sys/audit && kyua test` without any failures in a single-core QEMU instance. Before there would always be at least one failed test. Besides making the tests more reliable in CI, a nice side-effect of this change is that it also significantly speeds up running them by avoiding lots of fork()/execve() caused by shell scripts: Running kyua test on an AArch64 QEMU took 315s before and now takes 68s, so it's roughly 3.5 times faster. This effect is even larger when running on a CHERI-RISC-V QEMU since emulating CHERI instructions on an x86 host is noticeably slower than emulating AArch64. Test Plan: aarch64+amd64 QEMU no longer fail. Reviewed By: asomers Differential Revision: https://reviews.freebsd.org/D28451 (cherry picked from commit df093aa9463b2121d8307fb91c4ba7cf17f4ea64) --- tests/sys/audit/Makefile | 9 +++++ tests/sys/audit/administrative.c | 10 ++++- tests/sys/audit/utils.c | 86 +++++++++++++++++++++++++++++++++++----- 3 files changed, 93 insertions(+), 12 deletions(-) diff --git a/tests/sys/audit/Makefile b/tests/sys/audit/Makefile index 215740020eb5..4cacd86d009a 100644 --- a/tests/sys/audit/Makefile +++ b/tests/sys/audit/Makefile @@ -48,11 +48,20 @@ SRCS.miscellaneous+= utils.c TEST_METADATA+= timeout="30" TEST_METADATA+= required_user="root" +# Only one process can be auditing, if we attempt to run these tests in parallel +# some of them will fail to start auditing. +# TODO: it would be nice to be able to run them in parallel with other non-audit +# tests using some internal form of synchronization. +# TODO: In addititon to test failures, running in parallel can trigger a kernel +# panic: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253616 TEST_METADATA+= is_exclusive="true" TEST_METADATA+= required_files="/etc/rc.d/auditd /dev/auditpipe" MK_PIE:= no # XXX libprivateauditd.a is not PIE LDFLAGS+= -lbsm -lutil +OPENBSMDIR=${SRCTOP}/contrib/openbsm +CFLAGS+= -I${OPENBSMDIR} +LDADD+= ${LIBAUDITD} CFLAGS.process-control.c+= -I${SRCTOP}/tests diff --git a/tests/sys/audit/administrative.c b/tests/sys/audit/administrative.c index 4ec73f4710e0..d75f6147cdf4 100644 --- a/tests/sys/audit/administrative.c +++ b/tests/sys/audit/administrative.c @@ -341,10 +341,16 @@ ATF_TC_CLEANUP(auditctl_success, tc) * at the configured path. To reset this, we need to stop and start the * auditd(8) again. Here, we check if auditd(8) was running already * before the test started. If so, we stop and start it again. + * + * TODO: should we skip this test if auditd(8) is already running to + * avoid restarting it? */ - system("service auditd onestop > /dev/null 2>&1"); - if (!atf_utils_file_exists("started_auditd")) + if (!atf_utils_file_exists("started_fake_auditd")) { + system("service auditd onestop > /dev/null 2>&1"); system("service auditd onestart > /dev/null 2>&1"); + } else { + cleanup(); + } } diff --git a/tests/sys/audit/utils.c b/tests/sys/audit/utils.c index be31f4138412..e94279ff93bf 100644 --- a/tests/sys/audit/utils.c +++ b/tests/sys/audit/utils.c @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -222,13 +223,44 @@ skip_if_extattr_not_supported(const char *path) } } -FILE -*setup(struct pollfd fd[], const char *name) +static bool +is_auditd_running(void) +{ + int trigger; + int err; + + /* + * AUDIT_TRIGGER_INITIALIZE is a no-op message on FreeBSD and can + * therefore be used to check whether auditd has already been started. + * This is significantly cheaper than running `service auditd onestatus` + * for each test case. It is also slightly less racy since it will only + * return true once auditd() has opened the trigger file rather than + * just when the pidfile has been created. + */ + trigger = AUDIT_TRIGGER_INITIALIZE; + err = auditon(A_SENDTRIGGER, &trigger, sizeof(trigger)); + if (err == 0) { + fprintf(stderr, "auditd(8) is running.\n"); + return (true); + } else { + /* + * A_SENDTRIGGER returns ENODEV if auditd isn't listening, + * all other error codes indicate a fatal error. + */ + ATF_REQUIRE_MSG(errno == ENODEV, + "Unexpected error from auditon(2): %s", strerror(errno)); + return (false); + } + +} + +FILE * +setup(struct pollfd fd[], const char *name) { au_mask_t fmask, nomask; + FILE *pipestream; fmask = get_audit_mask(name); nomask = get_audit_mask("no"); - FILE *pipestream; ATF_REQUIRE((fd[0].fd = open("/dev/auditpipe", O_RDONLY)) != -1); ATF_REQUIRE((pipestream = fdopen(fd[0].fd, "r")) != NULL); @@ -244,12 +276,39 @@ FILE /* Set local preselection audit_class as "no" for audit startup */ set_preselect_mode(fd[0].fd, &nomask); - ATF_REQUIRE_EQ(0, system("service auditd onestatus || \ - { service auditd onestart && touch started_auditd ; }")); - - /* If 'started_auditd' exists, that means we started auditd(8) */ - if (atf_utils_file_exists("started_auditd")) + if (!is_auditd_running()) { + fprintf(stderr, "Running audit_quick_start() for testing... "); + /* + * Previously, this test started auditd using + * `service auditd onestart`. However, there is a race condition + * there since service can return before auditd(8) has + * fully started (once the daemon parent process has forked) + * and this can cause check_audit_startup() to fail sometimes. + * + * In the CheriBSD CI this caused the first test executed by + * kyua (administrative:acct_failure) to fail every time, but + * subsequent ones would almost always succeed. + * + * To avoid this problem (and as a nice side-effect this speeds + * up the test quite a bit), we register this process as a + * "fake" auditd(8) using the audit_quick_start() function from + * libauditd. + */ + atf_utils_create_file("started_fake_auditd", "yes\n"); + ATF_REQUIRE(atf_utils_file_exists("started_fake_auditd")); + ATF_REQUIRE_EQ_MSG(0, audit_quick_start(), + "Failed to start fake auditd: %m"); + fprintf(stderr, "done.\n"); + /* audit_quick_start() should log an audit start event. */ check_audit_startup(fd, "audit startup", pipestream); + /* + * If we exit cleanly shutdown audit_quick_start(), if not + * cleanup() will take care of it. + * This is not required, but makes it easier to run individual + * tests outside of kyua. + */ + atexit(cleanup); + } /* Set local preselection parameters specific to "name" audit_class */ set_preselect_mode(fd[0].fd, &fmask); @@ -259,6 +318,13 @@ FILE void cleanup(void) { - if (atf_utils_file_exists("started_auditd")) - system("service auditd onestop > /dev/null 2>&1"); + if (atf_utils_file_exists("started_fake_auditd")) { + fprintf(stderr, "Running audit_quick_stop()... "); + if (audit_quick_stop() != 0) { + fprintf(stderr, "Failed to stop fake auditd: %m\n"); + abort(); + } + fprintf(stderr, "done.\n"); + unlink("started_fake_auditd"); + } } From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:22:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C52357AB4D; Wed, 17 Mar 2021 22:22: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 4F14RQ71TLz3QCS; Wed, 17 Mar 2021 22:22: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 E42AE16DD8; Wed, 17 Mar 2021 22:22: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 12HMMwMJ045842; Wed, 17 Mar 2021 22:22:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMMwX9045841; Wed, 17 Mar 2021 22:22:58 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:22:58 GMT Message-Id: <202103172222.12HMMwX9045841@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 6805e948c4ce - stable/13 - close_range: add audit support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6805e948c4cecae74887fd6a4a08cf15c2f3061c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:22:59 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=6805e948c4cecae74887fd6a4a08cf15c2f3061c commit 6805e948c4cecae74887fd6a4a08cf15c2f3061c Author: Alex Richardson AuthorDate: 2021-02-23 17:47:07 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 22:22:48 +0000 close_range: add audit support This fixes the closefrom test in sys/audit. Includes cherry-picks of the following commits from openbsm: https://github.com/openbsm/openbsm/commit/4dfc628aafe589d68848f7033f3d3488c4d979e0 https://github.com/openbsm/openbsm/commit/99ff6fe32aebc5a4b8d40d60062b8574697df557 https://github.com/openbsm/openbsm/commit/da48a0399e95448693d3fa2be48454ca564c1be8 Reviewed By: kevans Differential Revision: https://reviews.freebsd.org/D28388 (cherry picked from commit fa32350347b4e351a144b5423f0fb2ca9d67f4ca) --- contrib/openbsm/etc/audit_event | 2 ++ contrib/openbsm/sys/bsm/audit_kevents.h | 2 ++ sys/kern/kern_descrip.c | 4 ++++ sys/security/audit/audit_bsm.c | 15 +++++++++++++++ tests/sys/audit/file-close.c | 4 ++-- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/contrib/openbsm/etc/audit_event b/contrib/openbsm/etc/audit_event index b397674564c6..be3557597eee 100644 --- a/contrib/openbsm/etc/audit_event +++ b/contrib/openbsm/etc/audit_event @@ -614,6 +614,8 @@ 43261:AUE_LGETUUID:lgetuuid(2):ip 43262:AUE_EXECVEAT:execveat(2):pc,ex 43263:AUE_SHMRENAME:shm_rename(2):ip +43264:AUE_REALPATHAT:realpathat(2):fa +43265:AUE_CLOSERANGE:close_range(2):cl # # Solaris userspace events. # diff --git a/contrib/openbsm/sys/bsm/audit_kevents.h b/contrib/openbsm/sys/bsm/audit_kevents.h index afa8c0f37a31..ec51f501e3a7 100644 --- a/contrib/openbsm/sys/bsm/audit_kevents.h +++ b/contrib/openbsm/sys/bsm/audit_kevents.h @@ -653,6 +653,8 @@ #define AUE_LGETUUID 43261 /* CADETS. */ #define AUE_EXECVEAT 43262 /* FreeBSD/Linux. */ #define AUE_SHMRENAME 43263 /* FreeBSD-specific. */ +#define AUE_REALPATHAT 43264 /* FreeBSD-specific. */ +#define AUE_CLOSERANGE 43265 /* FreeBSD-specific. */ /* * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 0813b6c8f3b8..67350f4ad71e 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -1422,6 +1422,10 @@ int sys_close_range(struct thread *td, struct close_range_args *uap) { + AUDIT_ARG_FD(uap->lowfd); + AUDIT_ARG_CMD(uap->highfd); + AUDIT_ARG_FFLAGS(uap->flags); + /* No flags currently defined */ if (uap->flags != 0) return (EINVAL); diff --git a/sys/security/audit/audit_bsm.c b/sys/security/audit/audit_bsm.c index 6742470c9578..d350ef3cf3c2 100644 --- a/sys/security/audit/audit_bsm.c +++ b/sys/security/audit/audit_bsm.c @@ -941,6 +941,21 @@ kaudit_to_bsm(struct kaudit_record *kar, struct au_record **pau) } break; + case AUE_CLOSERANGE: + if (ARG_IS_VALID(kar, ARG_FD)) { + tok = au_to_arg32(1, "lowfd", ar->ar_arg_fd); + kau_write(rec, tok); + } + if (ARG_IS_VALID(kar, ARG_CMD)) { + tok = au_to_arg32(2, "highfd", ar->ar_arg_cmd); + kau_write(rec, tok); + } + if (ARG_IS_VALID(kar, ARG_FFLAGS)) { + tok = au_to_arg32(3, "flags", ar->ar_arg_fflags); + kau_write(rec, tok); + } + break; + case AUE_CORE: if (ARG_IS_VALID(kar, ARG_SIGNUM)) { tok = au_to_arg32(1, "signal", ar->ar_arg_signum); diff --git a/tests/sys/audit/file-close.c b/tests/sys/audit/file-close.c index 54d0e60977e3..f85a8e39b67d 100644 --- a/tests/sys/audit/file-close.c +++ b/tests/sys/audit/file-close.c @@ -154,10 +154,10 @@ ATF_TC_HEAD(closefrom_success, tc) ATF_TC_BODY(closefrom_success, tc) { - const char *regex = "closefrom.*return,success"; + const char *regex = "close_range\\(2\\),.*,0x7fffffff,lowfd,.*" + "0xffffffff,highfd,.*return,success"; FILE *pipefd = setup(fds, auclass); - atf_tc_expect_fail("closefrom was converted to close_range"); /* closefrom(2) returns 'void' */ closefrom(INT_MAX); check_audit(fds, regex, pipefd); From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:23:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E92B857AD31; Wed, 17 Mar 2021 22:23:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F14RS24YHz3QLD; Wed, 17 Mar 2021 22:23: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 1CC32169C2; Wed, 17 Mar 2021 22:23: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 12HMMxAu045863; Wed, 17 Mar 2021 22:22:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMMxJs045862; Wed, 17 Mar 2021 22:22:59 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:22:59 GMT Message-Id: <202103172222.12HMMxJs045862@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 5d89c2e475f2 - stable/13 - tests/sys/audit: add missing comma delimiter between fields MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 5d89c2e475f2c4d9ff5bab3e229d31c4f2ac950f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:23:01 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=5d89c2e475f2c4d9ff5bab3e229d31c4f2ac950f commit 5d89c2e475f2c4d9ff5bab3e229d31c4f2ac950f Author: Alex Richardson AuthorDate: 2021-03-02 18:34:42 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 22:22:48 +0000 tests/sys/audit: add missing comma delimiter between fields This makes the `kyua report --verbose` output a lot easier to parse when looking at failed tests. It also fixes the closefrom() test since I tested my changes with this commit but forgot to push it together with fa32350347b4e351a144b5423f0fb2ca9d67f4ca. Fixes: fa32350347b4 ("close_range: add audit support") (cherry picked from commit c97304110a02f9c41b515e7b94d53229ab8f61af) --- tests/sys/audit/utils.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/sys/audit/utils.c b/tests/sys/audit/utils.c index e94279ff93bf..7b0c3445c253 100644 --- a/tests/sys/audit/utils.c +++ b/tests/sys/audit/utils.c @@ -79,6 +79,7 @@ get_records(const char *auditregex, FILE *pipestream) /* Print the tokens as they are obtained, in the default form */ au_print_flags_tok(memstream, &token, del, AU_OFLAG_NONE); + fputc(',', memstream); bytes += token.len; } From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:23:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16A6C57ADA7; Wed, 17 Mar 2021 22:23: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 4F14RW5dtCz3Q9J; Wed, 17 Mar 2021 22:23: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 6813516AC3; Wed, 17 Mar 2021 22:23: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 12HMN3CK045925; Wed, 17 Mar 2021 22:23:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMN3gl045924; Wed, 17 Mar 2021 22:23:03 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:23:03 GMT Message-Id: <202103172223.12HMN3gl045924@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 760cf46f3e40 - stable/13 - tests/sys/netgraph: Tell kyua that perl is required MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 760cf46f3e40c879f2f3efde3821419dbf32915d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:23:06 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=760cf46f3e40c879f2f3efde3821419dbf32915d commit 760cf46f3e40c879f2f3efde3821419dbf32915d Author: Alex Richardson AuthorDate: 2021-02-23 17:02:31 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 22:22:49 +0000 tests/sys/netgraph: Tell kyua that perl is required Otherwise these tests fail with incomprehensible error messages. Reviewed By: kp Differential Revision: https://reviews.freebsd.org/D28894 (cherry picked from commit 3775ddcf5a12c8e23970e94b7b165bf23c92aeba) --- tests/sys/netgraph/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/sys/netgraph/Makefile b/tests/sys/netgraph/Makefile index e370fad97df4..aef190bbe178 100644 --- a/tests/sys/netgraph/Makefile +++ b/tests/sys/netgraph/Makefile @@ -7,7 +7,8 @@ BINDIR= ${TESTSDIR} TAP_TESTS_SH+= ng_macfilter_test -TEST_METADATA.runtests+= required_user="root" +TEST_METADATA.ng_macfilter_test+= required_user="root" +TEST_METADATA.ng_macfilter_test+= required_programs="perl" MAN= From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:23:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7376A57ADAA; Wed, 17 Mar 2021 22:23: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 4F14RW3b8Jz3QFZ; Wed, 17 Mar 2021 22:23: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 5BF4016A27; Wed, 17 Mar 2021 22:23: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 12HMN2MC045905; Wed, 17 Mar 2021 22:23:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMN2tV045904; Wed, 17 Mar 2021 22:23:02 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:23:02 GMT Message-Id: <202103172223.12HMN2tV045904@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 3150732abb62 - stable/13 - tests/sys/netpfil/pf: Add missing python3 requirements MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3150732abb620cb17a918092e73b9fd9198f80d2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:23:07 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=3150732abb620cb17a918092e73b9fd9198f80d2 commit 3150732abb620cb17a918092e73b9fd9198f80d2 Author: Alex Richardson AuthorDate: 2021-02-23 19:04:01 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 22:22:49 +0000 tests/sys/netpfil/pf: Add missing python3 requirements This also fixes a typo in the dup test that caused the head function to not be called. On my test system without python3 the tests are now skipped instead of failing. Reviewed By: kp Differential Revision: https://reviews.freebsd.org/D28903 (cherry picked from commit 98202829d1b3727a8706f45d052fc9e9507b562b) --- tests/sys/netpfil/pf/checksum.sh | 1 + tests/sys/netpfil/pf/dup.sh | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/sys/netpfil/pf/checksum.sh b/tests/sys/netpfil/pf/checksum.sh index 778ae1cd6e9f..836bc1233963 100644 --- a/tests/sys/netpfil/pf/checksum.sh +++ b/tests/sys/netpfil/pf/checksum.sh @@ -32,6 +32,7 @@ unaligned_head() { atf_set descr 'Test unaligned checksum updates' atf_set require.user root + atf_set require.progs scapy } unaligned_body() diff --git a/tests/sys/netpfil/pf/dup.sh b/tests/sys/netpfil/pf/dup.sh index 7b9a91804e96..3b3bef976fc2 100644 --- a/tests/sys/netpfil/pf/dup.sh +++ b/tests/sys/netpfil/pf/dup.sh @@ -30,10 +30,11 @@ common_dir=$(atf_get_srcdir)/../common atf_test_case "dup_to" "cleanup" -do_to_head() +dup_to_head() { atf_set descr 'dup-to test' atf_set require.user root + atf_set require.progs scapy } dup_to_body() From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:23:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32C9657AF8E; Wed, 17 Mar 2021 22:23: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 4F14RT6fYFz3QWX; Wed, 17 Mar 2021 22:23: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 34C671697A; Wed, 17 Mar 2021 22:23: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 12HMN14X045885; Wed, 17 Mar 2021 22:23:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMN1iG045884; Wed, 17 Mar 2021 22:23:01 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:23:01 GMT Message-Id: <202103172223.12HMN1iG045884@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 2556fce493ab - stable/13 - Silence a macro-redefined warning when crossbuilding MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2556fce493ab586e287ea690532fc0c89d488d4b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:23:05 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=2556fce493ab586e287ea690532fc0c89d488d4b commit 2556fce493ab586e287ea690532fc0c89d488d4b Author: Alex Richardson AuthorDate: 2021-03-01 14:11:20 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 22:22:48 +0000 Silence a macro-redefined warning when crossbuilding This is already defined by the ncurses headers, so just undef it before defining it again. (cherry picked from commit 10f2a0c2e8766e9878ad4181f555d8dda84da34e) --- tools/build/cross-build/include/common/string.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/build/cross-build/include/common/string.h b/tools/build/cross-build/include/common/string.h index dd039d54583e..8a33f4d4ff19 100644 --- a/tools/build/cross-build/include/common/string.h +++ b/tools/build/cross-build/include/common/string.h @@ -38,7 +38,9 @@ #pragma once /* Avoid incompatible opensolaris redeclarations (without _FORTIFY_SOURCE). */ +#undef HAVE_STRLCAT #define HAVE_STRLCAT 1 +#undef HAVE_STRLCPY #define HAVE_STRLCPY 1 #include_next From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:23:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4174F57B018; Wed, 17 Mar 2021 22:23: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 4F14Rh2B2Sz3QLv; Wed, 17 Mar 2021 22: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 5BBF116A28; Wed, 17 Mar 2021 22:23: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 12HMNAPN046049; Wed, 17 Mar 2021 22:23:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMNAJe046048; Wed, 17 Mar 2021 22:23:10 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:23:10 GMT Message-Id: <202103172223.12HMNAJe046048@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 61271e7bba67 - stable/13 - tests/sys/cddl: correctly quote atf_set "require.progs" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 61271e7bba67be5bff350c2ab88eed25d46ca061 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:23:18 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=61271e7bba67be5bff350c2ab88eed25d46ca061 commit 61271e7bba67be5bff350c2ab88eed25d46ca061 Author: Alex Richardson AuthorDate: 2021-03-08 09:38:24 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 22:22:50 +0000 tests/sys/cddl: correctly quote atf_set "require.progs" The argument has to be a single whitespace-separate value. While touching all these lines also add ksh93, since `atf_set "require.progs"` overrides the default value specified in the Kyuafile. This then results in tests being executed despite ksh93 not being installed. Reviewed By: asomers Differential Revision: https://reviews.freebsd.org/D29066 (cherry picked from commit 0b86424c31ece31190c94d55feb5d190be4de5df) --- tests/sys/cddl/zfs/tests/acl/cifs/cifs_test.sh | 12 +-- .../zfs/tests/acl/nontrivial/nontrivial_test.sh | 34 ++++----- .../sys/cddl/zfs/tests/acl/trivial/trivial_test.sh | 56 +++++++------- tests/sys/cddl/zfs/tests/atime/atime_test.sh | 4 +- tests/sys/cddl/zfs/tests/bootfs/bootfs_test.sh | 18 ++--- tests/sys/cddl/zfs/tests/cache/cache_test.sh | 22 +++--- .../sys/cddl/zfs/tests/cachefile/cachefile_test.sh | 8 +- tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_test.sh | 2 +- tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_test.sh | 6 +- .../zfs/tests/cli_root/zfs_clone/zfs_clone_test.sh | 18 ++--- .../tests/cli_root/zfs_copies/zfs_copies_test.sh | 12 +-- .../tests/cli_root/zfs_create/zfs_create_test.sh | 26 +++---- .../tests/cli_root/zfs_destroy/zfs_destroy_test.sh | 14 ++-- .../zfs/tests/cli_root/zfs_diff/zfs_diff_test.sh | 2 +- .../zfs/tests/cli_root/zfs_get/zfs_get_test.sh | 20 ++--- .../tests/cli_root/zfs_inherit/zfs_inherit_test.sh | 6 +- .../zfs/tests/cli_root/zfs_mount/zfs_mount_test.sh | 24 +++--- .../tests/cli_root/zfs_promote/zfs_promote_test.sh | 16 ++-- .../cli_root/zfs_property/zfs_property_test.sh | 2 +- .../tests/cli_root/zfs_receive/zfs_receive_test.sh | 18 ++--- .../tests/cli_root/zfs_rename/zfs_rename_test.sh | 26 +++---- .../zfs_reservation/zfs_reservation_test.sh | 4 +- .../cli_root/zfs_rollback/zfs_rollback_test.sh | 8 +- .../zfs/tests/cli_root/zfs_send/zfs_send_test.sh | 8 +- .../zfs/tests/cli_root/zfs_set/zfs_set_test.sh | 44 +++++------ .../zfs/tests/cli_root/zfs_share/zfs_share_test.sh | 22 +++--- .../cli_root/zfs_snapshot/zfs_snapshot_test.sh | 14 ++-- .../tests/cli_root/zfs_unmount/zfs_unmount_test.sh | 20 ++--- .../tests/cli_root/zfs_unshare/zfs_unshare_test.sh | 10 +-- .../tests/cli_root/zfs_upgrade/zfs_upgrade_test.sh | 14 ++-- .../cddl/zfs/tests/cli_root/zpool/zpool_test.sh | 6 +- .../zfs/tests/cli_root/zpool_add/zpool_add_test.sh | 20 ++--- .../cli_root/zpool_attach/zpool_attach_test.sh | 2 +- .../tests/cli_root/zpool_clear/zpool_clear_test.sh | 10 +-- .../cli_root/zpool_create/zpool_create_test.sh | 40 +++++----- .../cli_root/zpool_destroy/zpool_destroy_test.sh | 8 +- .../cli_root/zpool_detach/zpool_detach_test.sh | 2 +- .../cli_root/zpool_expand/zpool_expand_test.sh | 6 +- .../cli_root/zpool_export/zpool_export_test.sh | 8 +- .../zfs/tests/cli_root/zpool_get/zpool_get_test.sh | 8 +- .../cli_root/zpool_history/zpool_history_test.sh | 4 +- .../cli_root/zpool_import/zpool_import_test.sh | 46 ++++++------ .../cli_root/zpool_offline/zpool_offline_test.sh | 4 +- .../cli_root/zpool_online/zpool_online_test.sh | 4 +- .../cli_root/zpool_remove/zpool_remove_test.sh | 6 +- .../cli_root/zpool_replace/zpool_replace_test.sh | 4 +- .../tests/cli_root/zpool_scrub/zpool_scrub_test.sh | 10 +-- .../zfs/tests/cli_root/zpool_set/zpool_set_test.sh | 6 +- .../cli_root/zpool_status/zpool_status_test.sh | 4 +- .../cli_root/zpool_upgrade/zpool_upgrade_test.sh | 18 ++--- .../sys/cddl/zfs/tests/cli_user/misc/misc_test.sh | 86 +++++++++++----------- .../zfs/tests/cli_user/zfs_list/zfs_list_test.sh | 16 ++-- .../cli_user/zpool_iostat/zpool_iostat_test.sh | 6 +- .../tests/cli_user/zpool_list/zpool_list_test.sh | 4 +- .../cddl/zfs/tests/compression/compression_test.sh | 6 +- tests/sys/cddl/zfs/tests/ctime/ctime_test.sh | 2 +- .../sys/cddl/zfs/tests/delegate/zfs_allow_test.sh | 24 +++--- .../cddl/zfs/tests/delegate/zfs_unallow_test.sh | 16 ++-- tests/sys/cddl/zfs/tests/devices/devices_test.sh | 4 +- tests/sys/cddl/zfs/tests/exec/exec_test.sh | 4 +- .../sys/cddl/zfs/tests/grow_pool/grow_pool_test.sh | 2 +- .../zfs/tests/grow_replicas/grow_replicas_test.sh | 2 +- tests/sys/cddl/zfs/tests/history/history_test.sh | 20 ++--- tests/sys/cddl/zfs/tests/hotplug/hotplug_test.sh | 6 +- tests/sys/cddl/zfs/tests/hotspare/hotspare_test.sh | 52 ++++++------- .../cddl/zfs/tests/inheritance/inheritance_test.sh | 2 +- tests/sys/cddl/zfs/tests/interop/interop_test.sh | 2 +- tests/sys/cddl/zfs/tests/inuse/inuse_test.sh | 4 +- tests/sys/cddl/zfs/tests/iscsi/iscsi_test.sh | 12 +-- .../zfs/tests/largest_pool/largest_pool_test.sh | 2 +- .../cddl/zfs/tests/link_count/link_count_test.sh | 2 +- .../sys/cddl/zfs/tests/migration/migration_test.sh | 24 +++--- tests/sys/cddl/zfs/tests/mmap/mmap_test.sh | 2 +- tests/sys/cddl/zfs/tests/mount/mount_test.sh | 4 +- tests/sys/cddl/zfs/tests/mv_files/mv_files_test.sh | 4 +- tests/sys/cddl/zfs/tests/nestedfs/nestedfs_test.sh | 2 +- tests/sys/cddl/zfs/tests/no_space/no_space_test.sh | 2 +- .../tests/online_offline/online_offline_test.sh | 4 +- .../cddl/zfs/tests/pool_names/pool_names_test.sh | 4 +- .../cddl/zfs/tests/poolversion/poolversion_test.sh | 4 +- tests/sys/cddl/zfs/tests/quota/quota_test.sh | 12 +-- .../cddl/zfs/tests/redundancy/redundancy_test.sh | 2 +- tests/sys/cddl/zfs/tests/refquota/refquota_test.sh | 12 +-- .../sys/cddl/zfs/tests/refreserv/refreserv_test.sh | 10 +-- .../cddl/zfs/tests/replacement/replacement_test.sh | 6 +- .../cddl/zfs/tests/reservation/reservation_test.sh | 36 ++++----- tests/sys/cddl/zfs/tests/rootpool/rootpool_test.sh | 4 +- tests/sys/cddl/zfs/tests/rsend/rsend_test.sh | 26 +++---- .../zfs/tests/scrub_mirror/scrub_mirror_test.sh | 8 +- tests/sys/cddl/zfs/tests/slog/slog_test.sh | 28 +++---- tests/sys/cddl/zfs/tests/snapshot/snapshot_test.sh | 48 ++++++------ tests/sys/cddl/zfs/tests/snapused/snapused_test.sh | 10 +-- tests/sys/cddl/zfs/tests/sparse/sparse_test.sh | 2 +- tests/sys/cddl/zfs/tests/truncate/truncate_test.sh | 2 +- .../sys/cddl/zfs/tests/userquota/userquota_test.sh | 32 ++++---- .../cddl/zfs/tests/utils_test/utils_test_test.sh | 18 ++--- .../cddl/zfs/tests/write_dirs/write_dirs_test.sh | 4 +- tests/sys/cddl/zfs/tests/xattr/xattr_test.sh | 26 +++---- tests/sys/cddl/zfs/tests/zfsd/zfsd_test.sh | 36 ++++----- tests/sys/cddl/zfs/tests/zil/zil_test.sh | 4 +- tests/sys/cddl/zfs/tests/zinject/zinject_test.sh | 8 +- tests/sys/cddl/zfs/tests/zones/zones_test.sh | 10 +-- .../cddl/zfs/tests/zvol/zvol_cli/zvol_cli_test.sh | 6 +- .../zfs/tests/zvol/zvol_misc/zvol_misc_test.sh | 16 ++-- .../zfs/tests/zvol/zvol_swap/zvol_swap_test.sh | 12 +-- .../cddl/zfs/tests/zvol_thrash/zvol_thrash_test.sh | 2 +- 106 files changed, 705 insertions(+), 705 deletions(-) diff --git a/tests/sys/cddl/zfs/tests/acl/cifs/cifs_test.sh b/tests/sys/cddl/zfs/tests/acl/cifs/cifs_test.sh index 01a14aac61ed..e05ad8b03912 100755 --- a/tests/sys/cddl/zfs/tests/acl/cifs/cifs_test.sh +++ b/tests/sys/cddl/zfs/tests/acl/cifs/cifs_test.sh @@ -30,8 +30,8 @@ atf_test_case cifs_attr_001_pos cleanup cifs_attr_001_pos_head() { atf_set "descr" "Verify set/clear DOS attributes will succeed while user haswrite_attributes permission or PRIV_FILE_OWNER privilege" - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" runwattr + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 runwattr" } cifs_attr_001_pos_body() { @@ -57,8 +57,8 @@ atf_test_case cifs_attr_002_pos cleanup cifs_attr_002_pos_head() { atf_set "descr" "Verify set/clear BSD'ish attributes will succeed while user hasPRIV_FILE_FLAG_SET/PRIV_FILE_FLAG_CLEAR privilege" - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" runwattr + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 runwattr" } cifs_attr_002_pos_body() { @@ -84,8 +84,8 @@ atf_test_case cifs_attr_003_pos cleanup cifs_attr_003_pos_head() { atf_set "descr" "Verify DOS & BSD'ish attributes will provide theaccess limitation as expected." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 runat" } cifs_attr_003_pos_body() { diff --git a/tests/sys/cddl/zfs/tests/acl/nontrivial/nontrivial_test.sh b/tests/sys/cddl/zfs/tests/acl/nontrivial/nontrivial_test.sh index 01abe61d532f..a75c25e9c721 100755 --- a/tests/sys/cddl/zfs/tests/acl/nontrivial/nontrivial_test.sh +++ b/tests/sys/cddl/zfs/tests/acl/nontrivial/nontrivial_test.sh @@ -55,7 +55,7 @@ zfs_acl_chmod_002_pos_head() { atf_set "descr" "Verify acl after upgrading." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_acl_chmod_002_pos_body() { @@ -80,7 +80,7 @@ zfs_acl_chmod_aclmode_001_pos_head() { atf_set "descr" "Verify chmod have correct behaviour to directory and file whenfilesystem has the different aclmode setting." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_acl_chmod_aclmode_001_pos_body() { @@ -177,7 +177,7 @@ zfs_acl_chmod_inherit_002_pos_head() { atf_set "descr" "Verify chmod have correct behaviour to directory and file whenfilesystem has the different aclinherit setting." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_acl_chmod_inherit_002_pos_body() { @@ -202,7 +202,7 @@ zfs_acl_chmod_inherit_003_pos_head() { atf_set "descr" "Verify chmod have correct behaviour to directory and file whenfilesystem has the different aclinherit setting." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_acl_chmod_inherit_003_pos_body() { @@ -227,7 +227,7 @@ zfs_acl_chmod_inherit_004_pos_head() { atf_set "descr" "Verify aclinherit=passthrough-x will inherit the 'x' bits while mode request." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" } zfs_acl_chmod_inherit_004_pos_body() { @@ -395,8 +395,8 @@ atf_test_case zfs_acl_chmod_xattr_001_pos cleanup zfs_acl_chmod_xattr_001_pos_head() { atf_set "descr" "Verify that the permission of read_xattr/write_xattr forowner/group/everyone are correct." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 runat" } zfs_acl_chmod_xattr_001_pos_body() { @@ -421,7 +421,7 @@ zfs_acl_chmod_xattr_002_pos_head() { atf_set "descr" "Verify that the permission of write_xattr forowner/group/everyone while remove extended attributes are correct." atf_set "require.config" zfs_xattr - atf_set "require.progs" runat + atf_set "require.progs" "ksh93 runat" } zfs_acl_chmod_xattr_002_pos_body() { @@ -446,7 +446,7 @@ zfs_acl_cp_001_pos_head() { atf_set "descr" "Verify that '$CP [-p]' supports ZFS ACLs." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_acl_cp_001_pos_body() { @@ -470,8 +470,8 @@ atf_test_case zfs_acl_cp_002_pos cleanup zfs_acl_cp_002_pos_head() { atf_set "descr" "Verify that '$CP [-p]' supports ZFS ACLs." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" zfs runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 zfs runat" } zfs_acl_cp_002_pos_body() { @@ -496,7 +496,7 @@ zfs_acl_cpio_001_pos_head() { atf_set "descr" "Verify that '$CPIO' command supports to archive ZFS ACLs." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_acl_cpio_001_pos_body() { @@ -520,8 +520,8 @@ atf_test_case zfs_acl_cpio_002_pos cleanup zfs_acl_cpio_002_pos_head() { atf_set "descr" "Verify that '$CPIO' command supports to archive ZFS ACLs & xattrs." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" zfs runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 zfs runat" } zfs_acl_cpio_002_pos_body() { @@ -618,7 +618,7 @@ zfs_acl_tar_001_pos_head() { atf_set "descr" "Verify that '$TAR' command supports to archive ZFS ACLs." atf_set "require.config" zfs_acl - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_acl_tar_001_pos_body() { @@ -642,8 +642,8 @@ atf_test_case zfs_acl_tar_002_pos cleanup zfs_acl_tar_002_pos_head() { atf_set "descr" "Verify that '$TAR' command supports to archive ZFS ACLs & xattrs." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" zfs runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 zfs runat" } zfs_acl_tar_002_pos_body() { diff --git a/tests/sys/cddl/zfs/tests/acl/trivial/trivial_test.sh b/tests/sys/cddl/zfs/tests/acl/trivial/trivial_test.sh index f979cc30c145..26ee9f534084 100755 --- a/tests/sys/cddl/zfs/tests/acl/trivial/trivial_test.sh +++ b/tests/sys/cddl/zfs/tests/acl/trivial/trivial_test.sh @@ -53,7 +53,7 @@ atf_test_case zfs_acl_compress_001_pos cleanup zfs_acl_compress_001_pos_head() { atf_set "descr" "Compress will keep file attribute intact after the file iscompressed and uncompressed" - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_compress_001_pos_body() { @@ -77,7 +77,7 @@ atf_test_case zfs_acl_cp_001_pos cleanup zfs_acl_cp_001_pos_head() { atf_set "descr" "Verifies that cp will include file attribute when using the -@ flag" - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_cp_001_pos_body() { @@ -101,7 +101,7 @@ atf_test_case zfs_acl_cp_002_neg cleanup zfs_acl_cp_002_neg_head() { atf_set "descr" "Verifies that cp will not include file attribute when the -@ flagis not present." - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_cp_002_neg_body() { @@ -125,8 +125,8 @@ atf_test_case zfs_acl_cp_003_neg cleanup zfs_acl_cp_003_neg_head() { atf_set "descr" "Verifies that cp won't be able to include file attribute whenattribute is unreadable (except root)" - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 runat" } zfs_acl_cp_003_neg_body() { @@ -150,7 +150,7 @@ atf_test_case zfs_acl_find_001_pos cleanup zfs_acl_find_001_pos_head() { atf_set "descr" "Verifies ability to find files with attribute with-xattr flag and using '-exec runat ls'" - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_find_001_pos_body() { @@ -174,8 +174,8 @@ atf_test_case zfs_acl_find_002_neg cleanup zfs_acl_find_002_neg_head() { atf_set "descr" "verifies -xattr doesn't include files withoutattribute and using '-exec runat ls'" - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 runat" } zfs_acl_find_002_neg_body() { @@ -199,7 +199,7 @@ atf_test_case zfs_acl_ls_001_pos cleanup zfs_acl_ls_001_pos_head() { atf_set "descr" "Verifies that ls displays @ in the file permissions using ls -@for files with attribute." - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_ls_001_pos_body() { @@ -223,8 +223,8 @@ atf_test_case zfs_acl_ls_002_neg cleanup zfs_acl_ls_002_neg_head() { atf_set "descr" "Verifies that ls doesn't display @ in the filepermissions using ls -@ for files without attribute." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" runat + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 runat" } zfs_acl_ls_002_neg_body() { @@ -248,7 +248,7 @@ atf_test_case zfs_acl_mv_001_pos cleanup zfs_acl_mv_001_pos_head() { atf_set "descr" "Verifies that mv will include file attribute." - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_mv_001_pos_body() { @@ -272,8 +272,8 @@ atf_test_case zfs_acl_pack_001_pos cleanup zfs_acl_pack_001_pos_head() { atf_set "descr" "Verifies that pack will keep file attribute intact after the fileis packed and unpacked" - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" unpack pack + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 unpack pack" } zfs_acl_pack_001_pos_body() { @@ -297,8 +297,8 @@ atf_test_case zfs_acl_pax_001_pos cleanup zfs_acl_pax_001_pos_head() { atf_set "descr" "Verify include attribute in pax archive and restore with paxshould succeed." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" pax + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 pax" } zfs_acl_pax_001_pos_body() { @@ -322,8 +322,8 @@ atf_test_case zfs_acl_pax_002_pos cleanup zfs_acl_pax_002_pos_head() { atf_set "descr" "Verify include attribute in pax archive and restore with tarshould succeed." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" pax + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 pax" } zfs_acl_pax_002_pos_body() { @@ -347,8 +347,8 @@ atf_test_case zfs_acl_pax_003_pos cleanup zfs_acl_pax_003_pos_head() { atf_set "descr" "Verify include attribute in pax archive and restore with cpioshould succeed." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" pax + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 pax" } zfs_acl_pax_003_pos_body() { @@ -372,8 +372,8 @@ atf_test_case zfs_acl_pax_004_pos cleanup zfs_acl_pax_004_pos_head() { atf_set "descr" "Verify files include attribute in pax archive and restore with paxshould succeed." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" pax + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 pax" } zfs_acl_pax_004_pos_body() { @@ -397,8 +397,8 @@ atf_test_case zfs_acl_pax_005_pos cleanup zfs_acl_pax_005_pos_head() { atf_set "descr" "Verify files include attribute in cpio archive and restore withcpio should succeed." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" pax + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 pax" } zfs_acl_pax_005_pos_body() { @@ -422,8 +422,8 @@ atf_test_case zfs_acl_pax_006_pos cleanup zfs_acl_pax_006_pos_head() { atf_set "descr" "Verify files include attribute in tar archive and restore withtar should succeed." - atf_set "require.config" zfs_acl zfs_xattr - atf_set "require.progs" pax + atf_set "require.config" "zfs_acl zfs_xattr" + atf_set "require.progs" "ksh93 pax" } zfs_acl_pax_006_pos_body() { @@ -447,7 +447,7 @@ atf_test_case zfs_acl_tar_001_pos cleanup zfs_acl_tar_001_pos_head() { atf_set "descr" "Verifies that tar will include file attribute when @ flag ispresent." - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_tar_001_pos_body() { @@ -471,7 +471,7 @@ atf_test_case zfs_acl_tar_002_neg cleanup zfs_acl_tar_002_neg_head() { atf_set "descr" "Verifies that tar will not include files attribute when @ flag isnot present" - atf_set "require.config" zfs_acl zfs_xattr + atf_set "require.config" "zfs_acl zfs_xattr" } zfs_acl_tar_002_neg_body() { diff --git a/tests/sys/cddl/zfs/tests/atime/atime_test.sh b/tests/sys/cddl/zfs/tests/atime/atime_test.sh index a36fc5c2eee2..7350c750ac3e 100755 --- a/tests/sys/cddl/zfs/tests/atime/atime_test.sh +++ b/tests/sys/cddl/zfs/tests/atime/atime_test.sh @@ -30,7 +30,7 @@ atf_test_case atime_001_pos cleanup atime_001_pos_head() { atf_set "descr" "Setting atime=on, the access time for files is updated when read." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } atime_001_pos_body() { @@ -56,7 +56,7 @@ atf_test_case atime_002_neg cleanup atime_002_neg_head() { atf_set "descr" "Setting atime=off, the access time for files will not be updatedwhen read." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } atime_002_neg_body() { diff --git a/tests/sys/cddl/zfs/tests/bootfs/bootfs_test.sh b/tests/sys/cddl/zfs/tests/bootfs/bootfs_test.sh index b6a9feb0f3ba..9cb52e73409c 100755 --- a/tests/sys/cddl/zfs/tests/bootfs/bootfs_test.sh +++ b/tests/sys/cddl/zfs/tests/bootfs/bootfs_test.sh @@ -30,7 +30,7 @@ atf_test_case bootfs_001_pos bootfs_001_pos_head() { atf_set "descr" "Valid datasets are accepted as bootfs property values" - atf_set "require.progs" zpool zfs + atf_set "require.progs" "ksh93 zpool zfs" } bootfs_001_pos_body() { @@ -45,7 +45,7 @@ atf_test_case bootfs_002_neg bootfs_002_neg_head() { atf_set "descr" "Invalid datasets are rejected as boot property values" - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" } bootfs_002_neg_body() { @@ -61,7 +61,7 @@ atf_test_case bootfs_003_pos bootfs_003_pos_head() { atf_set "descr" "Valid pool names are accepted by zpool set bootfs" - atf_set "require.progs" zpool zfs + atf_set "require.progs" "ksh93 zpool zfs" } bootfs_003_pos_body() { @@ -76,7 +76,7 @@ atf_test_case bootfs_004_neg bootfs_004_neg_head() { atf_set "descr" "Invalid pool names are rejected by zpool set bootfs" - atf_set "require.progs" zpool zfs + atf_set "require.progs" "ksh93 zpool zfs" } bootfs_004_neg_body() { @@ -91,7 +91,7 @@ atf_test_case bootfs_005_neg bootfs_005_neg_head() { atf_set "descr" "Boot properties cannot be set on pools with older versions" - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" } bootfs_005_neg_body() { @@ -107,7 +107,7 @@ atf_test_case bootfs_006_pos bootfs_006_pos_head() { atf_set "descr" "Pools of correct vdev types accept boot property" - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" } bootfs_006_pos_body() { @@ -122,7 +122,7 @@ atf_test_case bootfs_007_pos bootfs_007_pos_head() { atf_set "descr" "setting bootfs on a pool which was configured with the whole disk will succeed" - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" } bootfs_007_pos_body() { @@ -138,7 +138,7 @@ atf_test_case bootfs_008_neg bootfs_008_neg_head() { atf_set "descr" "setting bootfs on a dataset which has gzip compression enabled will fail" - atf_set "require.progs" zpool zfs + atf_set "require.progs" "ksh93 zpool zfs" } bootfs_008_neg_body() { @@ -154,7 +154,7 @@ bootfs_009_neg_head() { atf_set "descr" "Valid encrypted datasets can't be set bootfs property values" atf_set "require.config" zfs_encryption - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" } bootfs_009_neg_body() { diff --git a/tests/sys/cddl/zfs/tests/cache/cache_test.sh b/tests/sys/cddl/zfs/tests/cache/cache_test.sh index f722dbf0efdc..cf420d1e2b41 100755 --- a/tests/sys/cddl/zfs/tests/cache/cache_test.sh +++ b/tests/sys/cddl/zfs/tests/cache/cache_test.sh @@ -30,7 +30,7 @@ atf_test_case cache_001_pos cleanup cache_001_pos_head() { atf_set "descr" "Creating a pool with a cache device succeeds." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_001_pos_body() @@ -57,7 +57,7 @@ atf_test_case cache_002_pos cleanup cache_002_pos_head() { atf_set "descr" "Adding a cache device to normal pool works." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_002_pos_body() @@ -84,7 +84,7 @@ atf_test_case cache_003_pos cleanup cache_003_pos_head() { atf_set "descr" "Adding an extra cache device works." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_003_pos_body() @@ -111,7 +111,7 @@ atf_test_case cache_004_neg cleanup cache_004_neg_head() { atf_set "descr" "Attaching a cache device fails." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_004_neg_body() @@ -138,7 +138,7 @@ atf_test_case cache_005_neg cleanup cache_005_neg_head() { atf_set "descr" "Replacing a cache device fails." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_005_neg_body() @@ -165,7 +165,7 @@ atf_test_case cache_006_pos cleanup cache_006_pos_head() { atf_set "descr" "Exporting and importing pool with cache devices passes." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_006_pos_body() @@ -192,7 +192,7 @@ atf_test_case cache_007_neg cleanup cache_007_neg_head() { atf_set "descr" "A mirror/raidz/raidz2 cache is not supported." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_007_neg_body() @@ -219,7 +219,7 @@ atf_test_case cache_008_neg cleanup cache_008_neg_head() { atf_set "descr" "A raidz/raidz2 cache can not be added to existed pool." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_008_neg_body() @@ -246,7 +246,7 @@ atf_test_case cache_009_pos cleanup cache_009_pos_head() { atf_set "descr" "Offline and online a cache device succeed." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_009_pos_body() @@ -273,7 +273,7 @@ atf_test_case cache_010_neg cleanup cache_010_neg_head() { atf_set "descr" "Cache device can only be disk or slice." - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" atf_set "timeout" 1200 } cache_010_neg_body() @@ -300,7 +300,7 @@ atf_test_case cache_011_pos cleanup cache_011_pos_head() { atf_set "descr" "Remove cache device from pool with spare device should succeed" - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" atf_set "timeout" 1200 } cache_011_pos_body() diff --git a/tests/sys/cddl/zfs/tests/cachefile/cachefile_test.sh b/tests/sys/cddl/zfs/tests/cachefile/cachefile_test.sh index 04e7dc09f7e5..691ca66e3682 100755 --- a/tests/sys/cddl/zfs/tests/cachefile/cachefile_test.sh +++ b/tests/sys/cddl/zfs/tests/cachefile/cachefile_test.sh @@ -30,7 +30,7 @@ atf_test_case cachefile_001_pos cachefile_001_pos_head() { atf_set "descr" "Creating a pool with \cachefile\ set doesn't update zpool.cache" - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" } cachefile_001_pos_body() { @@ -47,7 +47,7 @@ atf_test_case cachefile_002_pos cachefile_002_pos_head() { atf_set "descr" "Importing a pool with \cachefile\ set doesn't update zpool.cache" - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" } cachefile_002_pos_body() { @@ -64,7 +64,7 @@ atf_test_case cachefile_003_pos cachefile_003_pos_head() { atf_set "descr" "Setting altroot=path and cachefile=$CPATH for zpool create succeed." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" } cachefile_003_pos_body() { @@ -81,7 +81,7 @@ atf_test_case cachefile_004_pos cachefile_004_pos_head() { atf_set "descr" "Verify set, export and destroy when cachefile is set on pool." - atf_set "require.progs" zpool + atf_set "require.progs" "ksh93 zpool" } cachefile_004_pos_body() { diff --git a/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_test.sh index e75da9201b5d..60168a3da493 100755 --- a/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_test.sh +++ b/tests/sys/cddl/zfs/tests/cli_root/zdb/zdb_test.sh @@ -30,7 +30,7 @@ atf_test_case zdb_001_neg cleanup zdb_001_neg_head() { atf_set "descr" "Execute zdb using invalid parameters." - atf_set "require.progs" zdb + atf_set "require.progs" "ksh93 zdb" } zdb_001_neg_body() { diff --git a/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_test.sh index 3d2270e28af8..aa96a7846983 100755 --- a/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_test.sh +++ b/tests/sys/cddl/zfs/tests/cli_root/zfs/zfs_test.sh @@ -30,7 +30,7 @@ atf_test_case zfs_001_neg cleanup zfs_001_neg_head() { atf_set "descr" "Badly-formed zfs sub-command should return an error." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_001_neg_body() { @@ -54,7 +54,7 @@ atf_test_case zfs_002_pos cleanup zfs_002_pos_head() { atf_set "descr" "With ZFS_ABORT set, all zfs commands can abort and generate a core file." - atf_set "require.progs" zfs coreadm + atf_set "require.progs" "ksh93 zfs coreadm" } zfs_002_pos_body() { @@ -78,7 +78,7 @@ atf_test_case zfs_003_neg cleanup zfs_003_neg_head() { atf_set "descr" "zfs fails with unexpected scenarios." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_003_neg_body() { diff --git a/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_test.sh index 5e82fd885ce1..d304770f419e 100755 --- a/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_test.sh +++ b/tests/sys/cddl/zfs/tests/cli_root/zfs_clone/zfs_clone_test.sh @@ -30,7 +30,7 @@ atf_test_case zfs_clone_001_neg cleanup zfs_clone_001_neg_head() { atf_set "descr" "Badly-formed 'zfs clone' with inapplicable scenariosshould return an error." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_001_neg_body() { @@ -54,7 +54,7 @@ atf_test_case zfs_clone_002_pos cleanup zfs_clone_002_pos_head() { atf_set "descr" "clone -p should work as expected." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_002_pos_body() { @@ -78,7 +78,7 @@ atf_test_case zfs_clone_003_pos cleanup zfs_clone_003_pos_head() { atf_set "descr" "'zfs clone -o property=value filesystem' can successfully createa ZFS clone filesystem with correct property set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_003_pos_body() { @@ -102,7 +102,7 @@ atf_test_case zfs_clone_004_pos cleanup zfs_clone_004_pos_head() { atf_set "descr" "'zfs clone -o property=value filesystem' can successfully createa ZFS clone filesystem with multiple properties set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_004_pos_body() { @@ -126,7 +126,7 @@ atf_test_case zfs_clone_005_pos cleanup zfs_clone_005_pos_head() { atf_set "descr" "'zfs clone -o property=value -V size volume' can successfullycreate a ZFS clone volume with correct property set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_005_pos_body() { @@ -150,7 +150,7 @@ atf_test_case zfs_clone_006_pos cleanup zfs_clone_006_pos_head() { atf_set "descr" "'zfs clone -o property=value volume' can successfullycreate a ZFS clone volume with multiple correct properties set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_006_pos_body() { @@ -174,7 +174,7 @@ atf_test_case zfs_clone_007_pos cleanup zfs_clone_007_pos_head() { atf_set "descr" "'zfs clone -o version=' could upgrade version,but downgrade is denied." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_007_pos_body() { @@ -198,7 +198,7 @@ atf_test_case zfs_clone_008_neg cleanup zfs_clone_008_neg_head() { atf_set "descr" "Verify 'zfs clone -o ' fails with bad argument." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_008_neg_body() { @@ -222,7 +222,7 @@ atf_test_case zfs_clone_009_neg cleanup zfs_clone_009_neg_head() { atf_set "descr" "Verify 'zfs clone -o ' fails with bad argument." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_clone_009_neg_body() { diff --git a/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_test.sh index 121b94b80b92..d0cd94ae0484 100755 --- a/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_test.sh +++ b/tests/sys/cddl/zfs/tests/cli_root/zfs_copies/zfs_copies_test.sh @@ -30,7 +30,7 @@ atf_test_case zfs_copies_001_pos cleanup zfs_copies_001_pos_head() { atf_set "descr" "Verify 'copies' property with correct arguments works or not." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_copies_001_pos_body() { @@ -56,7 +56,7 @@ atf_test_case zfs_copies_002_pos cleanup zfs_copies_002_pos_head() { atf_set "descr" "Verify that the space used by multiple copies is charged correctly." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_copies_002_pos_body() { @@ -82,7 +82,7 @@ atf_test_case zfs_copies_003_pos cleanup zfs_copies_003_pos_head() { atf_set "descr" "Verify that ZFS volume space used by multiple copies is charged correctly." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_copies_003_pos_body() { @@ -108,7 +108,7 @@ atf_test_case zfs_copies_004_neg cleanup zfs_copies_004_neg_head() { atf_set "descr" "Verify that copies property cannot be set to any value other than 1,2 or 3" - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_copies_004_neg_body() { @@ -135,7 +135,7 @@ atf_test_case zfs_copies_005_neg cleanup zfs_copies_005_neg_head() { atf_set "descr" "Verify that copies cannot be set with pool version 1" - atf_set "require.progs" zfs zpool + atf_set "require.progs" "ksh93 zfs zpool" } zfs_copies_005_neg_body() { @@ -161,7 +161,7 @@ atf_test_case zfs_copies_006_pos cleanup zfs_copies_006_pos_head() { atf_set "descr" "Verify that ZFS volume space used by multiple copies is charged correctly." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_copies_006_pos_body() { diff --git a/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_test.sh b/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_test.sh index 00185dbf4a0b..a79a10263386 100755 --- a/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_test.sh +++ b/tests/sys/cddl/zfs/tests/cli_root/zfs_create/zfs_create_test.sh @@ -30,7 +30,7 @@ atf_test_case zfs_create_001_pos cleanup zfs_create_001_pos_head() { atf_set "descr" "'zfs create ' can create a ZFS filesystem in the namespace." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_create_001_pos_body() { @@ -58,7 +58,7 @@ atf_test_case zfs_create_002_pos cleanup zfs_create_002_pos_head() { atf_set "descr" "'zfs create -s -V ' succeeds" - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_create_002_pos_body() { @@ -86,7 +86,7 @@ atf_test_case zfs_create_003_pos cleanup zfs_create_003_pos_head() { atf_set "descr" "Verify creating volume with specified blocksize works." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_create_003_pos_body() { @@ -114,7 +114,7 @@ atf_test_case zfs_create_004_pos cleanup zfs_create_004_pos_head() { atf_set "descr" "'zfs create -o property=value filesystem' can successfully createa ZFS filesystem with correct property set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_create_004_pos_body() { @@ -142,7 +142,7 @@ atf_test_case zfs_create_005_pos cleanup zfs_create_005_pos_head() { atf_set "descr" "'zfs create -o property=value filesystem' can successfully createa ZFS filesystem with multiple properties set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_create_005_pos_body() { @@ -170,7 +170,7 @@ atf_test_case zfs_create_006_pos cleanup zfs_create_006_pos_head() { atf_set "descr" "'zfs create -o property=value -V size volume' can successfullycreate a ZFS volume with correct property set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_create_006_pos_body() { @@ -198,7 +198,7 @@ atf_test_case zfs_create_007_pos cleanup zfs_create_007_pos_head() { atf_set "descr" "'zfs create -o property=value -V size volume' can successfullycreate a ZFS volume with correct property set." - atf_set "require.progs" zfs + atf_set "require.progs" "ksh93 zfs" } zfs_create_007_pos_body() { @@ -226,7 +226,7 @@ atf_test_case zfs_create_008_neg cleanup *** 5793 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:23:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F21E357AAE2; Wed, 17 Mar 2021 22:23: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 4F14Rf58kZz3QV0; Wed, 17 Mar 2021 22:23: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 D139B1697B; Wed, 17 Mar 2021 22:23: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 12HMN6eF045987; Wed, 17 Mar 2021 22:23:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMN64a045986; Wed, 17 Mar 2021 22:23:06 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:23:06 GMT Message-Id: <202103172223.12HMN64a045986@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: cad3bfa094e6 - stable/13 - Simplify the capsicum-test wrapper script MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cad3bfa094e6135b939a948f45c4dee2df9d64f3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:23:15 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=cad3bfa094e6135b939a948f45c4dee2df9d64f3 commit cad3bfa094e6135b939a948f45c4dee2df9d64f3 Author: Alex Richardson AuthorDate: 2021-03-02 18:27:34 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 22:22:49 +0000 Simplify the capsicum-test wrapper script Instead of running tests one-by-one with the shell wrapper we now run the full gtest testsuite twice (once as root, once as non root). This significantly speeds up running tests despite running them twice. This change also passes the missing -u flag to capsicum-test that caused test failures (https://bugs.freebsd.org/250178) Previously, running the testsuite with the wrapper script took ~3s per test on aarch64 QEMU, i.e. a total of almost 5 minutes. Now it takes 6 seconds to run all tests twice. Before: root@freebsd-aarch64:/usr/tests/sys/capsicum # /usr/bin/time kyua test functional 94/96 passed (2 failed) 309.97 real 58.46 user 244.31 sys After: root@freebsd-aarch64:/usr/tests/sys/capsicum # /usr/bin/time kyua test functional functional:test_root -> passed [2.659s] functional:test_unprivileged -> passed [2.391s] 2/2 passed (0 failed) 5.48 real 1.06 user 2.52 sys This overhead is caused by kyua + atf-sh spawning lots of additional processes and can be avoided by just running the googletest test binary. syscall seconds calls errors fork 39.810229456 1275 0 sigprocmask 13.546928736 572 0 i.e. 1275 processes spawned to run a single test. Test Plan: All tests pass with D28907. PR: 250178 Reviewed By: lwhsu Differential Revision: https://reviews.freebsd.org/D29014 (cherry picked from commit 53a535c1d80a2e5ea33a4e8807647e600402b1d8) --- tests/sys/capsicum/functional.sh | 70 ++++++++++------------------------------ 1 file changed, 17 insertions(+), 53 deletions(-) diff --git a/tests/sys/capsicum/functional.sh b/tests/sys/capsicum/functional.sh index 6e11a9c4621a..0bd6b2d5e983 100755 --- a/tests/sys/capsicum/functional.sh +++ b/tests/sys/capsicum/functional.sh @@ -29,69 +29,33 @@ # # $FreeBSD$ -SRCDIR=$(atf_get_srcdir) CAPSICUM_TEST_BIN=capsicum-test -check() -{ - local tc=${1} +atf_test_case "test_root" +test_root_head() { - atf_check -s exit:0 -o match:PASSED -e ignore \ - ${SRCDIR}/${CAPSICUM_TEST_BIN} --gtest_filter=${tc} + atf_set descr 'Run capsicum-test as root' + atf_set require.user root } -skip() -{ - local reason=${1} - - atf_skip "${reason}" +test_root_body() { + atf_check -s exit:0 -o match:PASSED -e ignore \ + "$(atf_get_srcdir)/${CAPSICUM_TEST_BIN}" -u "$(id -u tests)" } -add_testcase() -{ - local tc=${1} - local tc_escaped word - - tc_escaped=$(echo ${tc} | sed -e 's/\./__/') - - atf_test_case ${tc_escaped} - - if [ "$(atf_config_get ci false)" = "true" ]; then - case "${tc_escaped}" in - ForkedOpenatTest_WithFlagInCapabilityMode___|OpenatTest__WithFlag) - eval "${tc_escaped}_body() { skip \"https://bugs.freebsd.org/249960\"; }" - ;; - PipePdfork__WildcardWait) - eval "${tc_escaped}_body() { skip \"https://bugs.freebsd.org/244165\"; }" - ;; - Capability__NoBypassDAC) - eval "${tc_escaped}_body() { skip \"https://bugs.freebsd.org/250178\"; }" - ;; - Pdfork__OtherUserForked) - eval "${tc_escaped}_body() { skip \"https://bugs.freebsd.org/250179\"; }" - ;; - *) - eval "${tc_escaped}_body() { check ${tc}; }" - ;; - esac - else - eval "${tc_escaped}_body() { check ${tc}; }" - fi +atf_test_case "test_unprivileged" +test_unprivileged_head() { - atf_add_test_case ${tc_escaped} + atf_set descr 'Run capsicum-test as an unprivileged user' + atf_set require.user unprivileged } -list_tests() -{ - ${SRCDIR}/${CAPSICUM_TEST_BIN} --gtest_list_tests | awk ' - /^[^ ]/ { CAT=$0 } - /^[ ]/ { print CAT $1}' +test_unprivileged_body() { + atf_check -s exit:0 -o match:PASSED -e ignore \ + "$(atf_get_srcdir)/${CAPSICUM_TEST_BIN}" -u "$(id -u)" } -atf_init_test_cases() -{ - local t - for t in `list_tests`; do - add_testcase $t - done +atf_init_test_cases() { + atf_add_test_case test_root + atf_add_test_case test_unprivileged } From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:23:10 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38AE257ACE8; Wed, 17 Mar 2021 22:23: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 4F14Rb2VnHz3QZC; Wed, 17 Mar 2021 22:23: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 B406A169C3; Wed, 17 Mar 2021 22:23: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 12HMN5W0045969; Wed, 17 Mar 2021 22:23:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMN5Yb045968; Wed, 17 Mar 2021 22:23:05 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:23:05 GMT Message-Id: <202103172223.12HMN5Yb045968@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 60a9c919a532 - stable/13 - Update capsicum-test to git commit f4d97414d48b8f8356b971ab9f45dc5c70d53c40 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 60a9c919a53273a1535671f39084913b4eff95c5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:23:15 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=60a9c919a53273a1535671f39084913b4eff95c5 commit 60a9c919a53273a1535671f39084913b4eff95c5 Author: Alex Richardson AuthorDate: 2021-03-02 16:28:26 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 22:22:49 +0000 Update capsicum-test to git commit f4d97414d48b8f8356b971ab9f45dc5c70d53c40 This includes various fixes that I submitted recently such as updating the pdkill() tests for the actual implemented behaviour (https://github.com/google/capsicum-test/pull/53) and lots of changes to avoid calling sleep() and replacing it with reliable synchronization (pull requests 49,51,52,53,54). This should make the testsuite more reliable when running on Jenkins. Additionally, process status is now retrieved using libprocstat instead of running `ps` and parsing the output (https://github.com/google/capsicum-test/pull/50). This fixes one previously failing test and speeds up execution. Overall, this update reduces the total runtime from ~60s to about 4-5 seconds. (cherry picked from commit 955a3f9ad586f38395e66127f9f2f4afbf3d5a94) --- contrib/capsicum-test/GNUmakefile | 4 + contrib/capsicum-test/capability-fd.cc | 23 +++- contrib/capsicum-test/capmode.cc | 126 +++++++++++++---- contrib/capsicum-test/capsicum-test.cc | 88 ++++++++---- contrib/capsicum-test/capsicum-test.h | 36 ++++- contrib/capsicum-test/makefile | 2 +- contrib/capsicum-test/openat.cc | 1 + contrib/capsicum-test/procdesc.cc | 241 ++++++++++++++++++++++++--------- contrib/capsicum-test/socket.cc | 18 ++- tests/sys/capsicum/Makefile | 2 +- 10 files changed, 412 insertions(+), 129 deletions(-) diff --git a/contrib/capsicum-test/GNUmakefile b/contrib/capsicum-test/GNUmakefile index d7133ca3b386..426eb49cdfa1 100644 --- a/contrib/capsicum-test/GNUmakefile +++ b/contrib/capsicum-test/GNUmakefile @@ -4,6 +4,10 @@ OS:=$(shell uname) ARCH?=64 ARCHFLAG=-m$(ARCH) +ifeq ($(OS),FreeBSD) +EXTRA_LIBS=-lprocstat +endif + ifeq ($(OS),Linux) PROCESSOR:=$(shell uname -p) diff --git a/contrib/capsicum-test/capability-fd.cc b/contrib/capsicum-test/capability-fd.cc index a454d54aa86a..f255c6425cdd 100644 --- a/contrib/capsicum-test/capability-fd.cc +++ b/contrib/capsicum-test/capability-fd.cc @@ -486,6 +486,7 @@ FORK_TEST_ON(Capability, Mmap, TmpFile("cap_mmap_operations")) { // Given a file descriptor, create a capability with specific rights and // make sure only those rights work. #define TRY_FILE_OPS(fd, ...) do { \ + SCOPED_TRACE(#__VA_ARGS__); \ cap_rights_t rights; \ cap_rights_init(&rights, __VA_ARGS__); \ TryFileOps((fd), rights); \ @@ -1019,6 +1020,8 @@ FORK_TEST_ON(Capability, SocketTransfer, TmpFile("cap_fd_transfer")) { if (child == 0) { // Child: enter cap mode EXPECT_OK(cap_enter()); + // Child: send startup notification + SEND_INT_MESSAGE(sock_fds[0], MSG_CHILD_STARTED); // Child: wait to receive FD over socket int rc = recvmsg(sock_fds[0], &mh, 0); @@ -1036,10 +1039,12 @@ FORK_TEST_ON(Capability, SocketTransfer, TmpFile("cap_fd_transfer")) { EXPECT_RIGHTS_EQ(&r_rs, &rights); TryReadWrite(cap_fd); + // Child: acknowledge that we have received and tested the file descriptor + SEND_INT_MESSAGE(sock_fds[0], MSG_CHILD_FD_RECEIVED); + // Child: wait for a normal read - int val; - read(sock_fds[0], &val, sizeof(val)); - exit(0); + AWAIT_INT_MESSAGE(sock_fds[0], MSG_PARENT_REQUEST_CHILD_EXIT); + exit(testing::Test::HasFailure()); } int fd = open(TmpFile("cap_fd_transfer"), O_RDWR | O_CREAT, 0644); @@ -1054,6 +1059,9 @@ FORK_TEST_ON(Capability, SocketTransfer, TmpFile("cap_fd_transfer")) { // Confirm we can do the right operations on the capability TryReadWrite(cap_fd); + // Wait for child to start up: + AWAIT_INT_MESSAGE(sock_fds[1], MSG_CHILD_STARTED); + // Send the file descriptor over the pipe to the sub-process mh.msg_controllen = CMSG_LEN(sizeof(int)); cmptr = CMSG_FIRSTHDR(&mh); @@ -1063,13 +1071,14 @@ FORK_TEST_ON(Capability, SocketTransfer, TmpFile("cap_fd_transfer")) { *(int *)CMSG_DATA(cmptr) = cap_fd; buffer1[0] = 0; iov[0].iov_len = 1; - sleep(3); int rc = sendmsg(sock_fds[1], &mh, 0); EXPECT_OK(rc); - sleep(1); // Ensure subprocess runs - int zero = 0; - write(sock_fds[1], &zero, sizeof(zero)); + // Check that the child received the message + AWAIT_INT_MESSAGE(sock_fds[1], MSG_CHILD_FD_RECEIVED); + + // Tell the child to exit + SEND_INT_MESSAGE(sock_fds[1], MSG_PARENT_REQUEST_CHILD_EXIT); } TEST(Capability, SyscallAt) { diff --git a/contrib/capsicum-test/capmode.cc b/contrib/capsicum-test/capmode.cc index 567773f319d9..c274f5e1c9f3 100644 --- a/contrib/capsicum-test/capmode.cc +++ b/contrib/capsicum-test/capmode.cc @@ -528,6 +528,8 @@ TEST(Capmode, Abort) { FORK_TEST_F(WithFiles, AllowedMiscSyscalls) { umask(022); mode_t um_before = umask(022); + int pipefds[2]; + EXPECT_OK(pipe(pipefds)); EXPECT_OK(cap_enter()); // Enter capability mode. mode_t um = umask(022); @@ -540,13 +542,19 @@ FORK_TEST_F(WithFiles, AllowedMiscSyscalls) { pid_t pid = fork(); EXPECT_OK(pid); if (pid == 0) { - // Child: almost immediately exit. - sleep(1); + // Child: wait for an exit message from parent (so we can test waitpid). + EXPECT_OK(close(pipefds[0])); + SEND_INT_MESSAGE(pipefds[1], MSG_CHILD_STARTED); + AWAIT_INT_MESSAGE(pipefds[1], MSG_PARENT_REQUEST_CHILD_EXIT); exit(0); } else if (pid > 0) { + EXPECT_OK(close(pipefds[1])); + AWAIT_INT_MESSAGE(pipefds[0], MSG_CHILD_STARTED); errno = 0; EXPECT_CAPMODE(ptrace_(PTRACE_PEEKDATA_, pid, &pid, NULL)); - EXPECT_CAPMODE(waitpid(pid, NULL, 0)); + EXPECT_CAPMODE(waitpid(pid, NULL, WNOHANG)); + SEND_INT_MESSAGE(pipefds[0], MSG_PARENT_REQUEST_CHILD_EXIT); + if (verbose) fprintf(stderr, " child finished\n"); } // No error return from sync(2) to test, but check errno remains unset. @@ -568,68 +576,136 @@ FORK_TEST_F(WithFiles, AllowedMiscSyscalls) { } void *thread_fn(void *p) { - int delay = *(int *)p; - sleep(delay); + int fd = (int)(intptr_t)p; + if (verbose) fprintf(stderr, " thread waiting to run\n"); + AWAIT_INT_MESSAGE(fd, MSG_PARENT_CHILD_SHOULD_RUN); EXPECT_OK(getpid_()); EXPECT_CAPMODE(open("/dev/null", O_RDWR)); - return NULL; + // Return whether there have been any failures to the main thread. + void *rval = (void *)(intptr_t)testing::Test::HasFailure(); + if (verbose) fprintf(stderr, " thread finished: %p\n", rval); + return rval; } // Check that restrictions are the same in subprocesses and threads FORK_TEST(Capmode, NewThread) { // Fire off a new thread before entering capability mode pthread_t early_thread; - int one = 1; // second - EXPECT_OK(pthread_create(&early_thread, NULL, thread_fn, &one)); + void *thread_rval; + // Create two pipes, one for synchronization with the threads, the other to + // synchronize with the children (since we can't use waitpid after cap_enter). + // Note: Could use pdfork+pdwait instead, but that is tested in procdesc.cc. + int thread_pipe[2]; + EXPECT_OK(pipe(thread_pipe)); + int proc_pipe[2]; + EXPECT_OK(pipe(proc_pipe)); + EXPECT_OK(pthread_create(&early_thread, NULL, thread_fn, + (void *)(intptr_t)thread_pipe[1])); // Fire off a new process before entering capability mode. + if (verbose) fprintf(stderr, " starting second child (non-capability mode)\n"); int early_child = fork(); EXPECT_OK(early_child); if (early_child == 0) { - // Child: wait and then confirm this process is unaffect by capability mode in the parent. - sleep(1); + if (verbose) fprintf(stderr, " first child started\n"); + EXPECT_OK(close(proc_pipe[0])); + // Child: wait and then confirm this process is unaffected by capability mode in the parent. + AWAIT_INT_MESSAGE(proc_pipe[1], MSG_PARENT_CHILD_SHOULD_RUN); int fd = open("/dev/null", O_RDWR); EXPECT_OK(fd); close(fd); - exit(0); + // Notify the parent of success/failure. + int rval = (int)testing::Test::HasFailure(); + SEND_INT_MESSAGE(proc_pipe[1], rval); + if (verbose) fprintf(stderr, " first child finished: %d\n", rval); + exit(rval); } EXPECT_OK(cap_enter()); // Enter capability mode. + // At this point the current process has both a child process and a + // child thread that were created before entering capability mode. + // - The child process is unaffected by capability mode. + // - The child thread is affected by capability mode. + SEND_INT_MESSAGE(proc_pipe[0], MSG_PARENT_CHILD_SHOULD_RUN); + // Do an allowed syscall. EXPECT_OK(getpid_()); + // Wait for the first child to exit (should get a zero exit code message). + AWAIT_INT_MESSAGE(proc_pipe[0], 0); + + // The child processes/threads return HasFailure(), so we depend on no prior errors. + ASSERT_FALSE(testing::Test::HasFailure()) + << "Cannot continue test with pre-existing failures."; + // Now that we're in capability mode, if we create a second child process + // it will be affected by capability mode. + if (verbose) fprintf(stderr, " starting second child (in capability mode)\n"); int child = fork(); EXPECT_OK(child); if (child == 0) { + if (verbose) fprintf(stderr, " second child started\n"); + EXPECT_OK(close(proc_pipe[0])); // Child: do an allowed and a disallowed syscall. EXPECT_OK(getpid_()); EXPECT_CAPMODE(open("/dev/null", O_RDWR)); - exit(0); + // Notify the parent of success/failure. + int rval = (int)testing::Test::HasFailure(); + SEND_INT_MESSAGE(proc_pipe[1], rval); + if (verbose) fprintf(stderr, " second child finished: %d\n", rval); + exit(rval); } - // Don't (can't) wait for either child. - + // Now tell the early_started thread that it can run. We expect it to also + // be affected by capability mode since it's per-process not per-thread. + // Note: it is important that we don't allow the thread to run before fork(), + // since that could result in fork() being called while the thread holds one + // of the gtest-internal mutexes, so the child process deadlocks. + SEND_INT_MESSAGE(thread_pipe[0], MSG_PARENT_CHILD_SHOULD_RUN); // Wait for the early-started thread. - EXPECT_OK(pthread_join(early_thread, NULL)); + EXPECT_OK(pthread_join(early_thread, &thread_rval)); + EXPECT_FALSE((bool)(intptr_t)thread_rval) << "thread returned failure"; - // Fire off a new thread. + // Wait for the second child to exit (should get a zero exit code message). + AWAIT_INT_MESSAGE(proc_pipe[0], 0); + + // Fire off a new (second) child thread, which is also affected by capability mode. + ASSERT_FALSE(testing::Test::HasFailure()) + << "Cannot continue test with pre-existing failures."; pthread_t child_thread; - int zero = 0; // seconds - EXPECT_OK(pthread_create(&child_thread, NULL, thread_fn, &zero)); - EXPECT_OK(pthread_join(child_thread, NULL)); + EXPECT_OK(pthread_create(&child_thread, NULL, thread_fn, + (void *)(intptr_t)thread_pipe[1])); + SEND_INT_MESSAGE(thread_pipe[0], MSG_PARENT_CHILD_SHOULD_RUN); + EXPECT_OK(pthread_join(child_thread, &thread_rval)); + EXPECT_FALSE((bool)(intptr_t)thread_rval) << "thread returned failure"; // Fork a subprocess which fires off a new thread. + ASSERT_FALSE(testing::Test::HasFailure()) + << "Cannot continue test with pre-existing failures."; + if (verbose) fprintf(stderr, " starting third child (in capability mode)\n"); child = fork(); EXPECT_OK(child); if (child == 0) { + if (verbose) fprintf(stderr, " third child started\n"); + EXPECT_OK(close(proc_pipe[0])); pthread_t child_thread2; - EXPECT_OK(pthread_create(&child_thread2, NULL, thread_fn, &zero)); - EXPECT_OK(pthread_join(child_thread2, NULL)); - exit(0); + EXPECT_OK(pthread_create(&child_thread2, NULL, thread_fn, + (void *)(intptr_t)thread_pipe[1])); + SEND_INT_MESSAGE(thread_pipe[0], MSG_PARENT_CHILD_SHOULD_RUN); + EXPECT_OK(pthread_join(child_thread2, &thread_rval)); + EXPECT_FALSE((bool)(intptr_t)thread_rval) << "thread returned failure"; + // Notify the parent of success/failure. + int rval = (int)testing::Test::HasFailure(); + SEND_INT_MESSAGE(proc_pipe[1], rval); + if (verbose) fprintf(stderr, " third child finished: %d\n", rval); + exit(rval); } - // Sleep for a bit to allow the subprocess to finish. - sleep(2); + // Wait for the third child to exit (should get a zero exit code message). + AWAIT_INT_MESSAGE(proc_pipe[0], 0); + close(proc_pipe[0]); + close(proc_pipe[1]); + close(thread_pipe[0]); + close(thread_pipe[1]); } -static int had_signal = 0; +static volatile sig_atomic_t had_signal = 0; static void handle_signal(int) { had_signal = 1; } FORK_TEST(Capmode, SelfKill) { diff --git a/contrib/capsicum-test/capsicum-test.cc b/contrib/capsicum-test/capsicum-test.cc index 6adb222ec055..dedad464a4d9 100644 --- a/contrib/capsicum-test/capsicum-test.cc +++ b/contrib/capsicum-test/capsicum-test.cc @@ -1,5 +1,15 @@ #include "capsicum-test.h" +#ifdef __FreeBSD__ +#include +#include +#include +#include +#include +#include +#include +#endif + #include #include #include @@ -48,31 +58,59 @@ char ProcessState(int pid) { return '?'; #endif #ifdef __FreeBSD__ - char buffer[1024]; - snprintf(buffer, sizeof(buffer), "ps -p %d -o state | grep -v STAT", pid); - sig_t original = signal(SIGCHLD, SIG_IGN); - FILE* cmd = popen(buffer, "r"); - usleep(50000); // allow any pending SIGCHLD signals to arrive - signal(SIGCHLD, original); - int result = fgetc(cmd); - fclose(cmd); - // Map FreeBSD codes to Linux codes. - switch (result) { - case EOF: - return '\0'; - case 'D': // disk wait - case 'R': // runnable - case 'S': // sleeping - case 'T': // stopped - case 'Z': // zombie - return result; - case 'W': // idle interrupt thread - return 'S'; - case 'I': // idle - return 'S'; - case 'L': // waiting to acquire lock - default: - return '?'; + // First check if the process exists/we have permission to see it. This + // Avoids warning messages being printed to stderr by libprocstat. + size_t len = 0; + int name[4]; + name[0] = CTL_KERN; + name[1] = KERN_PROC; + name[2] = KERN_PROC_PID; + name[3] = pid; + if (sysctl(name, nitems(name), NULL, &len, NULL, 0) < 0 && errno == ESRCH) { + if (verbose) fprintf(stderr, "Process %d does not exist\n", pid); + return '\0'; // No such process. + } + unsigned int count = 0; + struct procstat *prstat = procstat_open_sysctl(); + EXPECT_NE(NULL, prstat) << "procstat_open_sysctl failed."; + errno = 0; + struct kinfo_proc *p = procstat_getprocs(prstat, KERN_PROC_PID, pid, &count); + if (p == NULL || count == 0) { + if (verbose) fprintf(stderr, "procstat_getprocs failed with %p/%d: %s\n", p, count, strerror(errno)); + procstat_close(prstat); + return '\0'; + } + char result = '\0'; + // See state() in bin/ps/print.c + switch (p->ki_stat) { + case SSTOP: + result = 'T'; + break; + case SSLEEP: + if (p->ki_tdflags & TDF_SINTR) /* interruptable (long) */ + result = 'S'; + else + result = 'D'; + break; + case SRUN: + case SIDL: + result = 'R'; + break; + case SWAIT: + case SLOCK: + // We treat SWAIT/SLOCK as 'S' here (instead of 'W'/'L'). + result = 'S'; + break; + case SZOMB: + result = 'Z'; + break; + default: + result = '?'; + break; } + procstat_freeprocs(prstat, p); + procstat_close(prstat); + if (verbose) fprintf(stderr, "Process %d in state '%c'\n", pid, result); + return result; #endif } diff --git a/contrib/capsicum-test/capsicum-test.h b/contrib/capsicum-test/capsicum-test.h index 808840f4280e..7433814b31c8 100644 --- a/contrib/capsicum-test/capsicum-test.h +++ b/contrib/capsicum-test/capsicum-test.h @@ -140,15 +140,17 @@ const char *TmpFile(const char *pathname); // Expect a syscall to fail with the given error. #define EXPECT_SYSCALL_FAIL(E, C) \ do { \ + SCOPED_TRACE(#C); \ EXPECT_GT(0, C); \ - EXPECT_EQ(E, errno); \ + EXPECT_EQ(E, errno) << "expected '" << strerror(E) \ + << "' but got '" << strerror(errno) << "'"; \ } while (0) // Expect a syscall to fail with anything other than the given error. #define EXPECT_SYSCALL_FAIL_NOT(E, C) \ do { \ EXPECT_GT(0, C); \ - EXPECT_NE(E, errno); \ + EXPECT_NE(E, errno) << strerror(E); \ } while (0) // Expect a void syscall to fail with anything other than the given error. @@ -163,7 +165,8 @@ const char *TmpFile(const char *pathname); // code is OS-specific. #ifdef O_BENEATH #define EXPECT_OPENAT_FAIL_TRAVERSAL(fd, path, flags) \ - do { \ + do { \ + SCOPED_TRACE(GTEST_STRINGIFY_(openat((fd), (path), (flags)))); \ const int result = openat((fd), (path), (flags)); \ if (((flags) & O_BENEATH) == O_BENEATH) { \ EXPECT_SYSCALL_FAIL(E_NO_TRAVERSE_O_BENEATH, result); \ @@ -175,6 +178,7 @@ const char *TmpFile(const char *pathname); #else #define EXPECT_OPENAT_FAIL_TRAVERSAL(fd, path, flags) \ do { \ + SCOPED_TRACE(GTEST_STRINGIFY_(openat((fd), (path), (flags)))); \ const int result = openat((fd), (path), (flags)); \ EXPECT_SYSCALL_FAIL(E_NO_TRAVERSE_CAPABILITY, result); \ if (result >= 0) { close(result); } \ @@ -200,7 +204,8 @@ const char *TmpFile(const char *pathname); int rc = C; \ EXPECT_GT(0, rc); \ EXPECT_TRUE(errno == ECAPMODE || errno == ENOTCAPABLE) \ - << #C << " did not fail with ECAPMODE/ENOTCAPABLE but " << errno; \ + << #C << " did not fail with ECAPMODE/ENOTCAPABLE but " << errno \ + << "(" << strerror(errno) << ")"; \ } while (0) // Ensure that 'rights' are a subset of 'max'. @@ -244,6 +249,29 @@ char ProcessState(int pid); #define EXPECT_PID_ZOMBIE(pid) EXPECT_PID_REACHES_STATES(pid, 'Z', 'Z'); #define EXPECT_PID_GONE(pid) EXPECT_PID_REACHES_STATES(pid, '\0', '\0'); +enum { + // Magic numbers for messages sent by child processes. + MSG_CHILD_STARTED = 1234, + MSG_CHILD_FD_RECEIVED = 4321, + // Magic numbers for messages sent by parent processes. + MSG_PARENT_REQUEST_CHILD_EXIT = 9999, + MSG_PARENT_CLOSED_FD = 10000, + MSG_PARENT_CHILD_SHOULD_RUN = 10001, +}; + +#define SEND_INT_MESSAGE(fd, message) \ + do { \ + int _msg = message; \ + EXPECT_EQ(sizeof(_msg), (size_t)write(fd, &_msg, sizeof(_msg))); \ + } while (0) + +#define AWAIT_INT_MESSAGE(fd, expected) \ + do { \ + int _msg = 0; \ + EXPECT_EQ(sizeof(_msg), (size_t)read(fd, &_msg, sizeof(_msg))); \ + EXPECT_EQ(expected, _msg); \ + } while (0) + // Mark a test that can only be run as root. #define GTEST_SKIP_IF_NOT_ROOT() \ if (getuid() != 0) { GTEST_SKIP() << "requires root"; } diff --git a/contrib/capsicum-test/makefile b/contrib/capsicum-test/makefile index 7b95e1927927..ad697f160e2e 100644 --- a/contrib/capsicum-test/makefile +++ b/contrib/capsicum-test/makefile @@ -8,7 +8,7 @@ CXXFLAGS+=$(ARCHFLAG) -Wall -g $(GTEST_INCS) $(GTEST_FLAGS) --std=c++11 CFLAGS+=$(ARCHFLAG) -Wall -g capsicum-test: $(OBJECTS) libgtest.a $(LOCAL_LIBS) - $(CXX) $(CXXFLAGS) -g -o $@ $(OBJECTS) libgtest.a -lpthread -lrt $(LIBSCTP) $(LIBCAPRIGHTS) + $(CXX) $(CXXFLAGS) -g -o $@ $(OBJECTS) libgtest.a -lpthread -lrt $(LIBSCTP) $(LIBCAPRIGHTS) $(EXTRA_LIBS) # Small statically-linked program for fexecve tests # (needs to be statically linked so that execve()ing it diff --git a/contrib/capsicum-test/openat.cc b/contrib/capsicum-test/openat.cc index 232fb22dd3f7..5447558cde89 100644 --- a/contrib/capsicum-test/openat.cc +++ b/contrib/capsicum-test/openat.cc @@ -11,6 +11,7 @@ // Check an open call works and close the resulting fd. #define EXPECT_OPEN_OK(f) do { \ + SCOPED_TRACE(#f); \ int _fd = f; \ EXPECT_OK(_fd); \ close(_fd); \ diff --git a/contrib/capsicum-test/procdesc.cc b/contrib/capsicum-test/procdesc.cc index 11274ce9e866..105546cabfb2 100644 --- a/contrib/capsicum-test/procdesc.cc +++ b/contrib/capsicum-test/procdesc.cc @@ -27,10 +27,6 @@ #define __WALL 0 #endif -// TODO(drysdale): it would be nice to use proper synchronization between -// processes, rather than synchronization-via-sleep; faster too. - - //------------------------------------------------ // Utilities for the tests. @@ -73,7 +69,10 @@ static void print_stat(FILE *f, const struct stat *stat) { (long)stat->st_atime, (long)stat->st_mtime, (long)stat->st_ctime); } -static std::map had_signal; +static volatile sig_atomic_t had_signal[NSIG]; +void clear_had_signals() { + memset(const_cast(had_signal), 0, sizeof(had_signal)); +} static void handle_signal(int x) { had_signal[x] = true; } @@ -109,7 +108,9 @@ void CheckChildFinished(pid_t pid, bool signaled=false) { TEST(Pdfork, Simple) { int pd = -1; + int pipefds[2]; pid_t parent = getpid_(); + EXPECT_OK(pipe(pipefds)); int pid = pdfork(&pd, 0); EXPECT_OK(pid); if (pid == 0) { @@ -117,19 +118,29 @@ TEST(Pdfork, Simple) { EXPECT_EQ(-1, pd); EXPECT_NE(parent, getpid_()); EXPECT_EQ(parent, getppid()); - sleep(1); - exit(0); + close(pipefds[0]); + SEND_INT_MESSAGE(pipefds[1], MSG_CHILD_STARTED); + if (verbose) fprintf(stderr, "Child waiting for exit message\n"); + // Terminate once the parent has completed the checks + AWAIT_INT_MESSAGE(pipefds[1], MSG_PARENT_REQUEST_CHILD_EXIT); + exit(testing::Test::HasFailure()); } - usleep(100); // ensure the child has a chance to run + close(pipefds[1]); + // Ensure the child has started. + AWAIT_INT_MESSAGE(pipefds[0], MSG_CHILD_STARTED); + EXPECT_NE(-1, pd); EXPECT_PID_ALIVE(pid); int pid_got; EXPECT_OK(pdgetpid(pd, &pid_got)); EXPECT_EQ(pid, pid_got); - // Wait long enough for the child to exit(). - sleep(2); + // Tell the child to exit and wait until it is a zombie. + SEND_INT_MESSAGE(pipefds[0], MSG_PARENT_REQUEST_CHILD_EXIT); + // EXPECT_PID_ZOMBIE waits for up to ~500ms, that should be enough time for + // the child to exit successfully. EXPECT_PID_ZOMBIE(pid); + close(pipefds[0]); // Wait for the the child. int status; @@ -223,7 +234,10 @@ TEST(Pdfork, NonProcessDescriptor) { close(fd); } -static void *SubThreadMain(void *) { +static void *SubThreadMain(void *arg) { + // Notify the main thread that we have started + if (verbose) fprintf(stderr, " subthread started: pipe=%p\n", arg); + SEND_INT_MESSAGE((int)(intptr_t)arg, MSG_CHILD_STARTED); while (true) { if (verbose) fprintf(stderr, " subthread: \"I aten't dead\"\n"); usleep(100000); @@ -233,11 +247,28 @@ static void *SubThreadMain(void *) { static void *ThreadMain(void *) { int pd; + int pipefds[2]; + EXPECT_EQ(0, pipe(pipefds)); pid_t child = pdfork(&pd, 0); if (child == 0) { - // Child: start a subthread then loop + close(pipefds[0]); + // Child: start a subthread then loop. pthread_t child_subthread; - EXPECT_OK(pthread_create(&child_subthread, NULL, SubThreadMain, NULL)); + // Wait for the subthread startup using another pipe. + int thread_pipefds[2]; + EXPECT_EQ(0, pipe(thread_pipefds)); + EXPECT_OK(pthread_create(&child_subthread, NULL, SubThreadMain, + (void *)(intptr_t)thread_pipefds[0])); + if (verbose) { + fprintf(stderr, " pdforked process %d: waiting for subthread.\n", + getpid()); + } + AWAIT_INT_MESSAGE(thread_pipefds[1], MSG_CHILD_STARTED); + close(thread_pipefds[0]); + close(thread_pipefds[1]); + // Child: Notify parent that all threads have started + if (verbose) fprintf(stderr, " pdforked process %d: subthread started\n", getpid()); + SEND_INT_MESSAGE(pipefds[1], MSG_CHILD_STARTED); while (true) { if (verbose) fprintf(stderr, " pdforked process %d: \"I aten't dead\"\n", getpid()); usleep(100000); @@ -245,7 +276,9 @@ static void *ThreadMain(void *) { exit(0); } if (verbose) fprintf(stderr, " thread generated pd %d\n", pd); - sleep(2); + close(pipefds[1]); + AWAIT_INT_MESSAGE(pipefds[0], MSG_CHILD_STARTED); + if (verbose) fprintf(stderr, "[%d] got child startup message\n", getpid_()); // Pass the process descriptor back to the main thread. return reinterpret_cast(pd); @@ -278,7 +311,7 @@ TEST(Pdfork, FromThread) { class PipePdforkBase : public ::testing::Test { public: PipePdforkBase(int pdfork_flags) : pd_(-1), pid_(-1) { - had_signal.clear(); + clear_had_signals(); int pipes[2]; EXPECT_OK(pipe(pipes)); pipe_ = pipes[1]; @@ -356,24 +389,34 @@ TEST_F(PipePdfork, Poll) { // Can multiple processes poll on the same descriptor? TEST_F(PipePdfork, PollMultiple) { + int pipefds[2]; + EXPECT_EQ(0, pipe(pipefds)); int child = fork(); EXPECT_OK(child); if (child == 0) { - // Child: wait to give time for setup, then write to the pipe (which will - // induce exit of the pdfork()ed process) and exit. - sleep(1); + close(pipefds[0]); + // Child: wait for parent to acknowledge startup + SEND_INT_MESSAGE(pipefds[1], MSG_CHILD_STARTED); + // Child: wait for two messages from the parent and the forked process + // before telling the other process to terminate. + if (verbose) fprintf(stderr, "[%d] waiting for read 1\n", getpid_()); + AWAIT_INT_MESSAGE(pipefds[1], MSG_PARENT_REQUEST_CHILD_EXIT); + if (verbose) fprintf(stderr, "[%d] waiting for read 2\n", getpid_()); + AWAIT_INT_MESSAGE(pipefds[1], MSG_PARENT_REQUEST_CHILD_EXIT); TerminateChild(); - exit(0); + if (verbose) fprintf(stderr, "[%d] about to exit\n", getpid_()); + exit(testing::Test::HasFailure()); } - usleep(100); // ensure the child has a chance to run - + close(pipefds[1]); + AWAIT_INT_MESSAGE(pipefds[0], MSG_CHILD_STARTED); + if (verbose) fprintf(stderr, "[%d] got child startup message\n", getpid_()); // Fork again int doppel = fork(); EXPECT_OK(doppel); // We now have: // pid A: main process, here // |--pid B: pdfork()ed process, blocked on read() - // |--pid C: fork()ed process, in sleep(1) above + // |--pid C: fork()ed process, in read() above // +--pid D: doppel process, here // Both A and D execute the following code. @@ -384,12 +427,18 @@ TEST_F(PipePdfork, PollMultiple) { fdp.revents = 0; EXPECT_EQ(0, poll(&fdp, 1, 0)); + // Both A and D ask C to exit, allowing it to do so. + if (verbose) fprintf(stderr, "[%d] telling child to exit\n", getpid_()); + SEND_INT_MESSAGE(pipefds[0], MSG_PARENT_REQUEST_CHILD_EXIT); + close(pipefds[0]); + // Now, wait (indefinitely) for activity on the process descriptor. // We expect: - // - pid C will finish its sleep, write to the pipe and exit + // - pid C will finish its two read() calls, write to the pipe and exit. // - pid B will unblock from read(), and exit // - this will generate an event on the process descriptor... // - ...in both process A and process D. + if (verbose) fprintf(stderr, "[%d] waiting for child to exit\n", getpid_()); EXPECT_EQ(1, poll(&fdp, 1, 2000)); EXPECT_TRUE(fdp.revents & POLLHUP); @@ -522,6 +571,7 @@ TEST_F(PipePdfork, CloseLast) { FORK_TEST(Pdfork, OtherUserIfRoot) { GTEST_SKIP_IF_NOT_ROOT(); int pd; + int status; pid_t pid = pdfork(&pd, 0); EXPECT_OK(pid); if (pid == 0) { @@ -542,15 +592,29 @@ FORK_TEST(Pdfork, OtherUserIfRoot) { EXPECT_EQ(EPERM, errno); EXPECT_PID_ALIVE(pid); - // Succeed with pdkill though. + // Ideally, we should be able to send signals via a process descriptor even + // if it's owned by another user, but this is not implementated on FreeBSD. +#ifdef __FreeBSD__ + // On FreeBSD, pdkill() still performs all the same checks that kill() does + // and therefore cannot be used to send a signal to a process with another + // UID unless we are root. + EXPECT_SYSCALL_FAIL(EBADF, pdkill(pid, SIGKILL)); + EXPECT_PID_ALIVE(pid); + // However, the process will be killed when we close the process descriptor. + EXPECT_OK(close(pd)); + EXPECT_PID_GONE(pid); + // Can't pdwait4() after close() since close() reparents the child to a reaper (init) + EXPECT_SYSCALL_FAIL(EBADF, pdwait4_(pd, &status, WNOHANG, NULL)); +#else + // Sending a signal with pdkill() should be permitted though. EXPECT_OK(pdkill(pd, SIGKILL)); EXPECT_PID_ZOMBIE(pid); - int status; int rc = pdwait4_(pd, &status, WNOHANG, NULL); EXPECT_OK(rc); EXPECT_EQ(pid, rc); EXPECT_TRUE(WIFSIGNALED(status)); +#endif } TEST_F(PipePdfork, WaitPidThenPd) { @@ -624,18 +688,27 @@ TEST_F(PipePdforkDaemon, Pdkill) { TEST(Pdfork, PdkillOtherSignal) { int pd = -1; + int pipefds[2]; + EXPECT_EQ(0, pipe(pipefds)); int pid = pdfork(&pd, 0); EXPECT_OK(pid); if (pid == 0) { - // Child: watch for SIGUSR1 forever. - had_signal.clear(); + // Child: tell the parent that we have started before entering the loop, + // and importantly only do so once we have registered the SIGUSR1 handler. + close(pipefds[0]); + clear_had_signals(); signal(SIGUSR1, handle_signal); + SEND_INT_MESSAGE(pipefds[1], MSG_CHILD_STARTED); + // Child: watch for SIGUSR1 forever. while (!had_signal[SIGUSR1]) { usleep(100000); } exit(123); } - sleep(1); + // Wait for child to start + close(pipefds[1]); + AWAIT_INT_MESSAGE(pipefds[0], MSG_CHILD_STARTED); + close(pipefds[0]); // Send an invalid signal. EXPECT_EQ(-1, pdkill(pd, 0xFFFF)); @@ -651,14 +724,15 @@ TEST(Pdfork, PdkillOtherSignal) { int rc = waitpid(pid, &status, __WALL); EXPECT_OK(rc); EXPECT_EQ(pid, rc); - EXPECT_TRUE(WIFEXITED(status)) << "0x" << std::hex << rc; + EXPECT_TRUE(WIFEXITED(status)) << "status: 0x" << std::hex << status; EXPECT_EQ(123, WEXITSTATUS(status)); } pid_t PdforkParentDeath(int pdfork_flags) { // Set up: // pid A: main process, here - // +--pid B: fork()ed process, sleep(4)s then exits + // +--pid B: fork()ed process, starts a child process with pdfork() then + // waits for parent to send a shutdown message. // +--pid C: pdfork()ed process, looping forever int sock_fds[2]; EXPECT_OK(socketpair(AF_UNIX, SOCK_STREAM, 0, sock_fds)); @@ -668,27 +742,45 @@ pid_t PdforkParentDeath(int pdfork_flags) { if (child == 0) { int pd; if (verbose) fprintf(stderr, " [%d] child about to pdfork()...\n", getpid_()); + int pipefds[2]; // for startup notification + EXPECT_OK(pipe(pipefds)); pid_t grandchild = pdfork(&pd, pdfork_flags); if (grandchild == 0) { + close(pipefds[0]); + pid_t grandchildPid = getpid_(); + EXPECT_EQ(sizeof(grandchildPid), (size_t)write(pipefds[1], &grandchildPid, sizeof(grandchildPid))); while (true) { - if (verbose) fprintf(stderr, " [%d] grandchild: \"I aten't dead\"\n", getpid_()); + if (verbose) fprintf(stderr, " [%d] grandchild: \"I aten't dead\"\n", grandchildPid); sleep(1); } } + close(pipefds[1]); if (verbose) fprintf(stderr, " [%d] pdfork()ed grandchild %d, sending ID to parent\n", getpid_(), grandchild); - // send grandchild pid to parent - write(sock_fds[1], &grandchild, sizeof(grandchild)); - sleep(4); + // Wait for grandchild to start. + pid_t grandchild2; + EXPECT_EQ(sizeof(grandchild2), (size_t)read(pipefds[0], &grandchild2, sizeof(grandchild2))); + EXPECT_EQ(grandchild, grandchild2) << "received invalid grandchild pid"; + if (verbose) fprintf(stderr, " [%d] grandchild %d has started successfully\n", getpid_(), grandchild); + close(pipefds[0]); + + // Send grandchild pid to parent. + EXPECT_EQ(sizeof(grandchild), (size_t)write(sock_fds[1], &grandchild, sizeof(grandchild))); + if (verbose) fprintf(stderr, " [%d] sent grandchild pid %d to parent\n", getpid_(), grandchild); + // Wait for parent to acknowledge the message. + AWAIT_INT_MESSAGE(sock_fds[1], MSG_PARENT_REQUEST_CHILD_EXIT); + if (verbose) fprintf(stderr, " [%d] parent acknowledged grandchild pid %d\n", getpid_(), grandchild); if (verbose) fprintf(stderr, " [%d] child terminating\n", getpid_()); - exit(0); + exit(testing::Test::HasFailure()); } if (verbose) fprintf(stderr, "[%d] fork()ed child is %d\n", getpid_(), child); pid_t grandchild; read(sock_fds[0], &grandchild, sizeof(grandchild)); - if (verbose) fprintf(stderr, "[%d] receive grandchild id %d\n", getpid_(), grandchild); + if (verbose) fprintf(stderr, "[%d] received grandchild id %d\n", getpid_(), grandchild); EXPECT_PID_ALIVE(child); EXPECT_PID_ALIVE(grandchild); - sleep(6); + // Tell child to exit. + if (verbose) fprintf(stderr, "[%d] telling child %d to exit\n", getpid_(), child); + SEND_INT_MESSAGE(sock_fds[0], MSG_PARENT_REQUEST_CHILD_EXIT); // Child dies, closing its process descriptor for the grandchild. EXPECT_PID_DEAD(child); CheckChildFinished(child); @@ -713,7 +805,7 @@ TEST(Pdfork, BagpussDaemon) { // The exit of a pdfork()ed process should not generate SIGCHLD. TEST_F(PipePdfork, NoSigchld) { - had_signal.clear(); + clear_had_signals(); sighandler_t original = signal(SIGCHLD, handle_signal); TerminateChild(); int rc = 0; @@ -728,7 +820,7 @@ TEST_F(PipePdfork, NoSigchld) { // all been closed should generate SIGCHLD. The child process needs // PD_DAEMON to survive the closure of the process descriptors. TEST_F(PipePdforkDaemon, NoPDSigchld) { - had_signal.clear(); + clear_had_signals(); sighandler_t original = signal(SIGCHLD, handle_signal); EXPECT_OK(close(pd_)); @@ -766,10 +858,8 @@ TEST_F(PipePdfork, ModeBits) { #endif TEST_F(PipePdfork, WildcardWait) { - // TODO(FreeBSD): make wildcard wait ignore pdfork()ed children - // https://bugs.freebsd.org/201054 TerminateChild(); - sleep(1); // Ensure child is truly dead. + EXPECT_PID_ZOMBIE(pid_); // Ensure child is truly dead. // Wildcard waitpid(-1) should not see the pdfork()ed child because // there is still a process descriptor for it. @@ -782,21 +872,30 @@ TEST_F(PipePdfork, WildcardWait) { } FORK_TEST(Pdfork, Pdkill) { - had_signal.clear(); + clear_had_signals(); int pd; + int pipefds[2]; + EXPECT_OK(pipe(pipefds)); pid_t pid = pdfork(&pd, 0); EXPECT_OK(pid); if (pid == 0) { - // Child: set a SIGINT handler and sleep. - had_signal.clear(); + // Child: set a SIGINT handler, notify the parent and sleep. + close(pipefds[0]); + clear_had_signals(); signal(SIGINT, handle_signal); + if (verbose) fprintf(stderr, "[%d] child started\n", getpid_()); + SEND_INT_MESSAGE(pipefds[1], MSG_CHILD_STARTED); if (verbose) fprintf(stderr, "[%d] child about to sleep(10)\n", getpid_()); - int left = sleep(10); - if (verbose) fprintf(stderr, "[%d] child slept, %d sec left, had[SIGINT]=%d\n", - getpid_(), left, had_signal[SIGINT]); - // Expect this sleep to be interrupted by the signal (and so left > 0). - exit(left == 0); + // Note: we could receive the SIGINT just before sleep(), so we use a loop + // with a short delay instead of one long sleep(). + for (int i = 0; i < 50 && !had_signal[SIGINT]; i++) { + usleep(100000); + } + if (verbose) fprintf(stderr, "[%d] child slept, had[SIGINT]=%d\n", + getpid_(), (int)had_signal[SIGINT]); + // Return non-zero if we didn't see SIGINT. + exit(had_signal[SIGINT] ? 0 : 99); } // Parent: get child's PID. @@ -804,9 +903,12 @@ FORK_TEST(Pdfork, Pdkill) { EXPECT_OK(pdgetpid(pd, &pd_pid)); EXPECT_EQ(pid, pd_pid); - // Interrupt the child after a second. - sleep(1); + // Interrupt the child once it's registered the SIGINT handler. + close(pipefds[1]); + if (verbose) fprintf(stderr, "[%d] waiting for child\n", getpid_()); + AWAIT_INT_MESSAGE(pipefds[0], MSG_CHILD_STARTED); EXPECT_OK(pdkill(pd, SIGINT)); + if (verbose) fprintf(stderr, "[%d] sent SIGINT\n", getpid_()); // Make sure the child finished properly (caught signal then exited). CheckChildFinished(pid); @@ -814,19 +916,28 @@ FORK_TEST(Pdfork, Pdkill) { FORK_TEST(Pdfork, PdkillSignal) { int pd; + int pipefds[2]; + EXPECT_OK(pipe(pipefds)); pid_t pid = pdfork(&pd, 0); EXPECT_OK(pid); if (pid == 0) { - // Child: sleep. No SIGINT handler. - if (verbose) fprintf(stderr, "[%d] child about to sleep(10)\n", getpid_()); - int left = sleep(10); - if (verbose) fprintf(stderr, "[%d] child slept, %d sec left\n", getpid_(), left); + close(pipefds[0]); + if (verbose) fprintf(stderr, "[%d] child started\n", getpid_()); + SEND_INT_MESSAGE(pipefds[1], MSG_CHILD_STARTED); + // Child: wait for shutdown message. No SIGINT handler. The message should + // never be received, since SIGINT should terminate the process. + if (verbose) fprintf(stderr, "[%d] child about to read()\n", getpid_()); + AWAIT_INT_MESSAGE(pipefds[1], MSG_PARENT_REQUEST_CHILD_EXIT); + fprintf(stderr, "[%d] child read() returned unexpectedly\n", getpid_()); exit(99); } - + // Wait for child to start before signalling. + if (verbose) fprintf(stderr, "[%d] waiting for child\n", getpid_()); + close(pipefds[1]); + AWAIT_INT_MESSAGE(pipefds[0], MSG_CHILD_STARTED); // Kill the child (as it doesn't handle SIGINT). - sleep(1); + if (verbose) fprintf(stderr, "[%d] sending SIGINT\n", getpid_()); EXPECT_OK(pdkill(pd, SIGINT)); // Make sure the child finished properly (terminated by signal). @@ -922,7 +1033,7 @@ TEST_F(PipePdfork, PassProcessDescriptor) { if (child2 == 0) { // Child: close our copy of the original process descriptor. *** 121 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:23:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 89A5B57B00A; Wed, 17 Mar 2021 22:23: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 4F14Rb1z55z3QFq; Wed, 17 Mar 2021 22:23: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 917E216C3E; Wed, 17 Mar 2021 22:23: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 12HMN4Cu045947; Wed, 17 Mar 2021 22:23:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMN4Ds045946; Wed, 17 Mar 2021 22:23:04 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:23:04 GMT Message-Id: <202103172223.12HMN4Ds045946@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 8e6eb890fefd - stable/13 - Update capsicum-test to git commit 7707222b46abe52d18fd4fbb76115ffdb3e6f74b MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8e6eb890fefdbcf5be2a61c7badadfabab3de52b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:23:09 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=8e6eb890fefdbcf5be2a61c7badadfabab3de52b commit 8e6eb890fefdbcf5be2a61c7badadfabab3de52b Author: Alex Richardson AuthorDate: 2021-02-16 14:35:12 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 22:22:49 +0000 Update capsicum-test to git commit 7707222b46abe52d18fd4fbb76115ffdb3e6f74b This includes changes to use GTEST_SKIP() instead of the local hand-rolled mechanism as well as a few minor cleanups. (cherry picked from commit 2d936e6c99ad1c4fb01f6c99a96dcc924ee44b9d) --- contrib/capsicum-test/capability-fd.cc | 82 +++++++++++++++++++---------- contrib/capsicum-test/capsicum-test-main.cc | 36 +++++++------ contrib/capsicum-test/capsicum-test.cc | 24 --------- contrib/capsicum-test/capsicum-test.h | 24 +++------ contrib/capsicum-test/fexecve.cc | 11 ++-- contrib/capsicum-test/linux.cc | 51 +++++++++--------- contrib/capsicum-test/makefile | 4 +- contrib/capsicum-test/mqueue.cc | 5 +- contrib/capsicum-test/procdesc.cc | 9 ++-- 9 files changed, 121 insertions(+), 125 deletions(-) diff --git a/contrib/capsicum-test/capability-fd.cc b/contrib/capsicum-test/capability-fd.cc index 6c470cff3418..a454d54aa86a 100644 --- a/contrib/capsicum-test/capability-fd.cc +++ b/contrib/capsicum-test/capability-fd.cc @@ -1085,8 +1085,6 @@ TEST(Capability, SyscallAt) { cap_rights_init(&r_no_mkdir, CAP_READ, CAP_LOOKUP, CAP_UNLINKAT, CAP_MKFIFOAT); cap_rights_t r_no_mkfifo; cap_rights_init(&r_no_mkfifo, CAP_READ, CAP_LOOKUP, CAP_UNLINKAT, CAP_MKDIRAT); - cap_rights_t r_no_mknod; - cap_rights_init(&r_no_mknod, CAP_READ, CAP_LOOKUP, CAP_UNLINKAT, CAP_MKDIRAT); cap_rights_t r_create; cap_rights_init(&r_create, CAP_READ, CAP_LOOKUP, CAP_CREATE); cap_rights_t r_bind; @@ -1106,9 +1104,6 @@ TEST(Capability, SyscallAt) { int cap_dfd_no_mkfifo = dup(dfd); EXPECT_OK(cap_dfd_no_mkfifo); EXPECT_OK(cap_rights_limit(cap_dfd_no_mkfifo, &r_no_mkfifo)); - int cap_dfd_no_mknod = dup(dfd); - EXPECT_OK(cap_dfd_no_mknod); - EXPECT_OK(cap_rights_limit(cap_dfd_no_mknod, &r_no_mknod)); int cap_dfd_create = dup(dfd); EXPECT_OK(cap_dfd_create); EXPECT_OK(cap_rights_limit(cap_dfd_create, &r_create)); @@ -1148,24 +1143,7 @@ TEST(Capability, SyscallAt) { unlink(TmpFile("cap_at_topdir/cap_socket")); #endif - if (getuid() == 0) { - // Need CAP_MKNODAT to mknodat(2) a device - EXPECT_NOTCAPABLE(mknodat(cap_dfd_no_mknod, "cap_device", S_IFCHR|0755, makedev(99, 123))); - unlink(TmpFile("cap_at_topdir/cap_device")); - EXPECT_OK(mknodat(cap_dfd_all, "cap_device", S_IFCHR|0755, makedev(99, 123))); - unlink(TmpFile("cap_at_topdir/cap_device")); - - // Need CAP_MKFIFOAT to mknodat(2) for a FIFO. - EXPECT_NOTCAPABLE(mknodat(cap_dfd_no_mkfifo, "cap_fifo", S_IFIFO|0755, 0)); - unlink(TmpFile("cap_at_topdir/cap_fifo")); - EXPECT_OK(mknodat(cap_dfd_all, "cap_fifo", S_IFIFO|0755, 0)); - unlink(TmpFile("cap_at_topdir/cap_fifo")); - } else { - TEST_SKIPPED("requires root (partial)"); - } - close(cap_dfd_all); - close(cap_dfd_no_mknod); close(cap_dfd_no_mkfifo); close(cap_dfd_no_mkdir); close(cap_dfd_no_unlink); @@ -1177,7 +1155,53 @@ TEST(Capability, SyscallAt) { rmdir(TmpFile("cap_at_topdir")); } -FORK_TEST_ON(Capability, ExtendedAttributes, TmpFile("cap_extattr")) { +TEST(Capability, SyscallAtIfRoot) { + GTEST_SKIP_IF_NOT_ROOT(); + int rc = mkdir(TmpFile("cap_at_topdir"), 0755); + EXPECT_OK(rc); + if (rc < 0 && errno != EEXIST) return; + + cap_rights_t r_all; + cap_rights_init(&r_all, CAP_READ, CAP_LOOKUP, CAP_MKNODAT, CAP_UNLINKAT, CAP_MKDIRAT, CAP_MKFIFOAT); + cap_rights_t r_no_mkfifo; + cap_rights_init(&r_no_mkfifo, CAP_READ, CAP_LOOKUP, CAP_UNLINKAT, CAP_MKDIRAT); + cap_rights_t r_no_mknod; + cap_rights_init(&r_no_mknod, CAP_READ, CAP_LOOKUP, CAP_UNLINKAT, CAP_MKDIRAT); + + int dfd = open(TmpFile("cap_at_topdir"), O_RDONLY); + EXPECT_OK(dfd); + int cap_dfd_all = dup(dfd); + EXPECT_OK(cap_dfd_all); + EXPECT_OK(cap_rights_limit(cap_dfd_all, &r_all)); + int cap_dfd_no_mkfifo = dup(dfd); + EXPECT_OK(cap_dfd_no_mkfifo); + EXPECT_OK(cap_rights_limit(cap_dfd_no_mkfifo, &r_no_mkfifo)); + int cap_dfd_no_mknod = dup(dfd); + EXPECT_OK(cap_dfd_no_mknod); + EXPECT_OK(cap_rights_limit(cap_dfd_no_mknod, &r_no_mknod)); + + // Need CAP_MKNODAT to mknodat(2) a device + EXPECT_NOTCAPABLE(mknodat(cap_dfd_no_mknod, "cap_device", S_IFCHR|0755, makedev(99, 123))); + unlink(TmpFile("cap_at_topdir/cap_device")); + EXPECT_OK(mknodat(cap_dfd_all, "cap_device", S_IFCHR|0755, makedev(99, 123))); + unlink(TmpFile("cap_at_topdir/cap_device")); + + // Need CAP_MKFIFOAT to mknodat(2) for a FIFO. + EXPECT_NOTCAPABLE(mknodat(cap_dfd_no_mkfifo, "cap_fifo", S_IFIFO|0755, 0)); + unlink(TmpFile("cap_at_topdir/cap_fifo")); + EXPECT_OK(mknodat(cap_dfd_all, "cap_fifo", S_IFIFO|0755, 0)); + unlink(TmpFile("cap_at_topdir/cap_fifo")); + + close(cap_dfd_all); + close(cap_dfd_no_mknod); + close(cap_dfd_no_mkfifo); + close(dfd); + + // Tidy up. + rmdir(TmpFile("cap_at_topdir")); +} + +FORK_TEST_ON(Capability, ExtendedAttributesIfAvailable, TmpFile("cap_extattr")) { int fd = open(TmpFile("cap_extattr"), O_RDONLY|O_CREAT, 0644); EXPECT_OK(fd); @@ -1185,9 +1209,8 @@ FORK_TEST_ON(Capability, ExtendedAttributes, TmpFile("cap_extattr")) { int rc = fgetxattr_(fd, "user.capsicumtest", buffer, sizeof(buffer)); if (rc < 0 && errno == ENOTSUP) { // Need user_xattr mount option for non-root users on Linux - TEST_SKIPPED("/tmp doesn't support extended attributes"); close(fd); - return; + GTEST_SKIP() << "/tmp doesn't support extended attributes"; } cap_rights_t r_rws; @@ -1278,8 +1301,8 @@ TEST(Capability, PipeUnseekable) { close(fds[1]); } -TEST(Capability, NoBypassDAC) { - REQUIRE_ROOT(); +TEST(Capability, NoBypassDACIfRoot) { + GTEST_SKIP_IF_NOT_ROOT(); int fd = open(TmpFile("cap_root_owned"), O_RDONLY|O_CREAT, 0644); EXPECT_OK(fd); cap_rights_t rights; @@ -1289,7 +1312,10 @@ TEST(Capability, NoBypassDAC) { pid_t child = fork(); if (child == 0) { // Child: change uid to a lesser being - setuid(other_uid); + ASSERT_NE(0u, other_uid) << "other_uid not initialized correctly, " + "please pass the -u flag."; + EXPECT_EQ(0, setuid(other_uid)); + EXPECT_EQ(other_uid, getuid()); // Attempt to fchmod the file, and fail. // Having CAP_FCHMOD doesn't bypass the need to comply with DAC policy. int rc = fchmod(fd, 0666); diff --git a/contrib/capsicum-test/capsicum-test-main.cc b/contrib/capsicum-test/capsicum-test-main.cc index 524631ebf5bd..d0f955270fd4 100644 --- a/contrib/capsicum-test/capsicum-test-main.cc +++ b/contrib/capsicum-test/capsicum-test-main.cc @@ -84,24 +84,30 @@ private: std::string capsicum_test_bindir; +// Adds a directory to $PATH. +static void AddDirectoryToPath(const char *dir) { + char *new_path, *old_path; + + old_path = getenv("PATH"); + assert(old_path); + + assert(asprintf(&new_path, "%s:%s", dir, old_path) > 0); + assert(setenv("PATH", new_path, 1) == 0); +} + int main(int argc, char* argv[]) { // Set up the test program path, so capsicum-test can find programs, like // mini-me* when executed from an absolute path. - { - char *new_path, *old_path, *program_name; - - program_name = strdup(argv[0]); - assert(program_name); - capsicum_test_bindir = std::string(dirname(program_name)); - free(program_name); + char *program_name; - old_path = getenv("PATH"); - assert(old_path); + // Copy argv[0], so dirname can do an in-place manipulation of the buffer's + // contents. + program_name = strdup(argv[0]); + assert(program_name); + capsicum_test_bindir = std::string(dirname(program_name)); + free(program_name); - assert(asprintf(&new_path, "%s:%s", capsicum_test_bindir.c_str(), - old_path) > 0); - assert(setenv("PATH", new_path, 1) == 0); - } + AddDirectoryToPath(capsicum_test_bindir.c_str()); ::testing::InitGoogleTest(&argc, argv); for (int ii = 1; ii < argc; ii++) { @@ -150,7 +156,5 @@ int main(int argc, char* argv[]) { #endif testing::AddGlobalTestEnvironment(new SetupEnvironment()); - int rc = RUN_ALL_TESTS(); - ShowSkippedTests(std::cerr); - return rc; + return RUN_ALL_TESTS(); } diff --git a/contrib/capsicum-test/capsicum-test.cc b/contrib/capsicum-test/capsicum-test.cc index 24b096ed877c..6adb222ec055 100644 --- a/contrib/capsicum-test/capsicum-test.cc +++ b/contrib/capsicum-test/capsicum-test.cc @@ -76,27 +76,3 @@ char ProcessState(int pid) { } #endif } - -typedef std::vector TestList; -typedef std::map SkippedTestMap; -static SkippedTestMap skipped_tests; -void TestSkipped(const char *testcase, const char *test, const std::string& reason) { - if (skipped_tests.find(reason) == skipped_tests.end()) { - skipped_tests[reason] = new TestList; - } - std::string testname(testcase); - testname += "."; - testname += test; - skipped_tests[reason]->push_back(testname); -} - -void ShowSkippedTests(std::ostream& os) { - for (SkippedTestMap::iterator skiplist = skipped_tests.begin(); - skiplist != skipped_tests.end(); ++skiplist) { - os << "Following tests were skipped because: " << skiplist->first << std::endl; - for (size_t ii = 0; ii < skiplist->second->size(); ++ii) { - const std::string& testname((*skiplist->second)[ii]); - os << " " << testname << std::endl; - } - } -} diff --git a/contrib/capsicum-test/capsicum-test.h b/contrib/capsicum-test/capsicum-test.h index 821100c48167..808840f4280e 100644 --- a/contrib/capsicum-test/capsicum-test.h +++ b/contrib/capsicum-test/capsicum-test.h @@ -10,6 +10,7 @@ #include #include +#include #include "gtest/gtest.h" @@ -75,7 +76,7 @@ const char *TmpFile(const char *pathname); } \ } else if (pid > 0) { \ int rc, status; \ - int remaining_us = 10000000; \ + int remaining_us = 30000000; \ while (remaining_us > 0) { \ status = 0; \ rc = waitpid(pid, &status, WNOHANG); \ @@ -169,12 +170,14 @@ const char *TmpFile(const char *pathname); } else { \ EXPECT_SYSCALL_FAIL(E_NO_TRAVERSE_CAPABILITY, result); \ } \ + if (result >= 0) { close(result); } \ } while (0) #else #define EXPECT_OPENAT_FAIL_TRAVERSAL(fd, path, flags) \ do { \ const int result = openat((fd), (path), (flags)); \ EXPECT_SYSCALL_FAIL(E_NO_TRAVERSE_CAPABILITY, result); \ + if (result >= 0) { close(result); } \ } while (0) #endif @@ -241,21 +244,10 @@ char ProcessState(int pid); #define EXPECT_PID_ZOMBIE(pid) EXPECT_PID_REACHES_STATES(pid, 'Z', 'Z'); #define EXPECT_PID_GONE(pid) EXPECT_PID_REACHES_STATES(pid, '\0', '\0'); -void ShowSkippedTests(std::ostream& os); -void TestSkipped(const char *testcase, const char *test, const std::string& reason); -#define TEST_SKIPPED(reason) \ - do { \ - const ::testing::TestInfo* const info = ::testing::UnitTest::GetInstance()->current_test_info(); \ - std::cerr << "Skipping " << info->test_case_name() << "::" << info->name() << " because: " << reason << std::endl; \ - TestSkipped(info->test_case_name(), info->name(), reason); \ - GTEST_SKIP(); \ - } while (0) - // Mark a test that can only be run as root. -#define REQUIRE_ROOT() \ - if (getuid() != 0) { \ - TEST_SKIPPED("requires root"); \ - return; \ - } +#define GTEST_SKIP_IF_NOT_ROOT() \ + if (getuid() != 0) { GTEST_SKIP() << "requires root"; } + +extern std::string capsicum_test_bindir; #endif // CAPSICUM_TEST_H diff --git a/contrib/capsicum-test/fexecve.cc b/contrib/capsicum-test/fexecve.cc index 2212e9fd955e..86df2af06388 100644 --- a/contrib/capsicum-test/fexecve.cc +++ b/contrib/capsicum-test/fexecve.cc @@ -1,6 +1,6 @@ #include -#include #include +#include #include #include #include @@ -126,10 +126,9 @@ FORK_TEST_F(Fexecve, ExecutePermissionCheck) { } } -FORK_TEST_F(Fexecve, SetuidIgnored) { +FORK_TEST_F(Fexecve, SetuidIgnoredIfNonRoot) { if (geteuid() == 0) { - TEST_SKIPPED("requires non-root"); - return; + GTEST_SKIP() << "requires non-root"; } int fd = open(exec_prog_setuid_.c_str(), O_RDONLY); EXPECT_OK(fd); @@ -173,7 +172,7 @@ class Execveat : public Execve { }; TEST_F(Execveat, NoUpwardTraversal) { - char *abspath = realpath(exec_prog_, NULL); + char *abspath = realpath(exec_prog_.c_str(), NULL); char cwd[1024]; getcwd(cwd, sizeof(cwd)); @@ -193,7 +192,7 @@ TEST_F(Execveat, NoUpwardTraversal) { char buffer[1024] = "../"; strcat(buffer, ++p); strcat(buffer, "/"); - strcat(buffer, exec_prog_); + strcat(buffer, exec_prog_.c_str()); EXPECT_SYSCALL_FAIL(E_NO_TRAVERSE_CAPABILITY, execveat(dfd, buffer, argv_pass_, null_envp, 0)); exit(HasFailure() ? 99 : 123); diff --git a/contrib/capsicum-test/linux.cc b/contrib/capsicum-test/linux.cc index dee1f99897f6..81ba06c5e588 100644 --- a/contrib/capsicum-test/linux.cc +++ b/contrib/capsicum-test/linux.cc @@ -104,10 +104,9 @@ TEST(Linux, TimerFD) { close(fd); } -FORK_TEST(Linux, SignalFD) { +FORK_TEST(Linux, SignalFDIfSingleThreaded) { if (force_mt) { - TEST_SKIPPED("multi-threaded run clashes with signals"); - return; + GTEST_SKIP() << "multi-threaded run clashes with signals"; } pid_t me = getpid(); sigset_t mask; @@ -372,8 +371,8 @@ TEST(Linux, fstatat) { // fanotify support may not be available at compile-time #ifdef __NR_fanotify_init -TEST(Linux, fanotify) { - REQUIRE_ROOT(); +TEST(Linux, FanotifyIfRoot) { + GTEST_SKIP_IF_NOT_ROOT(); int fa_fd = fanotify_init(FAN_CLASS_NOTIF, O_RDWR); EXPECT_OK(fa_fd); if (fa_fd < 0) return; // May not be enabled @@ -577,7 +576,7 @@ TEST(Linux, inotify) { unlink(TmpFile("cap_inotify")); } -TEST(Linux, ArchChange) { +TEST(Linux, ArchChangeIfAvailable) { const char* prog_candidates[] = {"./mini-me.32", "./mini-me.x32", "./mini-me.64"}; const char* progs[] = {NULL, NULL, NULL}; char* argv_pass[] = {(char*)"to-come", (char*)"--capmode", NULL}; @@ -593,8 +592,7 @@ TEST(Linux, ArchChange) { } } if (count == 0) { - TEST_SKIPPED("no different-architecture programs available"); - return; + GTEST_SKIP() << "no different-architecture programs available"; } for (int ii = 0; ii < count; ii++) { @@ -617,8 +615,8 @@ TEST(Linux, ArchChange) { } } -FORK_TEST(Linux, Namespace) { - REQUIRE_ROOT(); +FORK_TEST(Linux, NamespaceIfRoot) { + GTEST_SKIP_IF_NOT_ROOT(); pid_t me = getpid_(); // Create a new UTS namespace. @@ -758,9 +756,9 @@ static int ChildFunc(void *arg) { #define STACK_SIZE (1024 * 1024) static char child_stack[STACK_SIZE]; -// TODO(drysdale): fork into a user namespace first so REQUIRE_ROOT can be removed. -TEST(Linux, PidNamespacePdFork) { - REQUIRE_ROOT(); +// TODO(drysdale): fork into a user namespace first so GTEST_SKIP_IF_NOT_ROOT can be removed. +TEST(Linux, PidNamespacePdForkIfRoot) { + GTEST_SKIP_IF_NOT_ROOT(); // Pass process descriptors in both directions across a PID namespace boundary. // pdfork() off a child before we start, holding its process descriptor in a global // variable that's accessible to children. @@ -871,8 +869,8 @@ int NSInit(void *data) { return 0; } -TEST(Linux, DeadNSInit) { - REQUIRE_ROOT(); +TEST(Linux, DeadNSInitIfRoot) { + GTEST_SKIP_IF_NOT_ROOT(); // Prepare sockets to communicate with child process. EXPECT_OK(socketpair(AF_UNIX, SOCK_STREAM, 0, shared_sock_fds)); @@ -916,8 +914,8 @@ TEST(Linux, DeadNSInit) { } } -TEST(Linux, DeadNSInit2) { - REQUIRE_ROOT(); +TEST(Linux, DeadNSInit2IfRoot) { + GTEST_SKIP_IF_NOT_ROOT(); // Prepare sockets to communicate with child process. EXPECT_OK(socketpair(AF_UNIX, SOCK_STREAM, 0, shared_sock_fds)); @@ -1188,7 +1186,7 @@ TEST(Linux, AIO) { #ifndef KCMP_FILE #define KCMP_FILE 0 #endif -TEST(Linux, Kcmp) { +TEST(Linux, KcmpIfAvailable) { // This requires CONFIG_CHECKPOINT_RESTORE in kernel config. int fd = open("/etc/passwd", O_RDONLY); EXPECT_OK(fd); @@ -1197,8 +1195,7 @@ TEST(Linux, Kcmp) { errno = 0; int rc = syscall(__NR_kcmp, parent, parent, KCMP_FILE, fd, fd); if (rc == -1 && errno == ENOSYS) { - TEST_SKIPPED("kcmp(2) gives -ENOSYS"); - return; + GTEST_SKIP() << "kcmp(2) gives -ENOSYS"; } pid_t child = fork(); @@ -1362,8 +1359,8 @@ TEST(Linux, InvalidRightsSyscall) { unlink(TmpFile("cap_invalid_rights")); } -FORK_TEST_ON(Linux, OpenByHandleAt, TmpFile("cap_openbyhandle_testfile")) { - REQUIRE_ROOT(); +FORK_TEST_ON(Linux, OpenByHandleAtIfRoot, TmpFile("cap_openbyhandle_testfile")) { + GTEST_SKIP_IF_NOT_ROOT(); int dir = open(tmpdir.c_str(), O_RDONLY); EXPECT_OK(dir); int fd = openat(dir, "cap_openbyhandle_testfile", O_RDWR|O_CREAT, 0644); @@ -1380,8 +1377,9 @@ FORK_TEST_ON(Linux, OpenByHandleAt, TmpFile("cap_openbyhandle_testfile")) { fd = open_by_handle_at(dir, fhandle, O_RDONLY); EXPECT_OK(fd); char buffer[200]; - EXPECT_OK(read(fd, buffer, 199)); - EXPECT_EQ(std::string(message), std::string(buffer)); + ssize_t len = read(fd, buffer, 199); + EXPECT_OK(len); + EXPECT_EQ(std::string(message), std::string(buffer, len)); close(fd); // Cannot issue open_by_handle_at after entering capability mode. @@ -1423,11 +1421,10 @@ int memfd_create_(const char *name, unsigned int flags) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) #include // Requires 3.17 kernel -TEST(Linux, MemFDDeathTest) { +TEST(Linux, MemFDDeathTestIfAvailable) { int memfd = memfd_create_("capsicum-test", MFD_ALLOW_SEALING); if (memfd == -1 && errno == ENOSYS) { - TEST_SKIPPED("memfd_create(2) gives -ENOSYS"); - return; + GTEST_SKIP() << "memfd_create(2) gives -ENOSYS"; } const int LEN = 16; EXPECT_OK(ftruncate(memfd, LEN)); diff --git a/contrib/capsicum-test/makefile b/contrib/capsicum-test/makefile index c92caeb3bc10..7b95e1927927 100644 --- a/contrib/capsicum-test/makefile +++ b/contrib/capsicum-test/makefile @@ -1,7 +1,7 @@ all: capsicum-test smoketest mini-me mini-me.noexec mini-me.setuid $(EXTRA_PROGS) OBJECTS=capsicum-test-main.o capsicum-test.o capability-fd.o fexecve.o procdesc.o capmode.o fcntl.o ioctl.o openat.o sysctl.o select.o mqueue.o socket.o sctp.o capability-fd-pair.o linux.o overhead.o rename.o -GTEST_DIR=gtest-1.8.1 +GTEST_DIR=gtest-1.10.0 GTEST_INCS=-I$(GTEST_DIR)/include -I$(GTEST_DIR) GTEST_FLAGS=-DGTEST_USE_OWN_TR1_TUPLE=1 -DGTEST_HAS_TR1_TUPLE=1 CXXFLAGS+=$(ARCHFLAG) -Wall -g $(GTEST_INCS) $(GTEST_FLAGS) --std=c++11 @@ -28,7 +28,7 @@ smoketest: $(SMOKETEST_OBJECTS) $(LOCAL_LIBS) test: capsicum-test mini-me mini-me.noexec mini-me.setuid $(EXTRA_PROGS) ./capsicum-test gtest-all.o: - $(CXX) $(ARCHFLAG) -I$(GTEST_DIR)/include -I$(GTEST_DIR) $(GTEST_FLAGS) -c ${GTEST_DIR}/src/gtest-all.cc + $(CXX) $(CXXFLAGS) $(ARCHFLAG) -I$(GTEST_DIR)/include -I$(GTEST_DIR) $(GTEST_FLAGS) -c ${GTEST_DIR}/src/gtest-all.cc libgtest.a: gtest-all.o $(AR) -rv libgtest.a gtest-all.o diff --git a/contrib/capsicum-test/mqueue.cc b/contrib/capsicum-test/mqueue.cc index 42478c760020..f2f3daeb1db8 100644 --- a/contrib/capsicum-test/mqueue.cc +++ b/contrib/capsicum-test/mqueue.cc @@ -28,14 +28,13 @@ void seen_it_done_it(int) { invoked = true; } -FORK_TEST_ON_MQ(PosixMqueue, CapMode, "/cap_mq") { +FORK_TEST_ON_MQ(PosixMqueue, CapModeIfMqOpenAvailable, "/cap_mq") { int mq = mq_open_("/cap_mq", O_RDWR|O_CREAT, 0644, NULL); // On FreeBSD, turn on message queue support with: // - 'kldload mqueuefs' // - 'options P1003_1B_MQUEUE' in kernel build config. if (mq < 0 && errno == ENOSYS) { - TEST_SKIPPED("mq_open -> -ENOSYS"); - return; + GTEST_SKIP() << "mq_open -> -ENOSYS"; } EXPECT_OK(mq); cap_rights_t r_read; diff --git a/contrib/capsicum-test/procdesc.cc b/contrib/capsicum-test/procdesc.cc index 94c0dc5d774d..11274ce9e866 100644 --- a/contrib/capsicum-test/procdesc.cc +++ b/contrib/capsicum-test/procdesc.cc @@ -519,8 +519,8 @@ TEST_F(PipePdfork, CloseLast) { signal(SIGCHLD, original); } -FORK_TEST(Pdfork, OtherUser) { - REQUIRE_ROOT(); +FORK_TEST(Pdfork, OtherUserIfRoot) { + GTEST_SKIP_IF_NOT_ROOT(); int pd; pid_t pid = pdfork(&pd, 0); EXPECT_OK(pid); @@ -531,7 +531,10 @@ FORK_TEST(Pdfork, OtherUser) { usleep(100); // Now that the second process has been pdfork()ed, change euid. - setuid(other_uid); + ASSERT_NE(0u, other_uid) << "other_uid not initialized correctly, " + "please pass the -u flag."; + EXPECT_EQ(0, setuid(other_uid)); + EXPECT_EQ(other_uid, getuid()); if (verbose) fprintf(stderr, "uid=%d euid=%d\n", getuid(), geteuid()); // Fail to kill child with normal PID operation. From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:23:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B4B2557AD5C; Wed, 17 Mar 2021 22:23: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 4F14Rh6bFhz3QZS; Wed, 17 Mar 2021 22:23: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 76FE416AC4; Wed, 17 Mar 2021 22: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 12HMNB6l046071; Wed, 17 Mar 2021 22: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 12HMNBng046070; Wed, 17 Mar 2021 22:23:11 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:23:11 GMT Message-Id: <202103172223.12HMNBng046070@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: c4a6d3b183af - stable/13 - capsicum-test: Update for O_BENEATH removal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: c4a6d3b183af4f34ddd7637eeb8e2ad2008f914c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:23:18 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=c4a6d3b183af4f34ddd7637eeb8e2ad2008f914c commit c4a6d3b183af4f34ddd7637eeb8e2ad2008f914c Author: Alex Richardson AuthorDate: 2021-03-12 17:12:10 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 22:22:50 +0000 capsicum-test: Update for O_BENEATH removal Update the tests to check O_RESOLVE_BENEATH instead. If this looks reasonable, I'll try to upstream this change. This keeps a compat fallback for O_BENEATH since the Linux port still has/had O_BENEATH with "no .., no absolute paths" semantics. Test Plan: `/usr/tests/sys/capsicum/capsicum-test -u 977` passes and runs the O_RESOLVE_BENEATH tests. Reviewed By: markj Differential Revision: https://reviews.freebsd.org/D29016 (cherry picked from commit 8cf5812af4b7f4933983822ff8e1e9185818fbef) --- contrib/capsicum-test/openat.cc | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/contrib/capsicum-test/openat.cc b/contrib/capsicum-test/openat.cc index 5447558cde89..e3f0c2a731f8 100644 --- a/contrib/capsicum-test/openat.cc +++ b/contrib/capsicum-test/openat.cc @@ -341,22 +341,26 @@ FORK_TEST_F(OpenatTest, InCapabilityMode) { EXPECT_OPENAT_FAIL_TRAVERSAL(sub_fd_, "/etc/passwd", O_RDONLY); } -#ifdef O_BENEATH +#if !defined(O_RESOLVE_BENEATH) && defined(O_BENEATH) +#define O_RESOLVE_BENEATH O_BENEATH +#endif + +#ifdef O_RESOLVE_BENEATH TEST_F(OpenatTest, WithFlag) { - CheckPolicing(O_BENEATH); + CheckPolicing(O_RESOLVE_BENEATH); // Check with AT_FDCWD. - EXPECT_OPEN_OK(openat(AT_FDCWD, "topfile", O_RDONLY|O_BENEATH)); - EXPECT_OPEN_OK(openat(AT_FDCWD, "subdir/bottomfile", O_RDONLY|O_BENEATH)); + EXPECT_OPEN_OK(openat(AT_FDCWD, "topfile", O_RDONLY|O_RESOLVE_BENEATH)); + EXPECT_OPEN_OK(openat(AT_FDCWD, "subdir/bottomfile", O_RDONLY|O_RESOLVE_BENEATH)); - // Can't open paths starting with "/" with O_BENEATH specified. - EXPECT_OPENAT_FAIL_TRAVERSAL(AT_FDCWD, "/etc/passwd", O_RDONLY|O_BENEATH); - EXPECT_OPENAT_FAIL_TRAVERSAL(dir_fd_, "/etc/passwd", O_RDONLY|O_BENEATH); - EXPECT_OPENAT_FAIL_TRAVERSAL(sub_fd_, "/etc/passwd", O_RDONLY|O_BENEATH); + // Can't open paths starting with "/" with O_RESOLVE_BENEATH specified. + EXPECT_OPENAT_FAIL_TRAVERSAL(AT_FDCWD, "/etc/passwd", O_RDONLY|O_RESOLVE_BENEATH); + EXPECT_OPENAT_FAIL_TRAVERSAL(dir_fd_, "/etc/passwd", O_RDONLY|O_RESOLVE_BENEATH); + EXPECT_OPENAT_FAIL_TRAVERSAL(sub_fd_, "/etc/passwd", O_RDONLY|O_RESOLVE_BENEATH); } FORK_TEST_F(OpenatTest, WithFlagInCapabilityMode) { EXPECT_OK(cap_enter()); // Enter capability mode - CheckPolicing(O_BENEATH); + CheckPolicing(O_RESOLVE_BENEATH); } #endif From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:23:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A08E57B016; Wed, 17 Mar 2021 22:23: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 4F14Rg3N32z3QLs; Wed, 17 Mar 2021 22:23: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 197DD16C3F; Wed, 17 Mar 2021 22:23: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 12HMN8v4046031; Wed, 17 Mar 2021 22:23:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMN8CL046030; Wed, 17 Mar 2021 22:23:08 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:23:08 GMT Message-Id: <202103172223.12HMN8CL046030@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: ff6dded021a7 - stable/13 - Remove unnecessary semicolon from CRITICAL_ASSERT() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ff6dded021a7772347b9d5ff6b7562d9e688b05f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:23:15 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=ff6dded021a7772347b9d5ff6b7562d9e688b05f commit ff6dded021a7772347b9d5ff6b7562d9e688b05f Author: Alex Richardson AuthorDate: 2021-03-04 15:06:32 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 22:22:49 +0000 Remove unnecessary semicolon from CRITICAL_ASSERT() This fixes off-by-default "empty statement" compiler warnings. (cherry picked from commit b2c8cbf992cb0b51118beae9c304580705ae00c9) --- sys/sys/systm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 72a10c401af9..369b8bdedb51 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -193,7 +193,7 @@ void kassert_panic(const char *fmt, ...) __printflike(1, 2); * Assert that a thread is in critical(9) section. */ #define CRITICAL_ASSERT(td) \ - KASSERT((td)->td_critnest >= 1, ("Not in critical section")); + KASSERT((td)->td_critnest >= 1, ("Not in critical section")) /* * If we have already panic'd and this is the thread that called From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:23:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AC6EB57ADD7; Wed, 17 Mar 2021 22:23: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 4F14Rg6d7xz3QGH; Wed, 17 Mar 2021 22:23: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 094A316C9B; Wed, 17 Mar 2021 22:23: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 12HMN7sT046009; Wed, 17 Mar 2021 22:23:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMN762046008; Wed, 17 Mar 2021 22:23:07 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:23:07 GMT Message-Id: <202103172223.12HMN762046008@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 4159566e56a8 - stable/13 - Fix capsicum-test build with GCC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4159566e56a8521143c22b611e28157e958d1299 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:23:20 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=4159566e56a8521143c22b611e28157e958d1299 commit 4159566e56a8521143c22b611e28157e958d1299 Author: Alex Richardson AuthorDate: 2021-03-03 13:53:30 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 22:22:49 +0000 Fix capsicum-test build with GCC Apparently GCC defines NULL to 0 in C++11 mode (instead of nullptr), so this causes the following error: ``` In file included from capsicum-test.h:15, from capsicum-test.cc:1: gtest-1.10.0/include/gtest/gtest.h: In instantiation of 'testing::AssertionResult testing::internal::CmpHelperNE(const char*, const char*, const T1&, const T2&) [with T1 = long int; T2 = procstat*]': capsicum-test.cc:75:3: required from here gtest-1.10.0/include/gtest/gtest.h:1621:28: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] 1609 | if (val1 op val2) {\ | ~~~~~~~~~~~~ ...... 1621 | GTEST_IMPL_CMP_HELPER_(NE, !=); gtest-1.10.0/include/gtest/gtest.h:1609:12: note: in definition of macro 'GTEST_IMPL_CMP_HELPER_' 1609 | if (val1 op val2) {\ | ^~ ``` Fix this by using nullptr directly. Submitted upstream as https://github.com/google/capsicum-test/pull/56 Reported by: Jenkins CI (cherry picked from commit 47ceb65f3c213904642f4859a53a3139e9cb287d) --- contrib/capsicum-test/capsicum-test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/capsicum-test/capsicum-test.cc b/contrib/capsicum-test/capsicum-test.cc index dedad464a4d9..ba7936c788fc 100644 --- a/contrib/capsicum-test/capsicum-test.cc +++ b/contrib/capsicum-test/capsicum-test.cc @@ -72,7 +72,7 @@ char ProcessState(int pid) { } unsigned int count = 0; struct procstat *prstat = procstat_open_sysctl(); - EXPECT_NE(NULL, prstat) << "procstat_open_sysctl failed."; + EXPECT_NE(nullptr, prstat) << "procstat_open_sysctl failed."; errno = 0; struct kinfo_proc *p = procstat_getprocs(prstat, KERN_PROC_PID, pid, &count); if (p == NULL || count == 0) { From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:23:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA35557ACF1; Wed, 17 Mar 2021 22:23: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 4F14Rk2VkZz3QJF; Wed, 17 Mar 2021 22:23: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 9977A169C4; Wed, 17 Mar 2021 22:23: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 12HMNCSh046093; Wed, 17 Mar 2021 22:23:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMNCNO046092; Wed, 17 Mar 2021 22:23:12 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:23:12 GMT Message-Id: <202103172223.12HMNCNO046092@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 13c808e49c3b - stable/13 - tests/sys/netgraph/ng_macfilter_test: Fix invalid TAP output MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 13c808e49c3b340734433a3b029bab1cee810754 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:23:18 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=13c808e49c3b340734433a3b029bab1cee810754 commit 13c808e49c3b340734433a3b029bab1cee810754 Author: Alex Richardson AuthorDate: 2021-03-12 17:35:24 +0000 Commit: Alex Richardson CommitDate: 2021-03-17 22:22:50 +0000 tests/sys/netgraph/ng_macfilter_test: Fix invalid TAP output This should allow the test to pass in Jenkins. Testing it locally now reports "passed" instead of "invalid TAP data". While touching this file also fix some shellcheck warnings that were pointed out by my IDE. Reviewed By: lwhsu, afedorov Differential Revision: https://reviews.freebsd.org/D29054 (cherry picked from commit 65f4ff4e68afc3867781dfc8cd4faf2a8be1c74f) --- tests/sys/netgraph/ng_macfilter_test.sh | 46 ++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/tests/sys/netgraph/ng_macfilter_test.sh b/tests/sys/netgraph/ng_macfilter_test.sh index 56e201094bcc..269de3e130aa 100755 --- a/tests/sys/netgraph/ng_macfilter_test.sh +++ b/tests/sys/netgraph/ng_macfilter_test.sh @@ -45,7 +45,7 @@ find_iface () { loaded_modules='' load_modules () { - for kmod in $*; do + for kmod in "$@"; do if ! kldstat -q -m $kmod; then test_comment "Loading $kmod..." kldload $kmod @@ -96,16 +96,16 @@ TSTNR=0 TSTFAILS=0 TSTSUCCS=0 -_test_next () { TSTNR=$(($TSTNR + 1)); } -_test_succ () { TSTSUCCS=$(($TSTSUCCS + 1)); } -_test_fail () { TSTFAILS=$(($TSTFAILS + 1)); } +_test_next () { TSTNR=$((TSTNR + 1)); } +_test_succ () { TSTSUCCS=$((TSTSUCCS + 1)); } +_test_fail () { TSTFAILS=$((TSTFAILS + 1)); } test_cnt () { echo "1..${1:-$TSTNR}"; } test_title () { local msg="$1" printf '### %s ' "$msg" - printf '#%.0s' `seq $((80 - ${#msg} - 5))` + printf '#%.0s' $(seq $((80 - ${#msg} - 5))) printf "\n" } test_comment () { echo "# $1"; } @@ -229,7 +229,8 @@ trap 'cleanup' EXIT created_hooks=$(gethooks) rc=0 -test_cnt +# Update this number when adding new tests +test_cnt 46 ################################################################################ @@ -244,12 +245,12 @@ test_failure "duplicate connect of default hook" ################################################################################ test_title "Test: Add and remove hooks" -ngctl connect MF: O2M: xxx1 many$(($HOOKS + 1)) -test_success "connect MF:xxx1 to O2M:many$(($HOOKS + 1))" -ngctl connect MF: O2M: xxx2 many$(($HOOKS + 2)) -test_success "connect MF:xxx2 to O2M:many$(($HOOKS + 2))" -ngctl connect MF: O2M: xxx3 many$(($HOOKS + 3)) -test_success "connect MF:xxx3 to O2M:many$(($HOOKS + 3))" +ngctl connect MF: O2M: xxx1 many$((HOOKS + 1)) +test_success "connect MF:xxx1 to O2M:many$((HOOKS + 1))" +ngctl connect MF: O2M: xxx2 many$((HOOKS + 2)) +test_success "connect MF:xxx2 to O2M:many$((HOOKS + 2))" +ngctl connect MF: O2M: xxx3 many$((HOOKS + 3)) +test_success "connect MF:xxx3 to O2M:many$((HOOKS + 3))" hooks=$(gethooks) test_eq $created_hooks:xxx1:xxx2:xxx3 $hooks 'hooks after adding xxx1-3' @@ -273,7 +274,7 @@ test_title "Test: Add many hooks" added_hooks="" for i in $(seq 10 1 $HOOKSADD); do added_hooks="$added_hooks:xxx$i" - ngctl connect MF: O2M: xxx$i many$(($HOOKS + $i)) + ngctl connect MF: O2M: xxx$i many$((HOOKS + i)) done hooks=$(gethooks) test_eq $created_hooks$added_hooks $hooks 'hooks after adding many hooks' @@ -291,21 +292,21 @@ test_bail_on_fail test_title "Test: Adding many MACs..." I=1 for i in $(seq $ITERATIONS | sort -R); do - test_comment "Iteration $I/$iterations..." + test_comment "Iteration $I/$ITERATIONS..." for j in $(seq 0 1 $SUBITERATIONS); do test $i = 2 && edge='out2' || edge='out1' ether=$(genmac $j $i) ngctl msg MF: 'direct' "{ hookname=\"$edge\" ether=$ether }" done - I=$(($I + 1)) + I=$((I + 1)) done n=$(countmacs out1) -n2=$(( ( $ITERATIONS - 1 ) * ( $SUBITERATIONS + 1 ) )) +n2=$(( ( ITERATIONS - 1 ) * ( SUBITERATIONS + 1 ) )) test_eq $n $n2 'MACs in table for out1' n=$(countmacs out2) -n2=$(( 1 * ( $SUBITERATIONS + 1 ) )) +n2=$(( 1 * ( SUBITERATIONS + 1 ) )) test_eq $n $n2 'MACs in table for out2' n=$(countmacs out3) n2=0 @@ -324,10 +325,10 @@ for i in $(seq $ITERATIONS); do done n=$(countmacs out1) -n2=$(( ( $ITERATIONS - 1 ) * ( $SUBITERATIONS + 1 - 1 ) )) +n2=$(( ( ITERATIONS - 1 ) * ( SUBITERATIONS + 1 - 1 ) )) test_eq $n $n2 'MACs in table for out1' n=$(countmacs out2) -n2=$(( 1 * ( $SUBITERATIONS + 1 - 1 ) )) +n2=$(( 1 * ( SUBITERATIONS + 1 - 1 ) )) test_eq $n $n2 'MACs in table for out2' n=$(countmacs out3) n2=$ITERATIONS @@ -340,7 +341,7 @@ test_bail_on_fail test_title "Test: Removing all MACs one by one..." I=1 for i in $(seq $ITERATIONS | sort -R); do - test_comment "Iteration $I/$iterations..." + test_comment "Iteration $I/$ITERATIONS..." for j in $(seq 0 1 $SUBITERATIONS | sort -R); do edge="default" ether=$(genmac $j $i) @@ -360,7 +361,7 @@ test_bail_on_fail test_title "Test: Randomly adding MACs on random hooks..." rm -f $entries_lst for i in $(seq $ITERATIONS); do - test_comment "Iteration $i/$iterations..." + test_comment "Iteration $i/$ITERATIONS..." for j in $(seq 0 1 $SUBITERATIONS | sort -R); do edge=$(randomedge) ether=$(genmac $j $i) @@ -390,7 +391,7 @@ test_bail_on_fail test_title "Test: Randomly changing MAC assignments..." rm -f $entries2_lst for i in $(seq $ITERATIONS); do - test_comment "Iteration $i/$iterations..." + test_comment "Iteration $i/$ITERATIONS..." cat $entries_lst | while read ether edge; do edge2=$(randomedge) @@ -425,6 +426,5 @@ test_bail_on_fail ################################################################################ -test_cnt exit 0 From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:26:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9BDB57B625; Wed, 17 Mar 2021 22:26:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F14W05scLz3hZy; Wed, 17 Mar 2021 22:26:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBAE616ACA; Wed, 17 Mar 2021 22:26:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12HMQ4b1046703; Wed, 17 Mar 2021 22:26:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMQ41n046702; Wed, 17 Mar 2021 22:26:04 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:26:04 GMT Message-Id: <202103172226.12HMQ41n046702@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 3b71af08bb84 - stable/13 - sbin/ifconfig: Use a global libifconfig handle MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3b71af08bb84a0b8f0b1f4066b399cc48bddbfee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:26:04 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=3b71af08bb84a0b8f0b1f4066b399cc48bddbfee commit 3b71af08bb84a0b8f0b1f4066b399cc48bddbfee Author: Ryan Moeller AuthorDate: 2021-02-28 10:30:09 +0000 Commit: Ryan Moeller CommitDate: 2021-03-17 22:24:49 +0000 sbin/ifconfig: Use a global libifconfig handle This should eventually replace the socket passed to the various handlers. In the meantime, making it global avoids repeatedly opening and closing handles. Reported by: kp Reviewed by: kp (earlier version) Differential Revision: https://reviews.freebsd.org/D28990 (cherry picked from commit 8b22242550c98d0a59b6589f2be0beb1dc2eac13) --- sbin/ifconfig/carp.c | 9 +-------- sbin/ifconfig/ifbridge.c | 9 +-------- sbin/ifconfig/ifclone.c | 6 ------ sbin/ifconfig/ifconfig.c | 9 +++++++++ sbin/ifconfig/ifconfig.h | 5 +++++ sbin/ifconfig/ifgroup.c | 9 +-------- sbin/ifconfig/iflagg.c | 9 +-------- sbin/ifconfig/sfp.c | 14 +++----------- 8 files changed, 21 insertions(+), 49 deletions(-) diff --git a/sbin/ifconfig/carp.c b/sbin/ifconfig/carp.c index d6f8d78ba920..23a119e3b9d7 100644 --- a/sbin/ifconfig/carp.c +++ b/sbin/ifconfig/carp.c @@ -73,14 +73,9 @@ static void carp_status(int s) { struct carpreq carpr[CARP_MAXVHID]; - ifconfig_handle_t *lifh; - - lifh = ifconfig_open(); - if (lifh == NULL) - return; if (ifconfig_carp_get_info(lifh, name, carpr, CARP_MAXVHID) == -1) - goto close; + return; for (size_t i = 0; i < carpr[0].carpr_count; i++) { printf("\tcarp: %s vhid %d advbase %d advskew %d", @@ -91,8 +86,6 @@ carp_status(int s) else printf("\n"); } -close: - ifconfig_close(lifh); } static void diff --git a/sbin/ifconfig/ifbridge.c b/sbin/ifconfig/ifbridge.c index cc1520a2e3f0..2bd9c96f2489 100644 --- a/sbin/ifconfig/ifbridge.c +++ b/sbin/ifconfig/ifbridge.c @@ -156,19 +156,14 @@ bridge_addresses(int s, const char *prefix) static void bridge_status(int s) { - ifconfig_handle_t *lifh; struct ifconfig_bridge_status *bridge; struct ifbropreq *params; const char *pad, *prefix; uint8_t lladdr[ETHER_ADDR_LEN]; uint16_t bprio; - lifh = ifconfig_open(); - if (lifh == NULL) - return; - if (ifconfig_bridge_get_bridge_status(lifh, name, &bridge) == -1) - goto close; + return; params = bridge->params; @@ -227,8 +222,6 @@ bridge_status(int s) } ifconfig_bridge_free_bridge_status(bridge); -close: - ifconfig_close(lifh); } static void diff --git a/sbin/ifconfig/ifclone.c b/sbin/ifconfig/ifclone.c index ad39bd43757a..9cacff239967 100644 --- a/sbin/ifconfig/ifclone.c +++ b/sbin/ifconfig/ifclone.c @@ -57,17 +57,11 @@ typedef enum { static void list_cloners(void) { - ifconfig_handle_t *lifh; char *cloners; size_t cloners_count; - lifh = ifconfig_open(); - if (lifh == NULL) - return; - if (ifconfig_list_cloners(lifh, &cloners, &cloners_count) < 0) errc(1, ifconfig_err_errno(lifh), "unable to list cloners"); - ifconfig_close(lifh); for (const char *name = cloners; name < cloners + cloners_count * IFNAMSIZ; diff --git a/sbin/ifconfig/ifconfig.c b/sbin/ifconfig/ifconfig.c index c99602dd0d84..8b1a242db634 100644 --- a/sbin/ifconfig/ifconfig.c +++ b/sbin/ifconfig/ifconfig.c @@ -75,8 +75,12 @@ static const char rcsid[] = #include #include +#include + #include "ifconfig.h" +ifconfig_handle_t *lifh; + /* * Since "struct ifreq" is composed of various union members, callers * should pay special attention to interpret the value. @@ -419,6 +423,10 @@ main(int argc, char *argv[]) f_inet = f_inet6 = f_ether = f_addr = NULL; matchgroup = nogroup = NULL; + lifh = ifconfig_open(); + if (lifh == NULL) + err(EXIT_FAILURE, "ifconfig_open"); + envformat = getenv("IFCONFIG_FORMAT"); if (envformat != NULL) setformat(envformat); @@ -691,6 +699,7 @@ main(int argc, char *argv[]) done: freeformat(); + ifconfig_close(lifh); exit(exit_code); } diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h index 67c25f5921d6..61b1137b47ba 100644 --- a/sbin/ifconfig/ifconfig.h +++ b/sbin/ifconfig/ifconfig.h @@ -36,6 +36,10 @@ * $FreeBSD$ */ +#pragma once + +#include + #define __constructor __attribute__((constructor)) struct afswtch; @@ -128,6 +132,7 @@ struct option { }; void opt_register(struct option *); +extern ifconfig_handle_t *lifh; extern struct ifreq ifr; extern char name[IFNAMSIZ]; /* name of interface */ extern int allmedia; diff --git a/sbin/ifconfig/ifgroup.c b/sbin/ifconfig/ifgroup.c index 2b13227af4f3..7f1173c316d7 100644 --- a/sbin/ifconfig/ifgroup.c +++ b/sbin/ifconfig/ifgroup.c @@ -86,16 +86,11 @@ unsetifgroup(const char *group_name, int d, int s, const struct afswtch *rafp) static void getifgroups(int s) { - ifconfig_handle_t *lifh; struct ifgroupreq ifgr; size_t cnt; - lifh = ifconfig_open(); - if (lifh == NULL) - return; - if (ifconfig_get_groups(lifh, name, &ifgr) == -1) - goto close; + return; cnt = 0; for (size_t i = 0; i < ifgr.ifgr_len / sizeof(struct ifg_req); ++i) { @@ -112,8 +107,6 @@ getifgroups(int s) printf("\n"); free(ifgr.ifgr_groups); -close: - ifconfig_close(lifh); } static void diff --git a/sbin/ifconfig/iflagg.c b/sbin/ifconfig/iflagg.c index 5e726115662a..48d7450076a9 100644 --- a/sbin/ifconfig/iflagg.c +++ b/sbin/ifconfig/iflagg.c @@ -219,7 +219,6 @@ static void lagg_status(int s) { struct lagg_protos protos[] = LAGG_PROTOS; - ifconfig_handle_t *lifh; struct ifconfig_lagg_status *lagg; struct lagg_reqall *ra; struct lagg_reqflags *rf; @@ -228,12 +227,8 @@ lagg_status(int s) struct lacp_opreq *lp; const char *proto; - lifh = ifconfig_open(); - if (lifh == NULL) - return; - if (ifconfig_lagg_get_lagg_status(lifh, name, &lagg) == -1) - goto close; + return; ra = lagg->ra; rf = lagg->rf; @@ -297,8 +292,6 @@ lagg_status(int s) } ifconfig_lagg_free_lagg_status(lagg); -close: - ifconfig_close(lifh); } static diff --git a/sbin/ifconfig/sfp.c b/sbin/ifconfig/sfp.c index 15ff22639060..4900b18ff2c8 100644 --- a/sbin/ifconfig/sfp.c +++ b/sbin/ifconfig/sfp.c @@ -61,15 +61,10 @@ sfp_status(int s, struct ifreq *ifr, int verbose) struct ifconfig_sfp_info_strings strings; struct ifconfig_sfp_vendor_info vendor_info; struct ifconfig_sfp_status status; - ifconfig_handle_t *lifh; size_t channel_count; - lifh = ifconfig_open(); - if (lifh == NULL) - return; - if (ifconfig_sfp_get_sfp_info(lifh, name, &info) == -1) - goto close; + return; ifconfig_sfp_get_sfp_info_strings(&info, &strings); @@ -79,7 +74,7 @@ sfp_status(int s, struct ifreq *ifr, int verbose) strings.sfp_conn); if (ifconfig_sfp_get_sfp_vendor_info(lifh, name, &vendor_info) == -1) - goto close; + return; printf("\tvendor: %s PN: %s SN: %s DATE: %s\n", vendor_info.name, vendor_info.pn, vendor_info.sn, vendor_info.date); @@ -118,7 +113,7 @@ sfp_status(int s, struct ifreq *ifr, int verbose) struct ifconfig_sfp_dump dump; if (ifconfig_sfp_get_sfp_dump(lifh, name, &dump) == -1) - goto close; + return; if (ifconfig_sfp_id_is_qsfp(info.sfp_id)) { printf("\n\tSFF8436 DUMP (0xA0 128..255 range):\n"); @@ -133,7 +128,4 @@ sfp_status(int s, struct ifreq *ifr, int verbose) "\t", HD_OMIT_COUNT | HD_OMIT_CHARS); } } - -close: - ifconfig_close(lifh); } From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:30:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A647257B765; Wed, 17 Mar 2021 22:30: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 4F14br4KG2z3j77; Wed, 17 Mar 2021 22:30: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 873AD16E81; Wed, 17 Mar 2021 22:30: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 12HMUGte052839; Wed, 17 Mar 2021 22:30:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12HMUGQB052833; Wed, 17 Mar 2021 22:30:16 GMT (envelope-from git) Date: Wed, 17 Mar 2021 22:30:16 GMT Message-Id: <202103172230.12HMUGQB052833@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Bryan Drewery Subject: git: a771bf748f94 - main - Remove unused obj variable missed in r354870. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bdrewery X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a771bf748f94acd53ce95a397f8b0733d8c5aa3d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2021 22:30:16 -0000 The branch main has been updated by bdrewery: URL: https://cgit.FreeBSD.org/src/commit/?id=a771bf748f94acd53ce95a397f8b0733d8c5aa3d commit a771bf748f94acd53ce95a397f8b0733d8c5aa3d Author: Bryan Drewery AuthorDate: 2021-03-17 22:01:19 +0000 Commit: Bryan Drewery CommitDate: 2021-03-17 22:29:15 +0000 Remove unused obj variable missed in r354870. Sponsored by: Dell EMC --- sys/vm/vnode_pager.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sys/vm/vnode_pager.c b/sys/vm/vnode_pager.c index e75c6fb6b5d7..c33ffca4a700 100644 --- a/sys/vm/vnode_pager.c +++ b/sys/vm/vnode_pager.c @@ -1476,12 +1476,10 @@ void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written, off_t eof, int lpos) { - vm_object_t obj; int i, pos, pos_devb; if (written == 0 && eof >= lpos) return; - obj = ma[0]->object; for (i = 0, pos = 0; pos < written; i++, pos += PAGE_SIZE) { if (pos < trunc_page(written)) { rtvals[i] = VM_PAGER_OK; From owner-dev-commits-src-all@freebsd.org Thu Mar 18 00:31:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4AFA957E387; Thu, 18 Mar 2021 00:31: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 4F17J71jFCz3qnm; Thu, 18 Mar 2021 00:31: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 2D63D1862B; Thu, 18 Mar 2021 00:31: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 12I0VpKS014409; Thu, 18 Mar 2021 00:31:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12I0VpJY014408; Thu, 18 Mar 2021 00:31:51 GMT (envelope-from git) Date: Thu, 18 Mar 2021 00:31:51 GMT Message-Id: <202103180031.12I0VpJY014408@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mike Karels Subject: git: 2bdcf6237744 - main - genet: Fix problem with forwarding some TCP/IPv6 packets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: karels X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2bdcf6237744b2d9d9707d623660d33931daeb52 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 00:31:51 -0000 The branch main has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=2bdcf6237744b2d9d9707d623660d33931daeb52 commit 2bdcf6237744b2d9d9707d623660d33931daeb52 Author: Mike Karels AuthorDate: 2021-03-18 00:19:24 +0000 Commit: Mike Karels CommitDate: 2021-03-18 00:25:43 +0000 genet: Fix problem with forwarding some TCP/IPv6 packets TCP/IPv6 packets to be forwarded can be laid out with only the Ethernet header in the first mbuf, and these packets are lost. There was a previous hack to pullup ICMPv6 packets with such a layout for the same reason. Generalize, and pullup any IPv6 packets with only the Ethernet header in the first mbuf. Possibly this should also include IPv4, but that situation has not been observed to fail. PR: 254060 Reported by: denis at h3q.com MFC after: 3 days --- sys/arm64/broadcom/genet/if_genet.c | 46 +++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/sys/arm64/broadcom/genet/if_genet.c b/sys/arm64/broadcom/genet/if_genet.c index 5f2dfcc40395..0fe9f80f4c21 100644 --- a/sys/arm64/broadcom/genet/if_genet.c +++ b/sys/arm64/broadcom/genet/if_genet.c @@ -76,10 +76,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define ICMPV6_HACK /* workaround for chip issue */ -#ifdef ICMPV6_HACK -#include -#endif #include "syscon_if.h" #include "miibus_if.h" @@ -955,6 +951,8 @@ gen_start_locked(struct gen_softc *sc) if (err != 0) { if (err == ENOBUFS) if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0); + else if (m == NULL) + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (m != NULL) if_sendq_prepend(ifp, m); break; @@ -995,36 +993,34 @@ gen_encap(struct gen_softc *sc, struct mbuf **mp) q = &sc->tx_queue[DEF_TXQUEUE]; m = *mp; -#ifdef ICMPV6_HACK + /* * Reflected ICMPv6 packets, e.g. echo replies, tend to get laid * out with only the Ethernet header in the first mbuf, and this - * doesn't seem to work. + * doesn't seem to work. Forwarded TCP packets over IPv6 also + * fail if laid out with only the Ethernet header in the first mbuf. + * For now, pull up any IPv6 packet with that layout. Maybe IPv4 + * needs it but we haven't run into it. Pulling up the sizes of + * ether_header + ip6_header + icmp6_hdr seems to work for both + * ICMPv6 and TCP over IPv6. */ -#define ICMP6_LEN (sizeof(struct ether_header) + sizeof(struct ip6_hdr) + \ - sizeof(struct icmp6_hdr)) +#define IP6_PULLUP_LEN (sizeof(struct ether_header) + \ + sizeof(struct ip6_hdr) + 8) if (m->m_len == sizeof(struct ether_header)) { int ether_type = mtod(m, struct ether_header *)->ether_type; - if (ntohs(ether_type) == ETHERTYPE_IPV6 && - m->m_next->m_len >= sizeof(struct ip6_hdr)) { - struct ip6_hdr *ip6; - - ip6 = mtod(m->m_next, struct ip6_hdr *); - if (ip6->ip6_nxt == IPPROTO_ICMPV6) { - m = m_pullup(m, - MIN(m->m_pkthdr.len, ICMP6_LEN)); - if (m == NULL) { - if (sc->ifp->if_flags & IFF_DEBUG) - device_printf(sc->dev, - "ICMPV6 pullup fail\n"); - *mp = NULL; - return (ENOMEM); - } + if (ntohs(ether_type) == ETHERTYPE_IPV6) { + m = m_pullup(m, MIN(m->m_pkthdr.len, IP6_PULLUP_LEN)); + if (m == NULL) { + if (sc->ifp->if_flags & IFF_DEBUG) + device_printf(sc->dev, + "IPV6 pullup fail\n"); + *mp = NULL; + return (ENOMEM); } } } -#undef ICMP6_LEN -#endif +#undef IP6_PULLUP_LEN + if ((if_getcapenable(sc->ifp) & (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6)) != 0) { csum_flags = m->m_pkthdr.csum_flags; From owner-dev-commits-src-all@freebsd.org Thu Mar 18 01:25:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E9735A841E; Thu, 18 Mar 2021 01:25: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 4F18TY177Sz3vQf; Thu, 18 Mar 2021 01:25: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 1972919387; Thu, 18 Mar 2021 01:25: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 12I1P4XD083562; Thu, 18 Mar 2021 01:25:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12I1P4LX083561; Thu, 18 Mar 2021 01:25:04 GMT (envelope-from git) Date: Thu, 18 Mar 2021 01:25:04 GMT Message-Id: <202103180125.12I1P4LX083561@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 39a1b7bd9327 - stable/13 - gmirror: Pre-allocate the timeout event structure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 39a1b7bd93270a4e6c152678498a05a4fec1b486 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 01:25:05 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=39a1b7bd93270a4e6c152678498a05a4fec1b486 commit 39a1b7bd93270a4e6c152678498a05a4fec1b486 Author: Mark Johnston AuthorDate: 2021-03-11 20:43:04 +0000 Commit: Mark Johnston CommitDate: 2021-03-18 01:24:20 +0000 gmirror: Pre-allocate the timeout event structure We can't call malloc(M_WAITOK) in a callout handler. Reviewed by: imp Reported by: pho Tested by: pho Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29223 (cherry picked from commit 2f1cfb7f63ca744e7a143896347bdc8606c291d6) --- sys/geom/mirror/g_mirror.c | 43 ++++++++++++++++++++++++++++++++++--------- sys/geom/mirror/g_mirror.h | 1 + 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index 350845205485..51836b7eabb8 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -115,6 +115,7 @@ static int g_mirror_update_disk(struct g_mirror_disk *disk, u_int state); static void g_mirror_update_device(struct g_mirror_softc *sc, bool force); static void g_mirror_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp); +static void g_mirror_timeout_drain(struct g_mirror_softc *sc); static int g_mirror_refresh_device(struct g_mirror_softc *sc, const struct g_provider *pp, const struct g_mirror_metadata *md); static void g_mirror_sync_reinit(const struct g_mirror_disk *disk, @@ -183,15 +184,14 @@ g_mirror_event_free(struct g_mirror_event *ep) free(ep, M_MIRROR); } -int -g_mirror_event_send(void *arg, int state, int flags) +static int +g_mirror_event_dispatch(struct g_mirror_event *ep, void *arg, int state, + int flags) { struct g_mirror_softc *sc; struct g_mirror_disk *disk; - struct g_mirror_event *ep; int error; - ep = malloc(sizeof(*ep), M_MIRROR, M_WAITOK); G_MIRROR_DEBUG(4, "%s: Sending event %p.", __func__, ep); if ((flags & G_MIRROR_EVENT_DEVICE) != 0) { disk = NULL; @@ -226,6 +226,15 @@ g_mirror_event_send(void *arg, int state, int flags) return (error); } +int +g_mirror_event_send(void *arg, int state, int flags) +{ + struct g_mirror_event *ep; + + ep = malloc(sizeof(*ep), M_MIRROR, M_WAITOK); + return (g_mirror_event_dispatch(ep, arg, state, flags)); +} + static struct g_mirror_event * g_mirror_event_first(struct g_mirror_softc *sc) { @@ -582,7 +591,7 @@ g_mirror_destroy_device(struct g_mirror_softc *sc) mtx_unlock(&sc->sc_events_mtx); } } - callout_drain(&sc->sc_callout); + g_mirror_timeout_drain(sc); g_topology_lock(); LIST_FOREACH_SAFE(cp, &sc->sc_sync.ds_geom->consumer, consumer, tmpcp) { @@ -2291,13 +2300,26 @@ static void g_mirror_go(void *arg) { struct g_mirror_softc *sc; + struct g_mirror_event *ep; sc = arg; G_MIRROR_DEBUG(0, "Force device %s start due to timeout.", sc->sc_name); - g_mirror_event_send(sc, 0, + ep = sc->sc_timeout_event; + sc->sc_timeout_event = NULL; + g_mirror_event_dispatch(ep, sc, 0, G_MIRROR_EVENT_DONTWAIT | G_MIRROR_EVENT_DEVICE); } +static void +g_mirror_timeout_drain(struct g_mirror_softc *sc) +{ + sx_assert(&sc->sc_lock, SX_XLOCKED); + + callout_drain(&sc->sc_callout); + g_mirror_event_free(sc->sc_timeout_event); + sc->sc_timeout_event = NULL; +} + static u_int g_mirror_determine_state(struct g_mirror_disk *disk) { @@ -2454,7 +2476,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool force) * Disks went down in starting phase, so destroy * device. */ - callout_drain(&sc->sc_callout); + g_mirror_timeout_drain(sc); sc->sc_flags |= G_MIRROR_DEVICE_FLAG_DESTROY; G_MIRROR_DEBUG(1, "root_mount_rel[%u] %p", __LINE__, sc->sc_rootmount); @@ -2491,7 +2513,7 @@ g_mirror_update_device(struct g_mirror_softc *sc, bool force) } } else { /* Cancel timeout. */ - callout_drain(&sc->sc_callout); + g_mirror_timeout_drain(sc); } /* @@ -3153,10 +3175,13 @@ g_mirror_create(struct g_class *mp, const struct g_mirror_metadata *md, sc->sc_rootmount = root_mount_hold("GMIRROR"); G_MIRROR_DEBUG(1, "root_mount_hold %p", sc->sc_rootmount); + /* - * Run timeout. + * Schedule startup timeout. */ timeout = g_mirror_timeout * hz; + sc->sc_timeout_event = malloc(sizeof(struct g_mirror_event), M_MIRROR, + M_WAITOK); callout_reset(&sc->sc_callout, timeout, g_mirror_go, sc); return (sc->sc_geom); } diff --git a/sys/geom/mirror/g_mirror.h b/sys/geom/mirror/g_mirror.h index 57f341f752e1..7cec94adae18 100644 --- a/sys/geom/mirror/g_mirror.h +++ b/sys/geom/mirror/g_mirror.h @@ -207,6 +207,7 @@ struct g_mirror_softc { TAILQ_HEAD(, g_mirror_event) sc_events; struct mtx sc_events_mtx; + struct g_mirror_event *sc_timeout_event; struct callout sc_callout; From owner-dev-commits-src-all@freebsd.org Thu Mar 18 01:25:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79DB25A84AF; Thu, 18 Mar 2021 01:25: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 4F18TZ2dFMz3vCf; Thu, 18 Mar 2021 01:25: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 3B13D19293; Thu, 18 Mar 2021 01:25: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 12I1P6AB083582; Thu, 18 Mar 2021 01:25:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12I1P6Od083581; Thu, 18 Mar 2021 01:25:06 GMT (envelope-from git) Date: Thu, 18 Mar 2021 01:25:06 GMT Message-Id: <202103180125.12I1P6Od083581@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: e37ad9ef372d - stable/13 - link_elf_obj: Handle init_array sections in KLDs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: e37ad9ef372d7e3ff6cdc20ddb9003db116e91ea Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 01:25:06 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=e37ad9ef372d7e3ff6cdc20ddb9003db116e91ea commit e37ad9ef372d7e3ff6cdc20ddb9003db116e91ea Author: Mark Johnston AuthorDate: 2021-03-04 15:02:47 +0000 Commit: Mark Johnston CommitDate: 2021-03-18 01:24:34 +0000 link_elf_obj: Handle init_array sections in KLDs Reuse existing handling for .ctors, print a warning if multiple constructor sections are present. Destructors are not handled as of yet. This is required for KASAN. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D29049 (cherry picked from commit 5e6989ba4f26acafc77baa6055c0a9e7fe683514) --- sys/kern/link_elf_obj.c | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 6b5a6df0a56f..337588bd5c00 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -386,6 +386,8 @@ link_elf_link_preload(linker_class_t cls, const char *filename, #ifdef __amd64__ case SHT_X86_64_UNWIND: #endif + case SHT_INIT_ARRAY: + case SHT_FINI_ARRAY: /* Ignore sections not loaded by the loader. */ if (shdr[i].sh_addr == 0) break; @@ -470,6 +472,7 @@ link_elf_link_preload(linker_class_t cls, const char *filename, #ifdef __amd64__ case SHT_X86_64_UNWIND: #endif + case SHT_FINI_ARRAY: if (shdr[i].sh_addr == 0) break; ef->progtab[pb].addr = (void *)shdr[i].sh_addr; @@ -479,6 +482,10 @@ link_elf_link_preload(linker_class_t cls, const char *filename, else if (shdr[i].sh_type == SHT_X86_64_UNWIND) ef->progtab[pb].name = "<>"; #endif + else if (shdr[i].sh_type == SHT_INIT_ARRAY) + ef->progtab[pb].name = "<>"; + else if (shdr[i].sh_type == SHT_FINI_ARRAY) + ef->progtab[pb].name = "<>"; else ef->progtab[pb].name = "<>"; ef->progtab[pb].size = shdr[i].sh_size; @@ -525,10 +532,17 @@ link_elf_link_preload(linker_class_t cls, const char *filename, vnet_data_copy(vnet_data, shdr[i].sh_size); ef->progtab[pb].addr = vnet_data; #endif - } else if (ef->progtab[pb].name != NULL && - !strcmp(ef->progtab[pb].name, ".ctors")) { - lf->ctors_addr = ef->progtab[pb].addr; - lf->ctors_size = shdr[i].sh_size; + } else if ((ef->progtab[pb].name != NULL && + strcmp(ef->progtab[pb].name, ".ctors") == 0) || + shdr[i].sh_type == SHT_INIT_ARRAY) { + if (lf->ctors_addr != 0) { + printf( + "%s: multiple ctor sections in %s\n", + __func__, filename); + } else { + lf->ctors_addr = ef->progtab[pb].addr; + lf->ctors_size = shdr[i].sh_size; + } } /* Update all symbol values with the offset. */ @@ -773,6 +787,8 @@ link_elf_load_file(linker_class_t cls, const char *filename, #ifdef __amd64__ case SHT_X86_64_UNWIND: #endif + case SHT_INIT_ARRAY: + case SHT_FINI_ARRAY: if ((shdr[i].sh_flags & SHF_ALLOC) == 0) break; ef->nprogtab++; @@ -894,6 +910,8 @@ link_elf_load_file(linker_class_t cls, const char *filename, #ifdef __amd64__ case SHT_X86_64_UNWIND: #endif + case SHT_INIT_ARRAY: + case SHT_FINI_ARRAY: if ((shdr[i].sh_flags & SHF_ALLOC) == 0) break; alignmask = shdr[i].sh_addralign - 1; @@ -971,6 +989,8 @@ link_elf_load_file(linker_class_t cls, const char *filename, #ifdef __amd64__ case SHT_X86_64_UNWIND: #endif + case SHT_INIT_ARRAY: + case SHT_FINI_ARRAY: if ((shdr[i].sh_flags & SHF_ALLOC) == 0) break; alignmask = shdr[i].sh_addralign - 1; @@ -979,9 +999,18 @@ link_elf_load_file(linker_class_t cls, const char *filename, if (ef->shstrtab != NULL && shdr[i].sh_name != 0) { ef->progtab[pb].name = ef->shstrtab + shdr[i].sh_name; - if (!strcmp(ef->progtab[pb].name, ".ctors")) { - lf->ctors_addr = (caddr_t)mapbase; - lf->ctors_size = shdr[i].sh_size; + if (!strcmp(ef->progtab[pb].name, ".ctors") || + shdr[i].sh_type == SHT_INIT_ARRAY) { + if (lf->ctors_addr != 0) { + printf( + "%s: multiple ctor sections in %s\n", + __func__, filename); + } else { + lf->ctors_addr = + (caddr_t)mapbase; + lf->ctors_size = + shdr[i].sh_size; + } } } else if (shdr[i].sh_type == SHT_PROGBITS) ef->progtab[pb].name = "<>"; From owner-dev-commits-src-all@freebsd.org Thu Mar 18 01:25:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4097C5A80BA; Thu, 18 Mar 2021 01:25: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 4F18Tb3T7Nz3vWf; Thu, 18 Mar 2021 01:25: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 5C35118F5A; Thu, 18 Mar 2021 01:25: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 12I1P7D6083603; Thu, 18 Mar 2021 01:25:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12I1P7xG083602; Thu, 18 Mar 2021 01:25:07 GMT (envelope-from git) Date: Thu, 18 Mar 2021 01:25:07 GMT Message-Id: <202103180125.12I1P7xG083602@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 838ceecf2ab5 - stable/13 - link_elf_obj: Add a case missing from 5e6989ba4f26 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 838ceecf2ab5742af3ff5a9ad978268942cb1654 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 01:25:08 -0000 The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=838ceecf2ab5742af3ff5a9ad978268942cb1654 commit 838ceecf2ab5742af3ff5a9ad978268942cb1654 Author: Mark Johnston AuthorDate: 2021-03-16 19:01:41 +0000 Commit: Mark Johnston CommitDate: 2021-03-18 01:24:55 +0000 link_elf_obj: Add a case missing from 5e6989ba4f26 Fixes: 5e6989ba4f26 Sponsored by: The FreeBSD Foundation (cherry picked from commit 4aa157dd5b4e72b85dd07ce3c106b742ca371bca) --- sys/kern/link_elf_obj.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 337588bd5c00..65b997b513e3 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -472,6 +472,7 @@ link_elf_link_preload(linker_class_t cls, const char *filename, #ifdef __amd64__ case SHT_X86_64_UNWIND: #endif + case SHT_INIT_ARRAY: case SHT_FINI_ARRAY: if (shdr[i].sh_addr == 0) break; From owner-dev-commits-src-all@freebsd.org Thu Mar 18 07:15:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A0285AFF77; Thu, 18 Mar 2021 07:15:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1JGC3x7Rz4jkP; Thu, 18 Mar 2021 07:15:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79C551D7C6; Thu, 18 Mar 2021 07:15:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12I7FlOQ046896; Thu, 18 Mar 2021 07:15:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12I7Fklu046891; Thu, 18 Mar 2021 07:15:46 GMT (envelope-from git) Date: Thu, 18 Mar 2021 07:15:46 GMT Message-Id: <202103180715.12I7Fklu046891@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Scott Long Subject: git: b65d2c31b1de - stable/13 - base: remove if_wg(4) and associated utilities, manpage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: scottl X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: b65d2c31b1de93e697e6429b962d9fa0b78e4f70 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 07:15:47 -0000 The branch stable/13 has been updated by scottl: URL: https://cgit.FreeBSD.org/src/commit/?id=b65d2c31b1de93e697e6429b962d9fa0b78e4f70 commit b65d2c31b1de93e697e6429b962d9fa0b78e4f70 Author: Scott Long AuthorDate: 2021-03-18 07:07:56 +0000 Commit: Scott Long CommitDate: 2021-03-18 07:07:56 +0000 base: remove if_wg(4) and associated utilities, manpage After length decisions, we've decided that the if_wg(4) driver and related work is not yet ready to live in the tree. This driver has larger security implications than many, and thus will be held to more scrutiny than other drivers. Requested by: secteam Approved by: re --- sbin/ifconfig/Makefile | 1 - sbin/ifconfig/ifwg.c | 618 -- share/man/man4/Makefile | 1 - share/man/man4/wg.4 | 255 - sys/dev/if_wg/include/crypto/blake2s.h | 56 - sys/dev/if_wg/include/crypto/curve25519.h | 74 - sys/dev/if_wg/include/crypto/zinc.h | 15 - sys/dev/if_wg/include/sys/if_wg_session.h | 89 - sys/dev/if_wg/include/sys/if_wg_session_vars.h | 319 - sys/dev/if_wg/include/sys/simd-x86_64.h | 74 - sys/dev/if_wg/include/sys/support.h | 342 - sys/dev/if_wg/include/sys/wg_cookie.h | 174 - sys/dev/if_wg/include/sys/wg_module.h | 121 - sys/dev/if_wg/include/sys/wg_noise.h | 286 - sys/dev/if_wg/include/zinc/blake2s.h | 50 - sys/dev/if_wg/include/zinc/chacha20.h | 68 - sys/dev/if_wg/include/zinc/chacha20poly1305.h | 48 - sys/dev/if_wg/include/zinc/curve25519.h | 28 - sys/dev/if_wg/include/zinc/poly1305.h | 29 - sys/dev/if_wg/module/blake2s.c | 256 - sys/dev/if_wg/module/blake2s.h | 58 - sys/dev/if_wg/module/chacha20-x86_64.S | 2834 ------- .../crypto/zinc/chacha20/chacha20-arm-glue.c | 98 - .../module/crypto/zinc/chacha20/chacha20-arm.pl | 1227 --- .../module/crypto/zinc/chacha20/chacha20-arm64.pl | 1163 --- .../crypto/zinc/chacha20/chacha20-mips-glue.c | 27 - .../module/crypto/zinc/chacha20/chacha20-mips.S | 424 - .../crypto/zinc/chacha20/chacha20-x86_64-glue.c | 132 - .../module/crypto/zinc/chacha20/chacha20-x86_64.pl | 4106 ---------- .../if_wg/module/crypto/zinc/chacha20/chacha20.c | 238 - .../if_wg/module/crypto/zinc/chacha20poly1305.c | 196 - .../crypto/zinc/poly1305/poly1305-arm-glue.c | 140 - .../module/crypto/zinc/poly1305/poly1305-arm.pl | 1276 --- .../module/crypto/zinc/poly1305/poly1305-arm64.pl | 974 --- .../module/crypto/zinc/poly1305/poly1305-donna32.c | 205 - .../module/crypto/zinc/poly1305/poly1305-donna64.c | 182 - .../crypto/zinc/poly1305/poly1305-mips-glue.c | 37 - .../module/crypto/zinc/poly1305/poly1305-mips.S | 407 - .../module/crypto/zinc/poly1305/poly1305-mips64.pl | 467 -- .../crypto/zinc/poly1305/poly1305-x86_64-glue.c | 171 - .../module/crypto/zinc/poly1305/poly1305-x86_64.pl | 4266 ---------- .../if_wg/module/crypto/zinc/poly1305/poly1305.c | 163 - .../if_wg/module/crypto/zinc/selftest/blake2s.c | 2090 ----- .../if_wg/module/crypto/zinc/selftest/chacha20.c | 2703 ------- .../module/crypto/zinc/selftest/chacha20poly1305.c | 8443 -------------------- .../if_wg/module/crypto/zinc/selftest/curve25519.c | 1315 --- .../if_wg/module/crypto/zinc/selftest/poly1305.c | 1110 --- sys/dev/if_wg/module/crypto/zinc/selftest/run.h | 43 - sys/dev/if_wg/module/curve25519.c | 867 -- sys/dev/if_wg/module/if_wg_session.c | 1983 ----- sys/dev/if_wg/module/module.c | 863 -- sys/dev/if_wg/module/poly1305-x86_64.S | 3021 ------- sys/dev/if_wg/module/wg_cookie.c | 399 - sys/dev/if_wg/module/wg_noise.c | 958 --- sys/kern/subr_gtaskqueue.c | 13 - sys/modules/Makefile | 1 - sys/modules/if_wg/Makefile | 38 - sys/sys/gtaskqueue.h | 1 - 58 files changed, 45543 deletions(-) diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile index 61cb8ab933fd..b178dc0c7e6a 100644 --- a/sbin/ifconfig/Makefile +++ b/sbin/ifconfig/Makefile @@ -35,7 +35,6 @@ SRCS+= ifvxlan.c # VXLAN support SRCS+= ifgre.c # GRE keys etc SRCS+= ifgif.c # GIF reversed header workaround SRCS+= ifipsec.c # IPsec VTI -SRCS+= ifwg.c # Wireguard SRCS+= sfp.c # SFP/SFP+ information LIBADD+= ifconfig m util diff --git a/sbin/ifconfig/ifwg.c b/sbin/ifconfig/ifwg.c deleted file mode 100644 index a2b22d2dfbef..000000000000 --- a/sbin/ifconfig/ifwg.c +++ /dev/null @@ -1,618 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2020 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$"); - -#ifndef RESCUE -#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 /* NB: for offsetof */ -#include -#include -#include - -#include "ifconfig.h" - -typedef enum { - WGC_GET = 0x5, - WGC_SET = 0x6, -} wg_cmd_t; - -static nvlist_t *nvl_params; -static bool do_peer; -static int allowed_ips_count; -static int allowed_ips_max; -struct allowedip { - struct sockaddr_storage a_addr; - struct sockaddr_storage a_mask; -}; -struct allowedip *allowed_ips; - -#define ALLOWEDIPS_START 16 -#define WG_KEY_LEN 32 -#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1) -#define WG_KEY_LEN_HEX (WG_KEY_LEN * 2 + 1) -#define WG_MAX_STRLEN 64 - -static bool -key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64) -{ - - if (strlen(base64) != WG_KEY_LEN_BASE64 - 1) { - warnx("bad key len - need %d got %zu\n", WG_KEY_LEN_BASE64 - 1, strlen(base64)); - return false; - } - if (base64[WG_KEY_LEN_BASE64 - 2] != '=') { - warnx("bad key terminator, expected '=' got '%c'", base64[WG_KEY_LEN_BASE64 - 2]); - return false; - } - return (b64_pton(base64, key, WG_KEY_LEN)); -} - -static void -parse_endpoint(const char *endpoint_) -{ - int err; - char *base, *endpoint, *port, *colon, *tmp; - struct addrinfo hints, *res; - - endpoint = base = strdup(endpoint_); - colon = rindex(endpoint, ':'); - if (colon == NULL) - errx(1, "bad endpoint format %s - no port delimiter found", endpoint); - *colon = '\0'; - port = colon + 1; - - /* [::]:<> */ - if (endpoint[0] == '[') { - endpoint++; - tmp = index(endpoint, ']'); - if (tmp == NULL) - errx(1, "bad endpoint format %s - '[' found with no matching ']'", endpoint); - *tmp = '\0'; - } - bzero(&hints, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - err = getaddrinfo(endpoint, port, &hints, &res); - if (err) - errx(1, "%s", gai_strerror(err)); - nvlist_add_binary(nvl_params, "endpoint", res->ai_addr, res->ai_addrlen); - freeaddrinfo(res); - free(base); -} - -static void -in_len2mask(struct in_addr *mask, u_int len) -{ - u_int i; - u_char *p; - - p = (u_char *)mask; - memset(mask, 0, sizeof(*mask)); - for (i = 0; i < len / NBBY; i++) - p[i] = 0xff; - if (len % NBBY) - p[i] = (0xff00 >> (len % NBBY)) & 0xff; -} - -static u_int -in_mask2len(struct in_addr *mask) -{ - u_int x, y; - u_char *p; - - p = (u_char *)mask; - for (x = 0; x < sizeof(*mask); x++) { - if (p[x] != 0xff) - break; - } - y = 0; - if (x < sizeof(*mask)) { - for (y = 0; y < NBBY; y++) { - if ((p[x] & (0x80 >> y)) == 0) - break; - } - } - return x * NBBY + y; -} - -static void -in6_prefixlen2mask(struct in6_addr *maskp, int len) -{ - static const u_char maskarray[NBBY] = {0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff}; - int bytelen, bitlen, i; - - /* sanity check */ - if (len < 0 || len > 128) { - errx(1, "in6_prefixlen2mask: invalid prefix length(%d)\n", - len); - return; - } - - memset(maskp, 0, sizeof(*maskp)); - bytelen = len / NBBY; - bitlen = len % NBBY; - for (i = 0; i < bytelen; i++) - maskp->s6_addr[i] = 0xff; - if (bitlen) - maskp->s6_addr[bytelen] = maskarray[bitlen - 1]; -} - -static int -in6_mask2len(struct in6_addr *mask, u_char *lim0) -{ - int x = 0, y; - u_char *lim = lim0, *p; - - /* ignore the scope_id part */ - if (lim0 == NULL || lim0 - (u_char *)mask > sizeof(*mask)) - lim = (u_char *)mask + sizeof(*mask); - for (p = (u_char *)mask; p < lim; x++, p++) { - if (*p != 0xff) - break; - } - y = 0; - if (p < lim) { - for (y = 0; y < NBBY; y++) { - if ((*p & (0x80 >> y)) == 0) - break; - } - } - - /* - * when the limit pointer is given, do a stricter check on the - * remaining bits. - */ - if (p < lim) { - if (y != 0 && (*p & (0x00ff >> y)) != 0) - return -1; - for (p = p + 1; p < lim; p++) - if (*p != 0) - return -1; - } - - return x * NBBY + y; -} - -static bool -parse_ip(struct allowedip *aip, const char *value) -{ - struct addrinfo hints, *res; - int err; - - bzero(&aip->a_addr, sizeof(aip->a_addr)); - bzero(&hints, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_flags = AI_NUMERICHOST; - err = getaddrinfo(value, NULL, &hints, &res); - if (err) - errx(1, "%s", gai_strerror(err)); - - memcpy(&aip->a_addr, res->ai_addr, res->ai_addrlen); - - freeaddrinfo(res); - return (true); -} - -static void -sa_ntop(const struct sockaddr *sa, char *buf, int *port) -{ - const struct sockaddr_in *sin; - const struct sockaddr_in6 *sin6; - int err; - - err = getnameinfo(sa, sa->sa_len, buf, INET6_ADDRSTRLEN, NULL, - 0, NI_NUMERICHOST); - - if (sa->sa_family == AF_INET) { - sin = (const struct sockaddr_in *)sa; - if (port) - *port = sin->sin_port; - } else if (sa->sa_family == AF_INET6) { - sin6 = (const struct sockaddr_in6 *)sa; - if (port) - *port = sin6->sin6_port; - } - - if (err) - errx(1, "%s", gai_strerror(err)); -} - -static void -dump_peer(const nvlist_t *nvl_peer) -{ - const void *key; - const struct allowedip *aips; - const struct sockaddr *endpoint; - char outbuf[WG_MAX_STRLEN]; - char addr_buf[INET6_ADDRSTRLEN]; - size_t size; - int count, port; - - printf("[Peer]\n"); - if (nvlist_exists_binary(nvl_peer, "public-key")) { - key = nvlist_get_binary(nvl_peer, "public-key", &size); - b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); - printf("PublicKey = %s\n", outbuf); - } - if (nvlist_exists_binary(nvl_peer, "endpoint")) { - endpoint = nvlist_get_binary(nvl_peer, "endpoint", &size); - sa_ntop(endpoint, addr_buf, &port); - printf("Endpoint = %s:%d\n", addr_buf, ntohs(port)); - } - - if (!nvlist_exists_binary(nvl_peer, "allowed-ips")) - return; - aips = nvlist_get_binary(nvl_peer, "allowed-ips", &size); - if (size == 0 || size % sizeof(struct allowedip) != 0) { - errx(1, "size %zu not integer multiple of allowedip", size); - } - printf("AllowedIPs = "); - count = size / sizeof(struct allowedip); - for (int i = 0; i < count; i++) { - int mask; - sa_family_t family; - void *bitmask; - struct sockaddr *sa; - - sa = __DECONST(void *, &aips[i].a_addr); - bitmask = __DECONST(void *, - ((const struct sockaddr *)&(&aips[i])->a_mask)->sa_data); - family = aips[i].a_addr.ss_family; - getnameinfo(sa, sa->sa_len, addr_buf, INET6_ADDRSTRLEN, NULL, - 0, NI_NUMERICHOST); - if (family == AF_INET) - mask = in_mask2len(bitmask); - else if (family == AF_INET6) - mask = in6_mask2len(bitmask, NULL); - else - errx(1, "bad family in peer %d\n", family); - printf("%s/%d", addr_buf, mask); - if (i < count -1) - printf(", "); - } - printf("\n"); -} - -static int -get_nvl_out_size(int sock, u_long op, size_t *size) -{ - struct ifdrv ifd; - int err; - - memset(&ifd, 0, sizeof(ifd)); - - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); - ifd.ifd_cmd = op; - ifd.ifd_len = 0; - ifd.ifd_data = NULL; - - err = ioctl(sock, SIOCGDRVSPEC, &ifd); - if (err) - return (err); - *size = ifd.ifd_len; - return (0); -} - -static int -do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) -{ - struct ifdrv ifd; - - memset(&ifd, 0, sizeof(ifd)); - - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); - ifd.ifd_cmd = op; - ifd.ifd_len = argsize; - ifd.ifd_data = arg; - - return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); -} - -static -DECL_CMD_FUNC(peerlist, val, d) -{ - size_t size, peercount; - void *packed; - const nvlist_t *nvl, *nvl_peer; - const nvlist_t *const *nvl_peerlist; - - if (get_nvl_out_size(s, WGC_GET, &size)) - errx(1, "can't get peer list size"); - if ((packed = malloc(size)) == NULL) - errx(1, "malloc failed for peer list"); - if (do_cmd(s, WGC_GET, packed, size, 0)) - errx(1, "failed to obtain peer list"); - - nvl = nvlist_unpack(packed, size, 0); - if (!nvlist_exists_nvlist_array(nvl, "peer-list")) - return; - nvl_peerlist = nvlist_get_nvlist_array(nvl, "peer-list", &peercount); - - for (int i = 0; i < peercount; i++, nvl_peerlist++) { - nvl_peer = *nvl_peerlist; - dump_peer(nvl_peer); - } -} - -static void -peerfinish(int s, void *arg) -{ - nvlist_t *nvl, **nvl_array; - void *packed; - size_t size; - - if ((nvl = nvlist_create(0)) == NULL) - errx(1, "failed to allocate nvlist"); - if ((nvl_array = calloc(sizeof(void *), 1)) == NULL) - errx(1, "failed to allocate nvl_array"); - if (!nvlist_exists_binary(nvl_params, "public-key")) - errx(1, "must specify a public-key for adding peer"); - if (!nvlist_exists_binary(nvl_params, "endpoint")) - errx(1, "must specify an endpoint for adding peer"); - if (allowed_ips_count == 0) - errx(1, "must specify at least one range of allowed-ips to add a peer"); - - nvl_array[0] = nvl_params; - nvlist_add_nvlist_array(nvl, "peer-list", (const nvlist_t * const *)nvl_array, 1); - packed = nvlist_pack(nvl, &size); - - if (do_cmd(s, WGC_SET, packed, size, true)) - errx(1, "failed to install peer"); -} - -static -DECL_CMD_FUNC(peerstart, val, d) -{ - do_peer = true; - callback_register(peerfinish, NULL); - allowed_ips = malloc(ALLOWEDIPS_START * sizeof(struct allowedip)); - allowed_ips_max = ALLOWEDIPS_START; - if (allowed_ips == NULL) - errx(1, "failed to allocate array for allowedips"); -} - -static -DECL_CMD_FUNC(setwglistenport, val, d) -{ - struct addrinfo hints, *res; - const struct sockaddr_in *sin; - const struct sockaddr_in6 *sin6; - - u_long ul; - int err; - - bzero(&hints, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_flags = AI_NUMERICHOST; - err = getaddrinfo(NULL, val, &hints, &res); - if (err) - errx(1, "%s", gai_strerror(err)); - - if (res->ai_family == AF_INET) { - sin = (struct sockaddr_in *)res->ai_addr; - ul = sin->sin_port; - } else if (res->ai_family == AF_INET6) { - sin6 = (struct sockaddr_in6 *)res->ai_addr; - ul = sin6->sin6_port; - } else { - errx(1, "unknown family"); - } - ul = ntohs((u_short)ul); - nvlist_add_number(nvl_params, "listen-port", ul); -} - -static -DECL_CMD_FUNC(setwgprivkey, val, d) -{ - uint8_t key[WG_KEY_LEN]; - - if (!key_from_base64(key, val)) - errx(1, "invalid key %s", val); - nvlist_add_binary(nvl_params, "private-key", key, WG_KEY_LEN); -} - -static -DECL_CMD_FUNC(setwgpubkey, val, d) -{ - uint8_t key[WG_KEY_LEN]; - - if (!do_peer) - errx(1, "setting public key only valid when adding peer"); - - if (!key_from_base64(key, val)) - errx(1, "invalid key %s", val); - nvlist_add_binary(nvl_params, "public-key", key, WG_KEY_LEN); -} - -static -DECL_CMD_FUNC(setallowedips, val, d) -{ - char *base, *allowedip, *mask; - u_long ul; - char *endp; - struct allowedip *aip; - - if (!do_peer) - errx(1, "setting allowed ip only valid when adding peer"); - if (allowed_ips_count == allowed_ips_max) { - /* XXX grow array */ - } - aip = &allowed_ips[allowed_ips_count]; - base = allowedip = strdup(val); - mask = index(allowedip, '/'); - if (mask == NULL) - errx(1, "mask separator not found in allowedip %s", val); - *mask = '\0'; - mask++; - parse_ip(aip, allowedip); - ul = strtoul(mask, &endp, 0); - if (*endp != '\0') - errx(1, "invalid value for allowedip mask"); - bzero(&aip->a_mask, sizeof(aip->a_mask)); - if (aip->a_addr.ss_family == AF_INET) - in_len2mask((struct in_addr *)&((struct sockaddr *)&aip->a_mask)->sa_data, ul); - else if (aip->a_addr.ss_family == AF_INET6) - in6_prefixlen2mask((struct in6_addr *)&((struct sockaddr *)&aip->a_mask)->sa_data, ul); - else - errx(1, "invalid address family %d\n", aip->a_addr.ss_family); - allowed_ips_count++; - if (allowed_ips_count > 1) - nvlist_free_binary(nvl_params, "allowed-ips"); - nvlist_add_binary(nvl_params, "allowed-ips", allowed_ips, - allowed_ips_count*sizeof(*aip)); - - dump_peer(nvl_params); - free(base); -} - -static -DECL_CMD_FUNC(setendpoint, val, d) -{ - if (!do_peer) - errx(1, "setting endpoint only valid when adding peer"); - parse_endpoint(val); -} - -static void -wireguard_status(int s) -{ - size_t size; - void *packed; - nvlist_t *nvl; - char buf[WG_KEY_LEN_BASE64]; - const void *key; - uint16_t listen_port; - - if (get_nvl_out_size(s, WGC_GET, &size)) - return; - if ((packed = malloc(size)) == NULL) - return; - if (do_cmd(s, WGC_GET, packed, size, 0)) - return; - nvl = nvlist_unpack(packed, size, 0); - if (nvlist_exists_number(nvl, "listen-port")) { - listen_port = nvlist_get_number(nvl, "listen-port"); - printf("\tlisten-port: %d\n", listen_port); - } - if (nvlist_exists_binary(nvl, "private-key")) { - key = nvlist_get_binary(nvl, "private-key", &size); - b64_ntop((const uint8_t *)key, size, buf, WG_MAX_STRLEN); - printf("\tprivate-key: %s\n", buf); - } - if (nvlist_exists_binary(nvl, "public-key")) { - key = nvlist_get_binary(nvl, "public-key", &size); - b64_ntop((const uint8_t *)key, size, buf, WG_MAX_STRLEN); - printf("\tpublic-key: %s\n", buf); - } -} - -static struct cmd wireguard_cmds[] = { - DEF_CLONE_CMD_ARG("listen-port", setwglistenport), - DEF_CLONE_CMD_ARG("private-key", setwgprivkey), - DEF_CMD("peer-list", 0, peerlist), - DEF_CMD("peer", 0, peerstart), - DEF_CMD_ARG("public-key", setwgpubkey), - DEF_CMD_ARG("allowed-ips", setallowedips), - DEF_CMD_ARG("endpoint", setendpoint), -}; - -static struct afswtch af_wireguard = { - .af_name = "af_wireguard", - .af_af = AF_UNSPEC, - .af_other_status = wireguard_status, -}; - -static void -wg_create(int s, struct ifreq *ifr) -{ - struct iovec iov; - void *packed; - size_t size; - - setproctitle("ifconfig %s create ...\n", name); - if (!nvlist_exists_number(nvl_params, "listen-port")) - goto legacy; - if (!nvlist_exists_binary(nvl_params, "private-key")) - goto legacy; - - packed = nvlist_pack(nvl_params, &size); - if (packed == NULL) - errx(1, "failed to setup create request"); - iov.iov_len = size; - iov.iov_base = packed; - ifr->ifr_data = (caddr_t)&iov; - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) - err(1, "SIOCIFCREATE2"); - return; -legacy: - ifr->ifr_data == NULL; - if (ioctl(s, SIOCIFCREATE, ifr) < 0) - err(1, "SIOCIFCREATE"); -} - -static __constructor void -wireguard_ctor(void) -{ - int i; - - nvl_params = nvlist_create(0); - for (i = 0; i < nitems(wireguard_cmds); i++) - cmd_register(&wireguard_cmds[i]); - af_register(&af_wireguard); - clone_setdefcallback_prefix("wg", wg_create); -} - -#endif diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 5ccb42181482..f3896d6516be 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -584,7 +584,6 @@ MAN= aac.4 \ vtnet.4 \ watchdog.4 \ ${_wbwd.4} \ - wg.4 \ witness.4 \ wlan.4 \ wlan_acl.4 \ diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 deleted file mode 100644 index 760584e3a386..000000000000 --- a/share/man/man4/wg.4 +++ /dev/null @@ -1,255 +0,0 @@ -.\" Copyright (c) 2020 Gordon Bergling -.\" -.\" 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$ -.\" -.Dd March 7, 2021 -.Dt WG 4 -.Os -.Sh NAME -.Nm wg -.Nd "WireGuard - pseudo-device" -.Sh SYNOPSIS -To load the driver as a module at boot time, place the following line in -.Xr loader.conf 5 : -.Bd -literal -offset indent -if_wg_load="YES" -.Ed -.Sh DESCRIPTION -The -.Nm -driver provides Virtual Private Network (VPN) interfaces for the secure -exchange of layer 3 traffic with other WireGuard peers using the WireGuard -protocol. -.Pp -A -.Nm -interface recognises one or more peers, establishes a secure tunnel with -each on demand, and tracks each peer's UDP endpoint for exchanging encrypted -traffic with. -.Pp -The interfaces can be created at runtime using the -.Ic ifconfig Cm wg Ns Ar N Cm create -command. -The interface itself can be configured with -.Xr ifconfig 8 . -.Pp -The following parameters are available: -.Bl -tag -width indent -.It Cm listen-port -The listing port of the -.Nm -interface. -.It Cm public-key -The public key of the -.Nm -interface. -.It Cm private-key -The private key of the -.Nm -interface. -.It Cm pre-shared-key -Defines a pre-shared key for the -.Nm -interface. -.It Cm allowed-ips -A list of allowed IP addresses. -.It Cm endpoint -The IP address of the WiredGuard to connect to. -.It Cm peer-list -A list of peering IP addresses to connect to. -.El -.Pp -The -.Nm -interfaces support the following -.Xr ioctl 2 Ns s : -.Bl -tag -width Ds -offset indent -.It Dv SIOCSWG Fa "struct wg_device_io *" -Set the device configuration. -.It Dv SIOCGWG Fa "struct wg_device_io *" -Get the device configuration. -.El -.Pp -The following glossary provides a brief overview of WireGuard -terminology: -.Bl -tag -width indent -offset 3n -.It Peer -Peers exchange IPv4 or IPv6 traffic over secure tunnels. -Each -.Nm -interface may be configured to recognise one or more peers. -.It Key -Each peer uses its private key and corresponding public key to -identify itself to others. -A peer configures a -.Nm -interface with its own private key and with the public keys of its peers. -.It Pre-shared key -In addition to the public keys, each peer pair may be configured with a -unique pre-shared symmetric key. -This is used in their handshake to guard against future compromise of the -peers' encrypted tunnel if a quantum-computational attack on their -Diffie-Hellman exchange becomes feasible. -It is optional, but recommended. -.It Allowed IPs -A single -.Nm -interface may maintain concurrent tunnels connecting diverse networks. -The interface therefore implements rudimentary routing and reverse-path -filtering functions for its tunneled traffic. -These functions reference a set of allowed IP ranges configured against -each peer. -.Pp -The interface will route outbound tunneled traffic to the peer configured -with the most specific matching allowed IP address range, or drop it -if no such match exists. -.Pp -The interface will accept tunneled traffic only from the peer -configured with the most specific matching allowed IP address range -for the incoming traffic, or drop it if no such match exists. -That is, tunneled traffic routed to a given peer cannot return through -another peer of the same -.Nm -interface. -This ensures that peers cannot spoof another's traffic. -.It Handshake -Two peers handshake to mutually authenticate each other and to -establish a shared series of secret ephemeral encryption keys. -Any peer may initiate a handshake. -Handshakes occur only when there is traffic to send, and recur every -two minutes during transfers. -.It Connectionless -Due to the handshake behavior, there is no connected or disconnected -state. -.El -.Ss Keys -Private keys for WireGuard can be generated from any sufficiently -secure random source. -The Curve25519 keys and the pre-shared keys are both 32 bytes -long and are commonly encoded in base64 for ease of use. -.Pp -Keys can be generated with -.Xr openssl 1 -as follows: -.Pp -.Dl $ openssl rand -base64 32 -.Pp -Although a valid Curve25519 key must have 5 bits set to -specific values, this is done by the interface and so it -will accept any random 32-byte base64 string. -.Pp -When an interface has a private key set with -.Nm public-key , -the corresponding -public key is shown in the status output of the interface: -.Bd -literal -offset indent -# ifconfig wg0 | grep public-key - public-key: 7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw= -.Ed -.Sh EXAMPLES -Create a -.Nm -interface and set random private key. -.Bd -literal -offset indent -# ifconfig wg0 create listen-port 54321 private-key `openssl rand -base64 32` -.Ed -.Pp -Retrieve the associated public key from a -.Nm -interface. -.Bd -literal -offset indent -$ ifconfig wg0 | awk '/public-key/ { print $2 }'` -.Ed -.Pp -Connect to a specific endpoint using its public-key and set the allowed IP address -.Bd -literal -offset indent -# ifconfig wg0 peer public-key '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=' endpoint 10.0.1.100:54321 allowed-ips 192.168.2.100/32 -.Ed -.Sh DIAGNOSTICS -The -.Nm -interface supports runtime debugging, which can be enabled with: -.Pp -.D1 Ic ifconfig Cm wg Ns Ar N Cm debug -.Pp -Some common error messages include: -.Bl -diag -.It "Handshake for peer X did not complete after 5 seconds, retrying" -Peer X did not reply to our initiation packet, for example because: -.Bl -bullet -.It -The peer does not have the local interface configured as a peer. -Peers must be able to mutually authenticate each other. -.It -The peer endpoint IP address is incorrectly configured. -.It -There are firewall rules preventing communication between hosts. -.El -.It "Invalid handshake initiation" -The incoming handshake packet could not be processed. -This is likely due to the local interface not containing -the correct public key for the peer. -.It "Invalid initiation MAC" -The incoming handshake initiation packet had an invalid MAC. -This is likely because the initiation sender has the wrong public key -for the handshake receiver. -.It "Packet has unallowed src IP from peer X" -After decryption, an incoming data packet has a source IP address that -is not assigned to the allowed IPs of Peer X. -.El -.Sh SEE ALSO -.Xr inet 4 , -.Xr ip 4 , -.Xr netintro 4 , -.Xr ipf 5 , -.Xr pf.conf 5 , -.Xr ifconfig 8 , -.Xr ipfw 8 -.Rs -.%T WireGuard whitepaper -.%U https://www.wireguard.com/papers/wireguard.pdf -.Re -.Sh HISTORY -The -.Nm -device driver first appeared in -.Fx 13.0 . -.Sh AUTHORS -The -.Nm -device driver was originally written for -.Ox -by -.An Matt Dunwoodie Aq Mt ncon@nconroy.net -and ported to -.Fx -by -.An Matt Macy Aq Mt mmacy@FreeBSD.org . -.Pp -This manual page was written by -.An Gordon Bergling Aq Mt gbe@FreeBSD.org -and is based on the -.Ox *** 45006 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Mar 18 09:30:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A822A5B5173; Thu, 18 Mar 2021 09:30: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 4F1MFV4N6Hz4tcD; Thu, 18 Mar 2021 09:30: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 84A5F1F846; Thu, 18 Mar 2021 09:30: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 12I9UMuX026248; Thu, 18 Mar 2021 09:30:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12I9UMgx026247; Thu, 18 Mar 2021 09:30:22 GMT (envelope-from git) Date: Thu, 18 Mar 2021 09:30:22 GMT Message-Id: <202103180930.12I9UMgx026247@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: b75fb12b6827 - main - terminfo: add more path to lookup for the database MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b75fb12b6827e306936b338f06ddb906fd383f42 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 09:30:22 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=b75fb12b6827e306936b338f06ddb906fd383f42 commit b75fb12b6827e306936b338f06ddb906fd383f42 Author: Baptiste Daroussin AuthorDate: 2021-03-18 08:46:15 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-18 09:29:43 +0000 terminfo: add more path to lookup for the database In preparation for the move of the database out of base, add one more path to lookup Now the default lookup path is 1. base 2. localbase 3. localbase special site for custom terminfo (for ports adding custom terminfo and avoid potential collision with the general db) 4. termcap The plan is to allow the terminfo-db to be installed by end users via a package for people willing to have the support for features from this database provides. And keep the fallback on termcap for people who don't want to hear about the terminfo db or how to configure the terminal if it uses by default the features proposed in the definitions of the terminfo db. the first look up path is a window open for a proposal made by glebius@ consisting on creating a tool where the user at install time will select the feature it want for a given terminal and generate its configurations based on that. I won't work on it, but it is now posssible and there is a path where to store those definitions --- lib/ncurses/ncurses/ncurses_cfg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ncurses/ncurses/ncurses_cfg.h b/lib/ncurses/ncurses/ncurses_cfg.h index 2217eabd3580..259d5c656af7 100644 --- a/lib/ncurses/ncurses/ncurses_cfg.h +++ b/lib/ncurses/ncurses/ncurses_cfg.h @@ -65,7 +65,7 @@ #ifdef __FreeBSD__ #define USE_SYSMOUSE 1 #endif -#define TERMINFO_DIRS "/usr/share/terminfo:/usr/local/share/site-terminfo" +#define TERMINFO_DIRS "/usr/share/terminfo:/usr/local/share/terminfo:/usr/local/share/site-terminfo" #define TERMINFO "/usr/share/terminfo" #define HAVE_BIG_CORE 1 #define TERMPATH "/etc/termcap:/usr/share/misc/termcap" From owner-dev-commits-src-all@freebsd.org Thu Mar 18 10:10:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E79485B6426; Thu, 18 Mar 2021 10:10: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 4F1N8F68Fwz3DFh; Thu, 18 Mar 2021 10:10: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 C5C721FF30; Thu, 18 Mar 2021 10:10: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 12IAAr7g079834; Thu, 18 Mar 2021 10:10:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IAArna079833; Thu, 18 Mar 2021 10:10:53 GMT (envelope-from git) Date: Thu, 18 Mar 2021 10:10:53 GMT Message-Id: <202103181010.12IAArna079833@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 7a758a4cee23 - main - Revert "terminfo: add terminfo database" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7a758a4cee238aefdf6f631a415100fec28b659a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 10:10:54 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=7a758a4cee238aefdf6f631a415100fec28b659a commit 7a758a4cee238aefdf6f631a415100fec28b659a Author: Baptiste Daroussin AuthorDate: 2021-03-18 09:57:23 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-18 09:57:23 +0000 Revert "terminfo: add terminfo database" This reverts commit 2a50a9de8340f08bd876e9e5993332ae14376f80. --- share/Makefile | 1 - share/terminfo/Makefile | 34 ---------------------------------- 2 files changed, 35 deletions(-) diff --git a/share/Makefile b/share/Makefile index d6854b230ae5..c4e12b05f7db 100644 --- a/share/Makefile +++ b/share/Makefile @@ -26,7 +26,6 @@ SUBDIR= ${_colldef} \ ${_syscons} \ tabset \ termcap \ - terminfo \ ${_timedef} \ ${_vt} \ ${_zoneinfo} diff --git a/share/terminfo/Makefile b/share/terminfo/Makefile deleted file mode 100644 index 7bb11f3fdf24..000000000000 --- a/share/terminfo/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -PACKAGE= runtime - -.PATH: ${SRCTOP}/contrib/ncurses/misc -TINFOBUILDDIR= ${.OBJDIR}/builddir -CLEANDIRS+= builddir - -.include - -.if !defined(_SKIP_BUILD) -all: terminfo -.endif -META_TARGETS+= terminfo install-terminfo - -terminfo: terminfo.src - mkdir -p ${TINFOBUILDDIR} - ${TIC_CMD} -x -o ${TINFOBUILDDIR} ${.ALLSRC} - -.if make(*install*) -TINFOS!= cd ${TINFOBUILDDIR} && find * -type f | LC_ALL=C sort -TINFOSDIRS= ${TINFOS:C/(.).*/\1/g:O:u} -.endif - -beforeinstall: install-terminfo -install-terminfo: - mkdir -p ${DESTDIR}/usr/share/terminfo - cd ${DESTDIR}/usr/share/terminfo; mkdir -p ${TINFOSDIRS} -.for f in ${TINFOS} - ${INSTALL} ${TAG_ARGS} \ - -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ - ${TINFOBUILDDIR}/${f} ${DESTDIR}/usr/share/terminfo/${f} -.endfor - -.include - From owner-dev-commits-src-all@freebsd.org Thu Mar 18 10:10:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C2905B6681; Thu, 18 Mar 2021 10:10: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 4F1N8G6n5Bz3D58; Thu, 18 Mar 2021 10:10: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 DB88620203; Thu, 18 Mar 2021 10:10: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 12IAAs3D079857; Thu, 18 Mar 2021 10:10:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IAAsnP079856; Thu, 18 Mar 2021 10:10:54 GMT (envelope-from git) Date: Thu, 18 Mar 2021 10:10:54 GMT Message-Id: <202103181010.12IAAsnP079856@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 16d3faad099a - main - terminfo db: add entries for the terminfo database removal MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 16d3faad099a36b36518364611ba808f4bda4ea8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 10:10:55 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=16d3faad099a36b36518364611ba808f4bda4ea8 commit 16d3faad099a36b36518364611ba808f4bda4ea8 Author: Baptiste Daroussin AuthorDate: 2021-03-18 10:04:32 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-18 10:04:32 +0000 terminfo db: add entries for the terminfo database removal --- ObsoleteFiles.inc | 2824 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 2824 insertions(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index bb1a19ec5ceb..2d8113dd1cce 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,6 +36,2830 @@ # xargs -n1 | sort | uniq -d; # done +# 20210318: remove the terminfo database +OLD_FILES+=usr/share/terminfo/1/1178 +OLD_FILES+=usr/share/terminfo/1/1730-lm +OLD_DIRS+=usr/share/terminfo/1 +OLD_FILES+=usr/share/terminfo/2/2621 +OLD_FILES+=usr/share/terminfo/2/2621-wl +OLD_FILES+=usr/share/terminfo/2/2621A +OLD_FILES+=usr/share/terminfo/2/2621a +OLD_DIRS+=usr/share/terminfo/2/ +OLD_FILES+=usr/share/terminfo/3/386at +OLD_FILES+=usr/share/terminfo/3/3b1 +OLD_DIRS+=usr/share/terminfo/3/ +OLD_FILES+=usr/share/terminfo/4/4025ex +OLD_FILES+=usr/share/terminfo/4/4027ex +OLD_FILES+=usr/share/terminfo/4/4410-w +OLD_DIRS+=usr/share/terminfo/4/ +OLD_FILES+=usr/share/terminfo/5/5051 +OLD_FILES+=usr/share/terminfo/5/5410-w +OLD_FILES+=usr/share/terminfo/5/5620 +OLD_FILES+=usr/share/terminfo/5/5630-24 +OLD_FILES+=usr/share/terminfo/5/5630DMD-24 +OLD_DIRS+=usr/share/terminfo/5/ +OLD_FILES+=usr/share/terminfo/6/6053 +OLD_FILES+=usr/share/terminfo/6/6053-dg +OLD_FILES+=usr/share/terminfo/6/605x +OLD_FILES+=usr/share/terminfo/6/605x-dg +OLD_FILES+=usr/share/terminfo/6/630-lm +OLD_FILES+=usr/share/terminfo/6/630MTG-24 +OLD_DIRS+=usr/share/terminfo/6/ +OLD_FILES+=usr/share/terminfo/7/730MTG-24 +OLD_FILES+=usr/share/terminfo/7/730MTG-41 +OLD_FILES+=usr/share/terminfo/7/730MTG-41r +OLD_FILES+=usr/share/terminfo/7/730MTGr +OLD_FILES+=usr/share/terminfo/7/730MTGr-24 +OLD_DIRS+=usr/share/terminfo/7/ +OLD_FILES+=usr/share/terminfo/8/8510 +OLD_DIRS+=usr/share/terminfo/8/ +OLD_FILES+=usr/share/terminfo/9/955-hb +OLD_FILES+=usr/share/terminfo/9/955-w +OLD_FILES+=usr/share/terminfo/9/9term +OLD_DIRS+=usr/share/terminfo/9/ +OLD_FILES+=usr/share/terminfo/A/Apple_Terminal +OLD_DIRS+=usr/share/terminfo/A/ +OLD_FILES+=usr/share/terminfo/E/Eterm +OLD_FILES+=usr/share/terminfo/E/Eterm-256color +OLD_FILES+=usr/share/terminfo/E/Eterm-88color +OLD_FILES+=usr/share/terminfo/E/Eterm-color +OLD_DIRS+=usr/share/terminfo/E/ +OLD_FILES+=usr/share/terminfo/L/LFT-PC850 +OLD_DIRS+=usr/share/terminfo/L/ +OLD_FILES+=usr/share/terminfo/M/MtxOrb +OLD_FILES+=usr/share/terminfo/M/MtxOrb162 +OLD_FILES+=usr/share/terminfo/M/MtxOrb204 +OLD_DIRS+=usr/share/terminfo/M/ +OLD_FILES+=usr/share/terminfo/N/NCR260VT300WPP +OLD_FILES+=usr/share/terminfo/N/NCRVT100WPP +OLD_DIRS+=usr/share/terminfo/N/ +OLD_FILES+=usr/share/terminfo/P/P12 +OLD_FILES+=usr/share/terminfo/P/P12-M +OLD_FILES+=usr/share/terminfo/P/P12-M-W +OLD_FILES+=usr/share/terminfo/P/P12-W +OLD_FILES+=usr/share/terminfo/P/P14 +OLD_FILES+=usr/share/terminfo/P/P14-M +OLD_FILES+=usr/share/terminfo/P/P14-M-W +OLD_FILES+=usr/share/terminfo/P/P14-W +OLD_FILES+=usr/share/terminfo/P/P4 +OLD_FILES+=usr/share/terminfo/P/P5 +OLD_FILES+=usr/share/terminfo/P/P7 +OLD_FILES+=usr/share/terminfo/P/P8 +OLD_FILES+=usr/share/terminfo/P/P8-W +OLD_FILES+=usr/share/terminfo/P/P9 +OLD_FILES+=usr/share/terminfo/P/P9-8 +OLD_FILES+=usr/share/terminfo/P/P9-8-W +OLD_FILES+=usr/share/terminfo/P/P9-W +OLD_DIRS+=usr/share/terminfo/P/ +OLD_FILES+=usr/share/terminfo/Q/Q306-8-pc +OLD_FILES+=usr/share/terminfo/Q/Q310-vip-H +OLD_FILES+=usr/share/terminfo/Q/Q310-vip-H-am +OLD_FILES+=usr/share/terminfo/Q/Q310-vip-Hw +OLD_FILES+=usr/share/terminfo/Q/Q310-vip-w +OLD_FILES+=usr/share/terminfo/Q/Q310-vip-w-am +OLD_DIRS+=usr/share/terminfo/Q/ +OLD_FILES+=usr/share/terminfo/X/X-hpterm +OLD_DIRS+=usr/share/terminfo/X/ +OLD_FILES+=usr/share/terminfo/a/a210 +OLD_FILES+=usr/share/terminfo/a/a80 +OLD_FILES+=usr/share/terminfo/a/a980 +OLD_FILES+=usr/share/terminfo/a/aa4080 +OLD_FILES+=usr/share/terminfo/a/aaa +OLD_FILES+=usr/share/terminfo/a/aaa+dec +OLD_FILES+=usr/share/terminfo/a/aaa+rv +OLD_FILES+=usr/share/terminfo/a/aaa+unk +OLD_FILES+=usr/share/terminfo/a/aaa-18 +OLD_FILES+=usr/share/terminfo/a/aaa-18-rv +OLD_FILES+=usr/share/terminfo/a/aaa-20 +OLD_FILES+=usr/share/terminfo/a/aaa-22 +OLD_FILES+=usr/share/terminfo/a/aaa-24 +OLD_FILES+=usr/share/terminfo/a/aaa-24-rv +OLD_FILES+=usr/share/terminfo/a/aaa-26 +OLD_FILES+=usr/share/terminfo/a/aaa-28 +OLD_FILES+=usr/share/terminfo/a/aaa-30 +OLD_FILES+=usr/share/terminfo/a/aaa-30-ctxt +OLD_FILES+=usr/share/terminfo/a/aaa-30-rv +OLD_FILES+=usr/share/terminfo/a/aaa-30-rv-ctxt +OLD_FILES+=usr/share/terminfo/a/aaa-30-s +OLD_FILES+=usr/share/terminfo/a/aaa-30-s-ctxt +OLD_FILES+=usr/share/terminfo/a/aaa-30-s-rv +OLD_FILES+=usr/share/terminfo/a/aaa-30-s-rv-ct +OLD_FILES+=usr/share/terminfo/a/aaa-36 +OLD_FILES+=usr/share/terminfo/a/aaa-36-rv +OLD_FILES+=usr/share/terminfo/a/aaa-40 +OLD_FILES+=usr/share/terminfo/a/aaa-40-rv +OLD_FILES+=usr/share/terminfo/a/aaa-48 +OLD_FILES+=usr/share/terminfo/a/aaa-48-rv +OLD_FILES+=usr/share/terminfo/a/aaa-60 +OLD_FILES+=usr/share/terminfo/a/aaa-60-dec-rv +OLD_FILES+=usr/share/terminfo/a/aaa-60-rv +OLD_FILES+=usr/share/terminfo/a/aaa-60-s +OLD_FILES+=usr/share/terminfo/a/aaa-60-s-rv +OLD_FILES+=usr/share/terminfo/a/aaa-ctxt +OLD_FILES+=usr/share/terminfo/a/aaa-db +OLD_FILES+=usr/share/terminfo/a/aaa-rv +OLD_FILES+=usr/share/terminfo/a/aaa-rv-ctxt +OLD_FILES+=usr/share/terminfo/a/aaa-rv-unk +OLD_FILES+=usr/share/terminfo/a/aaa-s +OLD_FILES+=usr/share/terminfo/a/aaa-s-ctxt +OLD_FILES+=usr/share/terminfo/a/aaa-s-rv +OLD_FILES+=usr/share/terminfo/a/aaa-s-rv-ctxt +OLD_FILES+=usr/share/terminfo/a/aaa-unk +OLD_FILES+=usr/share/terminfo/a/aas1901 +OLD_FILES+=usr/share/terminfo/a/abm80 +OLD_FILES+=usr/share/terminfo/a/abm85 +OLD_FILES+=usr/share/terminfo/a/abm85e +OLD_FILES+=usr/share/terminfo/a/abm85h +OLD_FILES+=usr/share/terminfo/a/abm85h-old +OLD_FILES+=usr/share/terminfo/a/act4 +OLD_FILES+=usr/share/terminfo/a/act5 +OLD_FILES+=usr/share/terminfo/a/addrinfo +OLD_FILES+=usr/share/terminfo/a/adds200 +OLD_FILES+=usr/share/terminfo/a/adds980 +OLD_FILES+=usr/share/terminfo/a/addsviewpoint +OLD_FILES+=usr/share/terminfo/a/addsvp60 +OLD_FILES+=usr/share/terminfo/a/adm+sgr +OLD_FILES+=usr/share/terminfo/a/adm1 +OLD_FILES+=usr/share/terminfo/a/adm11 +OLD_FILES+=usr/share/terminfo/a/adm1178 +OLD_FILES+=usr/share/terminfo/a/adm12 +OLD_FILES+=usr/share/terminfo/a/adm1a +OLD_FILES+=usr/share/terminfo/a/adm2 +OLD_FILES+=usr/share/terminfo/a/adm20 +OLD_FILES+=usr/share/terminfo/a/adm21 +OLD_FILES+=usr/share/terminfo/a/adm22 +OLD_FILES+=usr/share/terminfo/a/adm3 +OLD_FILES+=usr/share/terminfo/a/adm31 +OLD_FILES+=usr/share/terminfo/a/adm31-old +OLD_FILES+=usr/share/terminfo/a/adm36 +OLD_FILES+=usr/share/terminfo/a/adm3a +OLD_FILES+=usr/share/terminfo/a/adm3a+ +OLD_FILES+=usr/share/terminfo/a/adm42 +OLD_FILES+=usr/share/terminfo/a/adm42-ns +OLD_FILES+=usr/share/terminfo/a/adm5 +OLD_FILES+=usr/share/terminfo/a/aepro +OLD_FILES+=usr/share/terminfo/a/aixterm +OLD_FILES+=usr/share/terminfo/a/aixterm-16color +OLD_FILES+=usr/share/terminfo/a/aixterm-m +OLD_FILES+=usr/share/terminfo/a/aixterm-m-old +OLD_FILES+=usr/share/terminfo/a/aj +OLD_FILES+=usr/share/terminfo/a/aj510 +OLD_FILES+=usr/share/terminfo/a/aj830 +OLD_FILES+=usr/share/terminfo/a/aj832 +OLD_FILES+=usr/share/terminfo/a/alacritty +OLD_FILES+=usr/share/terminfo/a/alacritty+common +OLD_FILES+=usr/share/terminfo/a/alacritty-direct +OLD_FILES+=usr/share/terminfo/a/alt2 +OLD_FILES+=usr/share/terminfo/a/alt3 +OLD_FILES+=usr/share/terminfo/a/alt4 +OLD_FILES+=usr/share/terminfo/a/alt5 +OLD_FILES+=usr/share/terminfo/a/alt7 +OLD_FILES+=usr/share/terminfo/a/alt7pc +OLD_FILES+=usr/share/terminfo/a/alto-h19 +OLD_FILES+=usr/share/terminfo/a/alto-heath +OLD_FILES+=usr/share/terminfo/a/altoh19 +OLD_FILES+=usr/share/terminfo/a/altoheath +OLD_FILES+=usr/share/terminfo/a/altos-2 +OLD_FILES+=usr/share/terminfo/a/altos-3 +OLD_FILES+=usr/share/terminfo/a/altos-4 +OLD_FILES+=usr/share/terminfo/a/altos-5 +OLD_FILES+=usr/share/terminfo/a/altos2 +OLD_FILES+=usr/share/terminfo/a/altos3 +OLD_FILES+=usr/share/terminfo/a/altos4 +OLD_FILES+=usr/share/terminfo/a/altos5 +OLD_FILES+=usr/share/terminfo/a/altos7 +OLD_FILES+=usr/share/terminfo/a/altos7pc +OLD_FILES+=usr/share/terminfo/a/ambas +OLD_FILES+=usr/share/terminfo/a/ambassador +OLD_FILES+=usr/share/terminfo/a/amiga +OLD_FILES+=usr/share/terminfo/a/amiga-8bit +OLD_FILES+=usr/share/terminfo/a/amiga-h +OLD_FILES+=usr/share/terminfo/a/amiga-vnc +OLD_FILES+=usr/share/terminfo/a/amp219 +OLD_FILES+=usr/share/terminfo/a/amp219w +OLD_FILES+=usr/share/terminfo/a/ampex-219 +OLD_FILES+=usr/share/terminfo/a/ampex-219w +OLD_FILES+=usr/share/terminfo/a/ampex-232 +OLD_FILES+=usr/share/terminfo/a/ampex175 +OLD_FILES+=usr/share/terminfo/a/ampex175-b +OLD_FILES+=usr/share/terminfo/a/ampex210 +OLD_FILES+=usr/share/terminfo/a/ampex219 +OLD_FILES+=usr/share/terminfo/a/ampex219w +OLD_FILES+=usr/share/terminfo/a/ampex232 +OLD_FILES+=usr/share/terminfo/a/ampex232w +OLD_FILES+=usr/share/terminfo/a/ampex80 +OLD_FILES+=usr/share/terminfo/a/annarbor4080 +OLD_FILES+=usr/share/terminfo/a/ansi +OLD_FILES+=usr/share/terminfo/a/ansi+arrows +OLD_FILES+=usr/share/terminfo/a/ansi+csr +OLD_FILES+=usr/share/terminfo/a/ansi+cup +OLD_FILES+=usr/share/terminfo/a/ansi+enq +OLD_FILES+=usr/share/terminfo/a/ansi+erase +OLD_FILES+=usr/share/terminfo/a/ansi+idc +OLD_FILES+=usr/share/terminfo/a/ansi+idc1 +OLD_FILES+=usr/share/terminfo/a/ansi+idl +OLD_FILES+=usr/share/terminfo/a/ansi+idl1 +OLD_FILES+=usr/share/terminfo/a/ansi+inittabs +OLD_FILES+=usr/share/terminfo/a/ansi+local +OLD_FILES+=usr/share/terminfo/a/ansi+local1 +OLD_FILES+=usr/share/terminfo/a/ansi+pp +OLD_FILES+=usr/share/terminfo/a/ansi+rca +OLD_FILES+=usr/share/terminfo/a/ansi+rep +OLD_FILES+=usr/share/terminfo/a/ansi+sgr +OLD_FILES+=usr/share/terminfo/a/ansi+sgrbold +OLD_FILES+=usr/share/terminfo/a/ansi+sgrdim +OLD_FILES+=usr/share/terminfo/a/ansi+sgrso +OLD_FILES+=usr/share/terminfo/a/ansi+sgrul +OLD_FILES+=usr/share/terminfo/a/ansi+tabs +OLD_FILES+=usr/share/terminfo/a/ansi-color-2-emx +OLD_FILES+=usr/share/terminfo/a/ansi-color-3-emx +OLD_FILES+=usr/share/terminfo/a/ansi-emx +OLD_FILES+=usr/share/terminfo/a/ansi-generic +OLD_FILES+=usr/share/terminfo/a/ansi-m +OLD_FILES+=usr/share/terminfo/a/ansi-mini +OLD_FILES+=usr/share/terminfo/a/ansi-mono +OLD_FILES+=usr/share/terminfo/a/ansi-mr +OLD_FILES+=usr/share/terminfo/a/ansi-mtabs +OLD_FILES+=usr/share/terminfo/a/ansi-nt +OLD_FILES+=usr/share/terminfo/a/ansi.sys +OLD_FILES+=usr/share/terminfo/a/ansi.sys-old +OLD_FILES+=usr/share/terminfo/a/ansi.sysk +OLD_FILES+=usr/share/terminfo/a/ansi43m +OLD_FILES+=usr/share/terminfo/a/ansi77 +OLD_FILES+=usr/share/terminfo/a/ansi80x25 +OLD_FILES+=usr/share/terminfo/a/ansi80x25-mono +OLD_FILES+=usr/share/terminfo/a/ansi80x25-raw +OLD_FILES+=usr/share/terminfo/a/ansi80x30 +OLD_FILES+=usr/share/terminfo/a/ansi80x30-mono +OLD_FILES+=usr/share/terminfo/a/ansi80x43 +OLD_FILES+=usr/share/terminfo/a/ansi80x43-mono +OLD_FILES+=usr/share/terminfo/a/ansi80x50 +OLD_FILES+=usr/share/terminfo/a/ansi80x50-mono +OLD_FILES+=usr/share/terminfo/a/ansi80x60 +OLD_FILES+=usr/share/terminfo/a/ansi80x60-mono +OLD_FILES+=usr/share/terminfo/a/ansil +OLD_FILES+=usr/share/terminfo/a/ansil-mono +OLD_FILES+=usr/share/terminfo/a/ansis +OLD_FILES+=usr/share/terminfo/a/ansis-mono +OLD_FILES+=usr/share/terminfo/a/ansisysk +OLD_FILES+=usr/share/terminfo/a/ansiterm +OLD_FILES+=usr/share/terminfo/a/ansiw +OLD_FILES+=usr/share/terminfo/a/ap-vm80 +OLD_FILES+=usr/share/terminfo/a/apl +OLD_FILES+=usr/share/terminfo/a/apollo +OLD_FILES+=usr/share/terminfo/a/apollo_15P +OLD_FILES+=usr/share/terminfo/a/apollo_19L +OLD_FILES+=usr/share/terminfo/a/apollo_color +OLD_FILES+=usr/share/terminfo/a/apple-80 +OLD_FILES+=usr/share/terminfo/a/apple-ae +OLD_FILES+=usr/share/terminfo/a/apple-soroc +OLD_FILES+=usr/share/terminfo/a/apple-uterm +OLD_FILES+=usr/share/terminfo/a/apple-uterm-vb +OLD_FILES+=usr/share/terminfo/a/apple-videx +OLD_FILES+=usr/share/terminfo/a/apple-videx2 +OLD_FILES+=usr/share/terminfo/a/apple-videx3 +OLD_FILES+=usr/share/terminfo/a/apple-vm80 +OLD_FILES+=usr/share/terminfo/a/apple2e +OLD_FILES+=usr/share/terminfo/a/apple2e-p +OLD_FILES+=usr/share/terminfo/a/apple80p +OLD_FILES+=usr/share/terminfo/a/appleII +OLD_FILES+=usr/share/terminfo/a/appleIIc +OLD_FILES+=usr/share/terminfo/a/appleIIe +OLD_FILES+=usr/share/terminfo/a/appleIIgs +OLD_FILES+=usr/share/terminfo/a/arm100 +OLD_FILES+=usr/share/terminfo/a/arm100-am +OLD_FILES+=usr/share/terminfo/a/arm100-w +OLD_FILES+=usr/share/terminfo/a/arm100-wam +OLD_FILES+=usr/share/terminfo/a/at +OLD_FILES+=usr/share/terminfo/a/at-color +OLD_FILES+=usr/share/terminfo/a/at-m +OLD_FILES+=usr/share/terminfo/a/at386 +OLD_FILES+=usr/share/terminfo/a/atari +OLD_FILES+=usr/share/terminfo/a/atari-color +OLD_FILES+=usr/share/terminfo/a/atari-m +OLD_FILES+=usr/share/terminfo/a/atari-old +OLD_FILES+=usr/share/terminfo/a/atari_st +OLD_FILES+=usr/share/terminfo/a/atari_st-color +OLD_FILES+=usr/share/terminfo/a/atarist-m +OLD_FILES+=usr/share/terminfo/a/aterm +OLD_FILES+=usr/share/terminfo/a/att2300 +OLD_FILES+=usr/share/terminfo/a/att2350 +OLD_FILES+=usr/share/terminfo/a/att4410 +OLD_FILES+=usr/share/terminfo/a/att4410-w +OLD_FILES+=usr/share/terminfo/a/att4410v1 +OLD_FILES+=usr/share/terminfo/a/att4410v1-w +OLD_FILES+=usr/share/terminfo/a/att4415 +OLD_FILES+=usr/share/terminfo/a/att4415+nl +OLD_FILES+=usr/share/terminfo/a/att4415-nl +OLD_FILES+=usr/share/terminfo/a/att4415-rv +OLD_FILES+=usr/share/terminfo/a/att4415-rv-nl +OLD_FILES+=usr/share/terminfo/a/att4415-w +OLD_FILES+=usr/share/terminfo/a/att4415-w-nl +OLD_FILES+=usr/share/terminfo/a/att4415-w-rv +OLD_FILES+=usr/share/terminfo/a/att4415-w-rv-n +OLD_FILES+=usr/share/terminfo/a/att4418 +OLD_FILES+=usr/share/terminfo/a/att4418-w +OLD_FILES+=usr/share/terminfo/a/att4420 +OLD_FILES+=usr/share/terminfo/a/att4424 +OLD_FILES+=usr/share/terminfo/a/att4424-1 +OLD_FILES+=usr/share/terminfo/a/att4424m +OLD_FILES+=usr/share/terminfo/a/att4425 +OLD_FILES+=usr/share/terminfo/a/att4425-nl +OLD_FILES+=usr/share/terminfo/a/att4425-w +OLD_FILES+=usr/share/terminfo/a/att4426 +OLD_FILES+=usr/share/terminfo/a/att500 +OLD_FILES+=usr/share/terminfo/a/att505 +OLD_FILES+=usr/share/terminfo/a/att505-24 +OLD_FILES+=usr/share/terminfo/a/att510a +OLD_FILES+=usr/share/terminfo/a/att510d +OLD_FILES+=usr/share/terminfo/a/att513 +OLD_FILES+=usr/share/terminfo/a/att5310 +OLD_FILES+=usr/share/terminfo/a/att5320 +OLD_FILES+=usr/share/terminfo/a/att5410 +OLD_FILES+=usr/share/terminfo/a/att5410-w +OLD_FILES+=usr/share/terminfo/a/att5410v1 +OLD_FILES+=usr/share/terminfo/a/att5410v1-w +OLD_FILES+=usr/share/terminfo/a/att5418 +OLD_FILES+=usr/share/terminfo/a/att5418-w +OLD_FILES+=usr/share/terminfo/a/att5420 +OLD_FILES+=usr/share/terminfo/a/att5420+nl +OLD_FILES+=usr/share/terminfo/a/att5420-nl +OLD_FILES+=usr/share/terminfo/a/att5420-rv +OLD_FILES+=usr/share/terminfo/a/att5420-rv-nl +OLD_FILES+=usr/share/terminfo/a/att5420-w +OLD_FILES+=usr/share/terminfo/a/att5420-w-nl +OLD_FILES+=usr/share/terminfo/a/att5420-w-rv +OLD_FILES+=usr/share/terminfo/a/att5420-w-rv-n +OLD_FILES+=usr/share/terminfo/a/att5420_2 +OLD_FILES+=usr/share/terminfo/a/att5420_2-w +OLD_FILES+=usr/share/terminfo/a/att5425 +OLD_FILES+=usr/share/terminfo/a/att5425-nl +OLD_FILES+=usr/share/terminfo/a/att5425-w +OLD_FILES+=usr/share/terminfo/a/att5430 +OLD_FILES+=usr/share/terminfo/a/att5620 +OLD_FILES+=usr/share/terminfo/a/att5620-1 +OLD_FILES+=usr/share/terminfo/a/att5620-24 +OLD_FILES+=usr/share/terminfo/a/att5620-34 +OLD_FILES+=usr/share/terminfo/a/att5620-s +OLD_FILES+=usr/share/terminfo/a/att605 +OLD_FILES+=usr/share/terminfo/a/att605-pc +OLD_FILES+=usr/share/terminfo/a/att605-w +OLD_FILES+=usr/share/terminfo/a/att610 +OLD_FILES+=usr/share/terminfo/a/att610-103k +OLD_FILES+=usr/share/terminfo/a/att610-103k-w +OLD_FILES+=usr/share/terminfo/a/att610-w +OLD_FILES+=usr/share/terminfo/a/att615 +OLD_FILES+=usr/share/terminfo/a/att615-103k +OLD_FILES+=usr/share/terminfo/a/att615-103k-w +OLD_FILES+=usr/share/terminfo/a/att615-w +OLD_FILES+=usr/share/terminfo/a/att620 +OLD_FILES+=usr/share/terminfo/a/att620-103k +OLD_FILES+=usr/share/terminfo/a/att620-103k-w +OLD_FILES+=usr/share/terminfo/a/att620-w +OLD_FILES+=usr/share/terminfo/a/att630 +OLD_FILES+=usr/share/terminfo/a/att630-24 +OLD_FILES+=usr/share/terminfo/a/att6386 +OLD_FILES+=usr/share/terminfo/a/att700 +OLD_FILES+=usr/share/terminfo/a/att730 +OLD_FILES+=usr/share/terminfo/a/att730-24 +OLD_FILES+=usr/share/terminfo/a/att730-41 +OLD_FILES+=usr/share/terminfo/a/att7300 +OLD_FILES+=usr/share/terminfo/a/att730r +OLD_FILES+=usr/share/terminfo/a/att730r-24 +OLD_FILES+=usr/share/terminfo/a/att730r-41 +OLD_FILES+=usr/share/terminfo/a/avatar +OLD_FILES+=usr/share/terminfo/a/avatar0 +OLD_FILES+=usr/share/terminfo/a/avatar0+ +OLD_FILES+=usr/share/terminfo/a/avatar1 +OLD_FILES+=usr/share/terminfo/a/avt +OLD_FILES+=usr/share/terminfo/a/avt+s +OLD_FILES+=usr/share/terminfo/a/avt-ns +OLD_FILES+=usr/share/terminfo/a/avt-rv +OLD_FILES+=usr/share/terminfo/a/avt-rv-ns +OLD_FILES+=usr/share/terminfo/a/avt-rv-s +OLD_FILES+=usr/share/terminfo/a/avt-s +OLD_FILES+=usr/share/terminfo/a/avt-w +OLD_FILES+=usr/share/terminfo/a/avt-w-ns +OLD_FILES+=usr/share/terminfo/a/avt-w-rv +OLD_FILES+=usr/share/terminfo/a/avt-w-rv-ns +OLD_FILES+=usr/share/terminfo/a/avt-w-rv-s +OLD_FILES+=usr/share/terminfo/a/avt-w-s +OLD_FILES+=usr/share/terminfo/a/aws +OLD_FILES+=usr/share/terminfo/a/awsc +OLD_DIRS+=usr/share/terminfo/a/ +OLD_FILES+=usr/share/terminfo/b/b-128 +OLD_FILES+=usr/share/terminfo/b/bantam +OLD_FILES+=usr/share/terminfo/b/basic4 +OLD_FILES+=usr/share/terminfo/b/basis +OLD_FILES+=usr/share/terminfo/b/bct510a +OLD_FILES+=usr/share/terminfo/b/bct510d +OLD_FILES+=usr/share/terminfo/b/beacon +OLD_FILES+=usr/share/terminfo/b/bee +OLD_FILES+=usr/share/terminfo/b/beehive +OLD_FILES+=usr/share/terminfo/b/beehive3 +OLD_FILES+=usr/share/terminfo/b/beehive4 +OLD_FILES+=usr/share/terminfo/b/beehiveIIIm +OLD_FILES+=usr/share/terminfo/b/beterm +OLD_FILES+=usr/share/terminfo/b/bg1.25 +OLD_FILES+=usr/share/terminfo/b/bg1.25nv +OLD_FILES+=usr/share/terminfo/b/bg1.25rv +OLD_FILES+=usr/share/terminfo/b/bg2.0 +OLD_FILES+=usr/share/terminfo/b/bg2.0nv +OLD_FILES+=usr/share/terminfo/b/bg2.0rv +OLD_FILES+=usr/share/terminfo/b/bg3.10 +OLD_FILES+=usr/share/terminfo/b/bg3.10nv +OLD_FILES+=usr/share/terminfo/b/bg3.10rv +OLD_FILES+=usr/share/terminfo/b/bh3m +OLD_FILES+=usr/share/terminfo/b/bh4 +OLD_FILES+=usr/share/terminfo/b/bitgraph +OLD_FILES+=usr/share/terminfo/b/blit +OLD_FILES+=usr/share/terminfo/b/bobcat +OLD_FILES+=usr/share/terminfo/b/bq300 +OLD_FILES+=usr/share/terminfo/b/bq300-8 +OLD_FILES+=usr/share/terminfo/b/bq300-8-pc +OLD_FILES+=usr/share/terminfo/b/bq300-8-pc-rv +OLD_FILES+=usr/share/terminfo/b/bq300-8-pc-w +OLD_FILES+=usr/share/terminfo/b/bq300-8-pc-w-rv +OLD_FILES+=usr/share/terminfo/b/bq300-8rv +OLD_FILES+=usr/share/terminfo/b/bq300-8w +OLD_FILES+=usr/share/terminfo/b/bq300-pc +OLD_FILES+=usr/share/terminfo/b/bq300-pc-rv +OLD_FILES+=usr/share/terminfo/b/bq300-pc-w +OLD_FILES+=usr/share/terminfo/b/bq300-pc-w-rv +OLD_FILES+=usr/share/terminfo/b/bq300-rv +OLD_FILES+=usr/share/terminfo/b/bq300-w +OLD_FILES+=usr/share/terminfo/b/bq300-w-8rv +OLD_FILES+=usr/share/terminfo/b/bq300-w-rv +OLD_FILES+=usr/share/terminfo/b/bsdos-pc +OLD_FILES+=usr/share/terminfo/b/bsdos-pc-m +OLD_FILES+=usr/share/terminfo/b/bsdos-pc-mono +OLD_FILES+=usr/share/terminfo/b/bsdos-pc-nobold +OLD_FILES+=usr/share/terminfo/b/bsdos-ppc +OLD_FILES+=usr/share/terminfo/b/bsdos-sparc +OLD_FILES+=usr/share/terminfo/b/bterm +OLD_DIRS+=usr/share/terminfo/b/ +OLD_FILES+=usr/share/terminfo/c/c100 +OLD_FILES+=usr/share/terminfo/c/c100-1p +OLD_FILES+=usr/share/terminfo/c/c100-4p +OLD_FILES+=usr/share/terminfo/c/c100-rv +OLD_FILES+=usr/share/terminfo/c/c100-rv-4p +OLD_FILES+=usr/share/terminfo/c/c104 +OLD_FILES+=usr/share/terminfo/c/c108 +OLD_FILES+=usr/share/terminfo/c/c108-4p +OLD_FILES+=usr/share/terminfo/c/c108-8p +OLD_FILES+=usr/share/terminfo/c/c108-rv +OLD_FILES+=usr/share/terminfo/c/c108-rv-4p +OLD_FILES+=usr/share/terminfo/c/c108-rv-8p +OLD_FILES+=usr/share/terminfo/c/c108-w +OLD_FILES+=usr/share/terminfo/c/c108-w-8p +OLD_FILES+=usr/share/terminfo/c/c300 +OLD_FILES+=usr/share/terminfo/c/c301 +OLD_FILES+=usr/share/terminfo/c/c321 +OLD_FILES+=usr/share/terminfo/c/ca22851 +OLD_FILES+=usr/share/terminfo/c/cad68-2 +OLD_FILES+=usr/share/terminfo/c/cad68-3 +OLD_FILES+=usr/share/terminfo/c/cbblit +OLD_FILES+=usr/share/terminfo/c/cbunix +OLD_FILES+=usr/share/terminfo/c/cci +OLD_FILES+=usr/share/terminfo/c/cci1 +OLD_FILES+=usr/share/terminfo/c/cdc456 +OLD_FILES+=usr/share/terminfo/c/cdc721 +OLD_FILES+=usr/share/terminfo/c/cdc721-esc +OLD_FILES+=usr/share/terminfo/c/cdc721ll +OLD_FILES+=usr/share/terminfo/c/cdc752 +OLD_FILES+=usr/share/terminfo/c/cdc756 +OLD_FILES+=usr/share/terminfo/c/cg7900 +OLD_FILES+=usr/share/terminfo/c/cgc2 +OLD_FILES+=usr/share/terminfo/c/cgc3 +OLD_FILES+=usr/share/terminfo/c/chromatics +OLD_FILES+=usr/share/terminfo/c/ci8510 +OLD_FILES+=usr/share/terminfo/c/cit-80 +OLD_FILES+=usr/share/terminfo/c/cit101 +OLD_FILES+=usr/share/terminfo/c/cit101e +OLD_FILES+=usr/share/terminfo/c/cit101e-132 +OLD_FILES+=usr/share/terminfo/c/cit101e-n +OLD_FILES+=usr/share/terminfo/c/cit101e-n132 +OLD_FILES+=usr/share/terminfo/c/cit101e-rv +OLD_FILES+=usr/share/terminfo/c/cit500 +OLD_FILES+=usr/share/terminfo/c/cit80 +OLD_FILES+=usr/share/terminfo/c/citc +OLD_FILES+=usr/share/terminfo/c/citoh +OLD_FILES+=usr/share/terminfo/c/citoh-6lpi +OLD_FILES+=usr/share/terminfo/c/citoh-8lpi +OLD_FILES+=usr/share/terminfo/c/citoh-comp +OLD_FILES+=usr/share/terminfo/c/citoh-elite +OLD_FILES+=usr/share/terminfo/c/citoh-pica +OLD_FILES+=usr/share/terminfo/c/citoh-prop +OLD_FILES+=usr/share/terminfo/c/citoh-ps +OLD_FILES+=usr/share/terminfo/c/coco3 +OLD_FILES+=usr/share/terminfo/c/coherent +OLD_FILES+=usr/share/terminfo/c/color_xterm +OLD_FILES+=usr/share/terminfo/c/colorscan +OLD_FILES+=usr/share/terminfo/c/commodore +OLD_FILES+=usr/share/terminfo/c/concept +OLD_FILES+=usr/share/terminfo/c/concept-avt +OLD_FILES+=usr/share/terminfo/c/concept100 +OLD_FILES+=usr/share/terminfo/c/concept100-rv +OLD_FILES+=usr/share/terminfo/c/concept108 +OLD_FILES+=usr/share/terminfo/c/concept108-4p +OLD_FILES+=usr/share/terminfo/c/concept108-8p +OLD_FILES+=usr/share/terminfo/c/concept108-w-8 +OLD_FILES+=usr/share/terminfo/c/concept108-w8p +OLD_FILES+=usr/share/terminfo/c/concept108rv4p +OLD_FILES+=usr/share/terminfo/c/cons25 +OLD_FILES+=usr/share/terminfo/c/cons25-debian +OLD_FILES+=usr/share/terminfo/c/cons25-iso-m +OLD_FILES+=usr/share/terminfo/c/cons25-iso8859 +OLD_FILES+=usr/share/terminfo/c/cons25-koi8-r +OLD_FILES+=usr/share/terminfo/c/cons25-koi8r-m +OLD_FILES+=usr/share/terminfo/c/cons25-m +OLD_FILES+=usr/share/terminfo/c/cons25l1 +OLD_FILES+=usr/share/terminfo/c/cons25l1-m +OLD_FILES+=usr/share/terminfo/c/cons25r +OLD_FILES+=usr/share/terminfo/c/cons25r-m +OLD_FILES+=usr/share/terminfo/c/cons25w +OLD_FILES+=usr/share/terminfo/c/cons30 +OLD_FILES+=usr/share/terminfo/c/cons30-m +OLD_FILES+=usr/share/terminfo/c/cons43 +OLD_FILES+=usr/share/terminfo/c/cons43-m +OLD_FILES+=usr/share/terminfo/c/cons50 +OLD_FILES+=usr/share/terminfo/c/cons50-iso-m +OLD_FILES+=usr/share/terminfo/c/cons50-iso8859 +OLD_FILES+=usr/share/terminfo/c/cons50-koi8r +OLD_FILES+=usr/share/terminfo/c/cons50-koi8r-m +OLD_FILES+=usr/share/terminfo/c/cons50-m +OLD_FILES+=usr/share/terminfo/c/cons50l1 +OLD_FILES+=usr/share/terminfo/c/cons50l1-m +OLD_FILES+=usr/share/terminfo/c/cons50r +OLD_FILES+=usr/share/terminfo/c/cons50r-m +OLD_FILES+=usr/share/terminfo/c/cons60 +OLD_FILES+=usr/share/terminfo/c/cons60-iso +OLD_FILES+=usr/share/terminfo/c/cons60-iso-m +OLD_FILES+=usr/share/terminfo/c/cons60-koi8r +OLD_FILES+=usr/share/terminfo/c/cons60-koi8r-m +OLD_FILES+=usr/share/terminfo/c/cons60-m +OLD_FILES+=usr/share/terminfo/c/cons60l1 +OLD_FILES+=usr/share/terminfo/c/cons60l1-m +OLD_FILES+=usr/share/terminfo/c/cons60r +OLD_FILES+=usr/share/terminfo/c/cons60r-m +OLD_FILES+=usr/share/terminfo/c/contel300 +OLD_FILES+=usr/share/terminfo/c/contel301 +OLD_FILES+=usr/share/terminfo/c/contel320 +OLD_FILES+=usr/share/terminfo/c/contel321 +OLD_FILES+=usr/share/terminfo/c/cops +OLD_FILES+=usr/share/terminfo/c/cops-10 +OLD_FILES+=usr/share/terminfo/c/cops10 +OLD_FILES+=usr/share/terminfo/c/crt +OLD_FILES+=usr/share/terminfo/c/crt-vt220 +OLD_FILES+=usr/share/terminfo/c/cs10 +OLD_FILES+=usr/share/terminfo/c/cs10-w +OLD_FILES+=usr/share/terminfo/c/ct82 +OLD_FILES+=usr/share/terminfo/c/ct8500 +OLD_FILES+=usr/share/terminfo/c/ctrm +OLD_FILES+=usr/share/terminfo/c/cx +OLD_FILES+=usr/share/terminfo/c/cx100 +OLD_FILES+=usr/share/terminfo/c/cyb110 +OLD_FILES+=usr/share/terminfo/c/cyb83 +OLD_FILES+=usr/share/terminfo/c/cygwin +OLD_FILES+=usr/share/terminfo/c/cygwinB19 +OLD_FILES+=usr/share/terminfo/c/cygwinDBG +OLD_DIRS+=usr/share/terminfo/c/ +OLD_FILES+=usr/share/terminfo/d/d132 +OLD_FILES+=usr/share/terminfo/d/d2 +OLD_FILES+=usr/share/terminfo/d/d2-dg +OLD_FILES+=usr/share/terminfo/d/d200 +OLD_FILES+=usr/share/terminfo/d/d200-dg +OLD_FILES+=usr/share/terminfo/d/d210 +OLD_FILES+=usr/share/terminfo/d/d210-dg +OLD_FILES+=usr/share/terminfo/d/d211 +OLD_FILES+=usr/share/terminfo/d/d211-7b +OLD_FILES+=usr/share/terminfo/d/d211-dg +OLD_FILES+=usr/share/terminfo/d/d214 +OLD_FILES+=usr/share/terminfo/d/d214-dg +OLD_FILES+=usr/share/terminfo/d/d215 +OLD_FILES+=usr/share/terminfo/d/d215-7b +OLD_FILES+=usr/share/terminfo/d/d215-dg +OLD_FILES+=usr/share/terminfo/d/d216+ +OLD_FILES+=usr/share/terminfo/d/d216+25 +OLD_FILES+=usr/share/terminfo/d/d216+dg +OLD_FILES+=usr/share/terminfo/d/d216-dg +OLD_FILES+=usr/share/terminfo/d/d216-unix +OLD_FILES+=usr/share/terminfo/d/d216-unix-25 +OLD_FILES+=usr/share/terminfo/d/d216e+ +OLD_FILES+=usr/share/terminfo/d/d216e+dg +OLD_FILES+=usr/share/terminfo/d/d216e-dg +OLD_FILES+=usr/share/terminfo/d/d216e-unix +OLD_FILES+=usr/share/terminfo/d/d217-dg +OLD_FILES+=usr/share/terminfo/d/d217-unix +OLD_FILES+=usr/share/terminfo/d/d217-unix-25 +OLD_FILES+=usr/share/terminfo/d/d220 +OLD_FILES+=usr/share/terminfo/d/d220-7b +OLD_FILES+=usr/share/terminfo/d/d220-dg +OLD_FILES+=usr/share/terminfo/d/d230 +OLD_FILES+=usr/share/terminfo/d/d230-dg +OLD_FILES+=usr/share/terminfo/d/d230c +OLD_FILES+=usr/share/terminfo/d/d230c-dg +OLD_FILES+=usr/share/terminfo/d/d400 +OLD_FILES+=usr/share/terminfo/d/d400-dg +OLD_FILES+=usr/share/terminfo/d/d410 +OLD_FILES+=usr/share/terminfo/d/d410-7b +OLD_FILES+=usr/share/terminfo/d/d410-7b-w +OLD_FILES+=usr/share/terminfo/d/d410-dg +OLD_FILES+=usr/share/terminfo/d/d410-w +OLD_FILES+=usr/share/terminfo/d/d411 +OLD_FILES+=usr/share/terminfo/d/d411-7b +OLD_FILES+=usr/share/terminfo/d/d411-7b-w +OLD_FILES+=usr/share/terminfo/d/d411-dg +OLD_FILES+=usr/share/terminfo/d/d411-w +OLD_FILES+=usr/share/terminfo/d/d412+ +OLD_FILES+=usr/share/terminfo/d/d412+25 +OLD_FILES+=usr/share/terminfo/d/d412+dg +OLD_FILES+=usr/share/terminfo/d/d412+s +OLD_FILES+=usr/share/terminfo/d/d412+sr +OLD_FILES+=usr/share/terminfo/d/d412+w +OLD_FILES+=usr/share/terminfo/d/d412-dg +OLD_FILES+=usr/share/terminfo/d/d412-unix +OLD_FILES+=usr/share/terminfo/d/d412-unix-25 +OLD_FILES+=usr/share/terminfo/d/d412-unix-s +OLD_FILES+=usr/share/terminfo/d/d412-unix-sr +OLD_FILES+=usr/share/terminfo/d/d412-unix-w +OLD_FILES+=usr/share/terminfo/d/d413-dg +OLD_FILES+=usr/share/terminfo/d/d413-unix +OLD_FILES+=usr/share/terminfo/d/d413-unix-25 +OLD_FILES+=usr/share/terminfo/d/d413-unix-s +OLD_FILES+=usr/share/terminfo/d/d413-unix-sr +OLD_FILES+=usr/share/terminfo/d/d413-unix-w +OLD_FILES+=usr/share/terminfo/d/d414-unix +OLD_FILES+=usr/share/terminfo/d/d414-unix-25 +OLD_FILES+=usr/share/terminfo/d/d414-unix-s +OLD_FILES+=usr/share/terminfo/d/d414-unix-sr +OLD_FILES+=usr/share/terminfo/d/d414-unix-w +OLD_FILES+=usr/share/terminfo/d/d430-dg +OLD_FILES+=usr/share/terminfo/d/d430-dg-ccc +OLD_FILES+=usr/share/terminfo/d/d430-unix +OLD_FILES+=usr/share/terminfo/d/d430-unix-25 +OLD_FILES+=usr/share/terminfo/d/d430-unix-25-ccc +OLD_FILES+=usr/share/terminfo/d/d430-unix-ccc +OLD_FILES+=usr/share/terminfo/d/d430-unix-s +OLD_FILES+=usr/share/terminfo/d/d430-unix-s-ccc +OLD_FILES+=usr/share/terminfo/d/d430-unix-sr +OLD_FILES+=usr/share/terminfo/d/d430-unix-sr-ccc +OLD_FILES+=usr/share/terminfo/d/d430-unix-w +OLD_FILES+=usr/share/terminfo/d/d430-unix-w-ccc +OLD_FILES+=usr/share/terminfo/d/d430c-dg +OLD_FILES+=usr/share/terminfo/d/d430c-dg-ccc +OLD_FILES+=usr/share/terminfo/d/d430c-unix +OLD_FILES+=usr/share/terminfo/d/d430c-unix-25 +OLD_FILES+=usr/share/terminfo/d/d430c-unix-25-ccc +OLD_FILES+=usr/share/terminfo/d/d430c-unix-ccc +OLD_FILES+=usr/share/terminfo/d/d430c-unix-s +OLD_FILES+=usr/share/terminfo/d/d430c-unix-s-ccc +OLD_FILES+=usr/share/terminfo/d/d430c-unix-sr +OLD_FILES+=usr/share/terminfo/d/d430c-unix-sr-ccc +OLD_FILES+=usr/share/terminfo/d/d430c-unix-w +OLD_FILES+=usr/share/terminfo/d/d430c-unix-w-ccc +OLD_FILES+=usr/share/terminfo/d/d450 +OLD_FILES+=usr/share/terminfo/d/d450-dg +OLD_FILES+=usr/share/terminfo/d/d460 +OLD_FILES+=usr/share/terminfo/d/d460-7b +OLD_FILES+=usr/share/terminfo/d/d460-7b-w +OLD_FILES+=usr/share/terminfo/d/d460-dg +OLD_FILES+=usr/share/terminfo/d/d460-w +OLD_FILES+=usr/share/terminfo/d/d461 +OLD_FILES+=usr/share/terminfo/d/d461-7b +OLD_FILES+=usr/share/terminfo/d/d461-7b-w +OLD_FILES+=usr/share/terminfo/d/d461-dg +OLD_FILES+=usr/share/terminfo/d/d461-w +OLD_FILES+=usr/share/terminfo/d/d462+ +OLD_FILES+=usr/share/terminfo/d/d462+25 +OLD_FILES+=usr/share/terminfo/d/d462+dg +OLD_FILES+=usr/share/terminfo/d/d462+s +OLD_FILES+=usr/share/terminfo/d/d462+sr +OLD_FILES+=usr/share/terminfo/d/d462+w +OLD_FILES+=usr/share/terminfo/d/d462-dg +OLD_FILES+=usr/share/terminfo/d/d462-unix +OLD_FILES+=usr/share/terminfo/d/d462-unix-25 +OLD_FILES+=usr/share/terminfo/d/d462-unix-s +OLD_FILES+=usr/share/terminfo/d/d462-unix-sr +OLD_FILES+=usr/share/terminfo/d/d462-unix-w +OLD_FILES+=usr/share/terminfo/d/d462e-dg +OLD_FILES+=usr/share/terminfo/d/d463-dg +OLD_FILES+=usr/share/terminfo/d/d463-unix +OLD_FILES+=usr/share/terminfo/d/d463-unix-25 +OLD_FILES+=usr/share/terminfo/d/d463-unix-s +OLD_FILES+=usr/share/terminfo/d/d463-unix-sr +OLD_FILES+=usr/share/terminfo/d/d463-unix-w +OLD_FILES+=usr/share/terminfo/d/d464-unix +OLD_FILES+=usr/share/terminfo/d/d464-unix-25 +OLD_FILES+=usr/share/terminfo/d/d464-unix-s +OLD_FILES+=usr/share/terminfo/d/d464-unix-sr +OLD_FILES+=usr/share/terminfo/d/d464-unix-w +OLD_FILES+=usr/share/terminfo/d/d470 +OLD_FILES+=usr/share/terminfo/d/d470-7b +OLD_FILES+=usr/share/terminfo/d/d470-dg +OLD_FILES+=usr/share/terminfo/d/d470c +OLD_FILES+=usr/share/terminfo/d/d470c-7b +OLD_FILES+=usr/share/terminfo/d/d470c-dg +OLD_FILES+=usr/share/terminfo/d/d555 +OLD_FILES+=usr/share/terminfo/d/d555-7b +OLD_FILES+=usr/share/terminfo/d/d555-7b-w +OLD_FILES+=usr/share/terminfo/d/d555-dg +OLD_FILES+=usr/share/terminfo/d/d555-w +OLD_FILES+=usr/share/terminfo/d/d577 +OLD_FILES+=usr/share/terminfo/d/d577-7b +OLD_FILES+=usr/share/terminfo/d/d577-7b-w +OLD_FILES+=usr/share/terminfo/d/d577-dg +OLD_FILES+=usr/share/terminfo/d/d577-w +OLD_FILES+=usr/share/terminfo/d/d578 +OLD_FILES+=usr/share/terminfo/d/d578-7b +OLD_FILES+=usr/share/terminfo/d/d578-dg +OLD_FILES+=usr/share/terminfo/d/d80 +OLD_FILES+=usr/share/terminfo/d/d800 +OLD_FILES+=usr/share/terminfo/d/darwin +OLD_FILES+=usr/share/terminfo/d/darwin-100x37 +OLD_FILES+=usr/share/terminfo/d/darwin-100x37-m +OLD_FILES+=usr/share/terminfo/d/darwin-112x37 +OLD_FILES+=usr/share/terminfo/d/darwin-112x37-m +OLD_FILES+=usr/share/terminfo/d/darwin-128x40 +OLD_FILES+=usr/share/terminfo/d/darwin-128x40-m +OLD_FILES+=usr/share/terminfo/d/darwin-128x48 +OLD_FILES+=usr/share/terminfo/d/darwin-128x48-m +OLD_FILES+=usr/share/terminfo/d/darwin-144x48 +OLD_FILES+=usr/share/terminfo/d/darwin-144x48-m +OLD_FILES+=usr/share/terminfo/d/darwin-160x64 +OLD_FILES+=usr/share/terminfo/d/darwin-160x64-m +OLD_FILES+=usr/share/terminfo/d/darwin-200x64 +OLD_FILES+=usr/share/terminfo/d/darwin-200x64-m +OLD_FILES+=usr/share/terminfo/d/darwin-200x75 +OLD_FILES+=usr/share/terminfo/d/darwin-200x75-m +OLD_FILES+=usr/share/terminfo/d/darwin-256x96 +OLD_FILES+=usr/share/terminfo/d/darwin-256x96-m +OLD_FILES+=usr/share/terminfo/d/darwin-80x25 +OLD_FILES+=usr/share/terminfo/d/darwin-80x25-m +OLD_FILES+=usr/share/terminfo/d/darwin-80x30 +OLD_FILES+=usr/share/terminfo/d/darwin-80x30-m +OLD_FILES+=usr/share/terminfo/d/darwin-90x30 +OLD_FILES+=usr/share/terminfo/d/darwin-90x30-m +OLD_FILES+=usr/share/terminfo/d/darwin-b +OLD_FILES+=usr/share/terminfo/d/darwin-f +OLD_FILES+=usr/share/terminfo/d/darwin-f2 +OLD_FILES+=usr/share/terminfo/d/darwin-m +OLD_FILES+=usr/share/terminfo/d/darwin-m-b +OLD_FILES+=usr/share/terminfo/d/darwin-m-f +OLD_FILES+=usr/share/terminfo/d/darwin-m-f2 +OLD_FILES+=usr/share/terminfo/d/datagraphix +OLD_FILES+=usr/share/terminfo/d/datamedia2500 +OLD_FILES+=usr/share/terminfo/d/datapoint +OLD_FILES+=usr/share/terminfo/d/dataspeed40 +OLD_FILES+=usr/share/terminfo/d/dd5000 +OLD_FILES+=usr/share/terminfo/d/ddr +OLD_FILES+=usr/share/terminfo/d/ddr3180 +OLD_FILES+=usr/share/terminfo/d/dec+pp +OLD_FILES+=usr/share/terminfo/d/dec+sl +OLD_FILES+=usr/share/terminfo/d/dec-vt100 +OLD_FILES+=usr/share/terminfo/d/dec-vt220 +OLD_FILES+=usr/share/terminfo/d/dec-vt330 +OLD_FILES+=usr/share/terminfo/d/dec-vt340 +OLD_FILES+=usr/share/terminfo/d/dec-vt400 +OLD_FILES+=usr/share/terminfo/d/decansi +OLD_FILES+=usr/share/terminfo/d/decpro +OLD_FILES+=usr/share/terminfo/d/decwriter +OLD_FILES+=usr/share/terminfo/d/delta +OLD_FILES+=usr/share/terminfo/d/dg+ccc +OLD_FILES+=usr/share/terminfo/d/dg+color +OLD_FILES+=usr/share/terminfo/d/dg+color8 +OLD_FILES+=usr/share/terminfo/d/dg+fixed +OLD_FILES+=usr/share/terminfo/d/dg-ansi +OLD_FILES+=usr/share/terminfo/d/dg-generic +OLD_FILES+=usr/share/terminfo/d/dg100 +OLD_FILES+=usr/share/terminfo/d/dg200 +OLD_FILES+=usr/share/terminfo/d/dg210 +OLD_FILES+=usr/share/terminfo/d/dg211 +OLD_FILES+=usr/share/terminfo/d/dg450 +OLD_FILES+=usr/share/terminfo/d/dg460-ansi +OLD_FILES+=usr/share/terminfo/d/dg6053 +OLD_FILES+=usr/share/terminfo/d/dg6053-old +OLD_FILES+=usr/share/terminfo/d/dg605x +OLD_FILES+=usr/share/terminfo/d/dg6134 +OLD_FILES+=usr/share/terminfo/d/dgkeys+11 +OLD_FILES+=usr/share/terminfo/d/dgkeys+15 +OLD_FILES+=usr/share/terminfo/d/dgkeys+7b +OLD_FILES+=usr/share/terminfo/d/dgkeys+8b +OLD_FILES+=usr/share/terminfo/d/dgmode+color +OLD_FILES+=usr/share/terminfo/d/dgmode+color8 +OLD_FILES+=usr/share/terminfo/d/dgunix+ccc +OLD_FILES+=usr/share/terminfo/d/dgunix+fixed +OLD_FILES+=usr/share/terminfo/d/diablo +OLD_FILES+=usr/share/terminfo/d/diablo-lm +OLD_FILES+=usr/share/terminfo/d/diablo1620 +OLD_FILES+=usr/share/terminfo/d/diablo1620-m8 +OLD_FILES+=usr/share/terminfo/d/diablo1640 +OLD_FILES+=usr/share/terminfo/d/diablo1640-lm +OLD_FILES+=usr/share/terminfo/d/diablo1640-m8 +OLD_FILES+=usr/share/terminfo/d/diablo1720 +OLD_FILES+=usr/share/terminfo/d/diablo1730 +OLD_FILES+=usr/share/terminfo/d/diablo1740 +OLD_FILES+=usr/share/terminfo/d/diablo1740-lm +OLD_FILES+=usr/share/terminfo/d/diablo450 +OLD_FILES+=usr/share/terminfo/d/diablo630 +OLD_FILES+=usr/share/terminfo/d/dialogue +OLD_FILES+=usr/share/terminfo/d/dialogue80 +OLD_FILES+=usr/share/terminfo/d/digilog +OLD_FILES+=usr/share/terminfo/d/djgpp +OLD_FILES+=usr/share/terminfo/d/djgpp203 +OLD_FILES+=usr/share/terminfo/d/djgpp204 +OLD_FILES+=usr/share/terminfo/d/dku7003 +OLD_FILES+=usr/share/terminfo/d/dku7003-dumb +OLD_FILES+=usr/share/terminfo/d/dku7102 +OLD_FILES+=usr/share/terminfo/d/dku7102-old +OLD_FILES+=usr/share/terminfo/d/dku7102-sna +OLD_FILES+=usr/share/terminfo/d/dku7103-sna +OLD_FILES+=usr/share/terminfo/d/dku7202 +OLD_FILES+=usr/share/terminfo/d/dm1520 +OLD_FILES+=usr/share/terminfo/d/dm1521 +OLD_FILES+=usr/share/terminfo/d/dm2500 +OLD_FILES+=usr/share/terminfo/d/dm3025 +OLD_FILES+=usr/share/terminfo/d/dm3045 +OLD_FILES+=usr/share/terminfo/d/dm80 +OLD_FILES+=usr/share/terminfo/d/dm80w +OLD_FILES+=usr/share/terminfo/d/dmchat +OLD_FILES+=usr/share/terminfo/d/dmd +OLD_FILES+=usr/share/terminfo/d/dmd-24 +OLD_FILES+=usr/share/terminfo/d/dmd-34 +OLD_FILES+=usr/share/terminfo/d/dmd1 +OLD_FILES+=usr/share/terminfo/d/dmdt80 +OLD_FILES+=usr/share/terminfo/d/dmdt80w +OLD_FILES+=usr/share/terminfo/d/dmterm +OLD_FILES+=usr/share/terminfo/d/domterm +OLD_FILES+=usr/share/terminfo/d/dp3360 +OLD_FILES+=usr/share/terminfo/d/dp8242 +OLD_FILES+=usr/share/terminfo/d/ds40 +OLD_FILES+=usr/share/terminfo/d/ds40-2 +OLD_FILES+=usr/share/terminfo/d/dt-100 +OLD_FILES+=usr/share/terminfo/d/dt-100w +OLD_FILES+=usr/share/terminfo/d/dt100 +OLD_FILES+=usr/share/terminfo/d/dt100w +OLD_FILES+=usr/share/terminfo/d/dt110 +OLD_FILES+=usr/share/terminfo/d/dt80 +OLD_FILES+=usr/share/terminfo/d/dt80-sas +OLD_FILES+=usr/share/terminfo/d/dt80w +OLD_FILES+=usr/share/terminfo/d/dtc300s +OLD_FILES+=usr/share/terminfo/d/dtc382 +OLD_FILES+=usr/share/terminfo/d/dtterm +OLD_FILES+=usr/share/terminfo/d/dumb +OLD_FILES+=usr/share/terminfo/d/dumb-emacs-ansi +OLD_FILES+=usr/share/terminfo/d/dvtm +OLD_FILES+=usr/share/terminfo/d/dvtm-256color +OLD_FILES+=usr/share/terminfo/d/dw +OLD_FILES+=usr/share/terminfo/d/dw1 +OLD_FILES+=usr/share/terminfo/d/dw2 +OLD_FILES+=usr/share/terminfo/d/dw3 +OLD_FILES+=usr/share/terminfo/d/dw4 +OLD_FILES+=usr/share/terminfo/d/dwk +OLD_FILES+=usr/share/terminfo/d/dwk-vt +OLD_DIRS+=usr/share/terminfo/d/ +OLD_FILES+=usr/share/terminfo/e/ecma+color +OLD_FILES+=usr/share/terminfo/e/ecma+index +OLD_FILES+=usr/share/terminfo/e/ecma+italics +OLD_FILES+=usr/share/terminfo/e/ecma+sgr +OLD_FILES+=usr/share/terminfo/e/ecma+strikeout +OLD_FILES+=usr/share/terminfo/e/elks +OLD_FILES+=usr/share/terminfo/e/elks-ansi +OLD_FILES+=usr/share/terminfo/e/elks-glasstty +OLD_FILES+=usr/share/terminfo/e/elks-vt52 +OLD_FILES+=usr/share/terminfo/e/emots +OLD_FILES+=usr/share/terminfo/e/emu +OLD_FILES+=usr/share/terminfo/e/emu-220 +OLD_FILES+=usr/share/terminfo/e/emx-base +OLD_FILES+=usr/share/terminfo/e/env230 +OLD_FILES+=usr/share/terminfo/e/envision230 +OLD_FILES+=usr/share/terminfo/e/ep40 +OLD_FILES+=usr/share/terminfo/e/ep4000 +OLD_FILES+=usr/share/terminfo/e/ep4080 +OLD_FILES+=usr/share/terminfo/e/ep48 +OLD_FILES+=usr/share/terminfo/e/ergo4000 +OLD_FILES+=usr/share/terminfo/e/esprit +OLD_FILES+=usr/share/terminfo/e/esprit-am +OLD_FILES+=usr/share/terminfo/e/eterm +OLD_FILES+=usr/share/terminfo/e/eterm-color +OLD_FILES+=usr/share/terminfo/e/ex155 +OLD_FILES+=usr/share/terminfo/e/excel62 +OLD_FILES+=usr/share/terminfo/e/excel62-rv +OLD_FILES+=usr/share/terminfo/e/excel62-w +OLD_FILES+=usr/share/terminfo/e/excel64 +OLD_FILES+=usr/share/terminfo/e/excel64-rv +OLD_FILES+=usr/share/terminfo/e/excel64-w +OLD_FILES+=usr/share/terminfo/e/exec80 +OLD_DIRS+=usr/share/terminfo/e/ +OLD_FILES+=usr/share/terminfo/f/f100 +OLD_FILES+=usr/share/terminfo/f/f100-rv +OLD_FILES+=usr/share/terminfo/f/f110 +OLD_FILES+=usr/share/terminfo/f/f110-14 +OLD_FILES+=usr/share/terminfo/f/f110-14w +OLD_FILES+=usr/share/terminfo/f/f110-w +OLD_FILES+=usr/share/terminfo/f/f1720 +OLD_FILES+=usr/share/terminfo/f/f1720a +OLD_FILES+=usr/share/terminfo/f/f200 +OLD_FILES+=usr/share/terminfo/f/f200-w +OLD_FILES+=usr/share/terminfo/f/f200vi +OLD_FILES+=usr/share/terminfo/f/f200vi-w +OLD_FILES+=usr/share/terminfo/f/falco +OLD_FILES+=usr/share/terminfo/f/falco-p +OLD_FILES+=usr/share/terminfo/f/fbterm +OLD_FILES+=usr/share/terminfo/f/fenix +OLD_FILES+=usr/share/terminfo/f/fenixw +OLD_FILES+=usr/share/terminfo/f/fixterm +OLD_FILES+=usr/share/terminfo/f/fortune +OLD_FILES+=usr/share/terminfo/f/fos +OLD_FILES+=usr/share/terminfo/f/fox +OLD_FILES+=usr/share/terminfo/f/freedom +OLD_FILES+=usr/share/terminfo/f/freedom-rv +OLD_FILES+=usr/share/terminfo/f/freedom100 +OLD_FILES+=usr/share/terminfo/f/freedom110 +OLD_FILES+=usr/share/terminfo/f/freedom200 +OLD_DIRS+=usr/share/terminfo/f/ +OLD_FILES+=usr/share/terminfo/g/gator +OLD_FILES+=usr/share/terminfo/g/gator-52 +OLD_FILES+=usr/share/terminfo/g/gator-52t +OLD_FILES+=usr/share/terminfo/g/gator-t +OLD_FILES+=usr/share/terminfo/g/gigi +OLD_FILES+=usr/share/terminfo/g/glasstty +OLD_FILES+=usr/share/terminfo/g/gnome +OLD_FILES+=usr/share/terminfo/g/gnome+pcfkeys +OLD_FILES+=usr/share/terminfo/g/gnome-2007 +OLD_FILES+=usr/share/terminfo/g/gnome-2008 +OLD_FILES+=usr/share/terminfo/g/gnome-2012 +OLD_FILES+=usr/share/terminfo/g/gnome-256color +OLD_FILES+=usr/share/terminfo/g/gnome-fc5 +OLD_FILES+=usr/share/terminfo/g/gnome-rh62 +OLD_FILES+=usr/share/terminfo/g/gnome-rh72 +OLD_FILES+=usr/share/terminfo/g/gnome-rh80 +OLD_FILES+=usr/share/terminfo/g/gnome-rh90 +OLD_FILES+=usr/share/terminfo/g/go-225 +OLD_FILES+=usr/share/terminfo/g/go140 +OLD_FILES+=usr/share/terminfo/g/go140w +OLD_FILES+=usr/share/terminfo/g/go225 +OLD_FILES+=usr/share/terminfo/g/graphos *** 1863 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Mar 18 10:55:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 108655B72AE; Thu, 18 Mar 2021 10:55: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 4F1P7q6zMZz3H1q; Thu, 18 Mar 2021 10:55: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 DE3B5206CC; Thu, 18 Mar 2021 10:55: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 12IAtZgQ037710; Thu, 18 Mar 2021 10:55:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IAtZ3I037709; Thu, 18 Mar 2021 10:55:35 GMT (envelope-from git) Date: Thu, 18 Mar 2021 10:55:35 GMT Message-Id: <202103181055.12IAtZ3I037709@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 0209400ceaed - main - termios: add more speeds MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0209400ceaed553a3f06a5f3759de992ddb58037 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 10:55:36 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=0209400ceaed553a3f06a5f3759de992ddb58037 commit 0209400ceaed553a3f06a5f3759de992ddb58037 Author: Bjoern A. Zeeb AuthorDate: 2021-03-10 22:17:07 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-03-18 10:44:01 +0000 termios: add more speeds A lot of small arm64 gadgets are using 1500000 as console speed. While cu can perfectly deal with this some 3rd party software, e.g., comms/conserver-con add speeds based on B being defined. Having it defined here simplifies enhancing other software. Obtained-from: NetBSD sys/sys/termios.h 1.36 MFC-after: 2 weeks Reviewed-by: philip (,okayed by imp) Differential Revision: https://reviews.freebsd.org/D29209 --- sys/sys/_termios.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/sys/_termios.h b/sys/sys/_termios.h index edbda0a161fc..b9fe17881b3a 100644 --- a/sys/sys/_termios.h +++ b/sys/sys/_termios.h @@ -208,7 +208,15 @@ #define B115200 115200 #define B230400 230400 #define B460800 460800 +#define B500000 500000 #define B921600 921600 +#define B1000000 1000000U +#define B1500000 1500000U +#define B2000000 2000000U +#define B2500000 2500000U +#define B3000000 3000000U +#define B3500000 3500000U +#define B4000000 4000000U #define EXTA 19200 #define EXTB 38400 #endif From owner-dev-commits-src-all@freebsd.org Thu Mar 18 11:06:06 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15F3C5B7E44; Thu, 18 Mar 2021 11:06: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 4F1PMy05NPz3HcH; Thu, 18 Mar 2021 11:06: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 DB93220B7E; Thu, 18 Mar 2021 11:06: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 12IB65Wj051555; Thu, 18 Mar 2021 11:06:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IB65dV051554; Thu, 18 Mar 2021 11:06:05 GMT (envelope-from git) Date: Thu, 18 Mar 2021 11:06:05 GMT Message-Id: <202103181106.12IB65dV051554@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 0c7b75f12840 - main - LinuxKPI: add support for crc32_le() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0c7b75f12840a31206ae24acca1f5ee35c8e341d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 11:06:06 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=0c7b75f12840a31206ae24acca1f5ee35c8e341d commit 0c7b75f12840a31206ae24acca1f5ee35c8e341d Author: Bjoern A. Zeeb AuthorDate: 2021-03-10 15:01:10 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-03-18 10:56:22 +0000 LinuxKPI: add support for crc32_le() Add support for crc32_le() as a wrapper around crc32_raw(). Sponsored-by: The FreeBSD Foundation Obtained-from: bz_iwlwifi MFC-after: 2 weeks Reviewed-by: hselasky Differential Revision: https://reviews.freebsd.org/D29187 --- sys/compat/linuxkpi/common/include/linux/crc32.h | 45 ++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/crc32.h b/sys/compat/linuxkpi/common/include/linux/crc32.h new file mode 100644 index 000000000000..6d43eb7b1859 --- /dev/null +++ b/sys/compat/linuxkpi/common/include/linux/crc32.h @@ -0,0 +1,45 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Björn Zeeb under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef __LKPI_LINUX_CRC32_H +#define __LKPI_LINUX_CRC32_H + +#include + +static __inline uint32_t +crc32_le(uint32_t crc, const void *data, size_t len) +{ + + return (crc32_raw(data, len, crc)); +} + +#endif /* __LKPI_LINUX_CRC32_H */ From owner-dev-commits-src-all@freebsd.org Thu Mar 18 11:16:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BA095704A0; Thu, 18 Mar 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 4F1PbT1jrwz3JRg; Thu, 18 Mar 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 2843220879; Thu, 18 Mar 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 12IBG59E064424; Thu, 18 Mar 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 12IBG5FC064423; Thu, 18 Mar 2021 11:16:05 GMT (envelope-from git) Date: Thu, 18 Mar 2021 11:16:05 GMT Message-Id: <202103181116.12IBG5FC064423@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: c338cf2c6d5e - main - net80211: split up ieee80211_probereq() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c338cf2c6d5eacdee813191d5976aa531d450ee7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 11:16:05 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=c338cf2c6d5eacdee813191d5976aa531d450ee7 commit c338cf2c6d5eacdee813191d5976aa531d450ee7 Author: Bjoern A. Zeeb AuthorDate: 2021-03-06 21:05:43 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-03-18 11:02:45 +0000 net80211: split up ieee80211_probereq() Factor out ieee80211_probereq_ie() and ieee80211_probereq_ie_len() and make the length dynamic rather than static max. The latter is needed as our current fixed length was longer than some "hw scan", e.g. that of ath10k, will take. This way we can pass what we have. Should this not be sufficient in the future we might have to deal with filtering and much more error handling. This also removes a duplicate calculation for ieee80211_ie_wpa [1]. Repoprted-by: Martin Husemann [1] Sponsored-by: Rubicon Communications, LLC ("Netgate") Sponsored-by: The FreeBSD Foundation (update for alloc) Reviewed-by: adrian, martin NetBSD.org (earlier version) Reviewed-by: philip MFC-after: 2 weeks Differential Revision: https://reviews.freebsd.org/D26545 --- sys/net80211/ieee80211_output.c | 171 +++++++++++++++++++++++++++------------- sys/net80211/ieee80211_proto.h | 2 + 2 files changed, 117 insertions(+), 56 deletions(-) diff --git a/sys/net80211/ieee80211_output.c b/sys/net80211/ieee80211_output.c index b67302b8d66f..07f7349461ac 100644 --- a/sys/net80211/ieee80211_output.c +++ b/sys/net80211/ieee80211_output.c @@ -2414,80 +2414,76 @@ ieee80211_add_qos(uint8_t *frm, const struct ieee80211_node *ni) } /* - * Send a probe request frame with the specified ssid - * and any optional information element data. + * ieee80211_send_probereq(): send a probe request frame with the specified ssid + * and any optional information element data; some helper functions as FW based + * HW scans need some of that information passed too. */ -int -ieee80211_send_probereq(struct ieee80211_node *ni, - const uint8_t sa[IEEE80211_ADDR_LEN], - const uint8_t da[IEEE80211_ADDR_LEN], - const uint8_t bssid[IEEE80211_ADDR_LEN], - const uint8_t *ssid, size_t ssidlen) +static uint32_t +ieee80211_probereq_ie_len(struct ieee80211vap *vap, struct ieee80211com *ic) { - struct ieee80211vap *vap = ni->ni_vap; - struct ieee80211com *ic = ni->ni_ic; - struct ieee80211_node *bss; - const struct ieee80211_txparam *tp; - struct ieee80211_bpf_params params; const struct ieee80211_rateset *rs; - struct mbuf *m; - uint8_t *frm; - int ret; - - bss = ieee80211_ref_node(vap->iv_bss); - if (vap->iv_state == IEEE80211_S_CAC) { - IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni, - "block %s frame in CAC state", "probe request"); - vap->iv_stats.is_tx_badstate++; - ieee80211_free_node(bss); - return EIO; /* XXX */ - } - - /* - * Hold a reference on the node so it doesn't go away until after - * the xmit is complete all the way in the driver. On error we - * will remove our reference. - */ - IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, - "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", - __func__, __LINE__, - ni, ether_sprintf(ni->ni_macaddr), - ieee80211_node_refcnt(ni)+1); - ieee80211_ref_node(ni); + rs = ieee80211_get_suprates(ic, ic->ic_curchan); /* * prreq frame format * [tlv] ssid * [tlv] supported rates * [tlv] RSN (optional) - * [tlv] extended supported rates + * [tlv] extended supported rates (if needed) * [tlv] HT cap (optional) * [tlv] VHT cap (optional) * [tlv] WPA (optional) * [tlv] user-specified ie's */ - m = ieee80211_getmgtframe(&frm, - ic->ic_headroom + sizeof(struct ieee80211_frame), - 2 + IEEE80211_NWID_LEN + return ( 2 + IEEE80211_NWID_LEN + 2 + IEEE80211_RATE_SIZE - + sizeof(struct ieee80211_ie_htcap) - + sizeof(struct ieee80211_ie_vhtcap) + + ((vap->iv_flags & IEEE80211_F_WPA2 && vap->iv_rsn_ie != NULL) ? + vap->iv_rsn_ie[1] : 0) + + ((rs->rs_nrates > IEEE80211_RATE_SIZE) ? + 2 + (rs->rs_nrates - IEEE80211_RATE_SIZE) : 0) + + (((vap->iv_opmode == IEEE80211_M_IBSS) && + (vap->iv_flags_ht & IEEE80211_FHT_HT)) ? + sizeof(struct ieee80211_ie_htcap) : 0) +#ifdef notyet + sizeof(struct ieee80211_ie_htinfo) /* XXX not needed? */ - + sizeof(struct ieee80211_ie_wpa) - + 2 + (IEEE80211_RATE_MAXSIZE - IEEE80211_RATE_SIZE) - + sizeof(struct ieee80211_ie_wpa) + + sizeof(struct ieee80211_ie_vhtcap) +#endif + + ((vap->iv_flags & IEEE80211_F_WPA1 && vap->iv_wpa_ie != NULL) ? + vap->iv_wpa_ie[1] : 0) + (vap->iv_appie_probereq != NULL ? vap->iv_appie_probereq->ie_len : 0) ); - if (m == NULL) { - vap->iv_stats.is_tx_nobuf++; - ieee80211_free_node(ni); - ieee80211_free_node(bss); - return ENOMEM; - } +} + +int +ieee80211_probereq_ie(struct ieee80211vap *vap, struct ieee80211com *ic, + uint8_t **frmp, uint32_t *frmlen, const uint8_t *ssid, size_t ssidlen, + bool alloc) +{ + const struct ieee80211_rateset *rs; + uint8_t *frm; + uint32_t len; + + if (!alloc && (frmp == NULL || frmlen == NULL)) + return (EINVAL); - frm = ieee80211_add_ssid(frm, ssid, ssidlen); + len = ieee80211_probereq_ie_len(vap, ic); + if (!alloc && len > *frmlen) + return (ENOBUFS); + + if (alloc) { + frm = malloc(len, M_80211_VAP, M_WAITOK | M_ZERO); + *frmp = frm; + *frmlen = len; + } else + frm = *frmp; + + /* For HW scans we usually do not pass in the SSID as IE. */ + if (ssidlen == -1) + len -= (2 + IEEE80211_NWID_LEN); + else + frm = ieee80211_add_ssid(frm, ssid, ssidlen); rs = ieee80211_get_suprates(ic, ic->ic_curchan); frm = ieee80211_add_rates(frm, rs); frm = ieee80211_add_rsn(frm, vap); @@ -2517,8 +2513,8 @@ ieee80211_send_probereq(struct ieee80211_node *ni, * XXX TODO: need to figure out what/how to update the * VHT channel. */ -#if 0 - (vap->iv_flags_vht & IEEE80211_FVHT_VHT) { +#ifdef notyet + if (vap->iv_flags_vht & IEEE80211_FVHT_VHT) { struct ieee80211_channel *c; c = ieee80211_ht_adjust_channel(ic, ic->ic_curchan, @@ -2531,8 +2527,71 @@ ieee80211_send_probereq(struct ieee80211_node *ni, frm = ieee80211_add_wpa(frm, vap); if (vap->iv_appie_probereq != NULL) frm = add_appie(frm, vap->iv_appie_probereq); - m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); + if (!alloc) { + *frmp = frm; + *frmlen = len; + } + + return (0); +} + +int +ieee80211_send_probereq(struct ieee80211_node *ni, + const uint8_t sa[IEEE80211_ADDR_LEN], + const uint8_t da[IEEE80211_ADDR_LEN], + const uint8_t bssid[IEEE80211_ADDR_LEN], + const uint8_t *ssid, size_t ssidlen) +{ + struct ieee80211vap *vap = ni->ni_vap; + struct ieee80211com *ic = ni->ni_ic; + struct ieee80211_node *bss; + const struct ieee80211_txparam *tp; + struct ieee80211_bpf_params params; + struct mbuf *m; + uint8_t *frm; + uint32_t frmlen; + int ret; + + bss = ieee80211_ref_node(vap->iv_bss); + + if (vap->iv_state == IEEE80211_S_CAC) { + IEEE80211_NOTE(vap, IEEE80211_MSG_OUTPUT, ni, + "block %s frame in CAC state", "probe request"); + vap->iv_stats.is_tx_badstate++; + ieee80211_free_node(bss); + return EIO; /* XXX */ + } + + /* + * Hold a reference on the node so it doesn't go away until after + * the xmit is complete all the way in the driver. On error we + * will remove our reference. + */ + IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, + "ieee80211_ref_node (%s:%u) %p<%s> refcnt %d\n", + __func__, __LINE__, + ni, ether_sprintf(ni->ni_macaddr), + ieee80211_node_refcnt(ni)+1); + ieee80211_ref_node(ni); + + /* See comments above for entire frame format. */ + frmlen = ieee80211_probereq_ie_len(vap, ic); + m = ieee80211_getmgtframe(&frm, + ic->ic_headroom + sizeof(struct ieee80211_frame), frmlen); + if (m == NULL) { + vap->iv_stats.is_tx_nobuf++; + ieee80211_free_node(ni); + ieee80211_free_node(bss); + return ENOMEM; + } + + ret = ieee80211_probereq_ie(vap, ic, &frm, &frmlen, ssid, ssidlen, + false); + KASSERT(ret == 0, + ("%s: ieee80211_probereq_ie railed: %d\n", __func__, ret)); + + m->m_pkthdr.len = m->m_len = frm - mtod(m, uint8_t *); KASSERT(M_LEADINGSPACE(m) >= sizeof(struct ieee80211_frame), ("leading space %zd", M_LEADINGSPACE(m))); M_PREPEND(m, sizeof(struct ieee80211_frame), M_NOWAIT); diff --git a/sys/net80211/ieee80211_proto.h b/sys/net80211/ieee80211_proto.h index fafedf46cab5..4b324caa694b 100644 --- a/sys/net80211/ieee80211_proto.h +++ b/sys/net80211/ieee80211_proto.h @@ -114,6 +114,8 @@ struct mbuf *ieee80211_encap(struct ieee80211vap *, struct ieee80211_node *, void ieee80211_free_mbuf(struct mbuf *); int ieee80211_send_mgmt(struct ieee80211_node *, int, int); struct ieee80211_appie; +int ieee80211_probereq_ie(struct ieee80211vap *, struct ieee80211com *, + uint8_t **, uint32_t *, const uint8_t *, size_t, bool); int ieee80211_send_probereq(struct ieee80211_node *ni, const uint8_t sa[IEEE80211_ADDR_LEN], const uint8_t da[IEEE80211_ADDR_LEN], From owner-dev-commits-src-all@freebsd.org Thu Mar 18 11:24:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 974FA57082E; Thu, 18 Mar 2021 11:24: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 4F1Pmr3qzgz3JxZ; Thu, 18 Mar 2021 11:24: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 76546210A7; Thu, 18 Mar 2021 11:24: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 12IBOCnp077123; Thu, 18 Mar 2021 11:24:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IBOCCH077122; Thu, 18 Mar 2021 11:24:12 GMT (envelope-from git) Date: Thu, 18 Mar 2021 11:24:12 GMT Message-Id: <202103181124.12IBOCCH077122@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 2ad93dade70a - main - lib80211: Start adding 11ac ETSI bits to regdomain.xml MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2ad93dade70a9c98174fc87d0cd24fd54bd0d120 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 11:24:12 -0000 The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=2ad93dade70a9c98174fc87d0cd24fd54bd0d120 commit 2ad93dade70a9c98174fc87d0cd24fd54bd0d120 Author: Bjoern A. Zeeb AuthorDate: 2021-03-18 11:08:47 +0000 Commit: Bjoern A. Zeeb CommitDate: 2021-03-18 11:09:10 +0000 lib80211: Start adding 11ac ETSI bits to regdomain.xml Summary: This change currently (partially) duplicates AC1 freqbands as AC2 as they are not fully overlapping. It then adds the 11ac netband to the "etsi" domain including "indoor" and "dfs" flags, which we can deal with, as well as appropriate (round down) maxpower values. Comments are left for the actual frequency bands as we do use the centerfreq for the first/last (chansep sized) channel in the freqband and their "id" name, which can be confusing. Sponsored-by: Rubicon Communications, LLC ("Netgate") Reviewed-by: philip, adrian MFC-after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25999 --- lib/lib80211/regdomain.xml | 174 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 173 insertions(+), 1 deletion(-) diff --git a/lib/lib80211/regdomain.xml b/lib/lib80211/regdomain.xml index cad3039c3d3d..38ef48fa3b69 100644 --- a/lib/lib80211/regdomain.xml +++ b/lib/lib80211/regdomain.xml @@ -551,9 +551,112 @@ IEEE80211_CHAN_DFS + + + + + 23 + IEEE80211_CHAN_HT20 + IEEE80211_CHAN_VHT20 + INDOOR + + + + 23 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT40 + INDOOR + + + + 23 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT80 + INDOOR + + + + + + 20 + IEEE80211_CHAN_HT20 + IEEE80211_CHAN_VHT20 + IEEE80211_CHAN_DFS + INDOOR + + + + 20 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT40 + IEEE80211_CHAN_DFS + INDOOR + + + + 20 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT80 + IEEE80211_CHAN_DFS + INDOOR + + + + + + 26 + IEEE80211_CHAN_HT20 + IEEE80211_CHAN_VHT20 + IEEE80211_CHAN_DFS + + + + 26 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT40 + IEEE80211_CHAN_DFS + + + + 26 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT80 + IEEE80211_CHAN_DFS + + + + 26 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT160 + IEEE80211_CHAN_DFS + + + + + + 13 + IEEE80211_CHAN_HT20 + IEEE80211_CHAN_VHT20 + IEEE80211_CHAN_DFS + + + + 13 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT40 + IEEE80211_CHAN_DFS + + + + 13 + IEEE80211_CHAN_HT40 + IEEE80211_CHAN_VHT80 + IEEE80211_CHAN_DFS + + - + ETSI2 @@ -1788,6 +1891,75 @@ 80 20 IEEE80211_CHAN_A + + + 5160 5240 + 20 20 + IEEE80211_CHAN_A + + + 5180 5240 + 40 20 + IEEE80211_CHAN_A + + + 5180 5240 + 80 20 + IEEE80211_CHAN_A + + + + 5260 5340 + 20 20 + IEEE80211_CHAN_A + + + 5260 5320 + 40 20 + IEEE80211_CHAN_A + + + 5260 5320 + 80 20 + IEEE80211_CHAN_A + + + + 5480 5700 + 20 20 + IEEE80211_CHAN_A + + + 5500 5680 + 40 20 + IEEE80211_CHAN_A + + + 5500 5640 + 80 20 + IEEE80211_CHAN_A + + + 5500 5640 + 160 20 + IEEE80211_CHAN_A + + + + 5745 5865 + 20 20 + IEEE80211_CHAN_A + + + 5745 5805 + 40 20 + IEEE80211_CHAN_A + + + 5745 5805 + 80 20 + IEEE80211_CHAN_A + 5180 5240 40 20 From owner-dev-commits-src-all@freebsd.org Thu Mar 18 13:53:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2EFAE575DCA; Thu, 18 Mar 2021 13:53: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 4F1T4Z0nHpz3k2r; Thu, 18 Mar 2021 13:53: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 0D33C22D42; Thu, 18 Mar 2021 13:53: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 12IDr15c073868; Thu, 18 Mar 2021 13:53:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IDr1iK073867; Thu, 18 Mar 2021 13:53:01 GMT (envelope-from git) Date: Thu, 18 Mar 2021 13:53:01 GMT Message-Id: <202103181353.12IDr1iK073867@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Scott Long Subject: git: 4c6c8f51fdb7 - releng/13.0 - base: remove if_wg(4) and associated utilities, manpage MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: scottl X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 4c6c8f51fdb7e2b3870ec5a6fa5dce51ad3b25a5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 13:53:02 -0000 The branch releng/13.0 has been updated by scottl: URL: https://cgit.FreeBSD.org/src/commit/?id=4c6c8f51fdb7e2b3870ec5a6fa5dce51ad3b25a5 commit 4c6c8f51fdb7e2b3870ec5a6fa5dce51ad3b25a5 Author: Scott Long AuthorDate: 2021-03-18 07:34:07 +0000 Commit: Scott Long CommitDate: 2021-03-18 07:34:07 +0000 base: remove if_wg(4) and associated utilities, manpage After length decisions, we've decided that the if_wg(4) driver and related work is not yet ready to live in the tree. This driver has larger security implications than many, and thus will be held to more scrutiny than other drivers. Requested by: secteam Approved by: re --- sbin/ifconfig/Makefile | 1 - sbin/ifconfig/ifwg.c | 618 -- share/man/man4/Makefile | 1 - share/man/man4/wg.4 | 255 - sys/dev/if_wg/include/crypto/blake2s.h | 56 - sys/dev/if_wg/include/crypto/curve25519.h | 74 - sys/dev/if_wg/include/crypto/zinc.h | 15 - sys/dev/if_wg/include/sys/if_wg_session.h | 89 - sys/dev/if_wg/include/sys/if_wg_session_vars.h | 319 - sys/dev/if_wg/include/sys/simd-x86_64.h | 74 - sys/dev/if_wg/include/sys/support.h | 342 - sys/dev/if_wg/include/sys/wg_cookie.h | 174 - sys/dev/if_wg/include/sys/wg_module.h | 121 - sys/dev/if_wg/include/sys/wg_noise.h | 286 - sys/dev/if_wg/include/zinc/blake2s.h | 50 - sys/dev/if_wg/include/zinc/chacha20.h | 68 - sys/dev/if_wg/include/zinc/chacha20poly1305.h | 48 - sys/dev/if_wg/include/zinc/curve25519.h | 28 - sys/dev/if_wg/include/zinc/poly1305.h | 29 - sys/dev/if_wg/module/blake2s.c | 256 - sys/dev/if_wg/module/blake2s.h | 58 - sys/dev/if_wg/module/chacha20-x86_64.S | 2834 ------- .../crypto/zinc/chacha20/chacha20-arm-glue.c | 98 - .../module/crypto/zinc/chacha20/chacha20-arm.pl | 1227 --- .../module/crypto/zinc/chacha20/chacha20-arm64.pl | 1163 --- .../crypto/zinc/chacha20/chacha20-mips-glue.c | 27 - .../module/crypto/zinc/chacha20/chacha20-mips.S | 424 - .../crypto/zinc/chacha20/chacha20-x86_64-glue.c | 132 - .../module/crypto/zinc/chacha20/chacha20-x86_64.pl | 4106 ---------- .../if_wg/module/crypto/zinc/chacha20/chacha20.c | 238 - .../if_wg/module/crypto/zinc/chacha20poly1305.c | 196 - .../crypto/zinc/poly1305/poly1305-arm-glue.c | 140 - .../module/crypto/zinc/poly1305/poly1305-arm.pl | 1276 --- .../module/crypto/zinc/poly1305/poly1305-arm64.pl | 974 --- .../module/crypto/zinc/poly1305/poly1305-donna32.c | 205 - .../module/crypto/zinc/poly1305/poly1305-donna64.c | 182 - .../crypto/zinc/poly1305/poly1305-mips-glue.c | 37 - .../module/crypto/zinc/poly1305/poly1305-mips.S | 407 - .../module/crypto/zinc/poly1305/poly1305-mips64.pl | 467 -- .../crypto/zinc/poly1305/poly1305-x86_64-glue.c | 171 - .../module/crypto/zinc/poly1305/poly1305-x86_64.pl | 4266 ---------- .../if_wg/module/crypto/zinc/poly1305/poly1305.c | 163 - .../if_wg/module/crypto/zinc/selftest/blake2s.c | 2090 ----- .../if_wg/module/crypto/zinc/selftest/chacha20.c | 2703 ------- .../module/crypto/zinc/selftest/chacha20poly1305.c | 8443 -------------------- .../if_wg/module/crypto/zinc/selftest/curve25519.c | 1315 --- .../if_wg/module/crypto/zinc/selftest/poly1305.c | 1110 --- sys/dev/if_wg/module/crypto/zinc/selftest/run.h | 43 - sys/dev/if_wg/module/curve25519.c | 867 -- sys/dev/if_wg/module/if_wg_session.c | 1985 ----- sys/dev/if_wg/module/module.c | 863 -- sys/dev/if_wg/module/poly1305-x86_64.S | 3021 ------- sys/dev/if_wg/module/wg_cookie.c | 399 - sys/dev/if_wg/module/wg_noise.c | 958 --- sys/kern/subr_gtaskqueue.c | 13 - sys/modules/Makefile | 1 - sys/modules/if_wg/Makefile | 38 - sys/sys/gtaskqueue.h | 1 - 58 files changed, 45545 deletions(-) diff --git a/sbin/ifconfig/Makefile b/sbin/ifconfig/Makefile index 61cb8ab933fd..b178dc0c7e6a 100644 --- a/sbin/ifconfig/Makefile +++ b/sbin/ifconfig/Makefile @@ -35,7 +35,6 @@ SRCS+= ifvxlan.c # VXLAN support SRCS+= ifgre.c # GRE keys etc SRCS+= ifgif.c # GIF reversed header workaround SRCS+= ifipsec.c # IPsec VTI -SRCS+= ifwg.c # Wireguard SRCS+= sfp.c # SFP/SFP+ information LIBADD+= ifconfig m util diff --git a/sbin/ifconfig/ifwg.c b/sbin/ifconfig/ifwg.c deleted file mode 100644 index a2b22d2dfbef..000000000000 --- a/sbin/ifconfig/ifwg.c +++ /dev/null @@ -1,618 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2020 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$"); - -#ifndef RESCUE -#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 /* NB: for offsetof */ -#include -#include -#include - -#include "ifconfig.h" - -typedef enum { - WGC_GET = 0x5, - WGC_SET = 0x6, -} wg_cmd_t; - -static nvlist_t *nvl_params; -static bool do_peer; -static int allowed_ips_count; -static int allowed_ips_max; -struct allowedip { - struct sockaddr_storage a_addr; - struct sockaddr_storage a_mask; -}; -struct allowedip *allowed_ips; - -#define ALLOWEDIPS_START 16 -#define WG_KEY_LEN 32 -#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1) -#define WG_KEY_LEN_HEX (WG_KEY_LEN * 2 + 1) -#define WG_MAX_STRLEN 64 - -static bool -key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64) -{ - - if (strlen(base64) != WG_KEY_LEN_BASE64 - 1) { - warnx("bad key len - need %d got %zu\n", WG_KEY_LEN_BASE64 - 1, strlen(base64)); - return false; - } - if (base64[WG_KEY_LEN_BASE64 - 2] != '=') { - warnx("bad key terminator, expected '=' got '%c'", base64[WG_KEY_LEN_BASE64 - 2]); - return false; - } - return (b64_pton(base64, key, WG_KEY_LEN)); -} - -static void -parse_endpoint(const char *endpoint_) -{ - int err; - char *base, *endpoint, *port, *colon, *tmp; - struct addrinfo hints, *res; - - endpoint = base = strdup(endpoint_); - colon = rindex(endpoint, ':'); - if (colon == NULL) - errx(1, "bad endpoint format %s - no port delimiter found", endpoint); - *colon = '\0'; - port = colon + 1; - - /* [::]:<> */ - if (endpoint[0] == '[') { - endpoint++; - tmp = index(endpoint, ']'); - if (tmp == NULL) - errx(1, "bad endpoint format %s - '[' found with no matching ']'", endpoint); - *tmp = '\0'; - } - bzero(&hints, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - err = getaddrinfo(endpoint, port, &hints, &res); - if (err) - errx(1, "%s", gai_strerror(err)); - nvlist_add_binary(nvl_params, "endpoint", res->ai_addr, res->ai_addrlen); - freeaddrinfo(res); - free(base); -} - -static void -in_len2mask(struct in_addr *mask, u_int len) -{ - u_int i; - u_char *p; - - p = (u_char *)mask; - memset(mask, 0, sizeof(*mask)); - for (i = 0; i < len / NBBY; i++) - p[i] = 0xff; - if (len % NBBY) - p[i] = (0xff00 >> (len % NBBY)) & 0xff; -} - -static u_int -in_mask2len(struct in_addr *mask) -{ - u_int x, y; - u_char *p; - - p = (u_char *)mask; - for (x = 0; x < sizeof(*mask); x++) { - if (p[x] != 0xff) - break; - } - y = 0; - if (x < sizeof(*mask)) { - for (y = 0; y < NBBY; y++) { - if ((p[x] & (0x80 >> y)) == 0) - break; - } - } - return x * NBBY + y; -} - -static void -in6_prefixlen2mask(struct in6_addr *maskp, int len) -{ - static const u_char maskarray[NBBY] = {0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff}; - int bytelen, bitlen, i; - - /* sanity check */ - if (len < 0 || len > 128) { - errx(1, "in6_prefixlen2mask: invalid prefix length(%d)\n", - len); - return; - } - - memset(maskp, 0, sizeof(*maskp)); - bytelen = len / NBBY; - bitlen = len % NBBY; - for (i = 0; i < bytelen; i++) - maskp->s6_addr[i] = 0xff; - if (bitlen) - maskp->s6_addr[bytelen] = maskarray[bitlen - 1]; -} - -static int -in6_mask2len(struct in6_addr *mask, u_char *lim0) -{ - int x = 0, y; - u_char *lim = lim0, *p; - - /* ignore the scope_id part */ - if (lim0 == NULL || lim0 - (u_char *)mask > sizeof(*mask)) - lim = (u_char *)mask + sizeof(*mask); - for (p = (u_char *)mask; p < lim; x++, p++) { - if (*p != 0xff) - break; - } - y = 0; - if (p < lim) { - for (y = 0; y < NBBY; y++) { - if ((*p & (0x80 >> y)) == 0) - break; - } - } - - /* - * when the limit pointer is given, do a stricter check on the - * remaining bits. - */ - if (p < lim) { - if (y != 0 && (*p & (0x00ff >> y)) != 0) - return -1; - for (p = p + 1; p < lim; p++) - if (*p != 0) - return -1; - } - - return x * NBBY + y; -} - -static bool -parse_ip(struct allowedip *aip, const char *value) -{ - struct addrinfo hints, *res; - int err; - - bzero(&aip->a_addr, sizeof(aip->a_addr)); - bzero(&hints, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_flags = AI_NUMERICHOST; - err = getaddrinfo(value, NULL, &hints, &res); - if (err) - errx(1, "%s", gai_strerror(err)); - - memcpy(&aip->a_addr, res->ai_addr, res->ai_addrlen); - - freeaddrinfo(res); - return (true); -} - -static void -sa_ntop(const struct sockaddr *sa, char *buf, int *port) -{ - const struct sockaddr_in *sin; - const struct sockaddr_in6 *sin6; - int err; - - err = getnameinfo(sa, sa->sa_len, buf, INET6_ADDRSTRLEN, NULL, - 0, NI_NUMERICHOST); - - if (sa->sa_family == AF_INET) { - sin = (const struct sockaddr_in *)sa; - if (port) - *port = sin->sin_port; - } else if (sa->sa_family == AF_INET6) { - sin6 = (const struct sockaddr_in6 *)sa; - if (port) - *port = sin6->sin6_port; - } - - if (err) - errx(1, "%s", gai_strerror(err)); -} - -static void -dump_peer(const nvlist_t *nvl_peer) -{ - const void *key; - const struct allowedip *aips; - const struct sockaddr *endpoint; - char outbuf[WG_MAX_STRLEN]; - char addr_buf[INET6_ADDRSTRLEN]; - size_t size; - int count, port; - - printf("[Peer]\n"); - if (nvlist_exists_binary(nvl_peer, "public-key")) { - key = nvlist_get_binary(nvl_peer, "public-key", &size); - b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); - printf("PublicKey = %s\n", outbuf); - } - if (nvlist_exists_binary(nvl_peer, "endpoint")) { - endpoint = nvlist_get_binary(nvl_peer, "endpoint", &size); - sa_ntop(endpoint, addr_buf, &port); - printf("Endpoint = %s:%d\n", addr_buf, ntohs(port)); - } - - if (!nvlist_exists_binary(nvl_peer, "allowed-ips")) - return; - aips = nvlist_get_binary(nvl_peer, "allowed-ips", &size); - if (size == 0 || size % sizeof(struct allowedip) != 0) { - errx(1, "size %zu not integer multiple of allowedip", size); - } - printf("AllowedIPs = "); - count = size / sizeof(struct allowedip); - for (int i = 0; i < count; i++) { - int mask; - sa_family_t family; - void *bitmask; - struct sockaddr *sa; - - sa = __DECONST(void *, &aips[i].a_addr); - bitmask = __DECONST(void *, - ((const struct sockaddr *)&(&aips[i])->a_mask)->sa_data); - family = aips[i].a_addr.ss_family; - getnameinfo(sa, sa->sa_len, addr_buf, INET6_ADDRSTRLEN, NULL, - 0, NI_NUMERICHOST); - if (family == AF_INET) - mask = in_mask2len(bitmask); - else if (family == AF_INET6) - mask = in6_mask2len(bitmask, NULL); - else - errx(1, "bad family in peer %d\n", family); - printf("%s/%d", addr_buf, mask); - if (i < count -1) - printf(", "); - } - printf("\n"); -} - -static int -get_nvl_out_size(int sock, u_long op, size_t *size) -{ - struct ifdrv ifd; - int err; - - memset(&ifd, 0, sizeof(ifd)); - - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); - ifd.ifd_cmd = op; - ifd.ifd_len = 0; - ifd.ifd_data = NULL; - - err = ioctl(sock, SIOCGDRVSPEC, &ifd); - if (err) - return (err); - *size = ifd.ifd_len; - return (0); -} - -static int -do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) -{ - struct ifdrv ifd; - - memset(&ifd, 0, sizeof(ifd)); - - strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); - ifd.ifd_cmd = op; - ifd.ifd_len = argsize; - ifd.ifd_data = arg; - - return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); -} - -static -DECL_CMD_FUNC(peerlist, val, d) -{ - size_t size, peercount; - void *packed; - const nvlist_t *nvl, *nvl_peer; - const nvlist_t *const *nvl_peerlist; - - if (get_nvl_out_size(s, WGC_GET, &size)) - errx(1, "can't get peer list size"); - if ((packed = malloc(size)) == NULL) - errx(1, "malloc failed for peer list"); - if (do_cmd(s, WGC_GET, packed, size, 0)) - errx(1, "failed to obtain peer list"); - - nvl = nvlist_unpack(packed, size, 0); - if (!nvlist_exists_nvlist_array(nvl, "peer-list")) - return; - nvl_peerlist = nvlist_get_nvlist_array(nvl, "peer-list", &peercount); - - for (int i = 0; i < peercount; i++, nvl_peerlist++) { - nvl_peer = *nvl_peerlist; - dump_peer(nvl_peer); - } -} - -static void -peerfinish(int s, void *arg) -{ - nvlist_t *nvl, **nvl_array; - void *packed; - size_t size; - - if ((nvl = nvlist_create(0)) == NULL) - errx(1, "failed to allocate nvlist"); - if ((nvl_array = calloc(sizeof(void *), 1)) == NULL) - errx(1, "failed to allocate nvl_array"); - if (!nvlist_exists_binary(nvl_params, "public-key")) - errx(1, "must specify a public-key for adding peer"); - if (!nvlist_exists_binary(nvl_params, "endpoint")) - errx(1, "must specify an endpoint for adding peer"); - if (allowed_ips_count == 0) - errx(1, "must specify at least one range of allowed-ips to add a peer"); - - nvl_array[0] = nvl_params; - nvlist_add_nvlist_array(nvl, "peer-list", (const nvlist_t * const *)nvl_array, 1); - packed = nvlist_pack(nvl, &size); - - if (do_cmd(s, WGC_SET, packed, size, true)) - errx(1, "failed to install peer"); -} - -static -DECL_CMD_FUNC(peerstart, val, d) -{ - do_peer = true; - callback_register(peerfinish, NULL); - allowed_ips = malloc(ALLOWEDIPS_START * sizeof(struct allowedip)); - allowed_ips_max = ALLOWEDIPS_START; - if (allowed_ips == NULL) - errx(1, "failed to allocate array for allowedips"); -} - -static -DECL_CMD_FUNC(setwglistenport, val, d) -{ - struct addrinfo hints, *res; - const struct sockaddr_in *sin; - const struct sockaddr_in6 *sin6; - - u_long ul; - int err; - - bzero(&hints, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_flags = AI_NUMERICHOST; - err = getaddrinfo(NULL, val, &hints, &res); - if (err) - errx(1, "%s", gai_strerror(err)); - - if (res->ai_family == AF_INET) { - sin = (struct sockaddr_in *)res->ai_addr; - ul = sin->sin_port; - } else if (res->ai_family == AF_INET6) { - sin6 = (struct sockaddr_in6 *)res->ai_addr; - ul = sin6->sin6_port; - } else { - errx(1, "unknown family"); - } - ul = ntohs((u_short)ul); - nvlist_add_number(nvl_params, "listen-port", ul); -} - -static -DECL_CMD_FUNC(setwgprivkey, val, d) -{ - uint8_t key[WG_KEY_LEN]; - - if (!key_from_base64(key, val)) - errx(1, "invalid key %s", val); - nvlist_add_binary(nvl_params, "private-key", key, WG_KEY_LEN); -} - -static -DECL_CMD_FUNC(setwgpubkey, val, d) -{ - uint8_t key[WG_KEY_LEN]; - - if (!do_peer) - errx(1, "setting public key only valid when adding peer"); - - if (!key_from_base64(key, val)) - errx(1, "invalid key %s", val); - nvlist_add_binary(nvl_params, "public-key", key, WG_KEY_LEN); -} - -static -DECL_CMD_FUNC(setallowedips, val, d) -{ - char *base, *allowedip, *mask; - u_long ul; - char *endp; - struct allowedip *aip; - - if (!do_peer) - errx(1, "setting allowed ip only valid when adding peer"); - if (allowed_ips_count == allowed_ips_max) { - /* XXX grow array */ - } - aip = &allowed_ips[allowed_ips_count]; - base = allowedip = strdup(val); - mask = index(allowedip, '/'); - if (mask == NULL) - errx(1, "mask separator not found in allowedip %s", val); - *mask = '\0'; - mask++; - parse_ip(aip, allowedip); - ul = strtoul(mask, &endp, 0); - if (*endp != '\0') - errx(1, "invalid value for allowedip mask"); - bzero(&aip->a_mask, sizeof(aip->a_mask)); - if (aip->a_addr.ss_family == AF_INET) - in_len2mask((struct in_addr *)&((struct sockaddr *)&aip->a_mask)->sa_data, ul); - else if (aip->a_addr.ss_family == AF_INET6) - in6_prefixlen2mask((struct in6_addr *)&((struct sockaddr *)&aip->a_mask)->sa_data, ul); - else - errx(1, "invalid address family %d\n", aip->a_addr.ss_family); - allowed_ips_count++; - if (allowed_ips_count > 1) - nvlist_free_binary(nvl_params, "allowed-ips"); - nvlist_add_binary(nvl_params, "allowed-ips", allowed_ips, - allowed_ips_count*sizeof(*aip)); - - dump_peer(nvl_params); - free(base); -} - -static -DECL_CMD_FUNC(setendpoint, val, d) -{ - if (!do_peer) - errx(1, "setting endpoint only valid when adding peer"); - parse_endpoint(val); -} - -static void -wireguard_status(int s) -{ - size_t size; - void *packed; - nvlist_t *nvl; - char buf[WG_KEY_LEN_BASE64]; - const void *key; - uint16_t listen_port; - - if (get_nvl_out_size(s, WGC_GET, &size)) - return; - if ((packed = malloc(size)) == NULL) - return; - if (do_cmd(s, WGC_GET, packed, size, 0)) - return; - nvl = nvlist_unpack(packed, size, 0); - if (nvlist_exists_number(nvl, "listen-port")) { - listen_port = nvlist_get_number(nvl, "listen-port"); - printf("\tlisten-port: %d\n", listen_port); - } - if (nvlist_exists_binary(nvl, "private-key")) { - key = nvlist_get_binary(nvl, "private-key", &size); - b64_ntop((const uint8_t *)key, size, buf, WG_MAX_STRLEN); - printf("\tprivate-key: %s\n", buf); - } - if (nvlist_exists_binary(nvl, "public-key")) { - key = nvlist_get_binary(nvl, "public-key", &size); - b64_ntop((const uint8_t *)key, size, buf, WG_MAX_STRLEN); - printf("\tpublic-key: %s\n", buf); - } -} - -static struct cmd wireguard_cmds[] = { - DEF_CLONE_CMD_ARG("listen-port", setwglistenport), - DEF_CLONE_CMD_ARG("private-key", setwgprivkey), - DEF_CMD("peer-list", 0, peerlist), - DEF_CMD("peer", 0, peerstart), - DEF_CMD_ARG("public-key", setwgpubkey), - DEF_CMD_ARG("allowed-ips", setallowedips), - DEF_CMD_ARG("endpoint", setendpoint), -}; - -static struct afswtch af_wireguard = { - .af_name = "af_wireguard", - .af_af = AF_UNSPEC, - .af_other_status = wireguard_status, -}; - -static void -wg_create(int s, struct ifreq *ifr) -{ - struct iovec iov; - void *packed; - size_t size; - - setproctitle("ifconfig %s create ...\n", name); - if (!nvlist_exists_number(nvl_params, "listen-port")) - goto legacy; - if (!nvlist_exists_binary(nvl_params, "private-key")) - goto legacy; - - packed = nvlist_pack(nvl_params, &size); - if (packed == NULL) - errx(1, "failed to setup create request"); - iov.iov_len = size; - iov.iov_base = packed; - ifr->ifr_data = (caddr_t)&iov; - if (ioctl(s, SIOCIFCREATE2, ifr) < 0) - err(1, "SIOCIFCREATE2"); - return; -legacy: - ifr->ifr_data == NULL; - if (ioctl(s, SIOCIFCREATE, ifr) < 0) - err(1, "SIOCIFCREATE"); -} - -static __constructor void -wireguard_ctor(void) -{ - int i; - - nvl_params = nvlist_create(0); - for (i = 0; i < nitems(wireguard_cmds); i++) - cmd_register(&wireguard_cmds[i]); - af_register(&af_wireguard); - clone_setdefcallback_prefix("wg", wg_create); -} - -#endif diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index b66dcf135733..ffc7a08292e9 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -583,7 +583,6 @@ MAN= aac.4 \ vtnet.4 \ watchdog.4 \ ${_wbwd.4} \ - wg.4 \ witness.4 \ wlan.4 \ wlan_acl.4 \ diff --git a/share/man/man4/wg.4 b/share/man/man4/wg.4 deleted file mode 100644 index 760584e3a386..000000000000 --- a/share/man/man4/wg.4 +++ /dev/null @@ -1,255 +0,0 @@ -.\" Copyright (c) 2020 Gordon Bergling -.\" -.\" 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$ -.\" -.Dd March 7, 2021 -.Dt WG 4 -.Os -.Sh NAME -.Nm wg -.Nd "WireGuard - pseudo-device" -.Sh SYNOPSIS -To load the driver as a module at boot time, place the following line in -.Xr loader.conf 5 : -.Bd -literal -offset indent -if_wg_load="YES" -.Ed -.Sh DESCRIPTION -The -.Nm -driver provides Virtual Private Network (VPN) interfaces for the secure -exchange of layer 3 traffic with other WireGuard peers using the WireGuard -protocol. -.Pp -A -.Nm -interface recognises one or more peers, establishes a secure tunnel with -each on demand, and tracks each peer's UDP endpoint for exchanging encrypted -traffic with. -.Pp -The interfaces can be created at runtime using the -.Ic ifconfig Cm wg Ns Ar N Cm create -command. -The interface itself can be configured with -.Xr ifconfig 8 . -.Pp -The following parameters are available: -.Bl -tag -width indent -.It Cm listen-port -The listing port of the -.Nm -interface. -.It Cm public-key -The public key of the -.Nm -interface. -.It Cm private-key -The private key of the -.Nm -interface. -.It Cm pre-shared-key -Defines a pre-shared key for the -.Nm -interface. -.It Cm allowed-ips -A list of allowed IP addresses. -.It Cm endpoint -The IP address of the WiredGuard to connect to. -.It Cm peer-list -A list of peering IP addresses to connect to. -.El -.Pp -The -.Nm -interfaces support the following -.Xr ioctl 2 Ns s : -.Bl -tag -width Ds -offset indent -.It Dv SIOCSWG Fa "struct wg_device_io *" -Set the device configuration. -.It Dv SIOCGWG Fa "struct wg_device_io *" -Get the device configuration. -.El -.Pp -The following glossary provides a brief overview of WireGuard -terminology: -.Bl -tag -width indent -offset 3n -.It Peer -Peers exchange IPv4 or IPv6 traffic over secure tunnels. -Each -.Nm -interface may be configured to recognise one or more peers. -.It Key -Each peer uses its private key and corresponding public key to -identify itself to others. -A peer configures a -.Nm -interface with its own private key and with the public keys of its peers. -.It Pre-shared key -In addition to the public keys, each peer pair may be configured with a -unique pre-shared symmetric key. -This is used in their handshake to guard against future compromise of the -peers' encrypted tunnel if a quantum-computational attack on their -Diffie-Hellman exchange becomes feasible. -It is optional, but recommended. -.It Allowed IPs -A single -.Nm -interface may maintain concurrent tunnels connecting diverse networks. -The interface therefore implements rudimentary routing and reverse-path -filtering functions for its tunneled traffic. -These functions reference a set of allowed IP ranges configured against -each peer. -.Pp -The interface will route outbound tunneled traffic to the peer configured -with the most specific matching allowed IP address range, or drop it -if no such match exists. -.Pp -The interface will accept tunneled traffic only from the peer -configured with the most specific matching allowed IP address range -for the incoming traffic, or drop it if no such match exists. -That is, tunneled traffic routed to a given peer cannot return through -another peer of the same -.Nm -interface. -This ensures that peers cannot spoof another's traffic. -.It Handshake -Two peers handshake to mutually authenticate each other and to -establish a shared series of secret ephemeral encryption keys. -Any peer may initiate a handshake. -Handshakes occur only when there is traffic to send, and recur every -two minutes during transfers. -.It Connectionless -Due to the handshake behavior, there is no connected or disconnected -state. -.El -.Ss Keys -Private keys for WireGuard can be generated from any sufficiently -secure random source. -The Curve25519 keys and the pre-shared keys are both 32 bytes -long and are commonly encoded in base64 for ease of use. -.Pp -Keys can be generated with -.Xr openssl 1 -as follows: -.Pp -.Dl $ openssl rand -base64 32 -.Pp -Although a valid Curve25519 key must have 5 bits set to -specific values, this is done by the interface and so it -will accept any random 32-byte base64 string. -.Pp -When an interface has a private key set with -.Nm public-key , -the corresponding -public key is shown in the status output of the interface: -.Bd -literal -offset indent -# ifconfig wg0 | grep public-key - public-key: 7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw= -.Ed -.Sh EXAMPLES -Create a -.Nm -interface and set random private key. -.Bd -literal -offset indent -# ifconfig wg0 create listen-port 54321 private-key `openssl rand -base64 32` -.Ed -.Pp -Retrieve the associated public key from a -.Nm -interface. -.Bd -literal -offset indent -$ ifconfig wg0 | awk '/public-key/ { print $2 }'` -.Ed -.Pp -Connect to a specific endpoint using its public-key and set the allowed IP address -.Bd -literal -offset indent -# ifconfig wg0 peer public-key '7lWtsDdqaGB3EY9WNxRN3hVaHMtu1zXw71+bOjNOVUw=' endpoint 10.0.1.100:54321 allowed-ips 192.168.2.100/32 -.Ed -.Sh DIAGNOSTICS -The -.Nm -interface supports runtime debugging, which can be enabled with: -.Pp -.D1 Ic ifconfig Cm wg Ns Ar N Cm debug -.Pp -Some common error messages include: -.Bl -diag -.It "Handshake for peer X did not complete after 5 seconds, retrying" -Peer X did not reply to our initiation packet, for example because: -.Bl -bullet -.It -The peer does not have the local interface configured as a peer. -Peers must be able to mutually authenticate each other. -.It -The peer endpoint IP address is incorrectly configured. -.It -There are firewall rules preventing communication between hosts. -.El -.It "Invalid handshake initiation" -The incoming handshake packet could not be processed. -This is likely due to the local interface not containing -the correct public key for the peer. -.It "Invalid initiation MAC" -The incoming handshake initiation packet had an invalid MAC. -This is likely because the initiation sender has the wrong public key -for the handshake receiver. -.It "Packet has unallowed src IP from peer X" -After decryption, an incoming data packet has a source IP address that -is not assigned to the allowed IPs of Peer X. -.El -.Sh SEE ALSO -.Xr inet 4 , -.Xr ip 4 , -.Xr netintro 4 , -.Xr ipf 5 , -.Xr pf.conf 5 , -.Xr ifconfig 8 , -.Xr ipfw 8 -.Rs -.%T WireGuard whitepaper -.%U https://www.wireguard.com/papers/wireguard.pdf -.Re -.Sh HISTORY -The -.Nm -device driver first appeared in -.Fx 13.0 . -.Sh AUTHORS -The -.Nm -device driver was originally written for -.Ox -by -.An Matt Dunwoodie Aq Mt ncon@nconroy.net -and ported to -.Fx -by -.An Matt Macy Aq Mt mmacy@FreeBSD.org . -.Pp -This manual page was written by -.An Gordon Bergling Aq Mt gbe@FreeBSD.org -and is based on the -.Ox *** 45008 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Thu Mar 18 14:21:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 459CD5769BA; Thu, 18 Mar 2021 14:21: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 4F1TjT1BRpz3lcg; Thu, 18 Mar 2021 14:21: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 1BC64230EA; Thu, 18 Mar 2021 14:21: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 12IELXVd011934; Thu, 18 Mar 2021 14:21:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IELXJo011933; Thu, 18 Mar 2021 14:21:33 GMT (envelope-from git) Date: Thu, 18 Mar 2021 14:21:33 GMT Message-Id: <202103181421.12IELXJo011933@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Daniel Ebdrup Jensen Subject: git: 21864048f392 - main - inetd.conf: Wordsmith recommendation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: debdrup X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 21864048f3929192bd20f34145ba62cda6e1d4f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 14:21:33 -0000 The branch main has been updated by debdrup (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=21864048f3929192bd20f34145ba62cda6e1d4f9 commit 21864048f3929192bd20f34145ba62cda6e1d4f9 Author: Daniel Ebdrup Jensen AuthorDate: 2021-03-18 14:17:32 +0000 Commit: Daniel Ebdrup Jensen CommitDate: 2021-03-18 14:17:32 +0000 inetd.conf: Wordsmith recommendation Rather than recommend specific VTIs, it's better to give a general recommendation for where current and future suitable VTIs can be found. --- usr.sbin/inetd/inetd.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/inetd/inetd.conf b/usr.sbin/inetd/inetd.conf index 7f5f6783a038..82f68be7ab5d 100644 --- a/usr.sbin/inetd/inetd.conf +++ b/usr.sbin/inetd/inetd.conf @@ -121,7 +121,8 @@ #prom-sysctl stream tcp nowait nobody /usr/sbin/prometheus_sysctl_exporter prometheus_sysctl_exporter -dgh # # Example entry for insecure rsync server -# This is best combined with a VTI like if_ipsec(4) or wg(4) +# This is best combined with encrypted virtual tunnel interfaces, which can be +# found with: apropos if_ | grep tunnel #rsync stream tcp nowait root /usr/local/bin/rsyncd rsyncd --daemon # # Let the system respond to date requests via tcpmux From owner-dev-commits-src-all@freebsd.org Thu Mar 18 15:00:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3D06578665; Thu, 18 Mar 2021 15:00: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 4F1VZ95Ystz3nxR; Thu, 18 Mar 2021 15:00: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 B1FDC23C26; Thu, 18 Mar 2021 15:00: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 12IF0Hah060711; Thu, 18 Mar 2021 15:00:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IF0H7B060705; Thu, 18 Mar 2021 15:00:17 GMT (envelope-from git) Date: Thu, 18 Mar 2021 15:00:17 GMT Message-Id: <202103181500.12IF0H7B060705@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: e9272225e6be - main - vfs: fix vnlru marker handling for filtered/unfiltered cases 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: e9272225e6bed840b00eef1c817b188c172338ee Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 15:00:17 -0000 The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=e9272225e6bed840b00eef1c817b188c172338ee commit e9272225e6bed840b00eef1c817b188c172338ee Author: Mateusz Guzik AuthorDate: 2021-03-17 21:33:47 +0000 Commit: Mateusz Guzik CommitDate: 2021-03-18 14:59:03 +0000 vfs: fix vnlru marker handling for filtered/unfiltered cases The global list has a marker with an invariant that free vnodes are placed somewhere past that. A caller which performs filtering (like ZFS) can move said marker all the way to the end, across free vnodes which don't match. Then a caller which does not perform filtering will fail to find them. This makes vn_alloc_hard sleep for 1 second instead of reclaiming, resulting in significant stalls. Fix the problem by requiring an explicit marker by callers which do filtering. As a temporary measure extend vnlru_free to restart if it fails to reclaim anything. Big thanks go to the reporter for testing several iterations of the patch. Reported by: Yamagi Tested by: Yamagi Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D29324 --- sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c | 14 ++++- sys/kern/vfs_subr.c | 72 +++++++++++++++++++--- sys/sys/vnode.h | 3 + 3 files changed, 80 insertions(+), 9 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 4fc7468bfa47..0d5cffbe8d1e 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c @@ -51,6 +51,9 @@ #include #include +static struct sx arc_vnlru_lock; +static struct vnode *arc_vnlru_marker; + extern struct vfsops zfs_vfsops; uint_t zfs_arc_free_target = 0; @@ -157,7 +160,9 @@ arc_prune_task(void *arg) arc_reduce_target_size(ptob(nr_scan)); free(arg, M_TEMP); - vnlru_free(nr_scan, &zfs_vfsops); + sx_xlock(&arc_vnlru_lock); + vnlru_free_vfsops(nr_scan, &zfs_vfsops, arc_vnlru_marker); + sx_xunlock(&arc_vnlru_lock); } /* @@ -234,7 +239,8 @@ arc_lowmem_init(void) { arc_event_lowmem = EVENTHANDLER_REGISTER(vm_lowmem, arc_lowmem, NULL, EVENTHANDLER_PRI_FIRST); - + arc_vnlru_marker = vnlru_alloc_marker(); + sx_init(&arc_vnlru_lock, "arc vnlru lock"); } void @@ -242,6 +248,10 @@ arc_lowmem_fini(void) { if (arc_event_lowmem != NULL) EVENTHANDLER_DEREGISTER(vm_lowmem, arc_event_lowmem); + if (arc_vnlru_marker != NULL) { + vnlru_free_marker(arc_vnlru_marker); + sx_destroy(&arc_vnlru_lock); + } } void diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 37e713ee48ea..af12252e8a88 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1216,9 +1216,9 @@ SYSCTL_INT(_debug, OID_AUTO, max_vnlru_free, CTLFLAG_RW, &max_vnlru_free, * Attempt to reduce the free list by the requested amount. */ static int -vnlru_free_locked(int count, struct vfsops *mnt_op) +vnlru_free_impl(int count, struct vfsops *mnt_op, struct vnode *mvp) { - struct vnode *vp, *mvp; + struct vnode *vp; struct mount *mp; int ocount; @@ -1226,7 +1226,6 @@ vnlru_free_locked(int count, struct vfsops *mnt_op) if (count > max_vnlru_free) count = max_vnlru_free; ocount = count; - mvp = vnode_list_free_marker; vp = mvp; for (;;) { if (count == 0) { @@ -1268,13 +1267,72 @@ vnlru_free_locked(int count, struct vfsops *mnt_op) return (ocount - count); } +static int +vnlru_free_locked(int count) +{ + + mtx_assert(&vnode_list_mtx, MA_OWNED); + return (vnlru_free_impl(count, NULL, vnode_list_free_marker)); +} + +void +vnlru_free_vfsops(int count, struct vfsops *mnt_op, struct vnode *mvp) +{ + + MPASS(mnt_op != NULL); + MPASS(mvp != NULL); + VNPASS(mvp->v_type == VMARKER, mvp); + mtx_lock(&vnode_list_mtx); + vnlru_free_impl(count, mnt_op, mvp); + mtx_unlock(&vnode_list_mtx); +} + +/* + * Temporary binary compat, don't use. Call vnlru_free_vfsops instead. + */ void vnlru_free(int count, struct vfsops *mnt_op) { + struct vnode *mvp; + + if (count == 0) + return; + mtx_lock(&vnode_list_mtx); + mvp = vnode_list_free_marker; + if (vnlru_free_impl(count, mnt_op, mvp) == 0) { + /* + * It is possible the marker was moved over eligible vnodes by + * callers which filtered by different ops. If so, start from + * scratch. + */ + if (vnlru_read_freevnodes() > 0) { + TAILQ_REMOVE(&vnode_list, mvp, v_vnodelist); + TAILQ_INSERT_HEAD(&vnode_list, mvp, v_vnodelist); + } + vnlru_free_impl(count, mnt_op, mvp); + } + mtx_unlock(&vnode_list_mtx); +} + +struct vnode * +vnlru_alloc_marker(void) +{ + struct vnode *mvp; + mvp = vn_alloc_marker(NULL); + mtx_lock(&vnode_list_mtx); + TAILQ_INSERT_BEFORE(vnode_list_free_marker, mvp, v_vnodelist); + mtx_unlock(&vnode_list_mtx); + return (mvp); +} + +void +vnlru_free_marker(struct vnode *mvp) +{ mtx_lock(&vnode_list_mtx); - vnlru_free_locked(count, mnt_op); + TAILQ_REMOVE(&vnode_list, mvp, v_vnodelist); mtx_unlock(&vnode_list_mtx); + vn_free_marker(mvp); } static void @@ -1423,7 +1481,7 @@ vnlru_proc(void) * try to reduce it by discarding from the free list. */ if (rnumvnodes > desiredvnodes) { - vnlru_free_locked(rnumvnodes - desiredvnodes, NULL); + vnlru_free_locked(rnumvnodes - desiredvnodes); rnumvnodes = atomic_load_long(&numvnodes); } /* @@ -1615,7 +1673,7 @@ vn_alloc_hard(struct mount *mp) * should be chosen so that we never wait or even reclaim from * the free list to below its target minimum. */ - if (vnlru_free_locked(1, NULL) > 0) + if (vnlru_free_locked(1) > 0) goto alloc; if (mp == NULL || (mp->mnt_kern_flag & MNTK_SUSPEND) == 0) { /* @@ -1625,7 +1683,7 @@ vn_alloc_hard(struct mount *mp) msleep(&vnlruproc_sig, &vnode_list_mtx, PVFS, "vlruwk", hz); if (atomic_load_long(&numvnodes) + 1 > desiredvnodes && vnlru_read_freevnodes() > 1) - vnlru_free_locked(1, NULL); + vnlru_free_locked(1); } alloc: rnumvnodes = atomic_fetchadd_long(&numvnodes, 1) + 1; diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 0e46bea14b64..f05b03c74c82 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -826,7 +826,10 @@ void vfs_timestamp(struct timespec *); void vfs_write_resume(struct mount *mp, int flags); int vfs_write_suspend(struct mount *mp, int flags); int vfs_write_suspend_umnt(struct mount *mp); +struct vnode *vnlru_alloc_marker(void); +void vnlru_free_marker(struct vnode *); void vnlru_free(int, struct vfsops *); +void vnlru_free_vfsops(int, struct vfsops *, struct vnode *); int vop_stdbmap(struct vop_bmap_args *); int vop_stdfdatasync_buf(struct vop_fdatasync_args *); int vop_stdfsync(struct vop_fsync_args *); From owner-dev-commits-src-all@freebsd.org Thu Mar 18 15:02:40 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6719B5788F0; Thu, 18 Mar 2021 15:02: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 4F1Vcw2SYMz3pYB; Thu, 18 Mar 2021 15:02: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 4755B23DB4; Thu, 18 Mar 2021 15:02: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 12IF2egG066628; Thu, 18 Mar 2021 15:02:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IF2e8s066627; Thu, 18 Mar 2021 15:02:40 GMT (envelope-from git) Date: Thu, 18 Mar 2021 15:02:40 GMT Message-Id: <202103181502.12IF2e8s066627@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: 4f2e8545f7fd - stable/13 - vfs: fix vnlru marker handling for filtered/unfiltered cases MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mjg X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4f2e8545f7fd842bb54f0a23166965f1ae58e522 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 15:02:40 -0000 The branch stable/13 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=4f2e8545f7fd842bb54f0a23166965f1ae58e522 commit 4f2e8545f7fd842bb54f0a23166965f1ae58e522 Author: Mateusz Guzik AuthorDate: 2021-03-17 21:33:47 +0000 Commit: Mateusz Guzik CommitDate: 2021-03-18 15:00:50 +0000 vfs: fix vnlru marker handling for filtered/unfiltered cases The global list has a marker with an invariant that free vnodes are placed somewhere past that. A caller which performs filtering (like ZFS) can move said marker all the way to the end, across free vnodes which don't match. Then a caller which does not perform filtering will fail to find them. This makes vn_alloc_hard sleep for 1 second instead of reclaiming, resulting in significant stalls. Fix the problem by requiring an explicit marker by callers which do filtering. As a temporary measure extend vnlru_free to restart if it fails to reclaim anything. Big thanks go to the reporter for testing several iterations of the patch. Reported by: Yamagi Tested by: Yamagi Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D29324 (cherry picked from commit e9272225e6bed840b00eef1c817b188c172338ee) --- sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c | 14 ++++- sys/kern/vfs_subr.c | 72 +++++++++++++++++++--- sys/sys/vnode.h | 3 + 3 files changed, 80 insertions(+), 9 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 4fc7468bfa47..0d5cffbe8d1e 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c @@ -51,6 +51,9 @@ #include #include +static struct sx arc_vnlru_lock; +static struct vnode *arc_vnlru_marker; + extern struct vfsops zfs_vfsops; uint_t zfs_arc_free_target = 0; @@ -157,7 +160,9 @@ arc_prune_task(void *arg) arc_reduce_target_size(ptob(nr_scan)); free(arg, M_TEMP); - vnlru_free(nr_scan, &zfs_vfsops); + sx_xlock(&arc_vnlru_lock); + vnlru_free_vfsops(nr_scan, &zfs_vfsops, arc_vnlru_marker); + sx_xunlock(&arc_vnlru_lock); } /* @@ -234,7 +239,8 @@ arc_lowmem_init(void) { arc_event_lowmem = EVENTHANDLER_REGISTER(vm_lowmem, arc_lowmem, NULL, EVENTHANDLER_PRI_FIRST); - + arc_vnlru_marker = vnlru_alloc_marker(); + sx_init(&arc_vnlru_lock, "arc vnlru lock"); } void @@ -242,6 +248,10 @@ arc_lowmem_fini(void) { if (arc_event_lowmem != NULL) EVENTHANDLER_DEREGISTER(vm_lowmem, arc_event_lowmem); + if (arc_vnlru_marker != NULL) { + vnlru_free_marker(arc_vnlru_marker); + sx_destroy(&arc_vnlru_lock); + } } void diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 3e39d19666e5..98c97324e467 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1216,9 +1216,9 @@ SYSCTL_INT(_debug, OID_AUTO, max_vnlru_free, CTLFLAG_RW, &max_vnlru_free, * Attempt to reduce the free list by the requested amount. */ static int -vnlru_free_locked(int count, struct vfsops *mnt_op) +vnlru_free_impl(int count, struct vfsops *mnt_op, struct vnode *mvp) { - struct vnode *vp, *mvp; + struct vnode *vp; struct mount *mp; int ocount; @@ -1226,7 +1226,6 @@ vnlru_free_locked(int count, struct vfsops *mnt_op) if (count > max_vnlru_free) count = max_vnlru_free; ocount = count; - mvp = vnode_list_free_marker; vp = mvp; for (;;) { if (count == 0) { @@ -1268,13 +1267,72 @@ vnlru_free_locked(int count, struct vfsops *mnt_op) return (ocount - count); } +static int +vnlru_free_locked(int count) +{ + + mtx_assert(&vnode_list_mtx, MA_OWNED); + return (vnlru_free_impl(count, NULL, vnode_list_free_marker)); +} + +void +vnlru_free_vfsops(int count, struct vfsops *mnt_op, struct vnode *mvp) +{ + + MPASS(mnt_op != NULL); + MPASS(mvp != NULL); + VNPASS(mvp->v_type == VMARKER, mvp); + mtx_lock(&vnode_list_mtx); + vnlru_free_impl(count, mnt_op, mvp); + mtx_unlock(&vnode_list_mtx); +} + +/* + * Temporary binary compat, don't use. Call vnlru_free_vfsops instead. + */ void vnlru_free(int count, struct vfsops *mnt_op) { + struct vnode *mvp; + + if (count == 0) + return; + mtx_lock(&vnode_list_mtx); + mvp = vnode_list_free_marker; + if (vnlru_free_impl(count, mnt_op, mvp) == 0) { + /* + * It is possible the marker was moved over eligible vnodes by + * callers which filtered by different ops. If so, start from + * scratch. + */ + if (vnlru_read_freevnodes() > 0) { + TAILQ_REMOVE(&vnode_list, mvp, v_vnodelist); + TAILQ_INSERT_HEAD(&vnode_list, mvp, v_vnodelist); + } + vnlru_free_impl(count, mnt_op, mvp); + } + mtx_unlock(&vnode_list_mtx); +} + +struct vnode * +vnlru_alloc_marker(void) +{ + struct vnode *mvp; + mvp = vn_alloc_marker(NULL); + mtx_lock(&vnode_list_mtx); + TAILQ_INSERT_BEFORE(vnode_list_free_marker, mvp, v_vnodelist); + mtx_unlock(&vnode_list_mtx); + return (mvp); +} + +void +vnlru_free_marker(struct vnode *mvp) +{ mtx_lock(&vnode_list_mtx); - vnlru_free_locked(count, mnt_op); + TAILQ_REMOVE(&vnode_list, mvp, v_vnodelist); mtx_unlock(&vnode_list_mtx); + vn_free_marker(mvp); } static void @@ -1423,7 +1481,7 @@ vnlru_proc(void) * try to reduce it by discarding from the free list. */ if (rnumvnodes > desiredvnodes) { - vnlru_free_locked(rnumvnodes - desiredvnodes, NULL); + vnlru_free_locked(rnumvnodes - desiredvnodes); rnumvnodes = atomic_load_long(&numvnodes); } /* @@ -1615,7 +1673,7 @@ vn_alloc_hard(struct mount *mp) * should be chosen so that we never wait or even reclaim from * the free list to below its target minimum. */ - if (vnlru_free_locked(1, NULL) > 0) + if (vnlru_free_locked(1) > 0) goto alloc; if (mp == NULL || (mp->mnt_kern_flag & MNTK_SUSPEND) == 0) { /* @@ -1625,7 +1683,7 @@ vn_alloc_hard(struct mount *mp) msleep(&vnlruproc_sig, &vnode_list_mtx, PVFS, "vlruwk", hz); if (atomic_load_long(&numvnodes) + 1 > desiredvnodes && vnlru_read_freevnodes() > 1) - vnlru_free_locked(1, NULL); + vnlru_free_locked(1); } alloc: rnumvnodes = atomic_fetchadd_long(&numvnodes, 1) + 1; diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 9d68f9e236f6..bb07cd80e42e 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -823,7 +823,10 @@ void vfs_timestamp(struct timespec *); void vfs_write_resume(struct mount *mp, int flags); int vfs_write_suspend(struct mount *mp, int flags); int vfs_write_suspend_umnt(struct mount *mp); +struct vnode *vnlru_alloc_marker(void); +void vnlru_free_marker(struct vnode *); void vnlru_free(int, struct vfsops *); +void vnlru_free_vfsops(int, struct vfsops *, struct vnode *); int vop_stdbmap(struct vop_bmap_args *); int vop_stdfdatasync_buf(struct vop_fdatasync_args *); int vop_stdfsync(struct vop_fsync_args *); From owner-dev-commits-src-all@freebsd.org Thu Mar 18 15:05:42 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62B8C578473; Thu, 18 Mar 2021 15:05: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 4F1VhQ2HLYz3pl9; Thu, 18 Mar 2021 15:05: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 3CD3223E14; Thu, 18 Mar 2021 15:05: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 12IF5g9T067216; Thu, 18 Mar 2021 15:05:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IF5gZ2067215; Thu, 18 Mar 2021 15:05:42 GMT (envelope-from git) Date: Thu, 18 Mar 2021 15:05:42 GMT Message-Id: <202103181505.12IF5gZ2067215@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 4a847a6ccdf2 - main - Revert "bootstrap: add tic to the bootstrap tools" Since we don't build and install the terminfo db anymore this is not needed MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 4a847a6ccdf2ed583b8635103b36b76e153ffb62 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 15:05:42 -0000 The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=4a847a6ccdf2ed583b8635103b36b76e153ffb62 commit 4a847a6ccdf2ed583b8635103b36b76e153ffb62 Author: Baptiste Daroussin AuthorDate: 2021-03-18 15:01:11 +0000 Commit: Baptiste Daroussin CommitDate: 2021-03-18 15:05:20 +0000 Revert "bootstrap: add tic to the bootstrap tools" Since we don't build and install the terminfo db anymore this is not needed This reverts commit b6a51d39e3a2e2f75d5b42a8c17a531063258a15. This reverts commit e5e4845959ac60110677df302a68c220dff75abe. This reverts commit 0af562d7e1850bbef230d30805c101b26588a3ed. --- Makefile.inc1 | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index 9b52372288f7..005d9d25afb3 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -2479,7 +2479,6 @@ bootstrap-tools: ${_bt}-links .PHONY lib/libopenbsd \ usr.bin/mandoc \ usr.bin/rpcgen \ - lib/ncurses/ncurses \ ${_yacc} \ ${_m4} \ ${_lex} \ @@ -2494,7 +2493,6 @@ bootstrap-tools: ${_bt}-links .PHONY ${_nmtree} \ ${_vtfontcvt} \ ${_localedef} \ - usr.bin/ncurses \ ${LOCAL_BSTOOL_DIRS} ${_bt}-${_tool}: ${_bt}-links .PHONY .MAKE ${_+_}@${ECHODIR} "===> ${_tool} (obj,all,install)"; \ @@ -2516,9 +2514,6 @@ ${_bt}-usr.bin/xinstall: ${_bt}-lib/libmd ${_bt}-sbin/md5: ${_bt}-lib/libmd .endif -.if target(${_bt}-usr.bin/ncurses) -${_bt}-usr.bin/ncurses: ${_bt}-lib/ncurses/ncurses -.endif # # build-tools: Build special purpose build tools From owner-dev-commits-src-all@freebsd.org Thu Mar 18 15:36:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CE0B57ADB0; Thu, 18 Mar 2021 15:36: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 4F1WN72dhsz3rln; Thu, 18 Mar 2021 15:36: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 4D4E823F7D; Thu, 18 Mar 2021 15:36: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 12IFadNf007003; Thu, 18 Mar 2021 15:36:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IFadcY007002; Thu, 18 Mar 2021 15:36:39 GMT (envelope-from git) Date: Thu, 18 Mar 2021 15:36:39 GMT Message-Id: <202103181536.12IFadcY007002@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mateusz Guzik Subject: git: faa41af1fed3 - releng/13.0 - vfs: fix vnlru marker handling for filtered/unfiltered cases 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: faa41af1fed350327cc542cb240ca2c6e1e8ba0c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 15:36:39 -0000 The branch releng/13.0 has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=faa41af1fed350327cc542cb240ca2c6e1e8ba0c commit faa41af1fed350327cc542cb240ca2c6e1e8ba0c Author: Mateusz Guzik AuthorDate: 2021-03-17 21:33:47 +0000 Commit: Mateusz Guzik CommitDate: 2021-03-18 15:36:22 +0000 vfs: fix vnlru marker handling for filtered/unfiltered cases The global list has a marker with an invariant that free vnodes are placed somewhere past that. A caller which performs filtering (like ZFS) can move said marker all the way to the end, across free vnodes which don't match. Then a caller which does not perform filtering will fail to find them. This makes vn_alloc_hard sleep for 1 second instead of reclaiming, resulting in significant stalls. Fix the problem by requiring an explicit marker by callers which do filtering. As a temporary measure extend vnlru_free to restart if it fails to reclaim anything. Big thanks go to the reporter for testing several iterations of the patch. Reported by: Yamagi Tested by: Yamagi Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D29324 Approved by: re (gjb) (cherry picked from commit e9272225e6bed840b00eef1c817b188c172338ee) --- sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c | 14 ++++- sys/kern/vfs_subr.c | 72 +++++++++++++++++++--- sys/sys/vnode.h | 3 + 3 files changed, 80 insertions(+), 9 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 4fc7468bfa47..0d5cffbe8d1e 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/arc_os.c @@ -51,6 +51,9 @@ #include #include +static struct sx arc_vnlru_lock; +static struct vnode *arc_vnlru_marker; + extern struct vfsops zfs_vfsops; uint_t zfs_arc_free_target = 0; @@ -157,7 +160,9 @@ arc_prune_task(void *arg) arc_reduce_target_size(ptob(nr_scan)); free(arg, M_TEMP); - vnlru_free(nr_scan, &zfs_vfsops); + sx_xlock(&arc_vnlru_lock); + vnlru_free_vfsops(nr_scan, &zfs_vfsops, arc_vnlru_marker); + sx_xunlock(&arc_vnlru_lock); } /* @@ -234,7 +239,8 @@ arc_lowmem_init(void) { arc_event_lowmem = EVENTHANDLER_REGISTER(vm_lowmem, arc_lowmem, NULL, EVENTHANDLER_PRI_FIRST); - + arc_vnlru_marker = vnlru_alloc_marker(); + sx_init(&arc_vnlru_lock, "arc vnlru lock"); } void @@ -242,6 +248,10 @@ arc_lowmem_fini(void) { if (arc_event_lowmem != NULL) EVENTHANDLER_DEREGISTER(vm_lowmem, arc_event_lowmem); + if (arc_vnlru_marker != NULL) { + vnlru_free_marker(arc_vnlru_marker); + sx_destroy(&arc_vnlru_lock); + } } void diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 04cd0e0175f9..74470805411c 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -1216,9 +1216,9 @@ SYSCTL_INT(_debug, OID_AUTO, max_vnlru_free, CTLFLAG_RW, &max_vnlru_free, * Attempt to reduce the free list by the requested amount. */ static int -vnlru_free_locked(int count, struct vfsops *mnt_op) +vnlru_free_impl(int count, struct vfsops *mnt_op, struct vnode *mvp) { - struct vnode *vp, *mvp; + struct vnode *vp; struct mount *mp; int ocount; @@ -1226,7 +1226,6 @@ vnlru_free_locked(int count, struct vfsops *mnt_op) if (count > max_vnlru_free) count = max_vnlru_free; ocount = count; - mvp = vnode_list_free_marker; vp = mvp; for (;;) { if (count == 0) { @@ -1268,13 +1267,72 @@ vnlru_free_locked(int count, struct vfsops *mnt_op) return (ocount - count); } +static int +vnlru_free_locked(int count) +{ + + mtx_assert(&vnode_list_mtx, MA_OWNED); + return (vnlru_free_impl(count, NULL, vnode_list_free_marker)); +} + +void +vnlru_free_vfsops(int count, struct vfsops *mnt_op, struct vnode *mvp) +{ + + MPASS(mnt_op != NULL); + MPASS(mvp != NULL); + VNPASS(mvp->v_type == VMARKER, mvp); + mtx_lock(&vnode_list_mtx); + vnlru_free_impl(count, mnt_op, mvp); + mtx_unlock(&vnode_list_mtx); +} + +/* + * Temporary binary compat, don't use. Call vnlru_free_vfsops instead. + */ void vnlru_free(int count, struct vfsops *mnt_op) { + struct vnode *mvp; + + if (count == 0) + return; + mtx_lock(&vnode_list_mtx); + mvp = vnode_list_free_marker; + if (vnlru_free_impl(count, mnt_op, mvp) == 0) { + /* + * It is possible the marker was moved over eligible vnodes by + * callers which filtered by different ops. If so, start from + * scratch. + */ + if (vnlru_read_freevnodes() > 0) { + TAILQ_REMOVE(&vnode_list, mvp, v_vnodelist); + TAILQ_INSERT_HEAD(&vnode_list, mvp, v_vnodelist); + } + vnlru_free_impl(count, mnt_op, mvp); + } + mtx_unlock(&vnode_list_mtx); +} + +struct vnode * +vnlru_alloc_marker(void) +{ + struct vnode *mvp; + mvp = vn_alloc_marker(NULL); + mtx_lock(&vnode_list_mtx); + TAILQ_INSERT_BEFORE(vnode_list_free_marker, mvp, v_vnodelist); + mtx_unlock(&vnode_list_mtx); + return (mvp); +} + +void +vnlru_free_marker(struct vnode *mvp) +{ mtx_lock(&vnode_list_mtx); - vnlru_free_locked(count, mnt_op); + TAILQ_REMOVE(&vnode_list, mvp, v_vnodelist); mtx_unlock(&vnode_list_mtx); + vn_free_marker(mvp); } static void @@ -1423,7 +1481,7 @@ vnlru_proc(void) * try to reduce it by discarding from the free list. */ if (rnumvnodes > desiredvnodes) { - vnlru_free_locked(rnumvnodes - desiredvnodes, NULL); + vnlru_free_locked(rnumvnodes - desiredvnodes); rnumvnodes = atomic_load_long(&numvnodes); } /* @@ -1615,7 +1673,7 @@ vn_alloc_hard(struct mount *mp) * should be chosen so that we never wait or even reclaim from * the free list to below its target minimum. */ - if (vnlru_free_locked(1, NULL) > 0) + if (vnlru_free_locked(1) > 0) goto alloc; if (mp == NULL || (mp->mnt_kern_flag & MNTK_SUSPEND) == 0) { /* @@ -1625,7 +1683,7 @@ vn_alloc_hard(struct mount *mp) msleep(&vnlruproc_sig, &vnode_list_mtx, PVFS, "vlruwk", hz); if (atomic_load_long(&numvnodes) + 1 > desiredvnodes && vnlru_read_freevnodes() > 1) - vnlru_free_locked(1, NULL); + vnlru_free_locked(1); } alloc: rnumvnodes = atomic_fetchadd_long(&numvnodes, 1) + 1; diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 639a16881e09..450e2747b773 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -821,7 +821,10 @@ void vfs_timestamp(struct timespec *); void vfs_write_resume(struct mount *mp, int flags); int vfs_write_suspend(struct mount *mp, int flags); int vfs_write_suspend_umnt(struct mount *mp); +struct vnode *vnlru_alloc_marker(void); +void vnlru_free_marker(struct vnode *); void vnlru_free(int, struct vfsops *); +void vnlru_free_vfsops(int, struct vfsops *, struct vnode *); int vop_stdbmap(struct vop_bmap_args *); int vop_stdfdatasync_buf(struct vop_fdatasync_args *); int vop_stdfsync(struct vop_fsync_args *); From owner-dev-commits-src-all@freebsd.org Thu Mar 18 16:50:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3A0957C995; Thu, 18 Mar 2021 16:50: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 4F1Y0s5j9sz4RFT; Thu, 18 Mar 2021 16:50: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 B6FF2252C7; Thu, 18 Mar 2021 16:50: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 12IGo509001302; Thu, 18 Mar 2021 16:50:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IGo5WZ001299; Thu, 18 Mar 2021 16:50:05 GMT (envelope-from git) Date: Thu, 18 Mar 2021 16:50:05 GMT Message-Id: <202103181650.12IGo5WZ001299@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: 120a4bd4e9d0 - stable/13 - netmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 120a4bd4e9d05147a9774a2ca4b4eff48e062442 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 16:50:05 -0000 The branch stable/13 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=120a4bd4e9d05147a9774a2ca4b4eff48e062442 commit 120a4bd4e9d05147a9774a2ca4b4eff48e062442 Author: Vincenzo Maffione AuthorDate: 2021-03-15 17:39:18 +0000 Commit: Vincenzo Maffione CommitDate: 2021-03-18 16:40:23 +0000 netmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET The netmap_ioctl() function has a reference counting bug in case of NETMAP_REQ_PORT_INFO_GET command. When `hdr->nr_name[0] == '\0'`, the function does not decrease the refcount of "nmd", which is increased by netmap_mem_find(), causing a refcount leak. Reported by: Xiyu Yang Submitted by: Carl Smith MFC after: 3 days PR: 254311 (cherry picked from commit 0ab5902e8ad93d0a9341dcce386b6c571ee02173) --- sys/dev/netmap/netmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index f37900712046..f9698096b47a 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -2646,6 +2646,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, case NETMAP_REQ_PORT_INFO_GET: { struct nmreq_port_info_get *req = (struct nmreq_port_info_get *)(uintptr_t)hdr->nr_body; + int nmd_ref = 0; NMG_LOCK(); do { @@ -2687,6 +2688,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, error = EINVAL; break; } + nmd_ref = 1; } error = netmap_mem_get_info(nmd, &req->nr_memsize, &memflags, @@ -2704,6 +2706,8 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, req->nr_host_rx_rings = na->num_host_rx_rings; } while (0); netmap_unget_na(na, ifp); + if (nmd_ref) + netmap_mem_put(nmd); NMG_UNLOCK(); break; } From owner-dev-commits-src-all@freebsd.org Thu Mar 18 16:57:16 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3450557D008; Thu, 18 Mar 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 4F1Y9811Drz4Rjj; Thu, 18 Mar 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 10D862550E; Thu, 18 Mar 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 12IGvFPL012039; Thu, 18 Mar 2021 16:57:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IGvFYV012038; Thu, 18 Mar 2021 16:57:15 GMT (envelope-from git) Date: Thu, 18 Mar 2021 16:57:15 GMT Message-Id: <202103181657.12IGvFYV012038@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: 09b2bde74654 - stable/12 - netmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 09b2bde74654a16c56ade52411c464ef79de8cd4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 16:57:16 -0000 The branch stable/12 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=09b2bde74654a16c56ade52411c464ef79de8cd4 commit 09b2bde74654a16c56ade52411c464ef79de8cd4 Author: Vincenzo Maffione AuthorDate: 2021-03-15 17:39:18 +0000 Commit: Vincenzo Maffione CommitDate: 2021-03-18 16:41:17 +0000 netmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET The netmap_ioctl() function has a reference counting bug in case of NETMAP_REQ_PORT_INFO_GET command. When `hdr->nr_name[0] == '\0'`, the function does not decrease the refcount of "nmd", which is increased by netmap_mem_find(), causing a refcount leak. Reported by: Xiyu Yang Submitted by: Carl Smith MFC after: 3 days PR: 254311 (cherry picked from commit 0ab5902e8ad93d0a9341dcce386b6c571ee02173) --- sys/dev/netmap/netmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index ca5af6ab5217..6532856b21a1 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -2636,6 +2636,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, case NETMAP_REQ_PORT_INFO_GET: { struct nmreq_port_info_get *req = (struct nmreq_port_info_get *)(uintptr_t)hdr->nr_body; + int nmd_ref = 0; NMG_LOCK(); do { @@ -2677,6 +2678,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, error = EINVAL; break; } + nmd_ref = 1; } error = netmap_mem_get_info(nmd, &req->nr_memsize, &memflags, @@ -2694,6 +2696,8 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, req->nr_host_rx_rings = na->num_host_rx_rings; } while (0); netmap_unget_na(na, ifp); + if (nmd_ref) + netmap_mem_put(nmd); NMG_UNLOCK(); break; } From owner-dev-commits-src-all@freebsd.org Thu Mar 18 17:02:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E71657D16E; Thu, 18 Mar 2021 17:02: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 4F1YHC0t7Kz4SgB; Thu, 18 Mar 2021 17:02: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 10E2A256C3; Thu, 18 Mar 2021 17:02: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 12IH2Ubo025090; Thu, 18 Mar 2021 17:02:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IH2UZe025089; Thu, 18 Mar 2021 17:02:30 GMT (envelope-from git) Date: Thu, 18 Mar 2021 17:02:30 GMT Message-Id: <202103181702.12IH2UZe025089@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vincenzo Maffione Subject: git: 4019787f50a2 - stable/11 - netmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: vmaffione X-Git-Repository: src X-Git-Refname: refs/heads/stable/11 X-Git-Reftype: branch X-Git-Commit: 4019787f50a2826e9a4bba6e70868467b3d6081a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 17:02:31 -0000 The branch stable/11 has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=4019787f50a2826e9a4bba6e70868467b3d6081a commit 4019787f50a2826e9a4bba6e70868467b3d6081a Author: Vincenzo Maffione AuthorDate: 2021-03-15 17:39:18 +0000 Commit: Vincenzo Maffione CommitDate: 2021-03-18 16:54:01 +0000 netmap: fix memory leak in NETMAP_REQ_PORT_INFO_GET The netmap_ioctl() function has a reference counting bug in case of NETMAP_REQ_PORT_INFO_GET command. When `hdr->nr_name[0] == '\0'`, the function does not decrease the refcount of "nmd", which is increased by netmap_mem_find(), causing a refcount leak. Reported by: Xiyu Yang Submitted by: Carl Smith MFC after: 3 days PR: 254311 --- sys/dev/netmap/netmap.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/dev/netmap/netmap.c b/sys/dev/netmap/netmap.c index 9d10aa4d6828..420287516aa6 100644 --- a/sys/dev/netmap/netmap.c +++ b/sys/dev/netmap/netmap.c @@ -2596,6 +2596,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, case NETMAP_REQ_PORT_INFO_GET: { struct nmreq_port_info_get *req = (struct nmreq_port_info_get *)(uintptr_t)hdr->nr_body; + int nmd_ref = 0; NMG_LOCK(); do { @@ -2635,6 +2636,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, error = EINVAL; break; } + nmd_ref = 1; } error = netmap_mem_get_info(nmd, &req->nr_memsize, &memflags, @@ -2650,6 +2652,8 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, req->nr_tx_slots = na->num_tx_desc; } while (0); netmap_unget_na(na, ifp); + if (nmd_ref) + netmap_mem_put(nmd); NMG_UNLOCK(); break; } From owner-dev-commits-src-all@freebsd.org Thu Mar 18 17:40:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 845A357E81C; Thu, 18 Mar 2021 17:40: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 4F1Z6k31Dfz4VcC; Thu, 18 Mar 2021 17:40: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 5A42625AD1; Thu, 18 Mar 2021 17:40: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 12IHeEQR069853; Thu, 18 Mar 2021 17:40:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IHeE44069846; Thu, 18 Mar 2021 17:40:14 GMT (envelope-from git) Date: Thu, 18 Mar 2021 17:40:14 GMT Message-Id: <202103181740.12IHeE44069846@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Daniel Ebdrup Jensen Subject: git: c39dda81923a - main - rc.conf(5): Document the 'workstation' firewall_type MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: debdrup X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c39dda81923a26116241fbe996351133c86ad97a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 17:40:14 -0000 The branch main has been updated by debdrup (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=c39dda81923a26116241fbe996351133c86ad97a commit c39dda81923a26116241fbe996351133c86ad97a Author: Tobias Rehbein AuthorDate: 2021-03-18 17:01:09 +0000 Commit: Daniel Ebdrup Jensen CommitDate: 2021-03-18 17:39:24 +0000 rc.conf(5): Document the 'workstation' firewall_type Document the workstation ACL ruleset, which uses stateful rules. While here, add a note about where some of the undocumented variables can be found. This is not a perfect solution for bug 127359, but it at at least gives a place to go look, and can be used as a reference for when bug 127359 gets fixed properly. PR: 254358, 127359 --- share/man/man5/rc.conf.5 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index fef0f167d1a5..ddf4ea120df5 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -539,7 +539,7 @@ Valid selections from .Pa /etc/rc.firewall are: .Pp -.Bl -tag -width ".Li simple" -compact +.Bl -tag -width ".Li workstation" -compact .It Li open unrestricted IP access .It Li closed @@ -547,12 +547,18 @@ all IP services disabled, except via .Dq Li lo0 .It Li client basic protection for a workstation +.It Li workstation +basic protection for a workstation using stateful firewalling .It Li simple basic protection for a LAN. .El .Pp If a filename is specified, the full path must be given. +.Pp +Most of the predefined rulesets define additional configuration variables. +These are documented in +.Pa /etc/rc.firewall . .It Va firewall_quiet .Pq Vt bool Set to From owner-dev-commits-src-all@freebsd.org Thu Mar 18 19:16:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 409CF5A9B14; Thu, 18 Mar 2021 19: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 4F1cFd1Nftz4cvv; Thu, 18 Mar 2021 19: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 22A2A2713A; Thu, 18 Mar 2021 19: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 12IJGLPH096928; Thu, 18 Mar 2021 19: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 12IJGLVd096927; Thu, 18 Mar 2021 19:16:21 GMT (envelope-from git) Date: Thu, 18 Mar 2021 19:16:21 GMT Message-Id: <202103181916.12IJGLVd096927@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: a7883464fcc4 - main - x86: Reduce code duplication in cpu_fork() and cpu_copy_thread(). 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: a7883464fcc45b78e6aa01222682ae40f787a378 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 19:16:21 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a7883464fcc45b78e6aa01222682ae40f787a378 commit a7883464fcc45b78e6aa01222682ae40f787a378 Author: John Baldwin AuthorDate: 2021-03-18 19:13:17 +0000 Commit: John Baldwin CommitDate: 2021-03-18 19:13:17 +0000 x86: Reduce code duplication in cpu_fork() and cpu_copy_thread(). Add copy_thread() to hold shared code. Reviewed by: kib MFC after: 1 week Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29228 --- sys/amd64/amd64/vm_machdep.c | 167 +++++++++++++++------------------------ sys/i386/i386/vm_machdep.c | 184 +++++++++++++++++-------------------------- 2 files changed, 137 insertions(+), 214 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index a17ddd4ba6d8..0527ef95cf3b 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -136,6 +136,65 @@ alloc_fpusave(int flags) return (res); } +/* + * Common code shared between cpu_fork() and cpu_copy_thread() for + * initializing a thread. + */ +static void +copy_thread(struct thread *td1, struct thread *td2) +{ + struct pcb *pcb2; + + pcb2 = td2->td_pcb; + + /* Ensure that td1's pcb is up to date for user threads. */ + if ((td2->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td1 == curthread); + fpuexit(td1); + update_pcb_bases(td1->td_pcb); + } + + /* Copy td1's pcb */ + bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); + + /* Properly initialize pcb_save */ + pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); + + /* Kernel threads start with clean FPU and segment bases. */ + if ((td2->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_fsbase = 0; + pcb2->pcb_gsbase = 0; + clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | + PCB_KERNFPU | PCB_KERNFPU_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); + bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), + cpu_max_ext_state_size); + } + + /* + * Set registers for trampoline to user mode. Leave space for the + * return address on stack. These are the kernel mode register values. + */ + pcb2->pcb_r12 = (register_t)fork_return; /* fork_trampoline argument */ + pcb2->pcb_rbp = 0; + pcb2->pcb_rsp = (register_t)td2->td_frame - sizeof(void *); + pcb2->pcb_rbx = (register_t)td2; /* fork_trampoline argument */ + pcb2->pcb_rip = (register_t)fork_trampoline; + /*- + * pcb2->pcb_dr*: cloned above. + * pcb2->pcb_savefpu: cloned above. + * pcb2->pcb_flags: cloned above. + * pcb2->pcb_onfault: cloned above (always NULL here?). + * pcb2->pcb_[fg]sbase: cloned above + */ + + /* Setup to release spin count in fork_exit(). */ + td2->td_md.md_spinlock_count = 1; + td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; + pmap_thread_init_invl_gen(td2); +} + /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the pcb, set up the stack so that the child @@ -164,36 +223,13 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Ensure that td1's pcb is up to date for user processes. */ - if ((td2->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td1 == curthread); - fpuexit(td1); - update_pcb_bases(td1->td_pcb); - } - /* Point the stack and pcb to the actual location */ set_top_of_stack_td(td2); td2->td_pcb = pcb2 = get_pcb_td(td2); - /* Copy td1's pcb */ - bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); - - /* Properly initialize pcb_save */ - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); + copy_thread(td1, td2); - /* Kernel processes start with clean FPU and segment bases. */ - if ((td2->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_fsbase = 0; - pcb2->pcb_gsbase = 0; - clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | - PCB_KERNFPU | PCB_KERNFPU_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); - bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), - cpu_max_ext_state_size); - } - - /* Point mdproc and then copy over td1's contents */ + /* Point mdproc and then copy over p1's contents */ mdp2 = &p2->p_md; bcopy(&p1->p_md, mdp2, sizeof(*mdp2)); @@ -215,29 +251,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) */ td2->td_frame->tf_rflags &= ~PSL_T; - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ - pcb2->pcb_r12 = (register_t)fork_return; /* fork_trampoline argument */ - pcb2->pcb_rbp = 0; - pcb2->pcb_rsp = (register_t)td2->td_frame - sizeof(void *); - pcb2->pcb_rbx = (register_t)td2; /* fork_trampoline argument */ - pcb2->pcb_rip = (register_t)fork_trampoline; - /*- - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_flags: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_[fg]sbase: cloned above - */ - - /* Setup to release spin count in fork_exit(). */ - td2->td_md.md_spinlock_count = 1; - td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; - pmap_thread_init_invl_gen(td2); - - /* As an i386, do not copy io permission bitmap. */ + /* As on i386, do not copy io permission bitmap. */ pcb2->pcb_tssp = NULL; /* New segment registers. */ @@ -275,7 +289,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) * pcb_rsp is loaded pointing to the cpu_switch() stack frame * containing the return address when exiting cpu_switch. * This will normally be to fork_trampoline(), which will have - * %ebx loaded with the new proc's pointer. fork_trampoline() + * %rbx loaded with the new proc's pointer. fork_trampoline() * will set up a stack to call fork_return(p, frame); to complete * the return to user-mode. */ @@ -571,38 +585,7 @@ cpu_set_syscall_retval(struct thread *td, int error) void cpu_copy_thread(struct thread *td, struct thread *td0) { - struct pcb *pcb2; - - pcb2 = td->td_pcb; - - /* Ensure that td0's pcb is up to date for user threads. */ - if ((td->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td0 == curthread); - fpuexit(td0); - update_pcb_bases(td0->td_pcb); - } - - /* - * Copy the upcall pcb. This loads kernel regs. - * Those not loaded individually below get their default - * values here. - */ - bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - - /* Kernel threads start with clean FPU and segment bases. */ - if ((td->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_fsbase = 0; - pcb2->pcb_gsbase = 0; - clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE | - PCB_KERNFPU | PCB_KERNFPU_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNFPU | PCB_KERNFPU_THR)) == 0); - bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, - cpu_max_ext_state_size); - } - set_pcb_flags_raw(pcb2, PCB_FULL_IRET); - + copy_thread(td0, td); /* * Copy user general-purpose registers. @@ -620,27 +603,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) */ td->td_frame->tf_rflags &= ~PSL_T; - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ - pcb2->pcb_r12 = (register_t)fork_return; /* trampoline arg */ - pcb2->pcb_rbp = 0; - pcb2->pcb_rsp = (register_t)td->td_frame - sizeof(void *); /* trampoline arg */ - pcb2->pcb_rbx = (register_t)td; /* trampoline arg */ - pcb2->pcb_rip = (register_t)fork_trampoline; - /* - * If we didn't copy the pcb, we'd need to do the following registers: - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_[fg]sbase: cloned above - */ - - /* Setup to release spin count in fork_exit(). */ - td->td_md.md_spinlock_count = 1; - td->td_md.md_saved_flags = PSL_KERNEL | PSL_I; - pmap_thread_init_invl_gen(td); + set_pcb_flags_raw(td->td_pcb, PCB_FULL_IRET); } /* diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 5947ae5a6d15..5bbdfdb77b2d 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -133,6 +133,74 @@ alloc_fpusave(int flags) } return (res); } + +/* + * Common code shared between cpu_fork() and cpu_copy_thread() for + * initializing a thread. + */ +static void +copy_thread(struct thread *td1, struct thread *td2) +{ + struct pcb *pcb2; + + pcb2 = td2->td_pcb; + + /* Ensure that td1's pcb is up to date for user threads. */ + if ((td2->td_pflags & TDP_KTHREAD) == 0) { + MPASS(td1 == curthread); + td1->td_pcb->pcb_gs = rgs(); + critical_enter(); + if (PCPU_GET(fpcurthread) == td1) + npxsave(td1->td_pcb->pcb_save); + critical_exit(); + } + + /* Copy td1's pcb */ + bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); + + /* Properly initialize pcb_save */ + pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); + + /* Kernel threads start with clean NPX and segment bases. */ + if ((td2->td_pflags & TDP_KTHREAD) != 0) { + pcb2->pcb_gs = _udatasel; + set_fsbase(td2, 0); + set_gsbase(td2, 0); + pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | + PCB_KERNNPX | PCB_KERNNPX_THR); + } else { + MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); + bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), + cpu_max_ext_state_size); + } + + /* + * Set registers for trampoline to user mode. Leave space for the + * return address on stack. These are the kernel mode register values. + */ + pcb2->pcb_edi = 0; + pcb2->pcb_esi = (int)fork_return; /* trampoline arg */ + pcb2->pcb_ebp = 0; + pcb2->pcb_esp = (int)td2->td_frame - sizeof(void *); /* trampoline arg */ + pcb2->pcb_ebx = (int)td2; /* trampoline arg */ + pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; + /* + * If we didn't copy the pcb, we'd need to do the following registers: + * pcb2->pcb_cr3: cloned above. + * pcb2->pcb_dr*: cloned above. + * pcb2->pcb_savefpu: cloned above. + * pcb2->pcb_flags: cloned above. + * pcb2->pcb_onfault: cloned above (always NULL here?). + * pcb2->pcb_gs: cloned above. + * pcb2->pcb_ext: cleared below. + */ + pcb2->pcb_ext = NULL; + + /* Setup to release spin count in fork_exit(). */ + td2->td_md.md_spinlock_count = 1; + td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; +} + /* * Finish a fork operation, with process p2 nearly set up. * Copy and update the pcb, set up the stack so that the child @@ -167,38 +235,11 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) return; } - /* Ensure that td1's pcb is up to date for user processes. */ - if ((td2->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td1 == curthread); - td1->td_pcb->pcb_gs = rgs(); - critical_enter(); - if (PCPU_GET(fpcurthread) == td1) - npxsave(td1->td_pcb->pcb_save); - critical_exit(); - } - /* Point the pcb to the top of the stack */ pcb2 = get_pcb_td(td2); td2->td_pcb = pcb2; - /* Copy td1's pcb */ - bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); - - /* Properly initialize pcb_save */ - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - - /* Kernel processes start with clean NPX and segment bases. */ - if ((td2->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_gs = _udatasel; - set_fsbase(td2, 0); - set_gsbase(td2, 0); - pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | - PCB_KERNNPX | PCB_KERNNPX_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); - bcopy(get_pcb_user_save_td(td1), get_pcb_user_save_pcb(pcb2), - cpu_max_ext_state_size); - } + copy_thread(td1, td2); /* Point mdproc and then copy over td1's contents */ mdp2 = &p2->p_md; @@ -225,30 +266,13 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) */ td2->td_frame->tf_eflags &= ~PSL_T; - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ + /* Set cr3 for the new process. */ pcb2->pcb_cr3 = pmap_get_cr3(vmspace_pmap(p2->p_vmspace)); - pcb2->pcb_edi = 0; - pcb2->pcb_esi = (int)fork_return; /* fork_trampoline argument */ - pcb2->pcb_ebp = 0; - pcb2->pcb_esp = (int)td2->td_frame - sizeof(void *); - pcb2->pcb_ebx = (int)td2; /* fork_trampoline argument */ - pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; - /*- - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_flags: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_gs: cloned above. - * pcb2->pcb_ext: cleared below. - */ /* * XXX don't copy the i/o pages. this should probably be fixed. */ - pcb2->pcb_ext = 0; + pcb2->pcb_ext = NULL; /* Copy the LDT, if necessary. */ mtx_lock_spin(&dt_lock); @@ -264,10 +288,6 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags) } mtx_unlock_spin(&dt_lock); - /* Setup to release spin count in fork_exit(). */ - td2->td_md.md_spinlock_count = 1; - td2->td_md.md_saved_flags = PSL_KERNEL | PSL_I; - /* * Now, cpu_switch() can schedule the new process. * pcb_esp is loaded pointing to the cpu_switch() stack frame @@ -435,41 +455,7 @@ cpu_set_syscall_retval(struct thread *td, int error) void cpu_copy_thread(struct thread *td, struct thread *td0) { - struct pcb *pcb2; - - /* Point the pcb to the top of the stack. */ - pcb2 = td->td_pcb; - - /* Ensure that td0's pcb is up to date for user threads. */ - if ((td->td_pflags & TDP_KTHREAD) == 0) { - MPASS(td0 == curthread); - td0->td_pcb->pcb_gs = rgs(); - critical_enter(); - if (PCPU_GET(fpcurthread) == td0) - npxsave(td0->td_pcb->pcb_save); - critical_exit(); - } - - /* - * Copy the upcall pcb. This loads kernel regs. - * Those not loaded individually below get their default - * values here. - */ - bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - pcb2->pcb_save = get_pcb_user_save_pcb(pcb2); - - /* Kernel threads start with clean NPX and segment bases. */ - if ((td->td_pflags & TDP_KTHREAD) != 0) { - pcb2->pcb_gs = _udatasel; - set_fsbase(td, 0); - set_gsbase(td, 0); - pcb2->pcb_flags &= ~(PCB_NPXINITDONE | PCB_NPXUSERINITDONE | - PCB_KERNNPX | PCB_KERNNPX_THR); - } else { - MPASS((pcb2->pcb_flags & (PCB_KERNNPX | PCB_KERNNPX_THR)) == 0); - bcopy(get_pcb_user_save_td(td0), pcb2->pcb_save, - cpu_max_ext_state_size); - } + copy_thread(td0, td); /* * Copy user general-purpose registers. @@ -486,32 +472,6 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * instruction after returning to userland. */ td->td_frame->tf_eflags &= ~PSL_T; - - /* - * Set registers for trampoline to user mode. Leave space for the - * return address on stack. These are the kernel mode register values. - */ - pcb2->pcb_edi = 0; - pcb2->pcb_esi = (int)fork_return; /* trampoline arg */ - pcb2->pcb_ebp = 0; - pcb2->pcb_esp = (int)td->td_frame - sizeof(void *); /* trampoline arg */ - pcb2->pcb_ebx = (int)td; /* trampoline arg */ - pcb2->pcb_eip = (int)fork_trampoline + setidt_disp; - /* - * If we didn't copy the pcb, we'd need to do the following registers: - * pcb2->pcb_cr3: cloned above. - * pcb2->pcb_dr*: cloned above. - * pcb2->pcb_savefpu: cloned above. - * pcb2->pcb_flags: cloned above. - * pcb2->pcb_onfault: cloned above (always NULL here?). - * pcb2->pcb_gs: cloned above. - * pcb2->pcb_ext: cleared below. - */ - pcb2->pcb_ext = NULL; - - /* Setup to release spin count in fork_exit(). */ - td->td_md.md_spinlock_count = 1; - td->td_md.md_saved_flags = PSL_KERNEL | PSL_I; } /* From owner-dev-commits-src-all@freebsd.org Thu Mar 18 19:16:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D27EE5A999B; Thu, 18 Mar 2021 19: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 4F1cFf39cRz4d4M; Thu, 18 Mar 2021 19: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 4CAFD27355; Thu, 18 Mar 2021 19: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 12IJGMSj096949; Thu, 18 Mar 2021 19: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 12IJGMvi096948; Thu, 18 Mar 2021 19:16:22 GMT (envelope-from git) Date: Thu, 18 Mar 2021 19:16:22 GMT Message-Id: <202103181916.12IJGMvi096948@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: 3b57ddb029da - main - Rename linux_set_upcall_kse() to linux_set_upcall(). 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: 3b57ddb029daf225a8385dade491019269da82e8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 19:16:22 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3b57ddb029daf225a8385dade491019269da82e8 commit 3b57ddb029daf225a8385dade491019269da82e8 Author: John Baldwin AuthorDate: 2021-03-18 19:14:34 +0000 Commit: John Baldwin CommitDate: 2021-03-18 19:14:34 +0000 Rename linux_set_upcall_kse() to linux_set_upcall(). This matches the rename of cpu_set_upcall_kse() in 5c2cf818454375536fda522ba83cf67c50929e6b. Reviewed by: kib, emaste MFC after: 1 week Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D29295 --- sys/amd64/amd64/vm_machdep.c | 2 +- sys/amd64/linux/linux_machdep.c | 2 +- sys/amd64/linux32/linux32_machdep.c | 2 +- sys/arm64/linux/linux_machdep.c | 8 ++++---- sys/compat/linux/linux_fork.c | 4 ++-- sys/compat/linux/linux_misc.h | 2 +- sys/i386/i386/vm_machdep.c | 2 +- sys/i386/linux/linux_machdep.c | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/amd64/amd64/vm_machdep.c b/sys/amd64/amd64/vm_machdep.c index 0527ef95cf3b..f64259decbff 100644 --- a/sys/amd64/amd64/vm_machdep.c +++ b/sys/amd64/amd64/vm_machdep.c @@ -591,7 +591,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * Copy user general-purpose registers. * * Some of these registers are rewritten by cpu_set_upcall() - * and linux_set_upcall_kse(). + * and linux_set_upcall(). */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); diff --git a/sys/amd64/linux/linux_machdep.c b/sys/amd64/linux/linux_machdep.c index 01b730c2b19c..a82ab411daa1 100644 --- a/sys/amd64/linux/linux_machdep.c +++ b/sys/amd64/linux/linux_machdep.c @@ -118,7 +118,7 @@ linux_execve(struct thread *td, struct linux_execve_args *args) } int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { if (stack) diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c index fde180d74d73..8ae82f3df8ca 100644 --- a/sys/amd64/linux32/linux32_machdep.c +++ b/sys/amd64/linux32/linux32_machdep.c @@ -418,7 +418,7 @@ linux_set_cloned_tls(struct thread *td, void *desc) } int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { if (stack) diff --git a/sys/arm64/linux/linux_machdep.c b/sys/arm64/linux/linux_machdep.c index 512bf1cc3398..711ccb4fd63d 100644 --- a/sys/arm64/linux/linux_machdep.c +++ b/sys/arm64/linux/linux_machdep.c @@ -52,7 +52,7 @@ __FBSDID("$FreeBSD$"); LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); /* DTrace probes */ -LIN_SDT_PROBE_DEFINE0(machdep, linux_set_upcall_kse, todo); +LIN_SDT_PROBE_DEFINE0(machdep, linux_set_upcall, todo); LIN_SDT_PROBE_DEFINE0(machdep, linux_mmap2, todo); LIN_SDT_PROBE_DEFINE0(machdep, linux_rt_sigsuspend, todo); LIN_SDT_PROBE_DEFINE0(machdep, linux_sigaltstack, todo); @@ -84,12 +84,12 @@ linux_execve(struct thread *td, struct linux_execve_args *uap) return (error); } -/* LINUXTODO: implement (or deduplicate) arm64 linux_set_upcall_kse */ +/* LINUXTODO: implement (or deduplicate) arm64 linux_set_upcall */ int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { - LIN_SDT_PROBE0(machdep, linux_set_upcall_kse, todo); + LIN_SDT_PROBE0(machdep, linux_set_upcall, todo); return (EDOOFUS); } diff --git a/sys/compat/linux/linux_fork.c b/sys/compat/linux/linux_fork.c index 3ba40fc2705e..ed4adcf8a175 100644 --- a/sys/compat/linux/linux_fork.c +++ b/sys/compat/linux/linux_fork.c @@ -205,7 +205,7 @@ linux_clone_proc(struct thread *td, struct linux_clone_args *args) * stack. This is what normal fork() does, so we just keep tf_rsp arg * intact. */ - linux_set_upcall_kse(td2, PTROUT(args->stack)); + linux_set_upcall(td2, PTROUT(args->stack)); if (args->flags & LINUX_CLONE_SETTLS) linux_set_cloned_tls(td2, args->tls); @@ -304,7 +304,7 @@ linux_clone_thread(struct thread *td, struct linux_clone_args *args) cpu_thread_clean(newtd); - linux_set_upcall_kse(newtd, PTROUT(args->stack)); + linux_set_upcall(newtd, PTROUT(args->stack)); PROC_LOCK(p); p->p_flag |= P_HADTHREADS; diff --git a/sys/compat/linux/linux_misc.h b/sys/compat/linux/linux_misc.h index c7e4fa38682c..da76753e3d24 100644 --- a/sys/compat/linux/linux_misc.h +++ b/sys/compat/linux/linux_misc.h @@ -181,7 +181,7 @@ extern int stclohz; int linux_ptrace_status(struct thread *td, int pid, int status); #endif void linux_to_bsd_waitopts(int options, int *bsdopts); -int linux_set_upcall_kse(struct thread *td, register_t stack); +int linux_set_upcall(struct thread *td, register_t stack); int linux_set_cloned_tls(struct thread *td, void *desc); struct thread *linux_tdfind(struct thread *, lwpid_t, pid_t); diff --git a/sys/i386/i386/vm_machdep.c b/sys/i386/i386/vm_machdep.c index 5bbdfdb77b2d..c04fb57db4b1 100644 --- a/sys/i386/i386/vm_machdep.c +++ b/sys/i386/i386/vm_machdep.c @@ -461,7 +461,7 @@ cpu_copy_thread(struct thread *td, struct thread *td0) * Copy user general-purpose registers. * * Some of these registers are rewritten by cpu_set_upcall() - * and linux_set_upcall_kse(). + * and linux_set_upcall(). */ bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c index 624a6ef6ae87..d2d713d4776d 100644 --- a/sys/i386/linux/linux_machdep.c +++ b/sys/i386/linux/linux_machdep.c @@ -314,7 +314,7 @@ linux_set_cloned_tls(struct thread *td, void *desc) } int -linux_set_upcall_kse(struct thread *td, register_t stack) +linux_set_upcall(struct thread *td, register_t stack) { if (stack) From owner-dev-commits-src-all@freebsd.org Thu Mar 18 20:17:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 649A45AB98C; Thu, 18 Mar 2021 20:17: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 4F1dcM24kcz4hwq; Thu, 18 Mar 2021 20:17: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 3A00A104; Thu, 18 Mar 2021 20:17: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 12IKHdHf075943; Thu, 18 Mar 2021 20:17:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IKHdK3075942; Thu, 18 Mar 2021 20:17:39 GMT (envelope-from git) Date: Thu, 18 Mar 2021 20:17:39 GMT Message-Id: <202103182017.12IKHdK3075942@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Chuck Silvers Subject: git: 8c59e863e2c0 - stable/13 - tail: fix "tail -F" file rotation detection MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: chs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 8c59e863e2c03c3b4ab2c403243561a4cc4fcb10 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 20:17:39 -0000 The branch stable/13 has been updated by chs: URL: https://cgit.FreeBSD.org/src/commit/?id=8c59e863e2c03c3b4ab2c403243561a4cc4fcb10 commit 8c59e863e2c03c3b4ab2c403243561a4cc4fcb10 Author: Chuck Silvers AuthorDate: 2021-02-02 00:21:14 +0000 Commit: Chuck Silvers CommitDate: 2021-03-18 20:12:24 +0000 tail: fix "tail -F" file rotation detection When checking if the newly opened file is the same as the old one, we need to fstat() the new file descriptor, not the old one again. Reviewed by: glebius Sponsored by: Netflix (cherry picked from commit 7787e7eed9d2a43fb6eb66666040f1b495995a2f) --- usr.bin/tail/forward.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.bin/tail/forward.c b/usr.bin/tail/forward.c index 2888bd18816e..878cb5a4550b 100644 --- a/usr.bin/tail/forward.c +++ b/usr.bin/tail/forward.c @@ -367,7 +367,7 @@ follow(file_info_t *files, enum STYLE style, off_t off) continue; ftmp = fileargs_fopen(fa, file->file_name, "r"); if (ftmp == NULL || - fstat(fileno(file->fp), &sb2) == -1) { + fstat(fileno(ftmp), &sb2) == -1) { if (errno != ENOENT) ierr(file->file_name); show(file); From owner-dev-commits-src-all@freebsd.org Thu Mar 18 20:21:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C677A5ABB1E; Thu, 18 Mar 2021 20:21: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 4F1djL4wgHz4jDw; Thu, 18 Mar 2021 20:21: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 9B9C427AF3; Thu, 18 Mar 2021 20:21: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 12IKLwmW088548; Thu, 18 Mar 2021 20:21:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IKLw98088547; Thu, 18 Mar 2021 20:21:58 GMT (envelope-from git) Date: Thu, 18 Mar 2021 20:21:58 GMT Message-Id: <202103182021.12IKLw98088547@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: fd232a21bb35 - main - nfsv4 pnfs client: fix updating of the layout stateid.seqid 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: fd232a21bb35e8ba8b62c2314b16b2f1d7c00afc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 20:21:58 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=fd232a21bb35e8ba8b62c2314b16b2f1d7c00afc commit fd232a21bb35e8ba8b62c2314b16b2f1d7c00afc Author: Rick Macklem AuthorDate: 2021-03-18 19:20:25 +0000 Commit: Rick Macklem CommitDate: 2021-03-18 19:20:25 +0000 nfsv4 pnfs client: fix updating of the layout stateid.seqid During a recent NFSv4 testing event a test server was replying NFSERR_OLDSTATEID for layout stateids presented to the server for LayoutReturn operations. Upon rereading RFC5661, it was apparent that the FreeBSD NFSv4.1/4.2 pNFS client did not maintain the seqid field of the layout stateid correctly. This patch is believed to correct the problem. Tested against a FreeBSD pNFS server with diagnostics added to check the stateid's seqid did not indicate problems. Unfortunately, testing aginst this server will not happen in the near future, so the fix may not be correct yet. MFC after: 2 weeks --- sys/fs/nfsclient/nfs_clstate.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clstate.c b/sys/fs/nfsclient/nfs_clstate.c index a1aa7c04e8a3..227d82a5f7f3 100644 --- a/sys/fs/nfsclient/nfs_clstate.c +++ b/sys/fs/nfsclient/nfs_clstate.c @@ -3495,11 +3495,18 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p) len, stateid.seqid, 0, 0, NULL, recallp); + if (error == 0 && + stateid.seqid > + lyp->nfsly_stateid.seqid) + lyp->nfsly_stateid.seqid = + stateid.seqid; recallp = NULL; wakeup(clp); NFSCL_DEBUG(4, - "aft layrcal=%d\n", - error); + "aft layrcal=%d " + "layseqid=%d\n", + error, + lyp->nfsly_stateid.seqid); } else error = NFSERR_NOMATCHLAYOUT; @@ -4881,6 +4888,8 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, } else { if (retonclose != 0) lyp->nfsly_flags |= NFSLY_RETONCLOSE; + if (stateidp->seqid > lyp->nfsly_stateid.seqid) + lyp->nfsly_stateid.seqid = stateidp->seqid; TAILQ_REMOVE(&clp->nfsc_layout, lyp, nfsly_list); TAILQ_INSERT_HEAD(&clp->nfsc_layout, lyp, nfsly_list); lyp->nfsly_timestamp = NFSD_MONOSEC + 120; @@ -4893,7 +4902,7 @@ nfscl_layout(struct nfsmount *nmp, vnode_t vp, u_int8_t *fhp, int fhlen, return (EPERM); } *lypp = lyp; - } else + } else if (stateidp->seqid > lyp->nfsly_stateid.seqid) lyp->nfsly_stateid.seqid = stateidp->seqid; /* Merge the new list of File Layouts into the list. */ From owner-dev-commits-src-all@freebsd.org Thu Mar 18 20:30:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A7BC95ABF00; Thu, 18 Mar 2021 20:30:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1dvM48Lvz4jhZ; Thu, 18 Mar 2021 20:30:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81B5B27F7B; Thu, 18 Mar 2021 20:30:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IKUd4O097325; Thu, 18 Mar 2021 20:30:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IKUdHa097324; Thu, 18 Mar 2021 20:30:39 GMT (envelope-from git) Date: Thu, 18 Mar 2021 20:30:39 GMT Message-Id: <202103182030.12IKUdHa097324@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: e026f4243c5a - main - Fix the 'linux' rc script on aarch64. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: trasz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e026f4243c5a65d19a63d98f55be17e8294a1e87 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 20:30:39 -0000 The branch main has been updated by trasz: URL: https://cgit.FreeBSD.org/src/commit/?id=e026f4243c5a65d19a63d98f55be17e8294a1e87 commit e026f4243c5a65d19a63d98f55be17e8294a1e87 Author: Edward Tomasz Napierala AuthorDate: 2021-03-16 16:48:13 +0000 Commit: Edward Tomasz Napierala CommitDate: 2021-03-18 20:30:21 +0000 Fix the 'linux' rc script on aarch64. Previously it would try to load linux.ko instead of linux64.ko and fail. While here, don't try to match 'linuxaout'; even if implemented, it's the same module as `linuxelf`. Reviewed By: emaste Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D29288 --- libexec/rc/rc.d/linux | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libexec/rc/rc.d/linux b/libexec/rc/rc.d/linux index f44a9d02fc8d..c9c45ba8b338 100755 --- a/libexec/rc/rc.d/linux +++ b/libexec/rc/rc.d/linux @@ -19,11 +19,17 @@ linux_start() { local _emul_path _tmpdir - load_kld -e 'linux(aout|elf)' linux case `sysctl -n hw.machine_arch` in + aarch64) + load_kld -e 'linux64elf' linux64 + ;; amd64) + load_kld -e 'linuxelf' linux load_kld -e 'linux64elf' linux64 ;; + i386) + load_kld -e 'linuxelf' linux + ;; esac _emul_path="$(sysctl -n compat.linux.emul_path)" From owner-dev-commits-src-all@freebsd.org Thu Mar 18 20:32:26 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC5F65ABED5; Thu, 18 Mar 2021 20:32: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 4F1dxQ51xjz4k4P; Thu, 18 Mar 2021 20:32: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 9F683346; Thu, 18 Mar 2021 20:32: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 12IKWQQM001931; Thu, 18 Mar 2021 20:32:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IKWQga001930; Thu, 18 Mar 2021 20:32:26 GMT (envelope-from git) Date: Thu, 18 Mar 2021 20:32:26 GMT Message-Id: <202103182032.12IKWQga001930@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: d4697a6b5616 - main - vtnet: fix TSO for TCP/IPv6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d4697a6b56168876fc0ffec1a0bb1b24d25b198e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 20:32:26 -0000 The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=d4697a6b56168876fc0ffec1a0bb1b24d25b198e commit d4697a6b56168876fc0ffec1a0bb1b24d25b198e Author: Michael Tuexen AuthorDate: 2021-03-18 20:25:47 +0000 Commit: Michael Tuexen CommitDate: 2021-03-18 20:32:20 +0000 vtnet: fix TSO for TCP/IPv6 The decision whether a TCP packet is sent over IPv4 or IPv6 was based on ethertype, which works correctly. In D27926 the criteria was changed to checking if the CSUM_IP_TSO flag is set in the csum-flags and then considering it to be TCP/IPv4. However, the TCP stack sets the flag to CSUM_TSO for IPv4 and IPv6, where CSUM_TSO is defined as CSUM_IP_TSO|CSUM_IP6_TSO. Therefore TCP/IPv6 packets gets mis-classified as TCP/IPv4, which breaks TSO for TCP/IPv6. This patch bases the check again on the ethertype. This fix will be MFC instantly as discussed with re(gjb). MFC after: instantly PR: 254366 Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D29331 --- sys/dev/virtio/network/if_vtnet.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index 09110183c30f..3650d19fbe0e 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -2389,7 +2389,7 @@ vtnet_txq_offload_ctx(struct vtnet_txq *txq, struct mbuf *m, int *etype, } static int -vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int flags, +vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int eth_type, int offset, struct virtio_net_hdr *hdr) { static struct timeval lastecn; @@ -2407,8 +2407,8 @@ vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int flags, hdr->hdr_len = vtnet_gtoh16(sc, offset + (tcp->th_off << 2)); hdr->gso_size = vtnet_gtoh16(sc, m->m_pkthdr.tso_segsz); - hdr->gso_type = (flags & CSUM_IP_TSO) ? - VIRTIO_NET_HDR_GSO_TCPV4 : VIRTIO_NET_HDR_GSO_TCPV6; + hdr->gso_type = eth_type == ETHERTYPE_IP ? VIRTIO_NET_HDR_GSO_TCPV4 : + VIRTIO_NET_HDR_GSO_TCPV6; if (__predict_false(tcp->th_flags & TH_CWR)) { /* @@ -2474,7 +2474,7 @@ vtnet_txq_offload(struct vtnet_txq *txq, struct mbuf *m, goto drop; } - error = vtnet_txq_offload_tso(txq, m, flags, csum_start, hdr); + error = vtnet_txq_offload_tso(txq, m, etype, csum_start, hdr); if (error) goto drop; } From owner-dev-commits-src-all@freebsd.org Thu Mar 18 20:34:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DFA25AC294; Thu, 18 Mar 2021 20:34: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 4F1dzS0PY6z4k69; Thu, 18 Mar 2021 20:34: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 00D8434C; Thu, 18 Mar 2021 20:34: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 12IKYBQ8002445; Thu, 18 Mar 2021 20:34:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IKYBTH002444; Thu, 18 Mar 2021 20:34:11 GMT (envelope-from git) Date: Thu, 18 Mar 2021 20:34:11 GMT Message-Id: <202103182034.12IKYBTH002444@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: c853c53d024a - main - Add Chacha20+Poly1035 to the list of AEAD algorithms. 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: c853c53d024a3cc950854dfaade7f50303c5a022 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 20:34:12 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=c853c53d024a3cc950854dfaade7f50303c5a022 commit c853c53d024a3cc950854dfaade7f50303c5a022 Author: John Baldwin AuthorDate: 2021-03-18 20:31:39 +0000 Commit: John Baldwin CommitDate: 2021-03-18 20:33:11 +0000 Add Chacha20+Poly1035 to the list of AEAD algorithms. Sponsored by: Netflix --- share/man/man9/crypto.9 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/share/man/man9/crypto.9 b/share/man/man9/crypto.9 index 0ea24356e975..69fe3339a757 100644 --- a/share/man/man9/crypto.9 +++ b/share/man/man9/crypto.9 @@ -17,7 +17,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 11, 2020 +.Dd March 18, 2021 .Dt CRYPTO 9 .Os .Sh NAME @@ -136,9 +136,10 @@ The following encryption algorithms are supported: The following authenticated encryption with additional data (AEAD) algorithms are supported: .Pp -.Bl -tag -offset indent -width CRYPTO_AES_NIST_GCM_16 -compact +.Bl -tag -offset indent -width CRYPTO_CHACHA20_POLY1305 -compact .It Dv CRYPTO_AES_CCM_16 .It Dv CRYPTO_AES_NIST_GCM_16 +.It Dv CRYPTO_CHACHA20_POLY1305 .El .Pp The following compression algorithms are supported: From owner-dev-commits-src-all@freebsd.org Thu Mar 18 20:35:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60BD75AC38A; Thu, 18 Mar 2021 20:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1f0N2HHwz4kYJ; Thu, 18 Mar 2021 20:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41B923B4; Thu, 18 Mar 2021 20:35:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12IKZ0xG002675; Thu, 18 Mar 2021 20:35:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IKZ0MC002674; Thu, 18 Mar 2021 20:35:00 GMT (envelope-from git) Date: Thu, 18 Mar 2021 20:35:00 GMT Message-Id: <202103182035.12IKZ0MC002674@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 6064ea8172f0 - stable/13 - vtnet: fix TSO for TCP/IPv6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6064ea8172f078c54954bc6e8865625feb7979fe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 20:35:00 -0000 The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=6064ea8172f078c54954bc6e8865625feb7979fe commit 6064ea8172f078c54954bc6e8865625feb7979fe Author: Michael Tuexen AuthorDate: 2021-03-18 20:25:47 +0000 Commit: Michael Tuexen CommitDate: 2021-03-18 20:33:32 +0000 vtnet: fix TSO for TCP/IPv6 The decision whether a TCP packet is sent over IPv4 or IPv6 was based on ethertype, which works correctly. In D27926 the criteria was changed to checking if the CSUM_IP_TSO flag is set in the csum-flags and then considering it to be TCP/IPv4. However, the TCP stack sets the flag to CSUM_TSO for IPv4 and IPv6, where CSUM_TSO is defined as CSUM_IP_TSO|CSUM_IP6_TSO. Therefore TCP/IPv6 packets gets mis-classified as TCP/IPv4, which breaks TSO for TCP/IPv6. This patch bases the check again on the ethertype. This fix is instantly MFCed. Approved by: re(gjb) PR: 254366 Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D29331 (cherry picked from commit d4697a6b56168876fc0ffec1a0bb1b24d25b198e) --- sys/dev/virtio/network/if_vtnet.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index e64b7de113c8..7aee77839bf3 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -2389,7 +2389,7 @@ vtnet_txq_offload_ctx(struct vtnet_txq *txq, struct mbuf *m, int *etype, } static int -vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int flags, +vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int eth_type, int offset, struct virtio_net_hdr *hdr) { static struct timeval lastecn; @@ -2407,8 +2407,8 @@ vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int flags, hdr->hdr_len = vtnet_gtoh16(sc, offset + (tcp->th_off << 2)); hdr->gso_size = vtnet_gtoh16(sc, m->m_pkthdr.tso_segsz); - hdr->gso_type = (flags & CSUM_IP_TSO) ? - VIRTIO_NET_HDR_GSO_TCPV4 : VIRTIO_NET_HDR_GSO_TCPV6; + hdr->gso_type = eth_type == ETHERTYPE_IP ? VIRTIO_NET_HDR_GSO_TCPV4 : + VIRTIO_NET_HDR_GSO_TCPV6; if (__predict_false(tcp->th_flags & TH_CWR)) { /* @@ -2474,7 +2474,7 @@ vtnet_txq_offload(struct vtnet_txq *txq, struct mbuf *m, goto drop; } - error = vtnet_txq_offload_tso(txq, m, flags, csum_start, hdr); + error = vtnet_txq_offload_tso(txq, m, etype, csum_start, hdr); if (error) goto drop; } From owner-dev-commits-src-all@freebsd.org Thu Mar 18 20:40:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FFF15AC7F6; Thu, 18 Mar 2021 20:40: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 4F1f6p2Brgz4l60; Thu, 18 Mar 2021 20:40: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 3441A633; Thu, 18 Mar 2021 20:40: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 12IKeYBg010991; Thu, 18 Mar 2021 20:40:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IKeYlA010990; Thu, 18 Mar 2021 20:40:34 GMT (envelope-from git) Date: Thu, 18 Mar 2021 20:40:34 GMT Message-Id: <202103182040.12IKeYlA010990@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 11660fa28fd3 - releng/13.0 - vtnet: fix TSO for TCP/IPv6 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 11660fa28fd39a644cb7d30a4378cf4751b89f15 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 20:40:34 -0000 The branch releng/13.0 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=11660fa28fd39a644cb7d30a4378cf4751b89f15 commit 11660fa28fd39a644cb7d30a4378cf4751b89f15 Author: Michael Tuexen AuthorDate: 2021-03-18 20:25:47 +0000 Commit: Michael Tuexen CommitDate: 2021-03-18 20:35:49 +0000 vtnet: fix TSO for TCP/IPv6 The decision whether a TCP packet is sent over IPv4 or IPv6 was based on ethertype, which works correctly. In D27926 the criteria was changed to checking if the CSUM_IP_TSO flag is set in the csum-flags and then considering it to be TCP/IPv4. However, the TCP stack sets the flag to CSUM_TSO for IPv4 and IPv6, where CSUM_TSO is defined as CSUM_IP_TSO|CSUM_IP6_TSO. Therefore TCP/IPv6 packets gets mis-classified as TCP/IPv4, which breaks TSO for TCP/IPv6. This patch bases the check again on the ethertype. This fix is instantly MFCed. Approved by: re(gjb) PR: 254366 Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D29331 (cherry picked from commit d4697a6b56168876fc0ffec1a0bb1b24d25b198e) (cherry picked from commit 6064ea8172f078c54954bc6e8865625feb7979fe) --- sys/dev/virtio/network/if_vtnet.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c index e64b7de113c8..7aee77839bf3 100644 --- a/sys/dev/virtio/network/if_vtnet.c +++ b/sys/dev/virtio/network/if_vtnet.c @@ -2389,7 +2389,7 @@ vtnet_txq_offload_ctx(struct vtnet_txq *txq, struct mbuf *m, int *etype, } static int -vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int flags, +vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int eth_type, int offset, struct virtio_net_hdr *hdr) { static struct timeval lastecn; @@ -2407,8 +2407,8 @@ vtnet_txq_offload_tso(struct vtnet_txq *txq, struct mbuf *m, int flags, hdr->hdr_len = vtnet_gtoh16(sc, offset + (tcp->th_off << 2)); hdr->gso_size = vtnet_gtoh16(sc, m->m_pkthdr.tso_segsz); - hdr->gso_type = (flags & CSUM_IP_TSO) ? - VIRTIO_NET_HDR_GSO_TCPV4 : VIRTIO_NET_HDR_GSO_TCPV6; + hdr->gso_type = eth_type == ETHERTYPE_IP ? VIRTIO_NET_HDR_GSO_TCPV4 : + VIRTIO_NET_HDR_GSO_TCPV6; if (__predict_false(tcp->th_flags & TH_CWR)) { /* @@ -2474,7 +2474,7 @@ vtnet_txq_offload(struct vtnet_txq *txq, struct mbuf *m, goto drop; } - error = vtnet_txq_offload_tso(txq, m, flags, csum_start, hdr); + error = vtnet_txq_offload_tso(txq, m, etype, csum_start, hdr); if (error) goto drop; } From owner-dev-commits-src-all@freebsd.org Thu Mar 18 20:53:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0156C5ACFB1; Thu, 18 Mar 2021 20:53: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 4F1fPT6gVQz4m63; Thu, 18 Mar 2021 20:53: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 D7B858B1; Thu, 18 Mar 2021 20:53: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 12IKrHDw028326; Thu, 18 Mar 2021 20:53:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IKrH04028325; Thu, 18 Mar 2021 20:53:17 GMT (envelope-from git) Date: Thu, 18 Mar 2021 20:53:17 GMT Message-Id: <202103182053.12IKrH04028325@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: 6ceacebdf522 - main - Unbreak MSG_CMSG_CLOEXEC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6ceacebdf5221133943ab3b6b56751c8b51c3e2b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 20:53:18 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=6ceacebdf5221133943ab3b6b56751c8b51c3e2b commit 6ceacebdf5221133943ab3b6b56751c8b51c3e2b Author: Alex Richardson AuthorDate: 2021-03-18 20:52:20 +0000 Commit: Alex Richardson CommitDate: 2021-03-18 20:52:20 +0000 Unbreak MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC has not been working since 2015 (SVN r284380) because _finstall expects O_CLOEXEC and not UF_EXCLOSE as the flags argument. This was probably not noticed because we don't have a test for this flag so this commit adds one. I found this problem because one of the libwayland tests was failing. Fixes: ea31808c3b07 ("fd: move out actual fp installation to _finstall") MFC after: 3 days Reviewed By: mjg, kib Differential Revision: https://reviews.freebsd.org/D29328 --- sys/kern/uipc_usrreq.c | 2 +- tests/sys/kern/unix_passfd_test.c | 45 ++++++++++++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index ca23ccbdb05e..4466ae8822cd 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -2067,7 +2067,7 @@ unp_externalize(struct mbuf *control, struct mbuf **controlp, int flags) } for (i = 0; i < newfds; i++, fdp++) { _finstall(fdesc, fdep[i]->fde_file, *fdp, - (flags & MSG_CMSG_CLOEXEC) != 0 ? UF_EXCLOSE : 0, + (flags & MSG_CMSG_CLOEXEC) != 0 ? O_CLOEXEC : 0, &fdep[i]->fde_caps); unp_externalize_fp(fdep[i]->fde_file); } diff --git a/tests/sys/kern/unix_passfd_test.c b/tests/sys/kern/unix_passfd_test.c index 2fac0b3f1a0a..2b5cdde012c1 100644 --- a/tests/sys/kern/unix_passfd_test.c +++ b/tests/sys/kern/unix_passfd_test.c @@ -194,7 +194,7 @@ localcreds(int sockfd) static void recvfd_payload(int sockfd, int *recv_fd, void *buf, size_t buflen, - size_t cmsgsz) + size_t cmsgsz, int recvmsg_flags) { struct cmsghdr *cmsghdr; struct msghdr msghdr; @@ -216,7 +216,7 @@ recvfd_payload(int sockfd, int *recv_fd, void *buf, size_t buflen, msghdr.msg_iov = &iovec; msghdr.msg_iovlen = 1; - len = recvmsg(sockfd, &msghdr, 0); + len = recvmsg(sockfd, &msghdr, recvmsg_flags); ATF_REQUIRE_MSG(len != -1, "recvmsg failed: %s", strerror(errno)); ATF_REQUIRE_MSG((size_t)len == buflen, "recvmsg: %zd bytes received; expected %zd", len, buflen); @@ -243,12 +243,12 @@ recvfd_payload(int sockfd, int *recv_fd, void *buf, size_t buflen, } static void -recvfd(int sockfd, int *recv_fd) +recvfd(int sockfd, int *recv_fd, int flags) { char ch = 0; recvfd_payload(sockfd, recv_fd, &ch, sizeof(ch), - CMSG_SPACE(sizeof(int))); + CMSG_SPACE(sizeof(int)), flags); } /* @@ -266,9 +266,33 @@ ATF_TC_BODY(simple_send_fd, tc) tempfile(&putfd); dofstat(putfd, &putfd_stat); sendfd(fd[0], putfd); - recvfd(fd[1], &getfd); + recvfd(fd[1], &getfd, 0); + dofstat(getfd, &getfd_stat); + samefile(&putfd_stat, &getfd_stat); + close(putfd); + close(getfd); + closesocketpair(fd); +} + +/* + * Like simple_send_fd but also sets MSG_CMSG_CLOEXEC and checks that the + * received file descriptor has the FD_CLOEXEC flag set. + */ +ATF_TC_WITHOUT_HEAD(simple_send_fd_msg_cmsg_cloexec); +ATF_TC_BODY(simple_send_fd_msg_cmsg_cloexec, tc) +{ + struct stat getfd_stat, putfd_stat; + int fd[2], getfd, putfd; + + domainsocketpair(fd); + tempfile(&putfd); + dofstat(putfd, &putfd_stat); + sendfd(fd[0], putfd); + recvfd(fd[1], &getfd, MSG_CMSG_CLOEXEC); dofstat(getfd, &getfd_stat); samefile(&putfd_stat, &getfd_stat); + ATF_REQUIRE_EQ_MSG(fcntl(getfd, F_GETFD) & FD_CLOEXEC, FD_CLOEXEC, + "FD_CLOEXEC not set on the received file descriptor"); close(putfd); close(getfd); closesocketpair(fd); @@ -289,7 +313,7 @@ ATF_TC_BODY(send_and_close, tc) dofstat(putfd, &putfd_stat); sendfd(fd[0], putfd); close(putfd); - recvfd(fd[1], &getfd); + recvfd(fd[1], &getfd, 0); dofstat(getfd, &getfd_stat); samefile(&putfd_stat, &getfd_stat); close(getfd); @@ -331,8 +355,8 @@ ATF_TC_BODY(two_files, tc) sendfd(fd[0], putfd_2); close(putfd_1); close(putfd_2); - recvfd(fd[1], &getfd_1); - recvfd(fd[1], &getfd_2); + recvfd(fd[1], &getfd_1, 0); + recvfd(fd[1], &getfd_2, 0); dofstat(getfd_1, &getfd_1_stat); dofstat(getfd_2, &getfd_2_stat); samefile(&putfd_1_stat, &getfd_1_stat); @@ -355,7 +379,7 @@ ATF_TC_BODY(bundle, tc) sendfd(fd[0], fd[0]); close(fd[0]); - recvfd(fd[1], &getfd); + recvfd(fd[1], &getfd, 0); close(getfd); close(fd[1]); } @@ -430,7 +454,7 @@ ATF_TC_BODY(rights_creds_payload, tc) len = sendfd_payload(fd[0], putfd, buf, sendspace); ATF_REQUIRE_MSG(len < sendspace, "sendmsg: %zu bytes sent", len); recvfd_payload(fd[1], &getfd, buf, len, - CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + CMSG_SPACE(sizeof(int))); + CMSG_SPACE(SOCKCREDSIZE(CMGROUP_MAX)) + CMSG_SPACE(sizeof(int)), 0); close(putfd); close(getfd); @@ -695,6 +719,7 @@ ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, simple_send_fd); + ATF_TP_ADD_TC(tp, simple_send_fd_msg_cmsg_cloexec); ATF_TP_ADD_TC(tp, send_and_close); ATF_TP_ADD_TC(tp, send_and_cancel); ATF_TP_ADD_TC(tp, two_files); From owner-dev-commits-src-all@freebsd.org Thu Mar 18 21:12:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6D06B5ADA2B; Thu, 18 Mar 2021 21:12: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 4F1fqP2k93z4nKL; Thu, 18 Mar 2021 21:12: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 4645CCA1; Thu, 18 Mar 2021 21:12: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 12ILCH4Q055489; Thu, 18 Mar 2021 21:12:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12ILCHqB055488; Thu, 18 Mar 2021 21:12:17 GMT (envelope-from git) Date: Thu, 18 Mar 2021 21:12:17 GMT Message-Id: <202103182112.12ILCHqB055488@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mariusz Zaborski Subject: git: 6bbca5ca3a66 - stable/13 - zfs: bring back possibility to rewind the checkpoint from 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 6bbca5ca3a6634fc10b93da203df2ae92cf60b61 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 21:12:17 -0000 The branch stable/13 has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=6bbca5ca3a6634fc10b93da203df2ae92cf60b61 commit 6bbca5ca3a6634fc10b93da203df2ae92cf60b61 Author: Mariusz Zaborski AuthorDate: 2021-03-13 11:56:17 +0000 Commit: Mariusz Zaborski CommitDate: 2021-03-18 21:10:59 +0000 zfs: bring back possibility to rewind the checkpoint from Add parsing of the rewind options. When I was upstreaming the change [1], I omitted the part where we detect that the pool should be rewind. When the FreeBSD repo has synced with the OpenZFS, this part of the code was removed. [1] FreeBSD repo: 277f38abffc6a8160b5044128b5b2c620fbb970c [2] OpenZFS repo: f2c027bd6a003ec5793f8716e6189c389c60f47a Originally reviewed by: tsoome, allanjude Originally reviewed by: kevans (ok from high-level overview) Signed-off-by: Mariusz Zaborski PR: 254152 Reported by: Zhenlei Huang Obtained from: https://github.com/openzfs/zfs/pull/11730 (cherry picked from commit 653ed678c70376b15cdc42daafa7b4554570cea2) --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c index 7bc6b83d0272..a537342f9678 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c @@ -1291,6 +1291,18 @@ getpoolname(const char *osname, char *poolname) return (0); } +static void +fetch_osname_options(char *name, bool *checkpointrewind) +{ + + if (name[0] == '!') { + *checkpointrewind = true; + memmove(name, name + 1, strlen(name)); + } else { + *checkpointrewind = false; + } +} + /*ARGSUSED*/ static int zfs_mount(vfs_t *vfsp) @@ -1301,6 +1313,7 @@ zfs_mount(vfs_t *vfsp) char *osname; int error = 0; int canwrite; + bool checkpointrewind; if (vfs_getopt(vfsp->mnt_optnew, "from", (void **)&osname, NULL)) return (SET_ERROR(EINVAL)); @@ -1314,6 +1327,8 @@ zfs_mount(vfs_t *vfsp) secpolicy_fs_mount_clearopts(cr, vfsp); } + fetch_osname_options(osname, &checkpointrewind); + /* * Check for mount privilege? * @@ -1392,7 +1407,7 @@ zfs_mount(vfs_t *vfsp) error = getpoolname(osname, pname); if (error == 0) - error = spa_import_rootpool(pname, false); + error = spa_import_rootpool(pname, checkpointrewind); if (error) goto out; } From owner-dev-commits-src-all@freebsd.org Thu Mar 18 23:03:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62A635B00AF; Thu, 18 Mar 2021 23:03: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 4F1jHh2Pw8z4t73; Thu, 18 Mar 2021 23:03: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 45BB5258D; Thu, 18 Mar 2021 23:03: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 12IN3S7D001321; Thu, 18 Mar 2021 23:03:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IN3SUS001320; Thu, 18 Mar 2021 23:03:28 GMT (envelope-from git) Date: Thu, 18 Mar 2021 23:03:28 GMT Message-Id: <202103182303.12IN3SUS001320@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mariusz Zaborski Subject: git: c145b7954656 - releng/13.0 - zfs: bring back possibility to rewind the checkpoint from 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/releng/13.0 X-Git-Reftype: branch X-Git-Commit: c145b7954656601d92f578b08183fbf78e1a249b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 23:03:28 -0000 The branch releng/13.0 has been updated by oshogbo: URL: https://cgit.FreeBSD.org/src/commit/?id=c145b7954656601d92f578b08183fbf78e1a249b commit c145b7954656601d92f578b08183fbf78e1a249b Author: Mariusz Zaborski AuthorDate: 2021-03-13 11:56:17 +0000 Commit: Mariusz Zaborski CommitDate: 2021-03-18 23:02:57 +0000 zfs: bring back possibility to rewind the checkpoint from Add parsing of the rewind options. When I was upstreaming the change [1], I omitted the part where we detect that the pool should be rewind. When the FreeBSD repo has synced with the OpenZFS, this part of the code was removed. [1] FreeBSD repo: 277f38abffc6a8160b5044128b5b2c620fbb970c [2] OpenZFS repo: f2c027bd6a003ec5793f8716e6189c389c60f47a Originally reviewed by: tsoome, allanjude Originally reviewed by: kevans (ok from high-level overview) Signed-off-by: Mariusz Zaborski PR: 254152 Approved by: re(gjb) Reported by: Zhenlei Huang Obtained from: https://github.com/openzfs/zfs/pull/11730 (cherry picked from commit 653ed678c70376b15cdc42daafa7b4554570cea2) (cherry picked from commit 6bbca5ca3a6634fc10b93da203df2ae92cf60b61) --- sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c index 7bc6b83d0272..a537342f9678 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c @@ -1291,6 +1291,18 @@ getpoolname(const char *osname, char *poolname) return (0); } +static void +fetch_osname_options(char *name, bool *checkpointrewind) +{ + + if (name[0] == '!') { + *checkpointrewind = true; + memmove(name, name + 1, strlen(name)); + } else { + *checkpointrewind = false; + } +} + /*ARGSUSED*/ static int zfs_mount(vfs_t *vfsp) @@ -1301,6 +1313,7 @@ zfs_mount(vfs_t *vfsp) char *osname; int error = 0; int canwrite; + bool checkpointrewind; if (vfs_getopt(vfsp->mnt_optnew, "from", (void **)&osname, NULL)) return (SET_ERROR(EINVAL)); @@ -1314,6 +1327,8 @@ zfs_mount(vfs_t *vfsp) secpolicy_fs_mount_clearopts(cr, vfsp); } + fetch_osname_options(osname, &checkpointrewind); + /* * Check for mount privilege? * @@ -1392,7 +1407,7 @@ zfs_mount(vfs_t *vfsp) error = getpoolname(osname, pname); if (error == 0) - error = spa_import_rootpool(pname, false); + error = spa_import_rootpool(pname, checkpointrewind); if (error) goto out; } From owner-dev-commits-src-all@freebsd.org Thu Mar 18 23:09:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A2675B0069; Thu, 18 Mar 2021 23:09: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 4F1jR12dLfz4tl9; Thu, 18 Mar 2021 23:09: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 48B4F224E; Thu, 18 Mar 2021 23:09: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 12IN9nJq002408; Thu, 18 Mar 2021 23:09:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12IN9nXd002407; Thu, 18 Mar 2021 23:09:49 GMT (envelope-from git) Date: Thu, 18 Mar 2021 23:09:49 GMT Message-Id: <202103182309.12IN9nXd002407@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 929acdb19acb - main - fusefs: fix two bugs regarding fcntl file locks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 929acdb19acb67cc0e6ee5439df98e28a84d4772 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 23:09:49 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=929acdb19acb67cc0e6ee5439df98e28a84d4772 commit 929acdb19acb67cc0e6ee5439df98e28a84d4772 Author: Alan Somers AuthorDate: 2021-03-18 20:27:27 +0000 Commit: Alan Somers CommitDate: 2021-03-18 23:09:10 +0000 fusefs: fix two bugs regarding fcntl file locks 1) F_SETLKW (blocking) operations would be sent to the FUSE server as F_SETLK (non-blocking). 2) Release operations, F_SETLK with lk_type = F_UNLCK, would simply return EINVAL. PR: 253500 Reported by: John Millikin MFC after: 2 weeks --- sys/fs/fuse/fuse_vnops.c | 10 +++++++--- tests/sys/fs/fusefs/flush.cc | 12 ++++++++++- tests/sys/fs/fusefs/locks.cc | 45 +++++++++++++++++++++++++++++++++++++++++- tests/sys/fs/fusefs/release.cc | 12 ++++++++++- 4 files changed, 73 insertions(+), 6 deletions(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index 5bbde1e278c9..cdbc42f5adf4 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -437,10 +437,14 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) op = FUSE_GETLK; break; case F_SETLK: - op = FUSE_SETLK; + if (flags & F_WAIT) + op = FUSE_SETLKW; + else + op = FUSE_SETLK; break; - case F_SETLKW: - op = FUSE_SETLKW; + case F_UNLCK: + op = FUSE_SETLK; + flags |= F_UNLCK; break; default: return EINVAL; diff --git a/tests/sys/fs/fusefs/flush.cc b/tests/sys/fs/fusefs/flush.cc index 4d5a87bd66d5..d31a9fdaa386 100644 --- a/tests/sys/fs/fusefs/flush.cc +++ b/tests/sys/fs/fusefs/flush.cc @@ -210,6 +210,16 @@ TEST_F(FlushWithLocks, unlock_on_close) ResultOf([=](auto in) { return (in.header.opcode == FUSE_SETLK && in.header.nodeid == ino && + in.body.setlk.lk.type == F_RDLCK && + in.body.setlk.fh == FH); + }, Eq(true)), + _) + ).WillOnce(Invoke(ReturnErrno(0))); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_SETLK && + in.header.nodeid == ino && + in.body.setlk.lk.type == F_UNLCK && in.body.setlk.fh == FH); }, Eq(true)), _) @@ -224,7 +234,7 @@ TEST_F(FlushWithLocks, unlock_on_close) fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; - ASSERT_NE(-1, fcntl(fd, F_SETLKW, &fl)) << strerror(errno); + ASSERT_NE(-1, fcntl(fd, F_SETLK, &fl)) << strerror(errno); fd2 = open(FULLPATH, O_WRONLY); ASSERT_LE(0, fd2) << strerror(errno); diff --git a/tests/sys/fs/fusefs/locks.cc b/tests/sys/fs/fusefs/locks.cc index f3f1d42637d9..49f495412259 100644 --- a/tests/sys/fs/fusefs/locks.cc +++ b/tests/sys/fs/fusefs/locks.cc @@ -72,6 +72,23 @@ void expect_setlk(uint64_t ino, pid_t pid, uint64_t start, uint64_t end, return (in.header.opcode == FUSE_SETLK && in.header.nodeid == ino && in.body.setlk.fh == FH && + in.body.setlk.owner == (uint32_t)pid && + in.body.setlk.lk.start == start && + in.body.setlk.lk.end == end && + in.body.setlk.lk.type == type && + in.body.setlk.lk.pid == (uint64_t)pid); + }, Eq(true)), + _) + ).WillOnce(Invoke(ReturnErrno(err))); +} +void expect_setlkw(uint64_t ino, pid_t pid, uint64_t start, uint64_t end, + uint32_t type, int err) +{ + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_SETLKW && + in.header.nodeid == ino && + in.body.setlkw.fh == FH && in.body.setlkw.owner == (uint32_t)pid && in.body.setlkw.lk.start == start && in.body.setlkw.lk.end == end && @@ -343,6 +360,32 @@ TEST_F(SetlkFallback, local) leak(fd); } +/* Clear a lock with FUSE_SETLK */ +TEST_F(Setlk, clear) +{ + const char FULLPATH[] = "mountpoint/some_file.txt"; + const char RELPATH[] = "some_file.txt"; + uint64_t ino = 42; + struct flock fl; + int fd; + pid_t pid = 1234; + + expect_lookup(RELPATH, ino); + expect_open(ino, 0, 1); + expect_setlk(ino, pid, 10, 1009, F_UNLCK, 0); + + fd = open(FULLPATH, O_RDWR); + ASSERT_LE(0, fd) << strerror(errno); + fl.l_start = 10; + fl.l_len = 1000; + fl.l_pid = pid; + fl.l_type = F_UNLCK; + fl.l_whence = SEEK_SET; + fl.l_sysid = 0; + ASSERT_NE(-1, fcntl(fd, F_SETLK, &fl)) << strerror(errno); + leak(fd); +} + /* Set a new lock with FUSE_SETLK */ TEST_F(Setlk, set) { @@ -465,7 +508,7 @@ TEST_F(Setlkw, set) expect_lookup(RELPATH, ino); expect_open(ino, 0, 1); - expect_setlk(ino, pid, 10, 1009, F_RDLCK, 0); + expect_setlkw(ino, pid, 10, 1009, F_RDLCK, 0); fd = open(FULLPATH, O_RDWR); ASSERT_LE(0, fd) << strerror(errno); diff --git a/tests/sys/fs/fusefs/release.cc b/tests/sys/fs/fusefs/release.cc index 3caf8589352d..daa3ce39f573 100644 --- a/tests/sys/fs/fusefs/release.cc +++ b/tests/sys/fs/fusefs/release.cc @@ -206,6 +206,16 @@ TEST_F(ReleaseWithLocks, unlock_on_close) ResultOf([=](auto in) { return (in.header.opcode == FUSE_SETLK && in.header.nodeid == ino && + in.body.setlk.lk.type == F_RDLCK && + in.body.setlk.fh == FH); + }, Eq(true)), + _) + ).WillOnce(Invoke(ReturnErrno(0))); + EXPECT_CALL(*m_mock, process( + ResultOf([=](auto in) { + return (in.header.opcode == FUSE_SETLK && + in.header.nodeid == ino && + in.body.setlk.lk.type == F_UNLCK && in.body.setlk.fh == FH); }, Eq(true)), _) @@ -221,7 +231,7 @@ TEST_F(ReleaseWithLocks, unlock_on_close) fl.l_type = F_RDLCK; fl.l_whence = SEEK_SET; fl.l_sysid = 0; - ASSERT_NE(-1, fcntl(fd, F_SETLKW, &fl)) << strerror(errno); + ASSERT_NE(-1, fcntl(fd, F_SETLK, &fl)) << strerror(errno); ASSERT_EQ(0, close(fd)) << strerror(errno); } From owner-dev-commits-src-all@freebsd.org Thu Mar 18 23:31:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E36975B06FC; Thu, 18 Mar 2021 23:31:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F1jwM64pBz4vrS; Thu, 18 Mar 2021 23:31:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3B552B2E; Thu, 18 Mar 2021 23:31:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12INVl4G040336; Thu, 18 Mar 2021 23:31:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12INVllW040335; Thu, 18 Mar 2021 23:31:47 GMT (envelope-from git) Date: Thu, 18 Mar 2021 23:31:47 GMT Message-Id: <202103182331.12INVllW040335@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: 621b5090487d - main - Refactor configuration management in bhyve. 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: 621b5090487de9fed1b503769702a9a2a27cc7bb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Mar 2021 23:31:47 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=621b5090487de9fed1b503769702a9a2a27cc7bb commit 621b5090487de9fed1b503769702a9a2a27cc7bb Author: John Baldwin AuthorDate: 2019-06-26 20:30:41 +0000 Commit: John Baldwin CommitDate: 2021-03-18 23:30:26 +0000 Refactor configuration management in bhyve. Replace the existing ad-hoc configuration via various global variables with a small database of key-value pairs. The database supports heirarchical keys using a MIB-like syntax to name the path to a given key. Values are always stored as strings. The API used to manage configuation values does include wrappers to handling boolean values. Other values use non-string types require parsing by consumers. The configuration values are stored in a tree using nvlists. Leaf nodes hold string values. Configuration values are permitted to reference other configuration values using '%(name)'. This permits constructing template configurations. All existing command line arguments now set configuration values. For devices, the "-s" option parses its option argument to generate a list of key-value pairs for the given device. A new '-o' command line option permits setting an individual configuration variable. The key name is always given as a full path of dot-separated components. A new '-k' command line option parses a simple configuration file. This configuration file holds a flat list of 'key=value' lines where the 'key' is the full path of a configuration variable. Lines starting with a '#' are comments. In general, bhyve starts by parsing command line options in sequence and applying those settings to configuration values. Once this is complete, bhyve then begins initializing its state based on the configuration values. This means that subsequent configuration options or files may override or supplement previously given settings. A special 'config.dump' configuration value can be set to true to help debug configuration issues. When this value is set, bhyve will print out the configuration variables as a flat list of 'key=value' lines. Most command line argments map to a single configuration variable, e.g. '-w' sets the 'x86.strictmsr' value to false. A few command line arguments have less obvious effects: - Multiple '-p' options append their values (as a comma-seperated list) to "vcpu.N.cpuset" values (where N is a decimal vcpu number). - For '-s' options, a pci... node is created. The first argument to '-s' (the device type) is used as the value of a "device" variable. Additional comma-separated arguments are then parsed into 'key=value' pairs and used to set additional variables under the device node. A PCI device emulation driver can provide its own hook to override the parsing of the additonal '-s' arguments after the device type. After the configuration phase as completed, the init_pci hook then walks the "pci..." nodes. It uses the "device" value to find the device model to use. The device model's init routine is passed a reference to its nvlist node in the configuration tree which it can query for specific variables. The result is that a lot of the string parsing is removed from the device models and centralized. In addition, adding a new variable just requires teaching the model to look for the new variable. - For '-l' options, a similar model is used where the string is parsed into values that are later read during initialization. One key note here is that the serial ports use the commonly used lowercase names from existing documentation and examples (e.g. "lpc.com1") instead of the uppercase names previously used internally in bhyve. Reviewed by: grehan MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D26035 --- usr.sbin/bhyve/Makefile | 5 +- usr.sbin/bhyve/bhyve.8 | 47 ++- usr.sbin/bhyve/bhyve_config.5 | 560 ++++++++++++++++++++++++++++++++++++ usr.sbin/bhyve/bhyverun.c | 485 ++++++++++++++++++++----------- usr.sbin/bhyve/bhyverun.h | 7 +- usr.sbin/bhyve/block_if.c | 98 ++++--- usr.sbin/bhyve/block_if.h | 4 +- usr.sbin/bhyve/config.c | 431 +++++++++++++++++++++++++++ usr.sbin/bhyve/config.h | 119 ++++++++ usr.sbin/bhyve/gdb.c | 12 + usr.sbin/bhyve/hda_codec.c | 6 +- usr.sbin/bhyve/inout.c | 6 +- usr.sbin/bhyve/inout.h | 3 +- usr.sbin/bhyve/mevent.c | 2 - usr.sbin/bhyve/mevent_test.c | 2 - usr.sbin/bhyve/net_backends.c | 106 +++---- usr.sbin/bhyve/net_backends.h | 3 +- usr.sbin/bhyve/net_utils.c | 5 +- usr.sbin/bhyve/net_utils.h | 2 +- usr.sbin/bhyve/pci_ahci.c | 283 ++++++++++-------- usr.sbin/bhyve/pci_e82545.c | 65 +---- usr.sbin/bhyve/pci_emul.c | 147 +++++++--- usr.sbin/bhyve/pci_emul.h | 7 +- usr.sbin/bhyve/pci_fbuf.c | 194 +++++++------ usr.sbin/bhyve/pci_hda.c | 95 ++---- usr.sbin/bhyve/pci_hda.h | 2 +- usr.sbin/bhyve/pci_hostbridge.c | 32 ++- usr.sbin/bhyve/pci_lpc.c | 60 ++-- usr.sbin/bhyve/pci_nvme.c | 164 +++++------ usr.sbin/bhyve/pci_passthru.c | 47 ++- usr.sbin/bhyve/pci_uart.c | 19 +- usr.sbin/bhyve/pci_virtio_9p.c | 80 +++--- usr.sbin/bhyve/pci_virtio_block.c | 15 +- usr.sbin/bhyve/pci_virtio_console.c | 131 +++++++-- usr.sbin/bhyve/pci_virtio_net.c | 97 +++---- usr.sbin/bhyve/pci_virtio_rnd.c | 2 +- usr.sbin/bhyve/pci_virtio_scsi.c | 49 ++-- usr.sbin/bhyve/pci_xhci.c | 220 +++++++++----- usr.sbin/bhyve/pctestdev.c | 9 - usr.sbin/bhyve/pctestdev.h | 1 - usr.sbin/bhyve/rtc.c | 9 +- usr.sbin/bhyve/rtc.h | 2 +- usr.sbin/bhyve/smbiostbl.c | 5 + usr.sbin/bhyve/uart_emul.c | 12 +- usr.sbin/bhyve/uart_emul.h | 2 +- usr.sbin/bhyve/usb_emul.c | 2 +- usr.sbin/bhyve/usb_emul.h | 5 +- usr.sbin/bhyve/usb_mouse.c | 5 +- 48 files changed, 2593 insertions(+), 1071 deletions(-) diff --git a/usr.sbin/bhyve/Makefile b/usr.sbin/bhyve/Makefile index a4fc3deea77e..e35d528ab605 100644 --- a/usr.sbin/bhyve/Makefile +++ b/usr.sbin/bhyve/Makefile @@ -10,7 +10,7 @@ CFLAGS+=-I${SRCTOP}/sys PROG= bhyve PACKAGE= bhyve -MAN= bhyve.8 +MAN= bhyve.8 bhyve_config.5 BHYVE_SYSDIR?=${SRCTOP} @@ -22,6 +22,7 @@ SRCS= \ bhyverun.c \ block_if.c \ bootrom.c \ + config.c \ console.c \ ctl_util.c \ ctl_scsi_all.c \ @@ -83,7 +84,7 @@ CFLAGS.kernemu_dev.c+= -I${SRCTOP}/sys/amd64 .PATH: ${BHYVE_SYSDIR}/sys/amd64/vmm SRCS+= vmm_instruction_emul.c -LIBADD= vmmapi md pthread z util sbuf cam 9p +LIBADD= vmmapi md nv pthread z util sbuf cam 9p .if ${MK_CASPER} != "no" LIBADD+= casper diff --git a/usr.sbin/bhyve/bhyve.8 b/usr.sbin/bhyve/bhyve.8 index 115727a136a7..04e22302d9d7 100644 --- a/usr.sbin/bhyve/bhyve.8 +++ b/usr.sbin/bhyve/bhyve.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 18, 2021 +.Dd March 18, 2021 .Dt BHYVE 8 .Os .Sh NAME @@ -46,6 +46,7 @@ .Oc .Sm on .Op Fl G Ar port +.Op Fl k Ar file .Oo Fl l .Sm off .Cm help | Ar lpcdev Op Cm \&, Ar conf @@ -59,6 +60,7 @@ .Oc .Sm on .Oc +.Op Fl o Ar var Ns Cm = Ns Ar value .Op Fl p Ar vcpu Ns Cm \&: Ns Ar hostcpu .Op Fl r Ar file .Oo Fl s @@ -149,6 +151,17 @@ Print help message and exit. .It Fl H Yield the virtual CPU thread when a HLT instruction is detected. If this option is not specified, virtual CPUs will use 100% of a host CPU. +.It Fl k Ar file +Set configuration variables from a simple, key-value config file. +Each line of the config file is expected to consist of a config variable +name, an equals sign +.Pq Sq = , +and a value. +No spaces are permitted between the variable name, equals sign, or +value. +Blank lines and lines starting with +.Sq # +are ignored. .It Fl l Op Ar help|lpcdev Ns Op , Ns Ar conf Allow devices behind the LPC PCI-ISA bridge to be configured. The only supported devices are the TTY-class devices @@ -174,6 +187,11 @@ If no suffix is given, the value is assumed to be in megabytes. .Pp .Ar memsize defaults to 256M. +.It Fl o Ar var Ns Cm = Ns Ar value +Set the configuration variable +.Ar var +to +.Ar value . .It Fl p Ar vcpu:hostcpu Pin guest's virtual CPU .Em vcpu @@ -594,6 +612,32 @@ Alphanumeric name of the guest. This should be the same as that created by .Xr bhyveload 8 . .El +.Sh CONFIGURATION VARIABLES +.Nm +uses an internal tree of configuration variables to describe global and +per-device settings. +When +.Nm +starts, +it parses command line options (including config files) in the order given +on the command line. +Each command line option sets one or more configuration variables. +For example, +the +.Fl s +option creates a new tree node for a PCI device and sets one or more variables +under that node including the device model and device model-specific variables. +Variables may be set multiple times during this parsing stage with the final +value overriding previous values. +.Pp +Once all of the command line options have been processed, +the configuration values are frozen. +.Nm +then uses the value of configuration values to initialize device models +and global settings. +.Pp +More details on configuration variables can be found in +.Xr bhyve_config 5 . .Sh DEBUG SERVER The current debug server provides limited support for debuggers. .Ss Registers @@ -717,6 +761,7 @@ bhyve -c 2 -m 4G -w -H \\ .Xr ng_socket 4 , .Xr nmdm 4 , .Xr vmm 4 , +.Xr bhyve_config 5 , .Xr ethers 5 , .Xr bhyvectl 8 , .Xr bhyveload 8 diff --git a/usr.sbin/bhyve/bhyve_config.5 b/usr.sbin/bhyve/bhyve_config.5 new file mode 100644 index 000000000000..4e200a779d50 --- /dev/null +++ b/usr.sbin/bhyve/bhyve_config.5 @@ -0,0 +1,560 @@ +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.\" Copyright (c) 2021 John H. Baldwin +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd March 18, 2021 +.Dt BHYVE_CONFIG 5 +.Os +.Sh NAME +.Nm bhyve_config +.Nd "bhyve configuration variables" +.Sh DESCRIPTION +.Xr bhyve 8 +uses a hierarchical tree of configuration variables to describe global and +per-device settings. +Internal nodes in this tree do not have a value, +only leaf nodes have values. +This manual describes the configuration variables understood by +.Xr bhyve 8 . +If additional variables are defined, +.Xr bhyve 8 +will ignore them and will not emit errors for unknown variables. +However, these additional variables can be referenced by other +variables as described below. +.Sh VARIABLE VALUES +Configuration variable values are stored as strings. +A configuration variable value may refer to one or more other +configuration values by name. +Instances of the pattern +.Sq % Ns Pq Ar var +are replaced by the value of the configuration variable +.Va var . +To avoid unwanted expansion, +.Sq % +characters can be escaped by a leading +.Sq % . +For example, +if a configuration variable +.Va disk +uses the value +.Pa /dev/zvol/bhyve/%(name) , +then the final value of the +.Va disk +variable will be set to the path of a ZFS volume whose name matches +the name of the virtual machine on the pool +.Pa bhyve . +.Pp +Some configuration variables may be interpreted as a boolean value. +For those variables the following case-insensitive values may be used to +indicate true: +.Pp +.Bl -bullet -offset indent -compact +.It +true +.It +on +.It +yes +.It +1 +.El +.Pp +The following values may be used to indicate false: +.Pp +.Bl -bullet -offset indent -compact +.It +false +.It +off +.It +no +.It +0 +.El +.Pp +Some configuration variables may be interperted as an integer. +For those variables, +any syntax supported by +.Xr strtol 3 +may be used. +.Sh GLOBAL SETTINGS +.Ss Architecture Neutral Settings +.Bl -column "memory.guest_in_core" "integer" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va name Ta string Ta Ta +The name of the VM. +.It Va cpus Ta integer Ta 1 Ta +The total number of virtual CPUs. +.It Va cores Ta integer Ta 1 Ta +The number of virtual cores in each virtual socket. +.It Va threads Ta integer Ta 1 Ta +The number of virtual CPUs in each virtual core. +.It Va sockets Ta integer Ta 1 Ta +The number of virtual sockets. +.It Va memory.guest_in_core Ta bool Ta false Ta +Include guest memory in core file. +.It Va memory.size Ta string Ta 256M Ta +Guest physical memory size in bytes. +The value must be formatted as described in +.Xr expand_number 3 . +.It Va memory.wired Ta bool Ta false Ta +Wire guest memory. +.It Va acpi_tables Ta bool Ta false Ta +Generate ACPI tables. +.It Va destroy_on_poweroff Ta bool Ta false Ta +Destroy the VM on guest-initiated power-off. +.It Va gdb.port Ta integer Ta 0 Ta +TCP port number for the debug server. +If this is set to a non-zero value, a debug server +will listen for connections on this port. +.It Va gdb.wait Ta bool Ta false Ta +If the debug server is enabled, wait for a debugger to connect +before starting the guest. +.It Va rtc.use_localtime Ta bool Ta true Ta +The real time clock uses the local time of the host. +If this is set to false, the real time clock uses UTC. +.It Va uuid Ta string Ta Ta +The universally unique identifier (UUID) to use in the guest's +System Management BIOS System Information structure. +If an explicit value is not set, a valid UUID is generated from +the host's hostname and the VM name. +.It Va virtio_msix Ta bool Ta true Ta +Use MSI-X interrupts for PCI VirtIO devices. +If set to false, MSI interrupts are used instead. +.It Va config.dump Ta bool Ta false Ta +If this value is set to true, +then +.Xr bhyve 8 +will write all of its configuration variables to stdout and exit +after it has finished parsing command line options. +.El +.Ss x86-Specific Settings +.Bl -column "x86.vmexit_on_pause" "integer" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va x86.mptable Ta bool Ta true Ta +Generate an MPTable. +.It Va x86.x2apic Ta bool Ta false Ta +Configure guest's local APICs in x2APIC mode. +.It Va x86.strictio Ta bool Ta false Ta +Exit if a guest accesses an I/O port that is not emulated. +By default, writes are ignored and reads return all bits set. +.It Va x86.strictmsr Ta bool Ta true Ta +Inject a general protection fault if a guest accesses a Model Specific +Register (MSR) that is not emulated. +If this is false, writes are ignored and reads return zero. +.It Va x86.vmexit_on_hlt Ta bool Ta false Ta +Force a VM exit when a guest CPU executes the +.Dv HLT +instruction. +This allows idle guest CPUs to yield the host CPU. +.It Va x86.vmexit_on_pause Ta bool Ta false Ta +Force a VM exit when a guest CPU executes the +.Dv PAUSE +instruction. +.El +.Sh DEVICE SETTINGS +Device settings are stored under a device node. +The device node's name is set by the parent bus of the device. +.Ss PCI Device Settings +PCI devices are described by a device node named +.Dq pci Ns Ar bus . Ns Ar slot . Ns Ar function +where each of +.Ar bus , +.Ar slot , +and +.Ar function +are formatted as decimal values with no padding. +All PCI device nodes must contain a configuration variable named +.Dq device +which specifies the device model to use. +The following PCI device models are supported: +.Bl -tag -indent +.It Li hostbridge +Provide a simple PCI-Host bridge device. +This is usually configured at pci0:0:0 and is required by most guest +operating systems. +.It Li ahci +AHCI storage controller. +.It Li e1000 +Intel e82545 network interface. +.It Li fbuf +VGA framebuffer device attached to VNC server. +.It Li lpc +LPC PCI-ISA bridge with COM1-COM4 16550 serial ports, +a boot ROM, +and an optional debug/test device. +This device must be configured on bus 0. +.It Li hda +High Definition audio controller. +.It Li nvme +NVM Express (NVMe) controller. +.It Li passthru +PCI pass-through device. +.It Li uart +PCI 16550 serial device. +.It Li virtio-9p +VirtIO 9p (VirtFS) interface. +.It Li virtio-blk +VirtIO block storage interface. +.It Li virtio-console +VirtIO console interface. +.It Li virtio-net +VirtIO network interface. +.It Li virtio-rnd +VirtIO RNG interface. +.It Li virtio-scsi +VirtIO SCSI interface. +.It Li xhci +Extensible Host Controller Interface (XHCI) USB controller. +.El +.Ss USB Device Settings +USB controller devices contain zero or more child USB devices +attached to slots. +Each USB device stores its settings in a node named +.Dq slot. Ns Va N +under the controller's device node. +.Va N +is the number of the slot to which the USB device is attached. +Note that USB slot numbers begin at 1. +All USB device nodes must contain a configuration variable named +.Dq device +which specifies the device model to use. +The following USB device models are supported: +.Bl -tag -indent +.It Li tablet +A USB tablet device which provides precise cursor synchronization +when using VNC. +.El +.Ss Block Device Settings +Block devices use the following settings to configure their backing store. +These settings are stored in the configuration node of the respective device. +.Bl -column "sectorsize" "logical[/physical]" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It path Ta string Ta Ta +The path of the file or disk device to use as the backing store. +.It nocache Ta bool Ta false Ta +Disable caching on the backing file by opening the backing file with +.Dv O_DIRECT . +.It nodelete Ta bool Ta false Ta +Disable emulation of guest trim requests via +.Dv DIOCGDELETE +requests. +.It sync Ta bool Ta false Ta +Write changes to the backing file with synchronous writes. +.It direct Ta bool Ta false Ta +An alias for +.Va sync . +.It ro Ta bool Ta false Ta +Disable writes to the backing file. +.It sectorsize Ta Va logical Ns Op / Ns Va physical Ta Ta +Specify the logical and physical sector size of the emulated disk. +If the physical size is not specified, +it is equal to the logical size. +.El +.Ss Network Backend Settings +Network devices use the following settings to configure their backend. +The backend is responsible for passing packets between the device model +and a desired destination. +Configuring a backend requires setting the +.Va backend +variable to one of the following values: +.Bl -tag +.It tap Ns Va N +Use the named +.Xr tap 4 +interface as the backend. +.It vmnet Ns Va N +Use the named +.Xr vmnet 4 +interface as the backend. +.It netgraph +Use a +.Xr netgraph 4 +socket hook as the backend. +This backend uses the following additional variables: +.Bl -column "peerhook" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va path Ta string Ta Ta +The name of the +.Xr netgraph 4 +destination node. +.It Va peerhook Ta string Ta Ta +The name of the destination hook. +.It Va socket Ta string Ta Ta +The name of the created +.Xr ng_socket 4 +node. +.It Va hook Ta string Ta vmlink Ta +The name of the source hook on the created +.Xr ng_socket 4 +node. +.El +.It netmap: Ns Va interface +Use +.Xr netmap 4 +on a network interface as the backend. +.It vale Ns Va bridge : Ns Va port +Use a port on a +.Xr vale 4 +bridge as the backend. +.El +.Ss UART Device Settings +.Bl -column "Name" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va path Ta path Ta Ta +Backend device for the serial port. +Either the pathname of a character device or +.Dq stdio +to use standard input and output of the +.Xr bhyve 8 +process. +.El +.Ss Host Bridge Settings +.Bl -column "vendor" "integer" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va vendor Ta integer Ta 0x1275 Ta +PCI vendor ID. +.It Va device Ta integer Ta 0x1275 Ta +PCI device ID. +.El +.Ss AHCI Controller Settings +AHCI controller devices contain zero or more ports each of which +provides a storage device. +Each port stores its settings in a node named +.Dq port. Ns Va N +under the controller's device node. +The +.Va N +values are formatted as successive decimal values starting with 0. +In addition to the block device settings described above, each +port supports the following settings: +.Bl -column "model" "integer" "generated" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va type Ta string Ta Ta +The type of storage device to emulate. +Must be set to either +.Dq cd +or +.Dq hd . +.It Va nmrr Ta integer Ta 0 Ta +Nominal Media Rotation Rate, also known as RPM. +A value 1 of indicates a device with no rate such as a Solid State Disk. +.It Va ser Ta string Ta generated Ta +Serial number of up to twenty characters. +A default serial number is generated using a hash of the backing +store's pathname. +.It Va rev Ta string Ta 001 Ta +Revision number of up to eight characters. +.It Va model Ta string Ta Ta +Model number of up to forty characters. +Separate default model strings are used for +.Dq cd +and +.Dq hd +device types. +.El +.Ss e1000 Settings +In addition to the network backend settings, +Intel e82545 network interfaces support the following variables: +.Bl -column "Name" "MAC address" "generated" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va mac Ta MAC address Ta generated Ta +MAC address. +If an explicit address is not provided, +a MAC address is generated from a hash of the device's PCI address. +.El +.Ss Frame Buffer Settings +.Bl -column "password" "[IP:]port" "127.0.0.1:5900" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va wait Ta bool Ta false Ta +Wait for a remote connection before starting the VM. +.It Va rfb Ta Oo Ar IP Ns : Oc Ns Ar port Ta 127.0.0.1:5900 Ta +TCP address to listen on for remote connections. +The IP address must be given as a numeric address. +IPv6 addresses must be enclosed in square brackets and +support scoped identifiers as described in +.Xr getaddrinfo 3 . +A bare port number may be given in which case the IPv4 +localhost address is used. +.It Va vga Ta string Ta io Ta +VGA configuration. +More details are provided in +.Xr bhyve 8 . +.It Va w Ta integer Ta 1024 Ta +Frame buffer width in pixels. +.It Va h Ta integer Ta 768 Ta +Frame buffer height in pixels. +.It Va password Ta string Ta Ta +Password to use for VNC authentication. +This type of authentication is known to be cryptographically weak and is not +intended for use on untrusted networks. +.El +.Ss High Definition Audio Settings +.Bl -column "Name" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va play Ta path Ta Ta +Host playback device, +typically +.Pa /dev/dsp0 . +.It Va rec Ta path Ta Ta +Host recording device, +typically +.Pa /dev/dsp0 . +.El +.Ss LPC Device Settings +The LPC bridge stores its configuration under a top-level +.Va lpc +node rather than under the PCI LPC device's node. +The following nodes are available under +.Va lpc : +.Bl -column "pc-testdev" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va bootrom Ta path Ta Ta +Path to a boot ROM. +The contents of this file are copied into the guest's +memory ending just before the 4GB physical address. +If a boot ROM is present, a firmware interface device is +also enabled for use by the boot ROM. +.It Va com1 Ta node Ta Ta +Settings for the COM1 serial port device. +.It Va com2 Ta node Ta Ta +Settings for the COM2 serial port device. +.It Va com3 Ta node Ta Ta +Settings for the COM3 serial port device. +.It Va com4 Ta node Ta Ta +Settings for the COM4 serial port device. +.It Va pc-testdev Ta bool Ta false Ta +Enable the PC debug/test device. +.El +.Ss NVMe Controller Settings +Each NVMe controller supports a single storage device. +The device can be backed either by a memory disk described by the +.Va ram +variable, or a block device using the the block device settings described above. +In addition, each controller supports the following settings: +.Bl -column "ioslots" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va maxq Ta integer Ta 16 Ta +Maximum number of I/O submission and completion queue pairs. +.It Va qsz Ta integer Ta 2058 Ta +Number of elements in each I/O queue. +.It Va ioslots Ta integer Ta 8 Ta +Maximum number of concurrent I/O requests. +.It Va sectsz Ta integer Ta Ta +Sector size. +Can be one of 512, 4096, or 8192. +Devices backed by a memory disk use 4096 as the default. +Devices backed by a block device use the block device's sector size +as the default. +.It Va ser Ta string Ta Ta +Serial number of up to twenty characters. +A default serial number is generated using a hash of the device's PCI address. +.It Va eui64 Ta integer Ta Ta +IEEE Extended Unique Identifier. +If an EUI is not provided, a default is generated using a checksum of the +device's PCI address. +.It Va dsm Ta string Ta auto Ta +Whether or not to advertise DataSet Management support. +One of +.Dq auto , +.Dq enable , +or +.Dq disable . +The +.Dq auto +setting only advertises support if the backing store supports +resource freeing, for example via TRIM. +.It Va ram Ta integer Ta Ta +If set, allocate a memory disk as the backing store. +The value of this variable is the size of the memory disk in megabytes. +.El +.Ss PCI Passthrough Settings +.Bl -column "Name" "integer" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va bus Ta integer Ta Ta +Host PCI bus address of device to pass through. +.It Va slot Ta integer Ta Ta +Host PCI slot address of device to pass through. +.It Va func Ta integer Ta Ta +Host PCI function address of device to pass through. +.El +.Ss VirtIO 9p Settings +Each VirtIO 9p device exposes a single filesystem from a host path. +.Bl -column "sharename" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va sharename Ta string Ta Ta +The share name exposed to the guest. +.It Va path Ta path Ta Ta +The path of a directory on the host to export to the guest. +.It Va ro Ta bool Ta false Ta +If true, the guest filesystem is read-only. +.El +.Ss VirtIO Console Device Settings +Each VirtIO Console device contains one or more console ports. +Each port stores its settings in a node named +.Dq port. Ns Va N +under the controller's device node. +The +.Va N +values are formatted as successive decimal values starting with 0. +Each port supports the following settings: +.Bl -column "Name" "Format" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va name Ta string Ta Ta +The name of the port exposed to the guest. +.It Va path Ta path Ta Ta +The path of a UNIX domain socket providing the host connection for the port. +.El +.Ss VirtIO Network Interface Settings +In addition to the network backend settings, +VirtIO network interfaces support the following variables: +.Bl -column "Name" "MAC address" "generated" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va mac Ta MAC address Ta generated Ta +MAC address. +If an explicit address is not provided, +a MAC address is generated from a hash of the device's PCI address. +.It Va mtu Ta integer Ta 1500 Ta +The largest supported MTU advertised to the guest. +.El +.Ss VirtIO SCSI Settings +.Bl -column "Name" "integer" "Default" +.It Sy Name Ta Sy Format Ta Sy Default Ta Sy Description +.It Va dev Ta path Ta Ta +The path of a CAM target layer (CTL) device to export: +.Pa /dev/cam/ctl Ns Oo Ar pp . Ns Ar vp Oc . +.It Va iid Ta integer Ta 0 Ta +Initiator ID to use when sending requests to the CTL port. +.El +.Sh SEE ALSO +.Xr expand_number 3 , +.Xr getaddrinfo 3 , +.Xr strtol 3 , +.Xr netgraph 4 , +.Xr netmap 4 , +.Xr ng_socket 4 , +.Xr tap 4 , +.Xr vale 4 , +.Xr vmnet 4 , +.Xr bhyve 8 diff --git a/usr.sbin/bhyve/bhyverun.c b/usr.sbin/bhyve/bhyverun.c index aafab4af8d8c..a3e6ef3c4724 100644 --- a/usr.sbin/bhyve/bhyverun.c +++ b/usr.sbin/bhyve/bhyverun.c @@ -87,6 +87,7 @@ __FBSDID("$FreeBSD$"); #include "acpi.h" #include "atkbdc.h" #include "bootrom.h" +#include "config.h" #include "inout.h" #include "debug.h" #include "fwctl.h" @@ -183,26 +184,11 @@ static const char * const vmx_exit_reason_desc[] = { typedef int (*vmexit_handler_t)(struct vmctx *, struct vm_exit *, int *vcpu); extern int vmexit_task_switch(struct vmctx *, struct vm_exit *, int *vcpu); -const char *vmname; - int guest_ncpus; uint16_t cores, maxcpus, sockets, threads; -char *guest_uuid_str; - int raw_stdio = 0; -static int gdb_port = 0; -static int guest_vmexit_on_hlt, guest_vmexit_on_pause; -static int virtio_msix = 1; -static int x2apic_mode = 0; /* default is xAPIC */ -static int destroy_on_poweroff = 0; - -static int strictio; -static int strictmsr = 1; - -static int acpi; - static char *progname; static const int BSP = 0; @@ -238,8 +224,8 @@ usage(int code) fprintf(stderr, "Usage: %s [-aehuwxACDHPSWY]\n" " %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n" - " %*s [-l ]\n" - " %*s [-m mem] [-p vcpu:hostcpu] [-s ] [-U uuid] \n" + " %*s [-k ] [-l ] [-m mem] [-o =]\n" + " %*s [-p vcpu:hostcpu] [-s ] [-U uuid] []\n" " -a: local apic is in xAPIC mode (deprecated)\n" " -A: create ACPI tables\n" " -c: number of cpus and/or topology specification\n" @@ -248,13 +234,15 @@ usage(int code) " -e: exit on unhandled I/O access\n" " -h: help\n" " -H: vmexit from the guest on hlt\n" + " -k: key=value flat config file\n" " -l: LPC device configuration\n" " -m: memory size in MB\n" + " -o: set config 'var' to 'value'\n" + " -p: pin 'vcpu' to 'hostcpu'\n" + " -P: vmexit from the guest on pause\n" #ifdef BHYVE_SNAPSHOT " -r: path to checkpoint file\n" #endif - " -p: pin 'vcpu' to 'hostcpu'\n" - " -P: vmexit from the guest on pause\n" " -s: PCI slot config\n" " -S: guest memory cannot be swapped\n" " -u: RTC keeps UTC time\n" @@ -271,11 +259,8 @@ usage(int code) /* * XXX This parser is known to have the following issues: - * 1. It accepts null key=value tokens ",,". - * 2. It accepts whitespace after = and before value. - * 3. Values out of range of INT are silently wrapped. - * 4. It doesn't check non-final values. - * 5. The apparently bogus limits of UINT16_MAX are for future expansion. + * 1. It accepts null key=value tokens ",," as setting "cpus" to an + * empty string. * * The acceptance of a null specification ('-c ""') is by design to match the * manual page syntax specification, this results in a topology of 1 vCPU. @@ -283,83 +268,122 @@ usage(int code) static int topology_parse(const char *opt) { - uint64_t ncpus; - int c, chk, n, s, t, tmp; char *cp, *str; - bool ns, scts; - c = 1, n = 1, s = 1, t = 1; - ns = false, scts = false; + if (*opt == '\0') { + set_config_value("sockets", "1"); + set_config_value("cores", "1"); + set_config_value("threads", "1"); + set_config_value("cpus", "1"); + return (0); + } + str = strdup(opt); if (str == NULL) - goto out; + errx(4, "Failed to allocate memory"); while ((cp = strsep(&str, ",")) != NULL) { - if (sscanf(cp, "%i%n", &tmp, &chk) == 1) { - n = tmp; - ns = true; - } else if (sscanf(cp, "cpus=%i%n", &tmp, &chk) == 1) { - n = tmp; - ns = true; - } else if (sscanf(cp, "sockets=%i%n", &tmp, &chk) == 1) { - s = tmp; - scts = true; - } else if (sscanf(cp, "cores=%i%n", &tmp, &chk) == 1) { - c = tmp; - scts = true; - } else if (sscanf(cp, "threads=%i%n", &tmp, &chk) == 1) { - t = tmp; - scts = true; + if (strncmp(cp, "cpus=", strlen("cpus=")) == 0) + set_config_value("cpus", cp + strlen("cpus=")); + else if (strncmp(cp, "sockets=", strlen("sockets=")) == 0) + set_config_value("sockets", cp + strlen("sockets=")); + else if (strncmp(cp, "cores=", strlen("cores=")) == 0) + set_config_value("cores", cp + strlen("cores=")); + else if (strncmp(cp, "threads=", strlen("threads=")) == 0) + set_config_value("threads", cp + strlen("threads=")); #ifdef notyet /* Do not expose this until vmm.ko implements it */ - } else if (sscanf(cp, "maxcpus=%i%n", &tmp, &chk) == 1) { - m = tmp; + else if (strncmp(cp, "maxcpus=", strlen("maxcpus=")) == 0) + set_config_value("maxcpus", cp + strlen("maxcpus=")); #endif - /* Skip the empty argument case from -c "" */ - } else if (cp[0] == '\0') - continue; - else - goto out; - /* Any trailing garbage causes an error */ - if (cp[chk] != '\0') + else if (strchr(cp, '=') != NULL) goto out; + else + set_config_value("cpus", cp); } free(str); - str = NULL; - - /* - * Range check 1 <= n <= UINT16_MAX all values - */ - if (n < 1 || s < 1 || c < 1 || t < 1 || - n > UINT16_MAX || s > UINT16_MAX || c > UINT16_MAX || *** 4873 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Mar 19 00:03:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CED275B1589; Fri, 19 Mar 2021 00:03: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 4F1kcw5QLNz3DNZ; Fri, 19 Mar 2021 00:03: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 ACC5E2E2D; Fri, 19 Mar 2021 00:03: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 12J03Sd0080730; Fri, 19 Mar 2021 00:03:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12J03SU4080729; Fri, 19 Mar 2021 00:03:28 GMT (envelope-from git) Date: Fri, 19 Mar 2021 00:03:28 GMT Message-Id: <202103190003.12J03SU4080729@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Glen Barber Subject: git: 8f731a397ad4 - releng/13.0 - 13.0 release: update to RC3 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gjb X-Git-Repository: src X-Git-Refname: refs/heads/releng/13.0 X-Git-Reftype: branch X-Git-Commit: 8f731a397ad4dc7b17622c0e69ac045f4a7b9d5b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 00:03:28 -0000 The branch releng/13.0 has been updated by gjb: URL: https://cgit.FreeBSD.org/src/commit/?id=8f731a397ad4dc7b17622c0e69ac045f4a7b9d5b commit 8f731a397ad4dc7b17622c0e69ac045f4a7b9d5b Author: Glen Barber AuthorDate: 2021-03-18 23:55:48 +0000 Commit: Glen Barber CommitDate: 2021-03-19 00:03:14 +0000 13.0 release: update to RC3 Sponsored by: Rubicon Communications, LLC ("Netgate") Approved by: re (implicit) --- sys/conf/newvers.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/conf/newvers.sh b/sys/conf/newvers.sh index 30178e155226..6e57164483fe 100644 --- a/sys/conf/newvers.sh +++ b/sys/conf/newvers.sh @@ -54,7 +54,7 @@ TYPE="FreeBSD" REVISION="13.0" -BRANCH="RC2" +BRANCH="RC3" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-dev-commits-src-all@freebsd.org Fri Mar 19 03:05:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E59DD5B46EF; Fri, 19 Mar 2021 03:05: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 4F1pfg5sLlz3N5T; Fri, 19 Mar 2021 03:05: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 BBD3558B5; Fri, 19 Mar 2021 03:05: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 12J35FQR019391; Fri, 19 Mar 2021 03:05:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12J35F44019390; Fri, 19 Mar 2021 03:05:15 GMT (envelope-from git) Date: Fri, 19 Mar 2021 03:05:15 GMT Message-Id: <202103190305.12J35F44019390@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: f8a6ec2d5727 - main - bhyve: support relocating fbuf and passthru data BARs 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: f8a6ec2d572758da6cfd29fcb4ecf4430463661d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 03:05:16 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=f8a6ec2d572758da6cfd29fcb4ecf4430463661d commit f8a6ec2d572758da6cfd29fcb4ecf4430463661d Author: D Scott Phillips AuthorDate: 2021-03-18 16:08:52 +0000 Commit: Ka Ho Ng CommitDate: 2021-03-19 03:04:36 +0000 bhyve: support relocating fbuf and passthru data BARs We want to allow the UEFI firmware to enumerate and assign addresses to PCI devices so we can boot from NVMe[1]. Address assignment of PCI BARs is properly handled by the PCI emulation code in general, but a few specific cases need additional support. fbuf and passthru map additional objects into the guest physical address space and so need to handle address updates. Here we add a callback to emulated PCI devices to inform them of a BAR configuration change. fbuf and passthru then watch for these BAR changes and relocate the frame buffer memory segment and passthru device mmio area respectively. We also add new VM_MUNMAP_MEMSEG and VM_UNMAP_PPTDEV_MMIO ioctls to vmm(4) to facilitate the unmapping needed for addres updates. [1]: https://github.com/freebsd/uefi-edk2/pull/9/ Originally by: scottph MFC After: 1 week Sponsored by: Intel Corporation Reviewed by: grehan Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D24066 --- lib/libvmmapi/vmmapi.c | 33 +++++++++++- lib/libvmmapi/vmmapi.h | 4 ++ sys/amd64/include/vmm.h | 1 + sys/amd64/include/vmm_dev.h | 11 ++++ sys/amd64/vmm/io/ppt.c | 30 ++++++++++- sys/amd64/vmm/io/ppt.h | 2 + sys/amd64/vmm/vmm.c | 18 +++++++ sys/amd64/vmm/vmm_dev.c | 12 +++++ usr.sbin/bhyve/pci_emul.c | 8 +++ usr.sbin/bhyve/pci_emul.h | 3 ++ usr.sbin/bhyve/pci_fbuf.c | 25 +++++++++ usr.sbin/bhyve/pci_passthru.c | 123 ++++++++++++++++++++++++++++++------------ 12 files changed, 232 insertions(+), 38 deletions(-) diff --git a/lib/libvmmapi/vmmapi.c b/lib/libvmmapi/vmmapi.c index 7d46a85b1cd5..7faa2fc545ea 100644 --- a/lib/libvmmapi/vmmapi.c +++ b/lib/libvmmapi/vmmapi.c @@ -251,6 +251,19 @@ vm_get_guestmem_from_ctx(struct vmctx *ctx, char **guest_baseaddr, return (0); } +int +vm_munmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, size_t len) +{ + struct vm_munmap munmap; + int error; + + munmap.gpa = gpa; + munmap.len = len; + + error = ioctl(ctx->fd, VM_MUNMAP_MEMSEG, &munmap); + return (error); +} + int vm_mmap_getnext(struct vmctx *ctx, vm_paddr_t *gpa, int *segid, vm_ooffset_t *segoff, size_t *len, int *prot, int *flags) @@ -980,6 +993,22 @@ vm_map_pptdev_mmio(struct vmctx *ctx, int bus, int slot, int func, return (ioctl(ctx->fd, VM_MAP_PPTDEV_MMIO, &pptmmio)); } +int +vm_unmap_pptdev_mmio(struct vmctx *ctx, int bus, int slot, int func, + vm_paddr_t gpa, size_t len) +{ + struct vm_pptdev_mmio pptmmio; + + bzero(&pptmmio, sizeof(pptmmio)); + pptmmio.bus = bus; + pptmmio.slot = slot; + pptmmio.func = func; + pptmmio.gpa = gpa; + pptmmio.len = len; + + return (ioctl(ctx->fd, VM_UNMAP_PPTDEV_MMIO, &pptmmio)); +} + int vm_setup_pptdev_msi(struct vmctx *ctx, int vcpu, int bus, int slot, int func, uint64_t addr, uint64_t msg, int numvec) @@ -1644,7 +1673,7 @@ vm_get_ioctls(size_t *len) /* keep in sync with machine/vmm_dev.h */ static const cap_ioctl_t vm_ioctl_cmds[] = { VM_RUN, VM_SUSPEND, VM_REINIT, VM_ALLOC_MEMSEG, VM_GET_MEMSEG, VM_MMAP_MEMSEG, VM_MMAP_MEMSEG, - VM_MMAP_GETNEXT, VM_SET_REGISTER, VM_GET_REGISTER, + VM_MMAP_GETNEXT, VM_MUNMAP_MEMSEG, VM_SET_REGISTER, VM_GET_REGISTER, VM_SET_SEGMENT_DESCRIPTOR, VM_GET_SEGMENT_DESCRIPTOR, VM_SET_REGISTER_SET, VM_GET_REGISTER_SET, VM_SET_KERNEMU_DEV, VM_GET_KERNEMU_DEV, @@ -1654,7 +1683,7 @@ vm_get_ioctls(size_t *len) VM_ISA_DEASSERT_IRQ, VM_ISA_PULSE_IRQ, VM_ISA_SET_IRQ_TRIGGER, VM_SET_CAPABILITY, VM_GET_CAPABILITY, VM_BIND_PPTDEV, VM_UNBIND_PPTDEV, VM_MAP_PPTDEV_MMIO, VM_PPTDEV_MSI, - VM_PPTDEV_MSIX, VM_PPTDEV_DISABLE_MSIX, + VM_PPTDEV_MSIX, VM_UNMAP_PPTDEV_MMIO, VM_PPTDEV_DISABLE_MSIX, VM_INJECT_NMI, VM_STATS, VM_STAT_DESC, VM_SET_X2APIC_STATE, VM_GET_X2APIC_STATE, VM_GET_HPET_CAPABILITIES, VM_GET_GPA_PMAP, VM_GLA2GPA, diff --git a/lib/libvmmapi/vmmapi.h b/lib/libvmmapi/vmmapi.h index 9dc44f391d2c..7e3d62b086aa 100644 --- a/lib/libvmmapi/vmmapi.h +++ b/lib/libvmmapi/vmmapi.h @@ -111,6 +111,8 @@ void *vm_create_devmem(struct vmctx *ctx, int segid, const char *name, int vm_mmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, int segid, vm_ooffset_t segoff, size_t len, int prot); +int vm_munmap_memseg(struct vmctx *ctx, vm_paddr_t gpa, size_t len); + int vm_create(const char *name); int vm_get_device_fd(struct vmctx *ctx); struct vmctx *vm_open(const char *name); @@ -176,6 +178,8 @@ int vm_assign_pptdev(struct vmctx *ctx, int bus, int slot, int func); int vm_unassign_pptdev(struct vmctx *ctx, int bus, int slot, int func); int vm_map_pptdev_mmio(struct vmctx *ctx, int bus, int slot, int func, vm_paddr_t gpa, size_t len, vm_paddr_t hpa); +int vm_unmap_pptdev_mmio(struct vmctx *ctx, int bus, int slot, int func, + vm_paddr_t gpa, size_t len); int vm_setup_pptdev_msi(struct vmctx *ctx, int vcpu, int bus, int slot, int func, uint64_t addr, uint64_t msg, int numvec); int vm_setup_pptdev_msix(struct vmctx *ctx, int vcpu, int bus, int slot, diff --git a/sys/amd64/include/vmm.h b/sys/amd64/include/vmm.h index 390d8f5699ac..f265237a5303 100644 --- a/sys/amd64/include/vmm.h +++ b/sys/amd64/include/vmm.h @@ -231,6 +231,7 @@ int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, */ int vm_mmap_memseg(struct vm *vm, vm_paddr_t gpa, int segid, vm_ooffset_t off, size_t len, int prot, int flags); +int vm_munmap_memseg(struct vm *vm, vm_paddr_t gpa, size_t len); int vm_alloc_memseg(struct vm *vm, int ident, size_t len, bool sysmem); void vm_free_memseg(struct vm *vm, int ident); int vm_map_mmio(struct vm *vm, vm_paddr_t gpa, size_t len, vm_paddr_t hpa); diff --git a/sys/amd64/include/vmm_dev.h b/sys/amd64/include/vmm_dev.h index e4204e759bf6..a048e05d4b7c 100644 --- a/sys/amd64/include/vmm_dev.h +++ b/sys/amd64/include/vmm_dev.h @@ -49,6 +49,11 @@ struct vm_memmap { #define VM_MEMMAP_F_WIRED 0x01 #define VM_MEMMAP_F_IOMMU 0x02 +struct vm_munmap { + vm_paddr_t gpa; + size_t len; +}; + #define VM_MEMSEG_NAME(m) ((m)->name[0] != '\0' ? (m)->name : NULL) struct vm_memseg { int segid; @@ -270,6 +275,7 @@ enum { IOCNUM_MMAP_MEMSEG = 16, IOCNUM_MMAP_GETNEXT = 17, IOCNUM_GLA2GPA_NOFAULT = 18, + IOCNUM_MUNMAP_MEMSEG = 19, /* register/state accessors */ IOCNUM_SET_REGISTER = 20, @@ -302,6 +308,7 @@ enum { IOCNUM_PPTDEV_MSI = 43, IOCNUM_PPTDEV_MSIX = 44, IOCNUM_PPTDEV_DISABLE_MSIX = 45, + IOCNUM_UNMAP_PPTDEV_MMIO = 46, /* statistics */ IOCNUM_VM_STATS = 50, @@ -358,6 +365,8 @@ enum { _IOW('v', IOCNUM_MMAP_MEMSEG, struct vm_memmap) #define VM_MMAP_GETNEXT \ _IOWR('v', IOCNUM_MMAP_GETNEXT, struct vm_memmap) +#define VM_MUNMAP_MEMSEG \ + _IOW('v', IOCNUM_MUNMAP_MEMSEG, struct vm_munmap) #define VM_SET_REGISTER \ _IOW('v', IOCNUM_SET_REGISTER, struct vm_register) #define VM_GET_REGISTER \ @@ -416,6 +425,8 @@ enum { _IOW('v', IOCNUM_PPTDEV_MSIX, struct vm_pptdev_msix) #define VM_PPTDEV_DISABLE_MSIX \ _IOW('v', IOCNUM_PPTDEV_DISABLE_MSIX, struct vm_pptdev) +#define VM_UNMAP_PPTDEV_MMIO \ + _IOW('v', IOCNUM_UNMAP_PPTDEV_MMIO, struct vm_pptdev_mmio) #define VM_INJECT_NMI \ _IOW('v', IOCNUM_INJECT_NMI, struct vm_nmi) #define VM_STATS \ diff --git a/sys/amd64/vmm/io/ppt.c b/sys/amd64/vmm/io/ppt.c index 22ad54093081..a936326e8df3 100644 --- a/sys/amd64/vmm/io/ppt.c +++ b/sys/amd64/vmm/io/ppt.c @@ -224,7 +224,7 @@ ppt_find(struct vm *vm, int bus, int slot, int func, struct pptdev **pptp) } static void -ppt_unmap_mmio(struct vm *vm, struct pptdev *ppt) +ppt_unmap_all_mmio(struct vm *vm, struct pptdev *ppt) { int i; struct pptseg *seg; @@ -412,7 +412,7 @@ ppt_unassign_device(struct vm *vm, int bus, int slot, int func) pci_save_state(ppt->dev); ppt_pci_reset(ppt->dev); pci_restore_state(ppt->dev); - ppt_unmap_mmio(vm, ppt); + ppt_unmap_all_mmio(vm, ppt); ppt_teardown_msi(ppt); ppt_teardown_msix(ppt); iommu_remove_device(vm_iommu_domain(vm), pci_get_rid(ppt->dev)); @@ -466,6 +466,32 @@ ppt_map_mmio(struct vm *vm, int bus, int slot, int func, return (ENOSPC); } +int +ppt_unmap_mmio(struct vm *vm, int bus, int slot, int func, + vm_paddr_t gpa, size_t len) +{ + int i, error; + struct pptseg *seg; + struct pptdev *ppt; + + error = ppt_find(vm, bus, slot, func, &ppt); + if (error) + return (error); + + for (i = 0; i < MAX_MMIOSEGS; i++) { + seg = &ppt->mmio[i]; + if (seg->gpa == gpa && seg->len == len) { + error = vm_unmap_mmio(vm, seg->gpa, seg->len); + if (error == 0) { + seg->gpa = 0; + seg->len = 0; + } + return (error); + } + } + return (ENOENT); +} + static int pptintr(void *arg) { diff --git a/sys/amd64/vmm/io/ppt.h b/sys/amd64/vmm/io/ppt.h index 223afb343e8c..e6339f57b8ad 100644 --- a/sys/amd64/vmm/io/ppt.h +++ b/sys/amd64/vmm/io/ppt.h @@ -34,6 +34,8 @@ int ppt_unassign_all(struct vm *vm); int ppt_map_mmio(struct vm *vm, int bus, int slot, int func, vm_paddr_t gpa, size_t len, vm_paddr_t hpa); +int ppt_unmap_mmio(struct vm *vm, int bus, int slot, int func, + vm_paddr_t gpa, size_t len); int ppt_setup_msi(struct vm *vm, int vcpu, int bus, int slot, int func, uint64_t addr, uint64_t msg, int numvec); int ppt_setup_msix(struct vm *vm, int vcpu, int bus, int slot, int func, diff --git a/sys/amd64/vmm/vmm.c b/sys/amd64/vmm/vmm.c index 893c9626e67f..5c2a404f45a7 100644 --- a/sys/amd64/vmm/vmm.c +++ b/sys/amd64/vmm/vmm.c @@ -797,6 +797,24 @@ vm_mmap_memseg(struct vm *vm, vm_paddr_t gpa, int segid, vm_ooffset_t first, return (0); } +int +vm_munmap_memseg(struct vm *vm, vm_paddr_t gpa, size_t len) +{ + struct mem_map *m; + int i; + + for (i = 0; i < VM_MAX_MEMMAPS; i++) { + m = &vm->mem_maps[i]; + if (m->gpa == gpa && m->len == len && + (m->flags & VM_MEMMAP_F_IOMMU) == 0) { + vm_free_memmap(vm, i); + return (0); + } + } + + return (EINVAL); +} + int vm_mmap_getnext(struct vm *vm, vm_paddr_t *gpa, int *segid, vm_ooffset_t *segoff, size_t *len, int *prot, int *flags) diff --git a/sys/amd64/vmm/vmm_dev.c b/sys/amd64/vmm/vmm_dev.c index da8c051016ec..2da6225fdddd 100644 --- a/sys/amd64/vmm/vmm_dev.c +++ b/sys/amd64/vmm/vmm_dev.c @@ -381,6 +381,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, struct vm_rtc_time *rtctime; struct vm_rtc_data *rtcdata; struct vm_memmap *mm; + struct vm_munmap *mu; struct vm_cpu_topology *topology; struct vm_readwrite_kernemu_device *kernemu; uint64_t *regvals; @@ -435,6 +436,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, break; case VM_MAP_PPTDEV_MMIO: + case VM_UNMAP_PPTDEV_MMIO: case VM_BIND_PPTDEV: case VM_UNBIND_PPTDEV: #ifdef COMPAT_FREEBSD12 @@ -442,6 +444,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, #endif case VM_ALLOC_MEMSEG: case VM_MMAP_MEMSEG: + case VM_MUNMAP_MEMSEG: case VM_REINIT: /* * ioctls that operate on the entire virtual machine must @@ -525,6 +528,11 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, pptmmio->func, pptmmio->gpa, pptmmio->len, pptmmio->hpa); break; + case VM_UNMAP_PPTDEV_MMIO: + pptmmio = (struct vm_pptdev_mmio *)data; + error = ppt_unmap_mmio(sc->vm, pptmmio->bus, pptmmio->slot, + pptmmio->func, pptmmio->gpa, pptmmio->len); + break; case VM_BIND_PPTDEV: pptdev = (struct vm_pptdev *)data; error = vm_assign_pptdev(sc->vm, pptdev->bus, pptdev->slot, @@ -643,6 +651,10 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, error = vm_mmap_memseg(sc->vm, mm->gpa, mm->segid, mm->segoff, mm->len, mm->prot, mm->flags); break; + case VM_MUNMAP_MEMSEG: + mu = (struct vm_munmap *)data; + error = vm_munmap_memseg(sc->vm, mu->gpa, mu->len); + break; #ifdef COMPAT_FREEBSD12 case VM_ALLOC_MEMSEG_FBSD12: error = alloc_memseg(sc, (struct vm_memseg *)data, diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c index e498b14ef700..113ac5121238 100644 --- a/usr.sbin/bhyve/pci_emul.c +++ b/usr.sbin/bhyve/pci_emul.c @@ -506,10 +506,12 @@ pci_emul_alloc_resource(uint64_t *baseptr, uint64_t limit, uint64_t size, static void modify_bar_registration(struct pci_devinst *pi, int idx, int registration) { + struct pci_devemu *pe; int error; struct inout_port iop; struct mem_range mr; + pe = pi->pi_d; switch (pi->pi_bar[idx].type) { case PCIBAR_IO: bzero(&iop, sizeof(struct inout_port)); @@ -523,6 +525,9 @@ modify_bar_registration(struct pci_devinst *pi, int idx, int registration) error = register_inout(&iop); } else error = unregister_inout(&iop); + if (pe->pe_baraddr != NULL) + (*pe->pe_baraddr)(pi->pi_vmctx, pi, idx, registration, + pi->pi_bar[idx].addr); break; case PCIBAR_MEM32: case PCIBAR_MEM64: @@ -538,6 +543,9 @@ modify_bar_registration(struct pci_devinst *pi, int idx, int registration) error = register_mem(&mr); } else error = unregister_mem(&mr); + if (pe->pe_baraddr != NULL) + (*pe->pe_baraddr)(pi->pi_vmctx, pi, idx, registration, + pi->pi_bar[idx].addr); break; default: error = EINVAL; diff --git a/usr.sbin/bhyve/pci_emul.h b/usr.sbin/bhyve/pci_emul.h index 2dbed07dfc14..031a6113fac4 100644 --- a/usr.sbin/bhyve/pci_emul.h +++ b/usr.sbin/bhyve/pci_emul.h @@ -76,6 +76,9 @@ struct pci_devemu { struct pci_devinst *pi, int baridx, uint64_t offset, int size); + void (*pe_baraddr)(struct vmctx *ctx, struct pci_devinst *pi, + int baridx, int enabled, uint64_t address); + /* Save/restore device state */ int (*pe_snapshot)(struct vm_snapshot_meta *meta); int (*pe_pause)(struct vmctx *ctx, struct pci_devinst *pi); diff --git a/usr.sbin/bhyve/pci_fbuf.c b/usr.sbin/bhyve/pci_fbuf.c index 215ce742edfb..9c5dbd9c6a40 100644 --- a/usr.sbin/bhyve/pci_fbuf.c +++ b/usr.sbin/bhyve/pci_fbuf.c @@ -216,6 +216,30 @@ pci_fbuf_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, return (value); } +static void +pci_fbuf_baraddr(struct vmctx *ctx, struct pci_devinst *pi, int baridx, + int enabled, uint64_t address) +{ + struct pci_fbuf_softc *sc; + int prot; + + if (baridx != 1) + return; + + sc = pi->pi_arg; + if (!enabled && sc->fbaddr != 0) { + if (vm_munmap_memseg(ctx, sc->fbaddr, FB_SIZE) != 0) + EPRINTLN("pci_fbuf: munmap_memseg failed"); + sc->fbaddr = 0; + } else if (sc->fb_base != NULL && sc->fbaddr == 0) { + prot = PROT_READ | PROT_WRITE; + if (vm_mmap_memseg(ctx, address, VM_FRAMEBUFFER, 0, FB_SIZE, prot) != 0) + EPRINTLN("pci_fbuf: mmap_memseg failed"); + sc->fbaddr = address; + } +} + + static int pci_fbuf_parse_config(struct pci_fbuf_softc *sc, nvlist_t *nvl) { @@ -457,6 +481,7 @@ struct pci_devemu pci_fbuf = { .pe_init = pci_fbuf_init, .pe_barwrite = pci_fbuf_write, .pe_barread = pci_fbuf_read, + .pe_baraddr = pci_fbuf_baraddr, #ifdef BHYVE_SNAPSHOT .pe_snapshot = pci_fbuf_snapshot, #endif diff --git a/usr.sbin/bhyve/pci_passthru.c b/usr.sbin/bhyve/pci_passthru.c index f1d306b03959..9028369217d4 100644 --- a/usr.sbin/bhyve/pci_passthru.c +++ b/usr.sbin/bhyve/pci_passthru.c @@ -441,8 +441,8 @@ static int init_msix_table(struct vmctx *ctx, struct passthru_softc *sc, uint64_t base) { int b, s, f; - int error, idx; - size_t len, remaining; + int idx; + size_t remaining; uint32_t table_size, table_offset; uint32_t pba_size, pba_offset; vm_paddr_t start; @@ -504,31 +504,6 @@ init_msix_table(struct vmctx *ctx, struct passthru_softc *sc, uint64_t base) } } - /* Map everything before the MSI-X table */ - if (table_offset > 0) { - len = table_offset; - error = vm_map_pptdev_mmio(ctx, b, s, f, start, len, base); - if (error) - return (error); - - base += len; - start += len; - remaining -= len; - } - - /* Skip the MSI-X table */ - base += table_size; - start += table_size; - remaining -= table_size; - - /* Map everything beyond the end of the MSI-X table */ - if (remaining > 0) { - len = remaining; - error = vm_map_pptdev_mmio(ctx, b, s, f, start, len, base); - if (error) - return (error); - } - return (0); } @@ -595,13 +570,6 @@ cfginitbar(struct vmctx *ctx, struct passthru_softc *sc) error = init_msix_table(ctx, sc, base); if (error) return (-1); - } else if (bartype != PCIBAR_IO) { - /* Map the physical BAR in the guest MMIO space */ - error = vm_map_pptdev_mmio(ctx, sc->psc_sel.pc_bus, - sc->psc_sel.pc_dev, sc->psc_sel.pc_func, - pi->pi_bar[i].addr, pi->pi_bar[i].size, base); - if (error) - return (-1); } /* @@ -988,6 +956,92 @@ passthru_read(struct vmctx *ctx, int vcpu, struct pci_devinst *pi, int baridx, return (val); } +static void +passthru_msix_addr(struct vmctx *ctx, struct pci_devinst *pi, int baridx, + int enabled, uint64_t address) +{ + struct passthru_softc *sc; + size_t remaining; + uint32_t table_size, table_offset; + + sc = pi->pi_arg; + table_offset = rounddown2(pi->pi_msix.table_offset, 4096); + if (table_offset > 0) { + if (!enabled) { + if (vm_unmap_pptdev_mmio(ctx, sc->psc_sel.pc_bus, + sc->psc_sel.pc_dev, + sc->psc_sel.pc_func, address, + table_offset) != 0) + warnx("pci_passthru: unmap_pptdev_mmio failed"); + } else { + if (vm_map_pptdev_mmio(ctx, sc->psc_sel.pc_bus, + sc->psc_sel.pc_dev, + sc->psc_sel.pc_func, address, + table_offset, + sc->psc_bar[baridx].addr) != 0) + warnx("pci_passthru: map_pptdev_mmio failed"); + } + } + table_size = pi->pi_msix.table_offset - table_offset; + table_size += pi->pi_msix.table_count * MSIX_TABLE_ENTRY_SIZE; + table_size = roundup2(table_size, 4096); + remaining = pi->pi_bar[baridx].size - table_offset - table_size; + if (remaining > 0) { + address += table_offset + table_size; + if (!enabled) { + if (vm_unmap_pptdev_mmio(ctx, sc->psc_sel.pc_bus, + sc->psc_sel.pc_dev, + sc->psc_sel.pc_func, address, + remaining) != 0) + warnx("pci_passthru: unmap_pptdev_mmio failed"); + } else { + if (vm_map_pptdev_mmio(ctx, sc->psc_sel.pc_bus, + sc->psc_sel.pc_dev, + sc->psc_sel.pc_func, address, + remaining, + sc->psc_bar[baridx].addr + + table_offset + table_size) != 0) + warnx("pci_passthru: map_pptdev_mmio failed"); + } + } +} + +static void +passthru_mmio_addr(struct vmctx *ctx, struct pci_devinst *pi, int baridx, + int enabled, uint64_t address) +{ + struct passthru_softc *sc; + + sc = pi->pi_arg; + if (!enabled) { + if (vm_unmap_pptdev_mmio(ctx, sc->psc_sel.pc_bus, + sc->psc_sel.pc_dev, + sc->psc_sel.pc_func, address, + sc->psc_bar[baridx].size) != 0) + warnx("pci_passthru: unmap_pptdev_mmio failed"); + } else { + if (vm_map_pptdev_mmio(ctx, sc->psc_sel.pc_bus, + sc->psc_sel.pc_dev, + sc->psc_sel.pc_func, address, + sc->psc_bar[baridx].size, + sc->psc_bar[baridx].addr) != 0) + warnx("pci_passthru: map_pptdev_mmio failed"); + } +} + +static void +passthru_addr(struct vmctx *ctx, struct pci_devinst *pi, int baridx, + int enabled, uint64_t address) +{ + + if (pi->pi_bar[baridx].type == PCIBAR_IO) + return; + if (baridx == pci_msix_table_bar(pi)) + passthru_msix_addr(ctx, pi, baridx, enabled, address); + else + passthru_mmio_addr(ctx, pi, baridx, enabled, address); +} + struct pci_devemu passthru = { .pe_emu = "passthru", .pe_init = passthru_init, @@ -996,5 +1050,6 @@ struct pci_devemu passthru = { .pe_cfgread = passthru_cfgread, .pe_barwrite = passthru_write, .pe_barread = passthru_read, + .pe_baraddr = passthru_addr, }; PCI_EMUL_SET(passthru); From owner-dev-commits-src-all@freebsd.org Fri Mar 19 03:14:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CD1D5B4EEF for ; Fri, 19 Mar 2021 03:14: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 4F1psc06k2z3NbM; Fri, 19 Mar 2021 03: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 EBB105D05; Fri, 19 Mar 2021 03: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 12J3EhQc032457; Fri, 19 Mar 2021 03: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 12J3EhSL032456; Fri, 19 Mar 2021 03:14:43 GMT (envelope-from git) Date: Fri, 19 Mar 2021 03:14:43 GMT Message-Id: <202103190314.12J3EhSL032456@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Philip Paeps Subject: git: 28c11c0b1590 - Create tag vendor/wpa/g9d9b42306541 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/tags/vendor/wpa/g9d9b42306541 X-Git-Reftype: annotated tag X-Git-Commit: 28c11c0b15905553c2c0f746ad2d4cd677b2225c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 03:14:44 -0000 The annotated tag vendor/wpa/g9d9b42306541 has been created by philip: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/wpa/g9d9b42306541 tag vendor/wpa/g9d9b42306541 Tagger: Philip Paeps TaggerDate: 2021-03-19 03:13:46 +0000 Tag import of hostapd/wpa_supplicant commit 9d9b42306541 commit f8262d7d8ac3000d0865826129738cd58a8fe1ab Author: Philip Paeps AuthorDate: 2021-03-19 03:13:37 +0000 Commit: Philip Paeps CommitDate: 2021-03-19 03:13:37 +0000 Import wpa_supplicant/hostapd commit 9d9b42306541 Start tracking upstream development of hostapd and wpa_supplicant more closely. The last upstream release is from August 2019. Keeping up with upstream development will make importing releases less exciting. Discussed with: cy Sponsored by: Rubicon Communications, LLC ("Netgate") From owner-dev-commits-src-all@freebsd.org Fri Mar 19 03:14:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B27775B47FD for ; Fri, 19 Mar 2021 03: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 4F1psb2275z3Nh2; Fri, 19 Mar 2021 03: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 D9F23546F; Fri, 19 Mar 2021 03:14: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 12J3EgSi032431; Fri, 19 Mar 2021 03:14:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12J3EdKS032421; Fri, 19 Mar 2021 03:14:39 GMT (envelope-from git) Date: Fri, 19 Mar 2021 03:14:39 GMT Message-Id: <202103190314.12J3EdKS032421@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Philip Paeps Subject: git: f8262d7d8ac3 - vendor/wpa - Import wpa_supplicant/hostapd commit 9d9b42306541 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/vendor/wpa X-Git-Reftype: branch X-Git-Commit: f8262d7d8ac3000d0865826129738cd58a8fe1ab Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 03:14:43 -0000 The branch vendor/wpa has been updated by philip: URL: https://cgit.FreeBSD.org/src/commit/?id=f8262d7d8ac3000d0865826129738cd58a8fe1ab commit f8262d7d8ac3000d0865826129738cd58a8fe1ab Author: Philip Paeps AuthorDate: 2021-03-19 03:13:37 +0000 Commit: Philip Paeps CommitDate: 2021-03-19 03:13:37 +0000 Import wpa_supplicant/hostapd commit 9d9b42306541 Start tracking upstream development of hostapd and wpa_supplicant more closely. The last upstream release is from August 2019. Keeping up with upstream development will make importing releases less exciting. Discussed with: cy Sponsored by: Rubicon Communications, LLC ("Netgate") --- .gitignore | 8 + Android.mk | 10 + CONTRIBUTIONS | 5 +- build_release | 47 + doc/.gitignore | 14 + doc/Makefile | 42 + doc/code_structure.doxygen | 315 + doc/ctrl_iface.doxygen | 1054 ++ doc/dbus.doxygen | 2394 ++++ doc/directories.doxygen | 90 + doc/doxygen.conf | 1547 +++ doc/driver_wrapper.doxygen | 180 + doc/eap.doxygen | 87 + doc/eap_server.doxygen | 56 + doc/hostapd.fig | 264 + doc/hostapd_ctrl_iface.doxygen | 66 + doc/mainpage.doxygen | 95 + doc/p2p.doxygen | 471 + doc/p2p_arch.dot | 85 + doc/p2p_arch2.dot | 85 + doc/p2p_sm.dot | 62 + doc/porting.doxygen | 209 + doc/testing_tools.doxygen | 201 + doc/wpa_supplicant.fig | 247 + eap_example/.gitignore | 4 + eap_example/Makefile | 119 + eap_example/README | 42 + eap_example/ca.pem | 55 + eap_example/dh.conf | 5 + eap_example/eap_example.c | 47 + eap_example/eap_example_peer.c | 377 + eap_example/eap_example_server.c | 300 + eap_example/server-key.pem | 15 + eap_example/server.key | 16 + eap_example/server.pem | 64 + hostapd/.gitignore | 5 + hostapd/Android.mk | 86 +- hostapd/ChangeLog | 4 +- hostapd/Makefile | 197 +- hostapd/android.config | 25 +- hostapd/config_file.c | 418 +- hostapd/ctrl_iface.c | 807 +- hostapd/defconfig | 35 +- hostapd/hostapd.conf | 337 +- hostapd/hostapd.wpa_psk | 6 + hostapd/hostapd_cli.c | 128 +- hostapd/main.c | 22 +- hostapd/sae_pk_gen.c | 196 + hs20/client/Makefile | 55 +- hs20/client/est.c | 7 +- hs20/client/oma_dm_client.c | 2 +- hs20/client/osu_client.c | 27 +- hs20/client/osu_client.h | 2 + hs20/client/spp_client.c | 2 +- hs20/server/.gitignore | 1 + hs20/server/Makefile | 42 + hs20/server/ca/clean.sh | 13 + hs20/server/ca/est-csrattrs.cnf | 17 + hs20/server/ca/est-csrattrs.sh | 4 + hs20/server/ca/hs20.oid | 7 + hs20/server/ca/ocsp-req.sh | 11 + hs20/server/ca/ocsp-responder-ica.sh | 3 + hs20/server/ca/ocsp-responder.sh | 3 + hs20/server/ca/ocsp-update-cache.sh | 11 + hs20/server/ca/openssl-root.cnf | 125 + hs20/server/ca/openssl.cnf | 200 + hs20/server/ca/setup.sh | 209 + hs20/server/ca/w1fi_logo.png | Bin 0 -> 7549 bytes hs20/server/hs20-osu-server.txt | 262 + hs20/server/hs20_spp_server.c | 207 + hs20/server/spp_server.c | 2933 +++++ hs20/server/spp_server.h | 36 + hs20/server/sql-example.txt | 17 + hs20/server/sql.txt | 108 + hs20/server/www/add-free.php | 50 + hs20/server/www/add-mo.php | 56 + hs20/server/www/cert-enroll.php | 39 + hs20/server/www/config.php | 7 + hs20/server/www/est.php | 232 + hs20/server/www/free-remediation.php | 19 + hs20/server/www/free.php | 23 + hs20/server/www/redirect.php | 32 + hs20/server/www/remediation-pw.php | 41 + hs20/server/www/remediation.php | 55 + hs20/server/www/signup.php | 59 + hs20/server/www/spp.php | 168 + hs20/server/www/terms.php | 87 + hs20/server/www/users.php | 377 + radius_example/.gitignore | 2 + radius_example/Makefile | 28 + radius_example/README | 35 + radius_example/radius_example.c | 153 + src/Makefile | 4 +- src/ap/Makefile | 18 +- src/ap/acs.c | 305 +- src/ap/airtime_policy.c | 8 +- src/ap/ap_config.c | 292 +- src/ap/ap_config.h | 123 +- src/ap/ap_drv_ops.c | 158 +- src/ap/ap_drv_ops.h | 38 +- src/ap/ap_list.c | 4 - src/ap/authsrv.c | 87 +- src/ap/beacon.c | 604 +- src/ap/beacon.h | 2 + src/ap/ctrl_iface_ap.c | 85 +- src/ap/dfs.c | 315 +- src/ap/dfs.h | 3 + src/ap/dhcp_snoop.c | 8 +- src/ap/dpp_hostapd.c | 1003 +- src/ap/dpp_hostapd.h | 11 + src/ap/drv_callbacks.c | 362 +- src/ap/fils_hlp.c | 36 +- src/ap/gas_serv.c | 10 +- src/ap/hostapd.c | 255 +- src/ap/hostapd.h | 57 +- src/ap/hs20.c | 6 +- src/ap/hw_features.c | 367 +- src/ap/hw_features.h | 22 +- src/ap/iapp.c | 542 - src/ap/iapp.h | 39 - src/ap/ieee802_11.c | 2415 +++- src/ap/ieee802_11.h | 24 +- src/ap/ieee802_11_auth.c | 172 +- src/ap/ieee802_11_auth.h | 17 +- src/ap/ieee802_11_he.c | 171 +- src/ap/ieee802_11_ht.c | 30 +- src/ap/ieee802_11_shared.c | 172 +- src/ap/ieee802_11_vht.c | 174 +- src/ap/ieee802_1x.c | 482 +- src/ap/ieee802_1x.h | 7 +- src/ap/neighbor_db.c | 58 +- src/ap/neighbor_db.h | 1 + src/ap/pmksa_cache_auth.c | 5 + src/ap/preauth_auth.c | 2 +- src/ap/sta_info.c | 111 +- src/ap/sta_info.h | 53 +- src/ap/utils.c | 4 + src/ap/vlan_init.c | 5 +- src/ap/wmm.c | 14 +- src/ap/wnm_ap.c | 83 +- src/ap/wpa_auth.c | 1385 ++- src/ap/wpa_auth.h | 98 +- src/ap/wpa_auth_ft.c | 386 +- src/ap/wpa_auth_glue.c | 336 +- src/ap/wpa_auth_i.h | 71 +- src/ap/wpa_auth_ie.c | 444 +- src/ap/wpa_auth_ie.h | 35 - src/ap/wpa_auth_kay.c | 12 +- src/ap/wps_hostapd.c | 230 +- src/build.rules | 109 + src/common/Makefile | 18 +- src/common/brcm_vendor.h | 156 + src/common/common_module_tests.c | 392 +- src/common/defs.h | 86 +- src/common/dhcp.h | 2 +- src/common/dpp.c | 11695 +++++-------------- src/common/dpp.h | 245 +- src/common/dpp_auth.c | 1977 ++++ src/common/dpp_backup.c | 1265 ++ src/common/dpp_crypto.c | 3329 ++++++ src/common/dpp_i.h | 160 + src/common/dpp_pkex.c | 1324 +++ src/common/dpp_reconfig.c | 958 ++ src/common/dpp_tcp.c | 1794 +++ src/common/gas_server.c | 140 +- src/common/gas_server.h | 9 +- src/common/hw_features_common.c | 427 +- src/common/hw_features_common.h | 26 +- src/common/ieee802_11_common.c | 760 +- src/common/ieee802_11_common.h | 67 +- src/common/ieee802_11_defs.h | 246 +- src/common/ocv.c | 39 +- src/common/ocv.h | 13 +- src/common/privsep_commands.h | 1 + src/common/ptksa_cache.c | 321 + src/common/ptksa_cache.h | 79 + src/common/qca-vendor.h | 3750 +++++- src/common/sae.c | 1330 ++- src/common/sae.h | 107 +- src/common/sae_pk.c | 884 ++ src/common/version.h | 2 +- src/common/wpa_common.c | 1240 +- src/common/wpa_common.h | 207 +- src/common/wpa_ctrl.c | 5 +- src/common/wpa_ctrl.h | 41 +- src/crypto/.gitignore | 1 - src/crypto/Makefile | 19 +- src/crypto/crypto.h | 49 +- src/crypto/crypto_module_tests.c | 150 + src/crypto/crypto_openssl.c | 248 + src/crypto/crypto_wolfssl.c | 77 +- src/crypto/sha256.c | 6 +- src/crypto/sha384-tlsprf.c | 71 + src/crypto/sha384.c | 6 +- src/crypto/sha384.h | 3 + src/crypto/sha512.c | 6 +- src/crypto/tls.h | 14 + src/crypto/tls_openssl.c | 304 +- src/crypto/tls_wolfssl.c | 65 +- src/drivers/.gitignore | 2 - src/drivers/driver.h | 703 +- src/drivers/driver_atheros.c | 41 +- src/drivers/driver_bsd.c | 613 +- src/drivers/driver_common.c | 21 + src/drivers/driver_hostap.c | 24 +- src/drivers/driver_macsec_linux.c | 87 +- src/drivers/driver_macsec_qca.c | 34 +- src/drivers/driver_ndis.c | 20 +- src/drivers/driver_nl80211.c | 2123 +++- src/drivers/driver_nl80211.h | 65 +- src/drivers/driver_nl80211_android.c | 4 +- src/drivers/driver_nl80211_capa.c | 577 +- src/drivers/driver_nl80211_event.c | 574 +- src/drivers/driver_nl80211_monitor.c | 3 + src/drivers/driver_nl80211_scan.c | 51 +- src/drivers/driver_none.c | 8 - src/drivers/driver_openbsd.c | 10 +- src/drivers/driver_privsep.c | 18 +- src/drivers/driver_wext.c | 95 +- src/drivers/driver_wext.h | 4 - src/drivers/drivers.mak | 22 +- src/drivers/drivers.mk | 24 +- src/drivers/nl80211_copy.h | 951 +- src/eap_common/Makefile | 15 +- src/eap_common/eap_common.c | 8 +- src/eap_common/eap_common.h | 8 +- src/eap_common/eap_defs.h | 4 +- src/eap_common/eap_sim_common.c | 4 + src/eap_common/eap_teap_common.c | 72 +- src/eap_common/eap_teap_common.h | 22 +- src/eap_peer/.gitignore | 1 + src/eap_peer/Makefile | 18 +- src/eap_peer/eap.c | 220 +- src/eap_peer/eap.h | 13 +- src/eap_peer/eap_aka.c | 48 +- src/eap_peer/eap_config.h | 408 +- src/eap_peer/eap_eke.c | 16 +- src/eap_peer/eap_fast.c | 54 +- src/eap_peer/eap_gpsk.c | 14 +- src/eap_peer/eap_gtc.c | 8 +- src/eap_peer/eap_i.h | 42 +- src/eap_peer/eap_ikev2.c | 28 +- src/eap_peer/eap_leap.c | 44 +- src/eap_peer/eap_md5.c | 12 +- src/eap_peer/eap_methods.c | 12 +- src/eap_peer/eap_methods.h | 14 +- src/eap_peer/eap_mschapv2.c | 32 +- src/eap_peer/eap_otp.c | 8 +- src/eap_peer/eap_pax.c | 50 +- src/eap_peer/eap_peap.c | 71 +- src/eap_peer/eap_psk.c | 22 +- src/eap_peer/eap_pwd.c | 22 +- src/eap_peer/eap_sake.c | 26 +- src/eap_peer/eap_sim.c | 44 +- src/eap_peer/eap_teap.c | 201 +- src/eap_peer/eap_tls.c | 42 +- src/eap_peer/eap_tls_common.c | 103 +- src/eap_peer/eap_tls_common.h | 10 +- src/eap_peer/eap_tnc.c | 32 +- src/eap_peer/eap_ttls.c | 88 +- src/eap_peer/eap_vendor_test.c | 16 +- src/eap_peer/eap_wsc.c | 24 +- src/eap_peer/ikev2.c | 10 +- src/eap_peer/tncc.c | 5 +- src/eap_server/Makefile | 15 +- src/eap_server/eap.h | 172 +- src/eap_server/eap_i.h | 67 +- src/eap_server/eap_methods.h | 9 +- src/eap_server/eap_server.c | 291 +- src/eap_server/eap_server_aka.c | 74 +- src/eap_server/eap_server_eke.c | 39 +- src/eap_server/eap_server_fast.c | 106 +- src/eap_server/eap_server_gpsk.c | 37 +- src/eap_server/eap_server_gtc.c | 12 +- src/eap_server/eap_server_identity.c | 14 +- src/eap_server/eap_server_ikev2.c | 22 +- src/eap_server/eap_server_md5.c | 14 +- src/eap_server/eap_server_methods.c | 10 +- src/eap_server/eap_server_mschapv2.c | 22 +- src/eap_server/eap_server_pax.c | 32 +- src/eap_server/eap_server_peap.c | 103 +- src/eap_server/eap_server_psk.c | 34 +- src/eap_server/eap_server_pwd.c | 22 +- src/eap_server/eap_server_sake.c | 38 +- src/eap_server/eap_server_sim.c | 66 +- src/eap_server/eap_server_teap.c | 309 +- src/eap_server/eap_server_tls.c | 54 +- src/eap_server/eap_server_tls_common.c | 93 +- src/eap_server/eap_server_tnc.c | 26 +- src/eap_server/eap_server_ttls.c | 96 +- src/eap_server/eap_server_vendor_test.c | 12 +- src/eap_server/eap_server_wsc.c | 24 +- src/eap_server/eap_tls_common.h | 2 +- src/eap_server/tncs.c | 5 +- src/eapol_auth/Makefile | 16 +- src/eapol_auth/eapol_auth_sm.c | 206 +- src/eapol_auth/eapol_auth_sm.h | 26 +- src/eapol_auth/eapol_auth_sm_i.h | 40 +- src/eapol_supp/Makefile | 15 +- src/eapol_supp/eapol_supp_sm.c | 218 +- src/eapol_supp/eapol_supp_sm.h | 29 +- src/fst/fst.c | 25 +- src/fst/fst.h | 23 +- src/fst/fst_ctrl_aux.h | 4 +- src/fst/fst_ctrl_iface.c | 48 +- src/fst/fst_ctrl_iface.h | 2 +- src/fst/fst_group.c | 10 +- src/fst/fst_group.h | 4 +- src/fst/fst_iface.c | 8 +- src/fst/fst_iface.h | 8 +- src/fst/fst_session.c | 96 +- src/fst/fst_session.h | 12 +- src/l2_packet/Makefile | 15 +- src/l2_packet/l2_packet.h | 4 + src/l2_packet/l2_packet_freebsd.c | 2 +- src/l2_packet/l2_packet_linux.c | 11 +- src/l2_packet/l2_packet_ndis.c | 3 +- src/l2_packet/l2_packet_none.c | 4 +- src/l2_packet/l2_packet_pcap.c | 4 +- src/l2_packet/l2_packet_privsep.c | 3 +- src/l2_packet/l2_packet_winpcap.c | 3 + src/lib.rules | 38 +- src/objs.mk | 3 + src/p2p/Makefile | 15 +- src/p2p/p2p.c | 45 +- src/p2p/p2p.h | 14 +- src/p2p/p2p_go_neg.c | 9 + src/pae/ieee802_1x_cp.c | 177 +- src/pae/ieee802_1x_cp.h | 10 +- src/pae/ieee802_1x_kay.c | 608 +- src/pae/ieee802_1x_kay.h | 68 +- src/pae/ieee802_1x_kay_i.h | 40 +- src/pae/ieee802_1x_secy_ops.c | 22 +- src/pae/ieee802_1x_secy_ops.h | 8 +- src/radius/.gitignore | 1 - src/radius/Makefile | 16 +- src/radius/radius.c | 2 +- src/radius/radius.h | 3 + src/radius/radius_client.c | 52 +- src/radius/radius_client.h | 5 + src/radius/radius_server.c | 283 +- src/radius/radius_server.h | 142 +- src/rsn_supp/Makefile | 16 +- src/rsn_supp/pmksa_cache.c | 43 +- src/rsn_supp/pmksa_cache.h | 1 + src/rsn_supp/preauth.c | 24 +- src/rsn_supp/tdls.c | 69 +- src/rsn_supp/wpa.c | 737 +- src/rsn_supp/wpa.h | 82 +- src/rsn_supp/wpa_ft.c | 399 +- src/rsn_supp/wpa_i.h | 88 +- src/rsn_supp/wpa_ie.c | 317 +- src/rsn_supp/wpa_ie.h | 52 +- src/tls/.gitignore | 1 - src/tls/Makefile | 17 +- src/tls/asn1.c | 396 +- src/tls/asn1.h | 146 +- src/tls/pkcs1.c | 55 +- src/tls/pkcs5.c | 78 +- src/tls/pkcs8.c | 59 +- src/tls/rsa.c | 23 +- src/tls/tlsv1_client.c | 29 +- src/tls/tlsv1_client_i.h | 4 +- src/tls/tlsv1_client_ocsp.c | 180 +- src/tls/tlsv1_client_read.c | 10 +- src/tls/tlsv1_client_write.c | 18 +- src/tls/tlsv1_cred.c | 247 +- src/tls/x509v3.c | 419 +- src/tls/x509v3.h | 7 + src/utils/.gitignore | 1 - src/utils/Makefile | 17 +- src/utils/base64.c | 59 +- src/utils/base64.h | 13 +- src/utils/browser-android.c | 2 +- src/utils/browser-system.c | 2 +- src/utils/browser-wpadebug.c | 2 +- src/utils/browser.c | 210 +- src/utils/browser.h | 4 +- src/utils/common.c | 38 +- src/utils/common.h | 8 +- src/utils/config.c | 97 + src/utils/config.h | 29 + src/utils/eloop.c | 47 +- src/utils/eloop_win.c | 8 +- src/utils/ext_password.c | 3 + src/utils/ext_password_file.c | 136 + src/utils/ext_password_i.h | 4 + src/utils/http-utils.h | 6 +- src/utils/includes.h | 1 + src/utils/json.c | 122 +- src/utils/json.h | 15 + src/utils/list.h | 8 +- src/utils/os_internal.c | 6 + src/utils/os_unix.c | 13 +- src/utils/platform.h | 23 +- src/utils/radiotap.c | 12 +- src/utils/radiotap.h | 407 +- src/utils/state_machine.h | 8 +- src/utils/trace.c | 11 + src/utils/utils_module_tests.c | 39 +- src/utils/wpa_debug.c | 147 +- src/utils/wpa_debug.h | 3 - src/utils/wpabuf.h | 27 + src/utils/xml_libxml2.c | 2 +- src/wps/Makefile | 15 +- src/wps/upnp_xml.c | 2 +- src/wps/wps.h | 19 +- src/wps/wps_attr_build.c | 15 +- src/wps/wps_attr_process.c | 9 +- src/wps/wps_dev_attr.c | 17 + src/wps/wps_dev_attr.h | 1 + src/wps/wps_enrollee.c | 11 + src/wps/wps_er.c | 4 +- src/wps/wps_registrar.c | 97 +- src/wps/wps_upnp.c | 25 +- src/wps/wps_upnp_ap.c | 4 +- src/wps/wps_upnp_event.c | 27 +- src/wps/wps_upnp_i.h | 9 +- src/wps/wps_upnp_web.c | 4 +- tests/.gitignore | 3 + tests/Makefile | 99 + tests/README | 123 + tests/cipher-and-key-mgmt-testing.txt | 377 + tests/fuzzing/README | 23 + tests/fuzzing/ap-mgmt/.gitignore | 1 + tests/fuzzing/ap-mgmt/Makefile | 44 + tests/fuzzing/ap-mgmt/ap-mgmt.c | 167 + tests/fuzzing/ap-mgmt/corpus/multi-sae-ffc.dat | Bin 0 -> 506 bytes tests/fuzzing/ap-mgmt/corpus/multi-sae.dat | Bin 0 -> 346 bytes tests/fuzzing/ap-mgmt/corpus/multi.dat | Bin 0 -> 246 bytes tests/fuzzing/asn1/.gitignore | 1 + tests/fuzzing/asn1/Makefile | 23 + tests/fuzzing/asn1/asn1.c | 184 + tests/fuzzing/asn1/corpus/ca.der | Bin 0 -> 560 bytes .../asn1/corpus/ocsp-multi-server-cache.der | Bin 0 -> 346 bytes tests/fuzzing/asn1/corpus/ocsp-req.der | Bin 0 -> 76 bytes tests/fuzzing/build-test.sh | 19 + tests/fuzzing/dpp-uri/.gitignore | 1 + tests/fuzzing/dpp-uri/Makefile | 43 + tests/fuzzing/dpp-uri/corpus/1.dat | 1 + tests/fuzzing/dpp-uri/corpus/2.dat | 1 + tests/fuzzing/dpp-uri/corpus/3.dat | 1 + tests/fuzzing/dpp-uri/dpp-uri.c | 51 + tests/fuzzing/eap-aka-peer/.gitignore | 1 + tests/fuzzing/eap-aka-peer/Makefile | 26 + tests/fuzzing/eap-aka-peer/corpus/server.msg | Bin 0 -> 520 bytes tests/fuzzing/eap-aka-peer/eap-aka-peer.c | 131 + tests/fuzzing/eap-mschapv2-peer/.gitignore | 1 + tests/fuzzing/eap-mschapv2-peer/Makefile | 25 + tests/fuzzing/eap-mschapv2-peer/corpus/server.msg | Bin 0 -> 304 bytes .../fuzzing/eap-mschapv2-peer/eap-mschapv2-peer.c | 152 + tests/fuzzing/eap-sim-peer/.gitignore | 1 + tests/fuzzing/eap-sim-peer/Makefile | 26 + tests/fuzzing/eap-sim-peer/corpus/server.msg | Bin 0 -> 340 bytes tests/fuzzing/eap-sim-peer/eap-sim-peer.c | 125 + tests/fuzzing/eapol-key-auth/.gitignore | 1 + tests/fuzzing/eapol-key-auth/Makefile | 34 + tests/fuzzing/eapol-key-auth/corpus/supp.msg | Bin 0 -> 549 bytes tests/fuzzing/eapol-key-auth/eapol-key-auth.c | 328 + tests/fuzzing/eapol-key-supp/.gitignore | 1 + tests/fuzzing/eapol-key-supp/Makefile | 30 + tests/fuzzing/eapol-key-supp/corpus/auth.msg | Bin 0 -> 580 bytes tests/fuzzing/eapol-key-supp/eapol-key-supp.c | 331 + tests/fuzzing/eapol-supp/.gitignore | 1 + tests/fuzzing/eapol-supp/Makefile | 28 + .../fuzzing/eapol-supp/corpus/eap-req-identity.dat | Bin 0 -> 9 bytes tests/fuzzing/eapol-supp/corpus/eap-req-sim.dat | Bin 0 -> 24 bytes tests/fuzzing/eapol-supp/corpus/eapol-key-m1.dat | Bin 0 -> 99 bytes tests/fuzzing/eapol-supp/eapol-supp.c | 198 + tests/fuzzing/fuzzer-common.c | 56 + tests/fuzzing/fuzzer-common.h | 14 + tests/fuzzing/json/.gitignore | 1 + tests/fuzzing/json/Makefile | 23 + tests/fuzzing/json/corpus/1.json | 1 + tests/fuzzing/json/corpus/2.json | 1 + tests/fuzzing/json/corpus/3.json | 1 + tests/fuzzing/json/json.c | 38 + tests/fuzzing/p2p/.gitignore | 1 + tests/fuzzing/p2p/Makefile | 23 + tests/fuzzing/p2p/corpus/go-neg-req.dat | Bin 0 -> 155 bytes tests/fuzzing/p2p/corpus/invitation-req.dat | Bin 0 -> 123 bytes tests/fuzzing/p2p/corpus/p2ps-pd-req.dat | Bin 0 -> 189 bytes tests/fuzzing/p2p/corpus/proberesp-go.dat | Bin 0 -> 306 bytes tests/fuzzing/p2p/corpus/proberesp.dat | Bin 0 -> 209 bytes tests/fuzzing/p2p/p2p.c | 178 + tests/fuzzing/rules.include | 31 + tests/fuzzing/sae/.gitignore | 1 + tests/fuzzing/sae/Makefile | 28 + .../sae/corpus/sae-commit-h2e-rejected-groups.dat | Bin 0 -> 102 bytes tests/fuzzing/sae/corpus/sae-commit-h2e-token.dat | Bin 0 -> 101 bytes tests/fuzzing/sae/corpus/sae-commit-pw-id.dat | Bin 0 -> 101 bytes tests/fuzzing/sae/corpus/sae-commit-token.dat | Bin 0 -> 130 bytes tests/fuzzing/sae/corpus/sae-commit-valid.dat | Bin 0 -> 98 bytes tests/fuzzing/sae/sae.c | 39 + tests/fuzzing/tls-client/.gitignore | 1 + tests/fuzzing/tls-client/Makefile | 32 + tests/fuzzing/tls-client/corpus/server.msg | Bin 0 -> 1902 bytes tests/fuzzing/tls-client/tls-client.c | 154 + tests/fuzzing/tls-server/.gitignore | 1 + tests/fuzzing/tls-server/Makefile | 32 + tests/fuzzing/tls-server/corpus/client.msg | Bin 0 -> 391 bytes tests/fuzzing/tls-server/tls-server.c | 157 + tests/fuzzing/wnm/.gitignore | 1 + tests/fuzzing/wnm/Makefile | 60 + tests/fuzzing/wnm/corpus/bss-tm-req.dat | Bin 0 -> 31 bytes tests/fuzzing/wnm/corpus/oss-fuzz-0001.dat | Bin 0 -> 64 bytes tests/fuzzing/wnm/corpus/oss-fuzz-0002.dat | Bin 0 -> 104 bytes tests/fuzzing/wnm/corpus/wnm-notif.dat | Bin 0 -> 56 bytes tests/fuzzing/wnm/wnm.c | 99 + tests/fuzzing/x509/.gitignore | 1 + tests/fuzzing/x509/Makefile | 27 + tests/fuzzing/x509/corpus/ca.der | Bin 0 -> 560 bytes tests/fuzzing/x509/corpus/oss-fuzz-15408 | 1 + tests/fuzzing/x509/x509.c | 25 + tests/hwsim/.gitignore | 1 + tests/hwsim/README | 220 + tests/hwsim/auth_serv/as.conf | 27 + tests/hwsim/auth_serv/as2.conf | 24 + tests/hwsim/auth_serv/ca-and-crl-expired.pem | 90 + tests/hwsim/auth_serv/ca-and-crl.pem | 90 + tests/hwsim/auth_serv/ca-incorrect-key.pem | 28 + tests/hwsim/auth_serv/ca-incorrect.der | Bin 0 -> 902 bytes tests/hwsim/auth_serv/ca-incorrect.pem | 79 + tests/hwsim/auth_serv/ca-key.pem | 28 + tests/hwsim/auth_serv/ca.der | Bin 0 -> 868 bytes tests/hwsim/auth_serv/ca.pem | 79 + tests/hwsim/auth_serv/dh.conf | 8 + tests/hwsim/auth_serv/dh2.conf | 8 + tests/hwsim/auth_serv/dh_param_3072.pem | 11 + tests/hwsim/auth_serv/dsaparam.pem | 14 + tests/hwsim/auth_serv/eap_user.conf | 167 + tests/hwsim/auth_serv/eap_user_vlan.conf | 7 + tests/hwsim/auth_serv/ec-ca-openssl.cnf | 111 + tests/hwsim/auth_serv/ec-ca.key | 8 + tests/hwsim/auth_serv/ec-ca.pem | 13 + tests/hwsim/auth_serv/ec-generate.sh | 53 + tests/hwsim/auth_serv/ec-server.key | 8 + tests/hwsim/auth_serv/ec-server.pem | 53 + tests/hwsim/auth_serv/ec-user.key | 8 + tests/hwsim/auth_serv/ec-user.pem | 52 + tests/hwsim/auth_serv/ec2-ca.key | 9 + tests/hwsim/auth_serv/ec2-ca.pem | 15 + tests/hwsim/auth_serv/ec2-generate.sh | 67 + tests/hwsim/auth_serv/ec2-server.key | 9 + tests/hwsim/auth_serv/ec2-server.pem | 58 + tests/hwsim/auth_serv/ec2-user-p256.key | 8 + tests/hwsim/auth_serv/ec2-user-p256.pem | 56 + tests/hwsim/auth_serv/ec2-user.key | 9 + tests/hwsim/auth_serv/ec2-user.pem | 57 + tests/hwsim/auth_serv/hlr_auc_gw.gsm | 17 + tests/hwsim/auth_serv/hlr_auc_gw.milenage_db | 16 + tests/hwsim/auth_serv/iCA-server/ca-and-root.pem | 160 + tests/hwsim/auth_serv/iCA-server/cacert.pem | 81 + tests/hwsim/auth_serv/iCA-server/careq.pem | 16 + tests/hwsim/auth_serv/iCA-server/index.txt | 2 + tests/hwsim/auth_serv/iCA-server/index.txt.attr | 1 + tests/hwsim/auth_serv/iCA-server/private/cakey.pem | 28 + tests/hwsim/auth_serv/iCA-server/serial | 1 + .../hwsim/auth_serv/iCA-server/server-revoked.key | 28 + .../hwsim/auth_serv/iCA-server/server-revoked.pem | 86 + .../hwsim/auth_serv/iCA-server/server-revoked.req | 16 + .../iCA-server/server-revoked_and_ica.pem | 167 + tests/hwsim/auth_serv/iCA-server/server.key | 28 + tests/hwsim/auth_serv/iCA-server/server.pem | 86 + tests/hwsim/auth_serv/iCA-server/server.req | 16 + .../hwsim/auth_serv/iCA-server/server_and_ica.pem | 167 + tests/hwsim/auth_serv/iCA-user/ca-and-root.pem | 160 + tests/hwsim/auth_serv/iCA-user/cacert.pem | 81 + tests/hwsim/auth_serv/iCA-user/careq.pem | 16 + tests/hwsim/auth_serv/iCA-user/index.txt | 1 + tests/hwsim/auth_serv/iCA-user/index.txt.attr | 1 + tests/hwsim/auth_serv/iCA-user/private/cakey.pem | 28 + tests/hwsim/auth_serv/iCA-user/serial | 1 + tests/hwsim/auth_serv/iCA-user/user.key | 28 + tests/hwsim/auth_serv/iCA-user/user.pem | 85 + tests/hwsim/auth_serv/iCA-user/user.req | 16 + tests/hwsim/auth_serv/iCA-user/user_and_ica.pem | 166 + tests/hwsim/auth_serv/ica-generate.sh | 87 + tests/hwsim/auth_serv/index-revoked.txt | 8 + tests/hwsim/auth_serv/index-unknown.txt | 1 + tests/hwsim/auth_serv/index.txt | 8 + tests/hwsim/auth_serv/ocsp-multi-server-cache.der | Bin 0 -> 493 bytes tests/hwsim/auth_serv/ocsp-req.der | Bin 0 -> 76 bytes tests/hwsim/auth_serv/ocsp-responder.csr | 16 + tests/hwsim/auth_serv/ocsp-responder.key | 28 + tests/hwsim/auth_serv/ocsp-responder.pem | 76 + tests/hwsim/auth_serv/ocsp-server-cache.der | Bin 0 -> 490 bytes .../hwsim/auth_serv/ocsp-server-cache.der-invalid | Bin 0 -> 343 bytes tests/hwsim/auth_serv/openssl2.cnf | 147 + tests/hwsim/auth_serv/radius_clients.conf | 1 + tests/hwsim/auth_serv/radius_clients_ipv6.conf | 1 + tests/hwsim/auth_serv/radius_clients_none.conf | 4 + tests/hwsim/auth_serv/rootCA/index.txt | 6 + tests/hwsim/auth_serv/rootCA/index.txt.attr | 1 + tests/hwsim/auth_serv/rootCA/serial | 1 + tests/hwsim/auth_serv/rsa3072-ca.key | 40 + tests/hwsim/auth_serv/rsa3072-ca.pem | 27 + tests/hwsim/auth_serv/rsa3072-generate.sh | 83 + tests/hwsim/auth_serv/rsa3072-server.key | 40 + tests/hwsim/auth_serv/rsa3072-server.pem | 106 + tests/hwsim/auth_serv/rsa3072-server.req | 22 + tests/hwsim/auth_serv/rsa3072-user-rsa2048.key | 28 + tests/hwsim/auth_serv/rsa3072-user-rsa2048.pem | 96 + tests/hwsim/auth_serv/rsa3072-user-rsa2048.req | 16 + tests/hwsim/auth_serv/rsa3072-user.key | 40 + tests/hwsim/auth_serv/rsa3072-user.pem | 106 + tests/hwsim/auth_serv/rsa3072-user.req | 21 + tests/hwsim/auth_serv/server-certpol.csr | 22 + tests/hwsim/auth_serv/server-certpol.key | 40 + tests/hwsim/auth_serv/server-certpol.pem | 102 + tests/hwsim/auth_serv/server-certpol2.csr | 22 + tests/hwsim/auth_serv/server-certpol2.key | 40 + tests/hwsim/auth_serv/server-certpol2.pem | 102 + tests/hwsim/auth_serv/server-eku-client-server.csr | 16 + tests/hwsim/auth_serv/server-eku-client-server.key | 28 + tests/hwsim/auth_serv/server-eku-client-server.pem | 85 + tests/hwsim/auth_serv/server-eku-client.csr | 16 + tests/hwsim/auth_serv/server-eku-client.key | 28 + tests/hwsim/auth_serv/server-eku-client.pem | 85 + tests/hwsim/auth_serv/server-expired.csr | 16 + tests/hwsim/auth_serv/server-expired.key | 28 + tests/hwsim/auth_serv/server-expired.pem | 85 + tests/hwsim/auth_serv/server-extra.pkcs12 | Bin 0 -> 3418 bytes tests/hwsim/auth_serv/server-long-duration.csr | 27 + tests/hwsim/auth_serv/server-long-duration.key | 52 + tests/hwsim/auth_serv/server-long-duration.pem | 107 + tests/hwsim/auth_serv/server-no-dnsname.csr | 16 + tests/hwsim/auth_serv/server-no-dnsname.key | 28 + tests/hwsim/auth_serv/server-no-dnsname.pem | 85 + tests/hwsim/auth_serv/server.csr | 16 + tests/hwsim/auth_serv/server.key | 28 + tests/hwsim/auth_serv/server.pem | 87 + tests/hwsim/auth_serv/server.pkcs12 | Bin 0 -> 2549 bytes tests/hwsim/auth_serv/sha384-server.key | 40 + tests/hwsim/auth_serv/sha384-server.pem | 115 + tests/hwsim/auth_serv/sha384-user.key | 38 + tests/hwsim/auth_serv/sha384-user.pem | 113 + tests/hwsim/auth_serv/sha512-ca.key | 52 + tests/hwsim/auth_serv/sha512-ca.pem | 32 + tests/hwsim/auth_serv/sha512-generate.sh | 75 + tests/hwsim/auth_serv/sha512-server.key | 45 + tests/hwsim/auth_serv/sha512-server.pem | 120 + tests/hwsim/auth_serv/sha512-user.key | 44 + tests/hwsim/auth_serv/sha512-user.pem | 119 + tests/hwsim/auth_serv/update.sh | 181 + tests/hwsim/auth_serv/user.csr | 16 + tests/hwsim/auth_serv/user.key | 28 + tests/hwsim/auth_serv/user.key.pkcs8 | 30 + tests/hwsim/auth_serv/user.key.pkcs8.pkcs5v15 | 29 + tests/hwsim/auth_serv/user.pem | 85 + tests/hwsim/auth_serv/user.pkcs12 | Bin 0 -> 2517 bytes tests/hwsim/auth_serv/user.rsa-key | 27 + tests/hwsim/auth_serv/user2.pkcs12 | Bin 0 -> 3558 bytes tests/hwsim/auth_serv/user3.pkcs12 | Bin 0 -> 3524 bytes tests/hwsim/build.sh | 83 + tests/hwsim/check_kernel.py | 31 + tests/hwsim/devdetail.xml | 47 + tests/hwsim/devinfo.xml | 7 + tests/hwsim/dictionary.radius | 20 + tests/hwsim/example-hostapd.config | 115 + tests/hwsim/example-setup.txt | 191 + tests/hwsim/example-wpa_supplicant.config | 160 + tests/hwsim/fst_module_aux.py | 832 ++ tests/hwsim/fst_test_common.py | 97 + tests/hwsim/hostapd.py | 870 ++ tests/hwsim/hostapd.vlan | 2 + tests/hwsim/hostapd.vlan2 | 3 + tests/hwsim/hostapd.wlan3.vlan | 2 + tests/hwsim/hostapd.wlan4.vlan | 2 + tests/hwsim/hostapd.wpa_psk | 5 + tests/hwsim/hwsim.py | 114 + tests/hwsim/hwsim_utils.py | 246 + tests/hwsim/multi-bss-acs.conf | 28 + tests/hwsim/multi-bss-iface-per_sta_vif.conf | 42 + tests/hwsim/multi-bss-iface.conf | 40 + tests/hwsim/multi-bss.conf | 21 + tests/hwsim/netlink.py | 237 + tests/hwsim/nl80211.py | 357 + tests/hwsim/owe-bss-1.conf | 12 + tests/hwsim/owe-bss-2.conf | 16 + tests/hwsim/p2p0.conf | 3 + tests/hwsim/p2p1.conf | 3 + tests/hwsim/p2p2.conf | 3 + tests/hwsim/p2p_utils.py | 394 + tests/hwsim/pps-mo-1.xml | 62 + tests/hwsim/radius_das.py | 47 + tests/hwsim/remotehost.py | 258 + tests/hwsim/rfkill.py | 152 + tests/hwsim/run-all.sh | 162 + tests/hwsim/run-tests.py | 692 ++ tests/hwsim/start.sh | 213 + tests/hwsim/stop.sh | 80 + tests/hwsim/test_ap_acs.py | 688 ++ tests/hwsim/test_ap_ciphers.py | 1200 ++ tests/hwsim/test_ap_config.py | 581 + tests/hwsim/test_ap_csa.py | 189 + tests/hwsim/test_ap_dynamic.py | 586 + tests/hwsim/test_ap_eap.py | 7491 ++++++++++++ tests/hwsim/test_ap_ft.py | 3437 ++++++ tests/hwsim/test_ap_hs20.py | 6496 ++++++++++ tests/hwsim/test_ap_ht.py | 1609 +++ tests/hwsim/test_ap_mixed.py | 101 + tests/hwsim/test_ap_open.py | 1017 ++ tests/hwsim/test_ap_params.py | 911 ++ tests/hwsim/test_ap_pmf.py | 1204 ++ tests/hwsim/test_ap_psk.py | 3537 ++++++ tests/hwsim/test_ap_qosmap.py | 169 + tests/hwsim/test_ap_roam.py | 395 + tests/hwsim/test_ap_tdls.py | 652 ++ tests/hwsim/test_ap_track.py | 405 + tests/hwsim/test_ap_vht.py | 1333 +++ tests/hwsim/test_ap_vlan.py | 807 ++ tests/hwsim/test_ap_wps.py | 10466 +++++++++++++++++ tests/hwsim/test_authsrv.py | 262 + tests/hwsim/test_autoscan.py | 81 + tests/hwsim/test_bgscan.py | 315 + tests/hwsim/test_cert_check.py | 312 + tests/hwsim/test_cfg80211.py | 150 + tests/hwsim/test_connect_cmd.py | 235 + tests/hwsim/test_dbus.py | 6093 ++++++++++ tests/hwsim/test_dfs.py | 767 ++ tests/hwsim/test_dpp.py | 6350 ++++++++++ tests/hwsim/test_eap.py | 602 + tests/hwsim/test_eap_proto.py | 10377 ++++++++++++++++ tests/hwsim/test_erp.py | 741 ++ tests/hwsim/test_ext_password.py | 112 + tests/hwsim/test_fils.py | 2360 ++++ tests/hwsim/test_fst_config.py | 553 + tests/hwsim/test_fst_module.py | 2825 +++++ tests/hwsim/test_gas.py | 2053 ++++ tests/hwsim/test_hapd_ctrl.py | 1071 ++ tests/hwsim/test_he.py | 1170 ++ tests/hwsim/test_hostapd_oom.py | 173 + tests/hwsim/test_hs20_filter.py | 205 + tests/hwsim/test_hs20_pps_mo.py | 43 + tests/hwsim/test_ibss.py | 601 + tests/hwsim/test_ieee8021x.py | 514 + tests/hwsim/test_kernel.py | 128 + tests/hwsim/test_macsec.py | 890 ++ tests/hwsim/test_mbo.py | 596 + tests/hwsim/test_module_tests.py | 28 + tests/hwsim/test_monitor_interface.py | 94 + tests/hwsim/test_multi_ap.py | 353 + tests/hwsim/test_nfc_p2p.py | 848 ++ tests/hwsim/test_nfc_wps.py | 709 ++ tests/hwsim/test_oce.py | 185 + tests/hwsim/test_ocv.py | 1204 ++ tests/hwsim/test_offchannel_tx.py | 50 + tests/hwsim/test_owe.py | 928 ++ tests/hwsim/test_p2p_autogo.py | 936 ++ tests/hwsim/test_p2p_channel.py | 1384 +++ tests/hwsim/test_p2p_concurrency.py | 286 + tests/hwsim/test_p2p_device.py | 552 + tests/hwsim/test_p2p_discovery.py | 820 ++ tests/hwsim/test_p2p_ext.py | 384 + tests/hwsim/test_p2p_grpform.py | 1185 ++ tests/hwsim/test_p2p_invitation.py | 195 + tests/hwsim/test_p2p_messages.py | 2143 ++++ tests/hwsim/test_p2p_persistent.py | 676 ++ tests/hwsim/test_p2p_service.py | 586 + tests/hwsim/test_p2p_set.py | 128 + tests/hwsim/test_p2p_wifi_display.py | 475 + tests/hwsim/test_p2ps.py | 1689 +++ tests/hwsim/test_pasn.py | 683 ++ tests/hwsim/test_pmksa_cache.py | 1253 ++ tests/hwsim/test_radio_work.py | 133 + tests/hwsim/test_radius.py | 1710 +++ tests/hwsim/test_rfkill.py | 242 + tests/hwsim/test_rrm.py | 2128 ++++ tests/hwsim/test_sae.py | 2722 +++++ tests/hwsim/test_sae_pk.py | 462 + tests/hwsim/test_scan.py | 2025 ++++ tests/hwsim/test_sigma_dut.py | 5264 +++++++++ tests/hwsim/test_ssid.py | 127 + tests/hwsim/test_sta_dynamic.py | 329 + tests/hwsim/test_suite_b.py | 739 ++ tests/hwsim/test_tnc.py | 194 + tests/hwsim/test_wep.py | 172 + tests/hwsim/test_wext.py | 254 + tests/hwsim/test_wmediumd.py | 480 + tests/hwsim/test_wnm.py | 1951 ++++ tests/hwsim/test_wpas_ap.py | 905 ++ tests/hwsim/test_wpas_config.py | 656 ++ tests/hwsim/test_wpas_ctrl.py | 2149 ++++ tests/hwsim/test_wpas_mesh.py | 2534 ++++ tests/hwsim/test_wpas_wmm_ac.py | 400 + tests/hwsim/tnc/.gitignore | 4 + tests/hwsim/tnc/Makefile | 23 + tests/hwsim/tnc/hostap2_imc.c | 183 + tests/hwsim/tnc/hostap2_imv.c | 203 + tests/hwsim/tnc/hostap_imc.c | 72 + tests/hwsim/tnc/hostap_imv.c | 66 + tests/hwsim/tnc/tnc_config | 4 + tests/hwsim/tshark.py | 124 + tests/hwsim/utils.py | 314 + tests/hwsim/vm/.gitignore | 1 + tests/hwsim/vm/README | 80 + tests/hwsim/vm/bisect-run.sh | 43 + tests/hwsim/vm/build-codecov.sh | 57 + tests/hwsim/vm/combine-codecov.sh | 39 + tests/hwsim/vm/dbus.conf | 34 + tests/hwsim/vm/example-vm-setup.txt | 95 + tests/hwsim/vm/inside.sh | 164 + tests/hwsim/vm/kernel-config | 175 + tests/hwsim/vm/kernel-config.uml | 131 + tests/hwsim/vm/parallel-vm.py | 669 ++ tests/hwsim/vm/process-codecov.sh | 36 + tests/hwsim/vm/uevent.sh | 9 + tests/hwsim/vm/vm-run.sh | 202 + tests/hwsim/w1fi_logo.png | Bin 0 -> 7549 bytes tests/hwsim/wlantest.py | 277 + tests/hwsim/wpasupplicant.py | 1649 +++ tests/hwsim/wps-ctrl-cred | Bin 0 -> 67 bytes tests/hwsim/wps-ctrl-cred2 | Bin 0 -> 59 bytes tests/hwsim/wps-mixed-cred | Bin 0 -> 112 bytes tests/hwsim/wps-wep-cred | Bin 0 -> 53 bytes tests/remote/config.py | 87 + tests/remote/hwsim_wrapper.py | 126 + tests/remote/monitor.py | 193 + tests/remote/run-tests.py | 408 + tests/remote/rutils.py | 567 + tests/remote/test_devices.py | 124 + tests/remote/test_example.py | 141 + tests/remote/test_monitor.py | 52 + tests/test-aes.c | 624 + tests/test-base64.c | 42 + tests/test-https.c | 225 + tests/test-https_server.c | 275 + tests/test-list.c | 72 + tests/test-md4.c | 93 + tests/test-milenage.c | 814 ++ tests/test-rc4.c | 250 + tests/test-rsa-sig-ver.c | 206 + tests/test-sha1.c | 119 + tests/test-sha256.c | 119 + tests/test-x509v3.c | 62 + tests/test_x509v3_nist.sh | 144 + tests/test_x509v3_nist2.sh | 177 + wlantest/.gitignore | 4 + wlantest/Makefile | 87 + wlantest/bip.c | 133 + wlantest/bss.c | 373 + wlantest/ccmp.c | 367 + wlantest/ctrl.c | 1471 +++ wlantest/gcmp.c | 160 + wlantest/inject.c | 341 + wlantest/monitor.c | 172 + wlantest/process.c | 409 + wlantest/readpcap.c | 190 + wlantest/rx_data.c | 904 ++ wlantest/rx_eapol.c | 1317 +++ wlantest/rx_ip.c | 184 + wlantest/rx_mgmt.c | 2642 +++++ wlantest/rx_tdls.c | 618 + wlantest/sta.c | 232 + wlantest/test_vectors.c | 937 ++ wlantest/tkip.c | 428 + wlantest/wep.c | 104 + wlantest/wired.c | 295 + wlantest/wlantest.c | 505 + wlantest/wlantest.h | 336 + wlantest/wlantest_cli.c | 1865 +++ wlantest/wlantest_ctrl.h | 171 + wlantest/writepcap.c | 373 + wpa_supplicant/.gitignore | 14 + wpa_supplicant/Android.mk | 114 +- wpa_supplicant/ChangeLog | 10 +- wpa_supplicant/Makefile | 395 +- wpa_supplicant/README | 4 +- wpa_supplicant/README-DPP | 71 +- wpa_supplicant/README-HS20 | 2 +- wpa_supplicant/android.config | 16 +- wpa_supplicant/ap.c | 223 +- wpa_supplicant/binder/binder.h | 2 +- wpa_supplicant/blacklist.c | 141 - wpa_supplicant/blacklist.h | 24 - wpa_supplicant/bss.c | 145 +- wpa_supplicant/bss.h | 25 +- wpa_supplicant/bssid_ignore.c | 221 + wpa_supplicant/bssid_ignore.h | 33 + wpa_supplicant/config.c | 644 +- wpa_supplicant/config.h | 129 +- wpa_supplicant/config_file.c | 243 +- wpa_supplicant/config_ssid.h | 155 +- wpa_supplicant/config_winreg.c | 39 +- wpa_supplicant/ctrl_iface.c | 1153 +- wpa_supplicant/ctrl_iface.h | 6 +- wpa_supplicant/ctrl_iface_named_pipe.c | 2 +- wpa_supplicant/ctrl_iface_udp.c | 57 +- wpa_supplicant/ctrl_iface_unix.c | 30 +- wpa_supplicant/dbus/dbus_common.c | 23 +- wpa_supplicant/dbus/dbus_new.c | 76 +- wpa_supplicant/dbus/dbus_new_handlers.c | 424 +- wpa_supplicant/dbus/dbus_new_handlers.h | 6 + wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 77 +- wpa_supplicant/dbus/dbus_new_introspect.c | 2 +- wpa_supplicant/defconfig | 45 +- wpa_supplicant/doc/docbook/.gitignore | 1 + wpa_supplicant/doc/docbook/eapol_test.8 | 124 - wpa_supplicant/doc/docbook/eapol_test.sgml | 4 + wpa_supplicant/doc/docbook/manpage.links | 0 wpa_supplicant/doc/docbook/manpage.refs | 4 - wpa_supplicant/doc/docbook/wpa_background.8 | 84 - wpa_supplicant/doc/docbook/wpa_background.sgml | 4 + wpa_supplicant/doc/docbook/wpa_cli.8 | 219 - wpa_supplicant/doc/docbook/wpa_cli.sgml | 4 + wpa_supplicant/doc/docbook/wpa_gui.8 | 60 - wpa_supplicant/doc/docbook/wpa_gui.sgml | 4 + wpa_supplicant/doc/docbook/wpa_passphrase.8 | 40 - wpa_supplicant/doc/docbook/wpa_passphrase.sgml | 4 + wpa_supplicant/doc/docbook/wpa_priv.8 | 120 - wpa_supplicant/doc/docbook/wpa_priv.sgml | 4 + wpa_supplicant/doc/docbook/wpa_supplicant.8 | 553 - wpa_supplicant/doc/docbook/wpa_supplicant.conf.5 | 225 - .../doc/docbook/wpa_supplicant.conf.sgml | 4 + wpa_supplicant/doc/docbook/wpa_supplicant.sgml | 4 + wpa_supplicant/dpp_supplicant.c | 1809 ++- wpa_supplicant/dpp_supplicant.h | 15 + wpa_supplicant/driver_i.h | 109 +- wpa_supplicant/eapol_test.c | 9 +- wpa_supplicant/events.c | 1537 ++- wpa_supplicant/examples/dpp-nfc.py | 1186 ++ wpa_supplicant/examples/p2p-action-udhcp.sh | 4 +- wpa_supplicant/examples/p2p-action.sh | 4 +- wpa_supplicant/examples/p2p/p2p_connect.py | 18 +- wpa_supplicant/examples/p2p/p2p_disconnect.py | 2 +- wpa_supplicant/examples/p2p/p2p_find.py | 2 +- wpa_supplicant/examples/p2p/p2p_flush.py | 2 +- wpa_supplicant/examples/p2p/p2p_group_add.py | 14 +- wpa_supplicant/examples/p2p/p2p_invite.py | 10 +- wpa_supplicant/examples/p2p/p2p_listen.py | 2 +- wpa_supplicant/examples/p2p/p2p_stop_find.py | 2 +- wpa_supplicant/examples/udhcpd-p2p.conf | 12 +- wpa_supplicant/gas_query.c | 62 +- wpa_supplicant/gas_query.h | 2 +- wpa_supplicant/hs20_supplicant.c | 30 +- wpa_supplicant/ibss_rsn.c | 45 +- wpa_supplicant/interworking.c | 66 +- wpa_supplicant/interworking.h | 2 +- wpa_supplicant/mbo.c | 30 + wpa_supplicant/mesh.c | 243 +- wpa_supplicant/mesh.h | 6 +- wpa_supplicant/mesh_mpm.c | 49 +- wpa_supplicant/mesh_rsn.c | 26 +- wpa_supplicant/nmake.mak | 2 +- wpa_supplicant/notify.c | 10 +- wpa_supplicant/offchannel.c | 6 +- wpa_supplicant/op_classes.c | 239 +- wpa_supplicant/p2p_supplicant.c | 407 +- wpa_supplicant/p2p_supplicant.h | 16 +- wpa_supplicant/pasn_supplicant.c | 1584 +++ wpa_supplicant/preauth_test.c | 14 +- wpa_supplicant/robust_av.c | 155 + wpa_supplicant/rrm.c | 91 +- wpa_supplicant/scan.c | 489 +- wpa_supplicant/scan.h | 31 + wpa_supplicant/sme.c | 521 +- wpa_supplicant/sme.h | 8 +- .../systemd/wpa_supplicant-nl80211.service.arg.in | 2 +- .../systemd/wpa_supplicant-wired.service.arg.in | 2 +- .../systemd/wpa_supplicant.service.arg.in | 2 +- wpa_supplicant/twt.c | 142 + wpa_supplicant/vs2005/eapol_test/eapol_test.vcproj | 6 +- .../vs2005/wpa_supplicant/wpa_supplicant.vcproj | 6 +- wpa_supplicant/vs2005/wpasvc/wpasvc.vcproj | 6 +- wpa_supplicant/wmm_ac.c | 2 +- wpa_supplicant/wnm_sta.c | 29 +- wpa_supplicant/wpa_cli.c | 339 +- *** 315025 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Fri Mar 19 03:54:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FDBE5B6A14; Fri, 19 Mar 2021 03:54: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 4F1qlt74m8z3RHk; Fri, 19 Mar 2021 03:54: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 E5F9464FB; Fri, 19 Mar 2021 03:54: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 12J3so4G084686; Fri, 19 Mar 2021 03:54:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12J3soGr084685; Fri, 19 Mar 2021 03:54:50 GMT (envelope-from git) Date: Fri, 19 Mar 2021 03:54:50 GMT Message-Id: <202103190354.12J3soGr084685@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Daniel Ebdrup Jensen Subject: git: 794f9f43c8ab - main - rc.conf(5): Bump date on .Dd MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: debdrup X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 794f9f43c8ab6f217085713055cb4d76d77745a7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 03:54:51 -0000 The branch main has been updated by debdrup (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=794f9f43c8ab6f217085713055cb4d76d77745a7 commit 794f9f43c8ab6f217085713055cb4d76d77745a7 Author: Daniel Ebdrup Jensen AuthorDate: 2021-03-19 03:52:26 +0000 Commit: Daniel Ebdrup Jensen CommitDate: 2021-03-19 03:52:26 +0000 rc.conf(5): Bump date on .Dd Pointy hat to: me Reported by: lwhsu --- share/man/man5/rc.conf.5 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index ddf4ea120df5..c5261974b475 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 23, 2021 +.Dd March 19, 2021 .Dt RC.CONF 5 .Os .Sh NAME From owner-dev-commits-src-all@freebsd.org Fri Mar 19 08:41:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0C275BC17D for ; Fri, 19 Mar 2021 08:41: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 4F1y6g34vBz3wTV; Fri, 19 Mar 2021 08:41: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 5CF6711E79; Fri, 19 Mar 2021 08:41: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 12J8fVmu065541; Fri, 19 Mar 2021 08:41:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12J8fVAV065538; Fri, 19 Mar 2021 08:41:31 GMT (envelope-from git) Date: Fri, 19 Mar 2021 08:41:31 GMT Message-Id: <202103190841.12J8fVAV065538@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Stefan Eßer Subject: git: 893ecb52db5e - vendor/bc - Vendor import of bc 3.3.4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/vendor/bc X-Git-Reftype: branch X-Git-Commit: 893ecb52db5ed47d6c1e8698334d34e0df651612 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 08:41:31 -0000 The branch vendor/bc has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=893ecb52db5ed47d6c1e8698334d34e0df651612 commit 893ecb52db5ed47d6c1e8698334d34e0df651612 Author: Stefan Eßer AuthorDate: 2021-03-19 08:39:56 +0000 Commit: Stefan Eßer CommitDate: 2021-03-19 08:39:56 +0000 Vendor import of bc 3.3.4 --- Makefile.in | 2 +- NEWS.md | 9 +++++++++ README.md | 10 +--------- src/program.c | 4 ++++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Makefile.in b/Makefile.in index db8e24967996..aab7f9b569e5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -29,7 +29,7 @@ # .POSIX: -VERSION = 3.3.3 +VERSION = 3.3.4 SRC = %%SRC%% OBJ = %%OBJ%% diff --git a/NEWS.md b/NEWS.md index 3a3433077d50..3374ab57bc41 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,14 @@ # News +## 3.3.4 + +This is a production release that fixes a small bug. + +The bug was that output was not flushed before a `read()` call, so prompts +without a newline on the end were not flushed before the `read()` call. + +This is such a tiny bug that users only need to upgrade if they are affected. + ## 3.3.3 This is a production release with one tweak and fixes for manuals. diff --git a/README.md b/README.md index 2f95e16ed246..6a37a8bfb8da 100644 --- a/README.md +++ b/README.md @@ -42,8 +42,7 @@ Systems that are known to work: * HP-UX* (except for history) Please submit bug reports if this `bc` does not build out of the box on any -system besides Windows. If Windows binaries are needed, they can be found at -[xstatic][6]. +system besides Windows. ## Build @@ -52,12 +51,6 @@ This `bc` should build unmodified on any POSIX-compliant system. For more complex build requirements than the ones below, see the [build manual][5]. -### Pre-built Binaries - -It is possible to download pre-compiled binaries for a wide list of platforms, -including Linux- and Windows-based systems, from [xstatic][6]. This link always -points to the latest release of `bc`. - ### Default For the default build with optimization, use the following commands in the root @@ -329,7 +322,6 @@ Folders: [1]: https://www.gnu.org/software/bc/ [4]: ./LICENSE.md [5]: ./manuals/build.md -[6]: https://pkg.musl.cc/bc/ [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 diff --git a/src/program.c b/src/program.c index d4e386d4ac1b..6ab794736f79 100644 --- a/src/program.c +++ b/src/program.c @@ -1928,6 +1928,10 @@ void bc_program_exec(BcProgram *p) { case BC_INST_READ: { + // We want to flush output before + // this in case there is a prompt. + bc_file_flush(&vm.fout); + bc_program_read(p); ip = bc_vec_top(&p->stack); From owner-dev-commits-src-all@freebsd.org Fri Mar 19 08:41:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8B565BC17E for ; Fri, 19 Mar 2021 08:41: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 4F1y6h4RwNz4Qnj; Fri, 19 Mar 2021 08:41: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 824DD12035; Fri, 19 Mar 2021 08:41: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 12J8fWL1065565; Fri, 19 Mar 2021 08:41:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12J8fWQf065564; Fri, 19 Mar 2021 08:41:32 GMT (envelope-from git) Date: Fri, 19 Mar 2021 08:41:32 GMT Message-Id: <202103190841.12J8fWQf065564@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Stefan Eßer Subject: git: 45c118155fe6 - Create tag vendor/bc/3.3.4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/tags/vendor/bc/3.3.4 X-Git-Reftype: annotated tag X-Git-Commit: 45c118155fe6700e3c40003ac20762f96dbc92ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 08:41:32 -0000 The annotated tag vendor/bc/3.3.4 has been created by se: URL: https://cgit.FreeBSD.org/src/tag/?h=vendor/bc/3.3.4 tag vendor/bc/3.3.4 Tagger: Stefan Eßer TaggerDate: 2021-03-19 08:40:16 +0000 Tag version 3.3.4 commit 893ecb52db5ed47d6c1e8698334d34e0df651612 Author: Stefan Eßer AuthorDate: 2021-03-19 08:39:56 +0000 Commit: Stefan Eßer CommitDate: 2021-03-19 08:39:56 +0000 Vendor import of bc 3.3.4 From owner-dev-commits-src-all@freebsd.org Fri Mar 19 08:49:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D65EC5BC826; Fri, 19 Mar 2021 08:49: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 4F1yHr5kxFz4RvY; Fri, 19 Mar 2021 08:49: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 B831911FD1; Fri, 19 Mar 2021 08:49: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 12J8nSJ9069235; Fri, 19 Mar 2021 08:49:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12J8nSoX069232; Fri, 19 Mar 2021 08:49:28 GMT (envelope-from git) Date: Fri, 19 Mar 2021 08:49:28 GMT Message-Id: <202103190849.12J8nSoX069232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Stefan Eßer Subject: git: 9300e88039d4 - main - bc: upgrade to version 3.3.4 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: 9300e88039d40a57cb4148e7de7a1808f8ca8d20 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 08:49:28 -0000 The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=9300e88039d40a57cb4148e7de7a1808f8ca8d20 commit 9300e88039d40a57cb4148e7de7a1808f8ca8d20 Merge: 794f9f43c8ab 893ecb52db5e Author: Stefan Eßer AuthorDate: 2021-03-19 08:46:12 +0000 Commit: Stefan Eßer CommitDate: 2021-03-19 08:46:12 +0000 bc: upgrade to version 3.3.4 This upgrade performs an implicit flush of the output if the script funcion read() is called, to make sure a prompt that does not end in a new-line is correctly displayed in line-buffered output mode. Merge commit '893ecb52db5ed47d6c1e8698334d34e0df651612' contrib/bc/Makefile.in | 2 +- contrib/bc/NEWS.md | 9 +++++++++ contrib/bc/README.md | 10 +--------- contrib/bc/src/program.c | 4 ++++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --cc contrib/bc/README.md index 2f95e16ed246,000000000000..6a37a8bfb8da mode 100644,000000..100644 --- a/contrib/bc/README.md +++ b/contrib/bc/README.md @@@ -1,348 -1,0 +1,340 @@@ +# `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. + +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: + +* Linux +* FreeBSD +* OpenBSD +* NetBSD +* Mac OSX +* Solaris* (as long as the Solaris version supports POSIX 2008) +* AIX +* HP-UX* (except for history) + +Please submit bug reports if this `bc` does not build out of the box on any - system besides Windows. If Windows binaries are needed, they can be found at - [xstatic][6]. ++system besides Windows. + +## Build + +This `bc` should build unmodified on any POSIX-compliant system. + +For more complex build requirements than the ones below, see the +[build manual][5]. + - ### Pre-built Binaries - - It is possible to download pre-compiled binaries for a wide list of platforms, - including Linux- and Windows-based systems, from [xstatic][6]. This link always - points to the latest release of `bc`. - +### Default + +For the default build with optimization, use the following commands in the root +directory: + +``` +./configure.sh -O3 +make +``` + +### 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 + +For debug builds, use the following commands in the root directory: + +``` +./configure.sh -g +make +``` + +### 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 + +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`. + +### Package and Distro Maintainers + +#### 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 + +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 + +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 + +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 + +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`. + +* 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, +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. + +## 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). + 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. + 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 - [6]: https://pkg.musl.cc/bc/ +[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 From owner-dev-commits-src-all@freebsd.org Fri Mar 19 12:52:58 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8364D572666; Fri, 19 Mar 2021 12:52: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 4F23hp3K8Pz4jLX; Fri, 19 Mar 2021 12:52: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 64DFB15743; Fri, 19 Mar 2021 12:52: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 12JCqwvf097386; Fri, 19 Mar 2021 12:52:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JCqwql097385; Fri, 19 Mar 2021 12:52:58 GMT (envelope-from git) Date: Fri, 19 Mar 2021 12:52:58 GMT Message-Id: <202103191252.12JCqwql097385@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Li-Wen Hsu Subject: git: 8ef03ce6db33 - main - development(7): mention the Git mirror list in the manual page MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: lwhsu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8ef03ce6db330fcc20e800c4d15a9f4915c56c43 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 12:52:58 -0000 The branch main has been updated by lwhsu: URL: https://cgit.FreeBSD.org/src/commit/?id=8ef03ce6db330fcc20e800c4d15a9f4915c56c43 commit 8ef03ce6db330fcc20e800c4d15a9f4915c56c43 Author: Evgeniy Khramtsov AuthorDate: 2021-03-19 12:52:21 +0000 Commit: Li-Wen Hsu CommitDate: 2021-03-19 12:52:21 +0000 development(7): mention the Git mirror list in the manual page MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29234 --- share/man/man7/development.7 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/share/man/man7/development.7 b/share/man/man7/development.7 index 67f317b8ec26..6a2d872e506f 100644 --- a/share/man/man7/development.7 +++ b/share/man/man7/development.7 @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 17, 2021 +.Dd March 19, 2021 .Dt DEVELOPMENT 7 .Os .Sh NAME @@ -67,9 +67,9 @@ The push URL is: .Pp .Lk ssh://git@gitrepo.FreeBSD.org/src.git .Pp -There is also a public, read-only GitHub mirror at: +There is also a list of public, read-only Git mirrors at: .Pp -.Lk https://github.com/freebsd/freebsd-src +.Lk https://docs.FreeBSD.org/en/books/handbook/mirrors/#_external_mirrors .Pp The .Ql main From owner-dev-commits-src-all@freebsd.org Fri Mar 19 13:00:59 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 39FE15731C2; Fri, 19 Mar 2021 13:00: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 4F23t31BxQz4jqj; Fri, 19 Mar 2021 13:00: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 1C111156EA; Fri, 19 Mar 2021 13:00: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 12JD0xFj006938; Fri, 19 Mar 2021 13:00:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JD0xUX006937; Fri, 19 Mar 2021 13:00:59 GMT (envelope-from git) Date: Fri, 19 Mar 2021 13:00:59 GMT Message-Id: <202103191300.12JD0xUX006937@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: 534e161747f8 - stable/13 - libifconfig: Overhaul ifconfig_media_* interfaces MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 534e161747f80d6c972577a24b8ad22f6a5d60c4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 13:00:59 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=534e161747f80d6c972577a24b8ad22f6a5d60c4 commit 534e161747f80d6c972577a24b8ad22f6a5d60c4 Author: Ryan Moeller AuthorDate: 2021-03-02 10:29:17 +0000 Commit: Ryan Moeller CommitDate: 2021-03-19 13:00:19 +0000 libifconfig: Overhaul ifconfig_media_* interfaces Define an ifmedia_t type to use for ifmedia words. Add ifconfig_media_lookup_* functions to lookup ifmedia words by name. Get media options as an array of option names rather than formatting it as a comma-delimited list into a buffer. Sprinkle const on static the static description tables for peace of mind. Don't need to zero memory allocated by calloc. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D29029 (cherry picked from commit c4ba4aa547184ab401204096cdad9def4ab37964) --- lib/libifconfig/Makefile | 2 +- lib/libifconfig/Symbol.map | 9 +- lib/libifconfig/libifconfig.h | 69 +++++++- lib/libifconfig/libifconfig_media.c | 339 ++++++++++++++++++++++++------------ share/examples/libifconfig/status.c | 27 ++- 5 files changed, 324 insertions(+), 122 deletions(-) diff --git a/lib/libifconfig/Makefile b/lib/libifconfig/Makefile index 73dad36c1dc5..c6f006018427 100644 --- a/lib/libifconfig/Makefile +++ b/lib/libifconfig/Makefile @@ -7,7 +7,7 @@ INTERNALLIB= true LIBADD= m SHLIBDIR?= /lib -SHLIB_MAJOR= 1 +SHLIB_MAJOR= 2 VERSION_DEF= ${LIBCSRCDIR}/Versions.def SYMBOL_MAPS= ${.CURDIR}/Symbol.map diff --git a/lib/libifconfig/Symbol.map b/lib/libifconfig/Symbol.map index 782f78ec5e34..b40f304915b3 100644 --- a/lib/libifconfig/Symbol.map +++ b/lib/libifconfig/Symbol.map @@ -26,12 +26,17 @@ FBSD_1.6 { ifconfig_lagg_get_lagg_status; ifconfig_lagg_get_laggport_status; ifconfig_list_cloners; + ifconfig_media_get_downreason; ifconfig_media_get_mediareq; - ifconfig_media_get_options_string; + ifconfig_media_get_mode; + ifconfig_media_get_options; ifconfig_media_get_status; ifconfig_media_get_subtype; ifconfig_media_get_type; - ifconfig_media_get_downreason; + ifconfig_media_lookup_mode; + ifconfig_media_lookup_options; + ifconfig_media_lookup_subtype; + ifconfig_media_lookup_type; ifconfig_open; ifconfig_set_capability; ifconfig_set_description; diff --git a/lib/libifconfig/libifconfig.h b/lib/libifconfig/libifconfig.h index d8245ea13b23..e1cd6d1821a5 100644 --- a/lib/libifconfig/libifconfig.h +++ b/lib/libifconfig/libifconfig.h @@ -202,10 +202,73 @@ int ifconfig_get_ifstatus(ifconfig_handle_t *h, const char *name, */ int ifconfig_media_get_mediareq(ifconfig_handle_t *h, const char *name, struct ifmediareq **ifmr); -const char *ifconfig_media_get_type(int ifmw); -const char *ifconfig_media_get_subtype(int ifmw); + const char *ifconfig_media_get_status(const struct ifmediareq *ifmr); -void ifconfig_media_get_options_string(int ifmw, char *buf, size_t buflen); + +typedef int ifmedia_t; + +#define INVALID_IFMEDIA ((ifmedia_t)-1) + +/** Retrieve the name of a media type + * @param media The media to be named + * @return A pointer to the media type name, or NULL on failure + */ +const char *ifconfig_media_get_type(ifmedia_t media); + +/** Retrieve a media type by its name + * @param name The name of a media type + * @return The media type value, or INVALID_IFMEDIA on failure + */ +ifmedia_t ifconfig_media_lookup_type(const char *name); + +/** Retrieve the name of a media subtype + * @param media The media subtype to be named + * @return A pointer to the media subtype name, or NULL on failure + */ +const char *ifconfig_media_get_subtype(ifmedia_t media); + +/** Retrieve a media subtype by its name + * @param media The top level media type whose subtype we want + * @param name The name of a media subtype + * @return The media subtype value, or INVALID_IFMEDIA on failure + */ +ifmedia_t ifconfig_media_lookup_subtype(ifmedia_t media, const char *name); + +/** Retrieve the name of a media mode + * @param media The media mode to be named + * @return A pointer to the media mode name, or NULL on failure + */ +const char *ifconfig_media_get_mode(ifmedia_t media); + +/** Retrieve a media mode by its name + * @param media The top level media type whose mode we want + * @param name The name of a media mode + * @return The media mode value, or INVALID_IFMEDIA on failure + */ +ifmedia_t ifconfig_media_lookup_mode(ifmedia_t media, const char *name); + +/** Retrieve an array of media options + * @param media The media for which to obtain the options + * @return Pointer to an array of pointers to option names, + * terminated by a NULL pointer, or simply NULL on failure. + * The caller is responsible for freeing the array but not its + * contents. + */ +const char **ifconfig_media_get_options(ifmedia_t media); + +/** Retrieve an array of media options by names + * @param media The top level media type whose options we want + * @param opts Pointer to an array of string pointers naming options + * @param nopts Number of elements in the opts array + * @return Pointer to an array of media options, one for each option named + * in opts. NULL is returned instead with errno set to ENOMEM if + * allocating the return array fails or EINVAL if media is not + * valid. A media option in the array will be INVALID_IFMEDIA + * when lookup failed for the option named in that position in + * opts. The caller is responsible for freeing the array. + */ +ifmedia_t *ifconfig_media_lookup_options(ifmedia_t media, const char **opts, + size_t nopts); /** Retrieve the reason the interface is down * @param h An open ifconfig state object diff --git a/lib/libifconfig/libifconfig_media.c b/lib/libifconfig/libifconfig_media.c index d7ef507604be..e27f5900e3d3 100644 --- a/lib/libifconfig/libifconfig_media.c +++ b/lib/libifconfig/libifconfig_media.c @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -53,11 +54,9 @@ #include "libifconfig.h" #include "libifconfig_internal.h" - -static struct ifmedia_description *get_toptype_desc(int); -static struct ifmedia_type_to_subtype *get_toptype_ttos(int); -static struct ifmedia_description *get_subtype_desc(int, - struct ifmedia_type_to_subtype *ttos); +static const struct ifmedia_description *lookup_media_desc( + const struct ifmedia_description *, const char *); +static const struct ifmedia_type_to_subtype *get_toptype_ttos(ifmedia_t); #define IFM_OPMODE(x) \ ((x) & (IFM_IEEE80211_ADHOC | IFM_IEEE80211_HOSTAP | \ @@ -65,74 +64,100 @@ static struct ifmedia_description *get_subtype_desc(int, IFM_IEEE80211_MBSS)) #define IFM_IEEE80211_STA 0 -static struct ifmedia_description ifm_type_descriptions[] = +static const struct ifmedia_description + ifm_type_descriptions[] = IFM_TYPE_DESCRIPTIONS; -static struct ifmedia_description ifm_subtype_ethernet_descriptions[] = +static const struct ifmedia_description + ifm_subtype_ethernet_descriptions[] = IFM_SUBTYPE_ETHERNET_DESCRIPTIONS; -static struct ifmedia_description ifm_subtype_ethernet_aliases[] = +static const struct ifmedia_description + ifm_subtype_ethernet_aliases[] = IFM_SUBTYPE_ETHERNET_ALIASES; -static struct ifmedia_description ifm_subtype_ethernet_option_descriptions[] = +static const struct ifmedia_description + ifm_subtype_ethernet_option_descriptions[] = IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS; -static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] = +static const struct ifmedia_description + ifm_subtype_ieee80211_descriptions[] = IFM_SUBTYPE_IEEE80211_DESCRIPTIONS; -static struct ifmedia_description ifm_subtype_ieee80211_aliases[] = +static const struct ifmedia_description + ifm_subtype_ieee80211_aliases[] = IFM_SUBTYPE_IEEE80211_ALIASES; -static struct ifmedia_description ifm_subtype_ieee80211_option_descriptions[] = +static const struct ifmedia_description + ifm_subtype_ieee80211_option_descriptions[] = IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS; -static struct ifmedia_description ifm_subtype_ieee80211_mode_descriptions[] = +static const struct ifmedia_description + ifm_subtype_ieee80211_mode_descriptions[] = IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS; -static struct ifmedia_description ifm_subtype_ieee80211_mode_aliases[] = +static const struct ifmedia_description + ifm_subtype_ieee80211_mode_aliases[] = IFM_SUBTYPE_IEEE80211_MODE_ALIASES; -static struct ifmedia_description ifm_subtype_atm_descriptions[] = +static const struct ifmedia_description + ifm_subtype_atm_descriptions[] = IFM_SUBTYPE_ATM_DESCRIPTIONS; -static struct ifmedia_description ifm_subtype_atm_aliases[] = +static const struct ifmedia_description + ifm_subtype_atm_aliases[] = IFM_SUBTYPE_ATM_ALIASES; -static struct ifmedia_description ifm_subtype_atm_option_descriptions[] = +static const struct ifmedia_description + ifm_subtype_atm_option_descriptions[] = IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS; -static struct ifmedia_description ifm_subtype_shared_descriptions[] = +static const struct ifmedia_description + ifm_subtype_shared_descriptions[] = IFM_SUBTYPE_SHARED_DESCRIPTIONS; -static struct ifmedia_description ifm_subtype_shared_aliases[] = +static const struct ifmedia_description + ifm_subtype_shared_aliases[] = IFM_SUBTYPE_SHARED_ALIASES; -static struct ifmedia_description ifm_shared_option_descriptions[] = +static const struct ifmedia_description + ifm_shared_option_descriptions[] = IFM_SHARED_OPTION_DESCRIPTIONS; -static struct ifmedia_description ifm_shared_option_aliases[] = +static const struct ifmedia_description + ifm_shared_option_aliases[] = IFM_SHARED_OPTION_ALIASES; +static const struct ifmedia_description * +lookup_media_desc(const struct ifmedia_description *desc, const char *name) +{ + + for (; desc->ifmt_string != NULL; ++desc) + if (strcasecmp(desc->ifmt_string, name) == 0) + return (desc); + return (NULL); +} + struct ifmedia_type_to_subtype { struct { - struct ifmedia_description *desc; - int alias; + const struct ifmedia_description *desc; + bool alias; } subtypes[5]; struct { - struct ifmedia_description *desc; - int alias; + const struct ifmedia_description *desc; + bool alias; } options[4]; struct { - struct ifmedia_description *desc; - int alias; + const struct ifmedia_description *desc; + bool alias; } modes[3]; }; /* must be in the same order as IFM_TYPE_DESCRIPTIONS */ -static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = +static const struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = { { { @@ -192,83 +217,214 @@ static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = }, }; -static struct ifmedia_description * -get_toptype_desc(int ifmw) +static const struct ifmedia_type_to_subtype * +get_toptype_ttos(ifmedia_t media) { - struct ifmedia_description *desc; + const struct ifmedia_description *desc; + const struct ifmedia_type_to_subtype *ttos; - for (desc = ifm_type_descriptions; desc->ifmt_string != NULL; desc++) { - if (IFM_TYPE(ifmw) == desc->ifmt_word) { - break; - } + for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes; + desc->ifmt_string != NULL; desc++, ttos++) { + if (IFM_TYPE(media) == desc->ifmt_word) + return (ttos); } - - return (desc); + errno = ENOENT; + return (NULL); } -static struct ifmedia_type_to_subtype * -get_toptype_ttos(int ifmw) +const char * +ifconfig_media_get_type(ifmedia_t media) { - struct ifmedia_description *desc; - struct ifmedia_type_to_subtype *ttos; + const struct ifmedia_description *desc; - for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes; - desc->ifmt_string != NULL; desc++, ttos++) { - if (IFM_TYPE(ifmw) == desc->ifmt_word) { - break; - } + for (desc = ifm_type_descriptions; desc->ifmt_string != NULL; ++desc) { + if (IFM_TYPE(media) == desc->ifmt_word) + return (desc->ifmt_string); } + errno = ENOENT; + return (NULL); +} + +ifmedia_t +ifconfig_media_lookup_type(const char *name) +{ + const struct ifmedia_description *desc; - return (ttos); + desc = lookup_media_desc(ifm_type_descriptions, name); + return (desc == NULL ? INVALID_IFMEDIA : desc->ifmt_word); } -static struct ifmedia_description * -get_subtype_desc(int ifmw, - struct ifmedia_type_to_subtype *ttos) +const char * +ifconfig_media_get_subtype(ifmedia_t media) { - int i; - struct ifmedia_description *desc; + const struct ifmedia_description *desc; + const struct ifmedia_type_to_subtype *ttos; + + ttos = get_toptype_ttos(media); + if (ttos == NULL) { + errno = EINVAL; + return (NULL); + } - for (i = 0; ttos->subtypes[i].desc != NULL; i++) { - if (ttos->subtypes[i].alias) { + for (size_t i = 0; ttos->subtypes[i].desc != NULL; ++i) { + if (ttos->subtypes[i].alias) continue; - } for (desc = ttos->subtypes[i].desc; - desc->ifmt_string != NULL; desc++) { - if (IFM_SUBTYPE(ifmw) == desc->ifmt_word) { - return (desc); - } + desc->ifmt_string != NULL; ++desc) { + if (IFM_SUBTYPE(media) == desc->ifmt_word) + return (desc->ifmt_string); } } - + errno = ENOENT; return (NULL); } -const char * -ifconfig_media_get_type(int ifmw) +ifmedia_t +ifconfig_media_lookup_subtype(ifmedia_t media, const char *name) { - struct ifmedia_description *desc; + const struct ifmedia_description *desc; + const struct ifmedia_type_to_subtype *ttos; - /*int seen_option = 0, i;*/ + ttos = get_toptype_ttos(media); + if (ttos == NULL) { + errno = EINVAL; + return (INVALID_IFMEDIA); + } - /* Find the top-level interface type. */ - desc = get_toptype_desc(ifmw); - if (desc->ifmt_string == NULL) { - return (""); - } else { - return (desc->ifmt_string); + for (size_t i = 0; ttos->subtypes[i].desc != NULL; ++i) { + desc = lookup_media_desc(ttos->subtypes[i].desc, name); + if (desc != NULL) + return (desc->ifmt_word); } + errno = ENOENT; + return (INVALID_IFMEDIA); } const char * -ifconfig_media_get_subtype(int ifmw) +ifconfig_media_get_mode(ifmedia_t media) { - struct ifmedia_description *desc; - struct ifmedia_type_to_subtype *ttos; + const struct ifmedia_description *desc; + const struct ifmedia_type_to_subtype *ttos; + + ttos = get_toptype_ttos(media); + if (ttos == NULL) { + errno = EINVAL; + return (NULL); + } - ttos = get_toptype_ttos(ifmw); - desc = get_subtype_desc(ifmw, ttos); - return (desc->ifmt_string); + for (size_t i = 0; ttos->modes[i].desc != NULL; ++i) { + if (ttos->modes[i].alias) + continue; + for (desc = ttos->modes[i].desc; + desc->ifmt_string != NULL; ++desc) { + if (IFM_MODE(media) == desc->ifmt_word) + return (desc->ifmt_string); + } + } + errno = ENOENT; + return (NULL); +} + +ifmedia_t +ifconfig_media_lookup_mode(ifmedia_t media, const char *name) +{ + const struct ifmedia_description *desc; + const struct ifmedia_type_to_subtype *ttos; + + ttos = get_toptype_ttos(media); + if (ttos == NULL) { + errno = EINVAL; + return (INVALID_IFMEDIA); + } + + for (size_t i = 0; ttos->modes[i].desc != NULL; ++i) { + desc = lookup_media_desc(ttos->modes[i].desc, name); + if (desc != NULL) + return (desc->ifmt_word); + } + errno = ENOENT; + return (INVALID_IFMEDIA); +} + +const char ** +ifconfig_media_get_options(ifmedia_t media) +{ + const char **options; + const struct ifmedia_description *desc; + const struct ifmedia_type_to_subtype *ttos; + size_t n; + + ttos = get_toptype_ttos(media); + if (ttos == NULL) { + errno = EINVAL; + return (NULL); + } + + n = 0; + for (size_t i = 0; ttos->options[i].desc != NULL; ++i) { + if (ttos->options[i].alias) + continue; + for (desc = ttos->options[i].desc; + desc->ifmt_string != NULL; ++desc) { + if ((media & desc->ifmt_word) != 0) + ++n; + } + } + if (n == 0) { + errno = ENOENT; + return (NULL); + } + + options = calloc(n + 1, sizeof(*options)); + if (options == NULL) + return (NULL); + + options[n] = NULL; + n = 0; + for (size_t i = 0; ttos->options[i].desc != NULL; ++i) { + if (ttos->options[i].alias) + continue; + for (desc = ttos->options[i].desc; + desc->ifmt_string != NULL; ++desc) { + if ((media & desc->ifmt_word) != 0) { + options[n] = desc->ifmt_string; + ++n; + } + } + } + return (options); +} + +ifmedia_t * +ifconfig_media_lookup_options(ifmedia_t media, const char **opts, size_t nopts) +{ + ifmedia_t *options; + const struct ifmedia_description *desc, *opt; + const struct ifmedia_type_to_subtype *ttos; + + assert(opts != NULL); + assert(nopts > 0); + + ttos = get_toptype_ttos(media); + if (ttos == NULL) { + errno = EINVAL; + return (NULL); + } + + options = calloc(nopts, sizeof(*options)); + if (options == NULL) + return (NULL); + (void)memset(options, INVALID_IFMEDIA, nopts * sizeof(ifmedia_t)); + + for (size_t i = 0; ttos->options[i].desc != NULL; ++i) { + desc = ttos->options[i].desc; + for (size_t j = 0; j < nopts; ++j) { + opt = lookup_media_desc(desc, opts[j]); + if (opt != NULL) + options[j] = opt->ifmt_word; + } + } + return (options); } /*************************************************************************** @@ -295,7 +451,6 @@ ifconfig_media_get_mediareq(ifconfig_handle_t *h, const char *name, h->error.errcode = ENOMEM; return (-1); } - (void)memset(ms, 0, sizeof(*ms)); (void)strlcpy(ms->ifmr.ifm_name, name, sizeof(ms->ifmr.ifm_name)); /* @@ -363,36 +518,6 @@ ifconfig_media_get_status(const struct ifmediareq *ifmr) } } -void -ifconfig_media_get_options_string(int ifmw, char *buf, size_t buflen) -{ - struct ifmedia_type_to_subtype *ttos; - struct ifmedia_description *desc; - int i, seen_option = 0; - size_t len; - - assert(buflen > 0); - buf[0] = '\0'; - ttos = get_toptype_ttos(ifmw); - for (i = 0; ttos->options[i].desc != NULL; i++) { - if (ttos->options[i].alias) { - continue; - } - for (desc = ttos->options[i].desc; - desc->ifmt_string != NULL; desc++) { - if (ifmw & desc->ifmt_word) { - if (seen_option++) { - strlcat(buf, ",", buflen); - } - len = strlcat(buf, desc->ifmt_string, buflen); - assert(len < buflen); - buf += len; - buflen -= len; - } - } - } -} - int ifconfig_media_get_downreason(ifconfig_handle_t *h, const char *name, struct ifdownreason *ifdr) diff --git a/share/examples/libifconfig/status.c b/share/examples/libifconfig/status.c index 62fd3f35c8de..114cf7e87a68 100644 --- a/share/examples/libifconfig/status.c +++ b/share/examples/libifconfig/status.c @@ -406,7 +406,6 @@ print_media(ifconfig_handle_t *lifh, struct ifaddrs *ifa) * tables, finding an entry with the right media subtype */ struct ifmediareq *ifmr; - char opts[80]; if (ifconfig_media_get_mediareq(lifh, ifa->ifa_name, &ifmr) != 0) { if (ifconfig_err_errtype(lifh) != OK) { @@ -419,14 +418,19 @@ print_media(ifconfig_handle_t *lifh, struct ifaddrs *ifa) printf("\tmedia: %s %s", ifconfig_media_get_type(ifmr->ifm_current), ifconfig_media_get_subtype(ifmr->ifm_current)); if (ifmr->ifm_active != ifmr->ifm_current) { + const char **options; + printf(" (%s", ifconfig_media_get_subtype(ifmr->ifm_active)); - ifconfig_media_get_options_string(ifmr->ifm_active, opts, - sizeof(opts)); - if (opts[0] != '\0') { - printf(" <%s>)\n", opts); + options = ifconfig_media_get_options(ifmr->ifm_active); + if (options != NULL && options[0] != NULL) { + printf(" <%s", options[0]); + for (size_t i = 1; options[i] != NULL; ++i) + printf(",%s", options[i]); + printf(">)\n"); } else { printf(")\n"); } + free(options); } else { printf("\n"); } @@ -438,15 +442,20 @@ print_media(ifconfig_handle_t *lifh, struct ifaddrs *ifa) printf("\tsupported media:\n"); for (i = 0; i < ifmr->ifm_count; i++) { + const char **options; + printf("\t\tmedia %s", ifconfig_media_get_subtype(ifmr->ifm_ulist[i])); - ifconfig_media_get_options_string(ifmr->ifm_ulist[i], opts, - sizeof(opts)); - if (opts[0] != '\0') { - printf(" mediaopt %s\n", opts); + options = ifconfig_media_get_options(ifmr->ifm_ulist[i]); + if (options != NULL && options[0] != NULL) { + printf(" mediaopt %s", options[0]); + for (size_t i = 1; options[i] != NULL; ++i) + printf(",%s", options[i]); + printf("\n"); } else { printf("\n"); } + free(options); } free(ifmr); } From owner-dev-commits-src-all@freebsd.org Fri Mar 19 13:01:00 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 528D9572F6B; Fri, 19 Mar 2021 13:01:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F23t41wnjz4jsy; Fri, 19 Mar 2021 13:01: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 3549115255; Fri, 19 Mar 2021 13:01: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 12JD103H006959; Fri, 19 Mar 2021 13:01:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JD10Qp006958; Fri, 19 Mar 2021 13:01:00 GMT (envelope-from git) Date: Fri, 19 Mar 2021 13:01:00 GMT Message-Id: <202103191301.12JD10Qp006958@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ryan Moeller Subject: git: ebee42edc86c - stable/13 - sbin/ifconfig: Get media status with libifconfig MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: freqlabs X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: ebee42edc86c0864d4a9b09ae4dae32cca7a996f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 13:01:00 -0000 The branch stable/13 has been updated by freqlabs: URL: https://cgit.FreeBSD.org/src/commit/?id=ebee42edc86c0864d4a9b09ae4dae32cca7a996f commit ebee42edc86c0864d4a9b09ae4dae32cca7a996f Author: Ryan Moeller AuthorDate: 2021-02-28 20:27:28 +0000 Commit: Ryan Moeller CommitDate: 2021-03-19 13:00:40 +0000 sbin/ifconfig: Get media status with libifconfig Code deduplication. Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D29030 (cherry picked from commit 2803fa471e77dc8f227fe00bbf075de7feb10022) --- sbin/ifconfig/ifconfig.h | 2 +- sbin/ifconfig/ifieee80211.c | 2 +- sbin/ifconfig/ifmedia.c | 673 ++++++++++++-------------------------------- 3 files changed, 176 insertions(+), 501 deletions(-) diff --git a/sbin/ifconfig/ifconfig.h b/sbin/ifconfig/ifconfig.h index 61b1137b47ba..ea541c5e9257 100644 --- a/sbin/ifconfig/ifconfig.h +++ b/sbin/ifconfig/ifconfig.h @@ -161,7 +161,7 @@ void sfp_status(int s, struct ifreq *ifr, int verbose); * XXX expose this so modules that neeed to know of any pending * operations on ifmedia can avoid cmd line ordering confusion. */ -struct ifmediareq *ifmedia_getstate(int s); +struct ifmediareq *ifmedia_getstate(void); void print_vhid(const struct ifaddrs *, const char *); diff --git a/sbin/ifconfig/ifieee80211.c b/sbin/ifconfig/ifieee80211.c index bb406469829a..cfaf163f5930 100644 --- a/sbin/ifconfig/ifieee80211.c +++ b/sbin/ifconfig/ifieee80211.c @@ -239,7 +239,7 @@ getchaninfo(int s) if (get80211(s, IEEE80211_IOC_CHANINFO, chaninfo, IEEE80211_CHANINFO_SIZE(MAXCHAN)) < 0) err(1, "unable to get channel information"); - ifmr = ifmedia_getstate(s); + ifmr = ifmedia_getstate(); gethtconf(s); getvhtconf(s); } diff --git a/sbin/ifconfig/ifmedia.c b/sbin/ifconfig/ifmedia.c index cd3600df454c..66eb40254889 100644 --- a/sbin/ifconfig/ifmedia.c +++ b/sbin/ifconfig/ifmedia.c @@ -86,201 +86,103 @@ #include #include +#include + #include "ifconfig.h" -static void domediaopt(const char *, int, int); -static int get_media_subtype(int, const char *); -static int get_media_mode(int, const char *); -static int get_media_options(int, const char *); -static int lookup_media_word(struct ifmedia_description *, const char *); -static void print_media_word(int, int); -static void print_media_word_ifconfig(int); - -static struct ifmedia_description *get_toptype_desc(int); -static struct ifmedia_type_to_subtype *get_toptype_ttos(int); -static struct ifmedia_description *get_subtype_desc(int, - struct ifmedia_type_to_subtype *ttos); - -#define IFM_OPMODE(x) \ - ((x) & (IFM_IEEE80211_ADHOC | IFM_IEEE80211_HOSTAP | \ - IFM_IEEE80211_IBSS | IFM_IEEE80211_WDS | IFM_IEEE80211_MONITOR | \ - IFM_IEEE80211_MBSS)) -#define IFM_IEEE80211_STA 0 +static void domediaopt(const char *, bool, int); +static ifmedia_t get_media_subtype(ifmedia_t, const char *); +static ifmedia_t get_media_mode(ifmedia_t, const char *); +static ifmedia_t get_media_options(ifmedia_t, const char *); +static void print_media(ifmedia_t, bool); +static void print_media_ifconfig(ifmedia_t); static void media_status(int s) { - struct ifmediareq ifmr; - struct ifdownreason ifdr; - int *media_list, i; - bool no_carrier, xmedia; - - (void) memset(&ifmr, 0, sizeof(ifmr)); - (void) strlcpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name)); - xmedia = true; + struct ifmediareq *ifmr; - /* - * Check if interface supports extended media types. - */ - if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)&ifmr) < 0) - xmedia = false; - if (!xmedia && ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { - /* - * Interface doesn't support SIOC{G,S}IFMEDIA. - */ + if (ifconfig_media_get_mediareq(lifh, name, &ifmr) == -1) return; - } - if (ifmr.ifm_count == 0) { + if (ifmr->ifm_count == 0) { warnx("%s: no media types?", name); - return; - } - - media_list = (int *)malloc(ifmr.ifm_count * sizeof(int)); - if (media_list == NULL) - err(1, "malloc"); - ifmr.ifm_ulist = media_list; - - if (xmedia) { - if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)&ifmr) < 0) - err(1, "SIOCGIFXMEDIA"); - } else { - if (ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) - err(1, "SIOCGIFMEDIA"); + goto free; } printf("\tmedia: "); - print_media_word(ifmr.ifm_current, 1); - if (ifmr.ifm_active != ifmr.ifm_current) { + print_media(ifmr->ifm_current, true); + if (ifmr->ifm_active != ifmr->ifm_current) { putchar(' '); putchar('('); - print_media_word(ifmr.ifm_active, 0); + print_media(ifmr->ifm_active, false); putchar(')'); } putchar('\n'); - if (ifmr.ifm_status & IFM_AVALID) { - no_carrier = false; - printf("\tstatus: "); - switch (IFM_TYPE(ifmr.ifm_active)) { - case IFM_ETHER: - case IFM_ATM: - if (ifmr.ifm_status & IFM_ACTIVE) - printf("active"); - else - no_carrier = true; - break; - - case IFM_IEEE80211: - if (ifmr.ifm_status & IFM_ACTIVE) { - /* NB: only sta mode associates */ - if (IFM_OPMODE(ifmr.ifm_active) == IFM_IEEE80211_STA) - printf("associated"); - else - printf("running"); - } else - no_carrier = true; - break; - } - if (no_carrier) { - printf("no carrier"); - memset(&ifdr, 0, sizeof(ifdr)); - strlcpy(ifdr.ifdr_name, name, sizeof(ifdr.ifdr_name)); - if (ioctl(s, SIOCGIFDOWNREASON, (caddr_t)&ifdr) == 0) { - switch (ifdr.ifdr_reason) { - case IFDR_REASON_MSG: - printf(" (%s)", ifdr.ifdr_msg); - break; - case IFDR_REASON_VENDOR: - printf(" (vendor code %d)", - ifdr.ifdr_vendor); - break; - default: - break; - } + if (ifmr->ifm_status & IFM_AVALID) { + struct ifdownreason ifdr; + const char *status; + + status = ifconfig_media_get_status(ifmr); + printf("\tstatus: %s", status); + if (strcmp(status, "no carrier") == 0 && + ifconfig_media_get_downreason(lifh, name, &ifdr) == 0) { + switch (ifdr.ifdr_reason) { + case IFDR_REASON_MSG: + printf(" (%s)", ifdr.ifdr_msg); + break; + case IFDR_REASON_VENDOR: + printf(" (vendor code %d)", + ifdr.ifdr_vendor); + break; + default: + break; } } putchar('\n'); } - if (ifmr.ifm_count > 0 && supmedia) { + if (supmedia) { printf("\tsupported media:\n"); - for (i = 0; i < ifmr.ifm_count; i++) { + for (size_t i = 0; i < ifmr->ifm_count; ++i) { printf("\t\t"); - print_media_word_ifconfig(media_list[i]); + print_media_ifconfig(ifmr->ifm_ulist[i]); putchar('\n'); } } - - free(media_list); +free: + free(ifmr); } struct ifmediareq * -ifmedia_getstate(int s) +ifmedia_getstate(void) { - static struct ifmediareq *ifmr = NULL; - int *mwords; - int xmedia = 1; - - if (ifmr == NULL) { - ifmr = (struct ifmediareq *)malloc(sizeof(struct ifmediareq)); - if (ifmr == NULL) - err(1, "malloc"); - - (void) memset(ifmr, 0, sizeof(struct ifmediareq)); - (void) strlcpy(ifmr->ifm_name, name, - sizeof(ifmr->ifm_name)); - - ifmr->ifm_count = 0; - ifmr->ifm_ulist = NULL; - - /* - * We must go through the motions of reading all - * supported media because we need to know both - * the current media type and the top-level type. - */ - - if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)ifmr) < 0) { - xmedia = 0; - } - if (xmedia == 0 && ioctl(s, SIOCGIFMEDIA, (caddr_t)ifmr) < 0) { - err(1, "SIOCGIFMEDIA"); - } + static struct ifmediareq *ifmr; - if (ifmr->ifm_count == 0) - errx(1, "%s: no media types?", name); - - mwords = (int *)malloc(ifmr->ifm_count * sizeof(int)); - if (mwords == NULL) - err(1, "malloc"); - - ifmr->ifm_ulist = mwords; - if (xmedia) { - if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)ifmr) < 0) - err(1, "SIOCGIFXMEDIA"); - } else { - if (ioctl(s, SIOCGIFMEDIA, (caddr_t)ifmr) < 0) - err(1, "SIOCGIFMEDIA"); - } - } + if (ifconfig_media_get_mediareq(lifh, name, &ifmr) == -1) + errc(1, ifconfig_err_errno(lifh), + "%s: ifconfig_media_get_mediareq", name); - return ifmr; + if (ifmr->ifm_count == 0) + errx(1, "%s: no media types?", name); + + return (ifmr); } static void setifmediacallback(int s, void *arg) { struct ifmediareq *ifmr = (struct ifmediareq *)arg; - static int did_it = 0; + static bool did_it = false; if (!did_it) { ifr.ifr_media = ifmr->ifm_current; if (ioctl(s, SIOCSIFMEDIA, (caddr_t)&ifr) < 0) err(1, "SIOCSIFMEDIA (media)"); - free(ifmr->ifm_ulist); free(ifmr); - did_it = 1; + did_it = true; } } @@ -290,7 +192,7 @@ setmedia(const char *val, int d, int s, const struct afswtch *afp) struct ifmediareq *ifmr; int subtype; - ifmr = ifmedia_getstate(s); + ifmr = ifmedia_getstate(); /* * We are primarily concerned with the top-level type. @@ -301,7 +203,7 @@ setmedia(const char *val, int d, int s, const struct afswtch *afp) * (I'm assuming that all supported media types for a given * interface will be the same top-level type..) */ - subtype = get_media_subtype(IFM_TYPE(ifmr->ifm_ulist[0]), val); + subtype = get_media_subtype(ifmr->ifm_ulist[0], val); strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_media = (ifmr->ifm_current & IFM_IMASK) | @@ -315,25 +217,25 @@ static void setmediaopt(const char *val, int d, int s, const struct afswtch *afp) { - domediaopt(val, 0, s); + domediaopt(val, false, s); } static void unsetmediaopt(const char *val, int d, int s, const struct afswtch *afp) { - domediaopt(val, 1, s); + domediaopt(val, true, s); } static void -domediaopt(const char *val, int clear, int s) +domediaopt(const char *val, bool clear, int s) { struct ifmediareq *ifmr; - int options; + ifmedia_t options; - ifmr = ifmedia_getstate(s); + ifmr = ifmedia_getstate(); - options = get_media_options(IFM_TYPE(ifmr->ifm_ulist[0]), val); + options = get_media_options(ifmr->ifm_ulist[0], val); strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_media = ifmr->ifm_current; @@ -356,7 +258,7 @@ setmediainst(const char *val, int d, int s, const struct afswtch *afp) struct ifmediareq *ifmr; int inst; - ifmr = ifmedia_getstate(s); + ifmr = ifmedia_getstate(); inst = atoi(val); if (inst < 0 || inst > (int)IFM_INST_MAX) @@ -375,9 +277,9 @@ setmediamode(const char *val, int d, int s, const struct afswtch *afp) struct ifmediareq *ifmr; int mode; - ifmr = ifmedia_getstate(s); + ifmr = ifmedia_getstate(); - mode = get_media_mode(IFM_TYPE(ifmr->ifm_ulist[0]), val); + mode = get_media_mode(ifmr->ifm_ulist[0], val); strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name)); ifr.ifr_media = (ifmr->ifm_current & ~IFM_MMASK) | mode; @@ -386,320 +288,112 @@ setmediamode(const char *val, int d, int s, const struct afswtch *afp) callback_register(setifmediacallback, (void *)ifmr); } -/********************************************************************** - * A good chunk of this is duplicated from sys/net/if_media.c - **********************************************************************/ - -static struct ifmedia_description ifm_type_descriptions[] = - IFM_TYPE_DESCRIPTIONS; - -static struct ifmedia_description ifm_subtype_ethernet_descriptions[] = - IFM_SUBTYPE_ETHERNET_DESCRIPTIONS; - -static struct ifmedia_description ifm_subtype_ethernet_aliases[] = - IFM_SUBTYPE_ETHERNET_ALIASES; - -static struct ifmedia_description ifm_subtype_ethernet_option_descriptions[] = - IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS; - -static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] = - IFM_SUBTYPE_IEEE80211_DESCRIPTIONS; - -static struct ifmedia_description ifm_subtype_ieee80211_aliases[] = - IFM_SUBTYPE_IEEE80211_ALIASES; - -static struct ifmedia_description ifm_subtype_ieee80211_option_descriptions[] = - IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS; - -struct ifmedia_description ifm_subtype_ieee80211_mode_descriptions[] = - IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS; - -struct ifmedia_description ifm_subtype_ieee80211_mode_aliases[] = - IFM_SUBTYPE_IEEE80211_MODE_ALIASES; - -static struct ifmedia_description ifm_subtype_atm_descriptions[] = - IFM_SUBTYPE_ATM_DESCRIPTIONS; - -static struct ifmedia_description ifm_subtype_atm_aliases[] = - IFM_SUBTYPE_ATM_ALIASES; - -static struct ifmedia_description ifm_subtype_atm_option_descriptions[] = - IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS; - -static struct ifmedia_description ifm_subtype_shared_descriptions[] = - IFM_SUBTYPE_SHARED_DESCRIPTIONS; - -static struct ifmedia_description ifm_subtype_shared_aliases[] = - IFM_SUBTYPE_SHARED_ALIASES; - -static struct ifmedia_description ifm_shared_option_descriptions[] = - IFM_SHARED_OPTION_DESCRIPTIONS; - -static struct ifmedia_description ifm_shared_option_aliases[] = - IFM_SHARED_OPTION_ALIASES; - -struct ifmedia_type_to_subtype { - struct { - struct ifmedia_description *desc; - int alias; - } subtypes[5]; - struct { - struct ifmedia_description *desc; - int alias; - } options[4]; - struct { - struct ifmedia_description *desc; - int alias; - } modes[3]; -}; - -/* must be in the same order as IFM_TYPE_DESCRIPTIONS */ -static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = { - { - { - { &ifm_subtype_shared_descriptions[0], 0 }, - { &ifm_subtype_shared_aliases[0], 1 }, - { &ifm_subtype_ethernet_descriptions[0], 0 }, - { &ifm_subtype_ethernet_aliases[0], 1 }, - { NULL, 0 }, - }, - { - { &ifm_shared_option_descriptions[0], 0 }, - { &ifm_shared_option_aliases[0], 1 }, - { &ifm_subtype_ethernet_option_descriptions[0], 0 }, - { NULL, 0 }, - }, - { - { NULL, 0 }, - }, - }, - { - { - { &ifm_subtype_shared_descriptions[0], 0 }, - { &ifm_subtype_shared_aliases[0], 1 }, - { &ifm_subtype_ieee80211_descriptions[0], 0 }, - { &ifm_subtype_ieee80211_aliases[0], 1 }, - { NULL, 0 }, - }, - { - { &ifm_shared_option_descriptions[0], 0 }, - { &ifm_shared_option_aliases[0], 1 }, - { &ifm_subtype_ieee80211_option_descriptions[0], 0 }, - { NULL, 0 }, - }, - { - { &ifm_subtype_ieee80211_mode_descriptions[0], 0 }, - { &ifm_subtype_ieee80211_mode_aliases[0], 0 }, - { NULL, 0 }, - }, - }, - { - { - { &ifm_subtype_shared_descriptions[0], 0 }, - { &ifm_subtype_shared_aliases[0], 1 }, - { &ifm_subtype_atm_descriptions[0], 0 }, - { &ifm_subtype_atm_aliases[0], 1 }, - { NULL, 0 }, - }, - { - { &ifm_shared_option_descriptions[0], 0 }, - { &ifm_shared_option_aliases[0], 1 }, - { &ifm_subtype_atm_option_descriptions[0], 0 }, - { NULL, 0 }, - }, - { - { NULL, 0 }, - }, - }, -}; - -static int -get_media_subtype(int type, const char *val) +static ifmedia_t +get_media_subtype(ifmedia_t media, const char *val) { - struct ifmedia_description *desc; - struct ifmedia_type_to_subtype *ttos; - int rval, i; - - /* Find the top-level interface type. */ - for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes; - desc->ifmt_string != NULL; desc++, ttos++) - if (type == desc->ifmt_word) - break; - if (desc->ifmt_string == NULL) - errx(1, "unknown media type 0x%x", type); - - for (i = 0; ttos->subtypes[i].desc != NULL; i++) { - rval = lookup_media_word(ttos->subtypes[i].desc, val); - if (rval != -1) - return (rval); + ifmedia_t subtype; + + subtype = ifconfig_media_lookup_subtype(media, val); + if (subtype != INVALID_IFMEDIA) + return (subtype); + switch (errno) { + case EINVAL: + errx(EXIT_FAILURE, "unknown media type 0x%x", media); + case ENOENT: + errx(EXIT_FAILURE, "unknown media subtype: %s", val); + default: + err(EXIT_FAILURE, "ifconfig_media_lookup_subtype"); } - errx(1, "unknown media subtype: %s", val); /*NOTREACHED*/ } -static int -get_media_mode(int type, const char *val) +static ifmedia_t +get_media_mode(ifmedia_t media, const char *val) { - struct ifmedia_description *desc; - struct ifmedia_type_to_subtype *ttos; - int rval, i; - - /* Find the top-level interface type. */ - for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes; - desc->ifmt_string != NULL; desc++, ttos++) - if (type == desc->ifmt_word) - break; - if (desc->ifmt_string == NULL) - errx(1, "unknown media mode 0x%x", type); - - for (i = 0; ttos->modes[i].desc != NULL; i++) { - rval = lookup_media_word(ttos->modes[i].desc, val); - if (rval != -1) - return (rval); + ifmedia_t mode; + + mode = ifconfig_media_lookup_mode(media, val); + if (mode != INVALID_IFMEDIA) + return (mode); + switch (errno) { + case EINVAL: + errx(EXIT_FAILURE, "unknown media type 0x%x", media); + case ENOENT: + return (INVALID_IFMEDIA); + default: + err(EXIT_FAILURE, "ifconfig_media_lookup_subtype"); } - return -1; + /*NOTREACHED*/ } -static int -get_media_options(int type, const char *val) +static ifmedia_t +get_media_options(ifmedia_t media, const char *val) { - struct ifmedia_description *desc; - struct ifmedia_type_to_subtype *ttos; - char *optlist, *optptr; - int option, i, rval = 0; - - /* We muck with the string, so copy it. */ - optlist = strdup(val); - if (optlist == NULL) - err(1, "strdup"); - - /* Find the top-level interface type. */ - for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes; - desc->ifmt_string != NULL; desc++, ttos++) - if (type == desc->ifmt_word) - break; - if (desc->ifmt_string == NULL) - errx(1, "unknown media type 0x%x", type); + ifmedia_t *options; + const char **optnames; + char *opts, *opt; + size_t nopts; + int rval; /* - * Look up the options in the user-provided comma-separated - * list. + * We muck with the string, so copy it. */ - optptr = optlist; - for (; (optptr = strtok(optptr, ",")) != NULL; optptr = NULL) { - option = -1; - for (i = 0; ttos->options[i].desc != NULL; i++) { - option = lookup_media_word(ttos->options[i].desc, optptr); - if (option != -1) - break; - } - if (option == -1) - errx(1, "unknown option: %s", optptr); - rval |= option; - } - - free(optlist); - return (rval); -} - -static int -lookup_media_word(struct ifmedia_description *desc, const char *val) -{ - - for (; desc->ifmt_string != NULL; desc++) - if (strcasecmp(desc->ifmt_string, val) == 0) - return (desc->ifmt_word); - - return (-1); -} - -static struct ifmedia_description *get_toptype_desc(int ifmw) -{ - struct ifmedia_description *desc; - - for (desc = ifm_type_descriptions; desc->ifmt_string != NULL; desc++) - if (IFM_TYPE(ifmw) == desc->ifmt_word) - break; + opts = strdup(val); + if (opts == NULL) + err(EXIT_FAILURE, "strdup"); - return desc; -} - -static struct ifmedia_type_to_subtype *get_toptype_ttos(int ifmw) -{ - struct ifmedia_description *desc; - struct ifmedia_type_to_subtype *ttos; - - for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes; - desc->ifmt_string != NULL; desc++, ttos++) - if (IFM_TYPE(ifmw) == desc->ifmt_word) - break; - - return ttos; -} - -static struct ifmedia_description *get_subtype_desc(int ifmw, - struct ifmedia_type_to_subtype *ttos) -{ - int i; - struct ifmedia_description *desc; - - for (i = 0; ttos->subtypes[i].desc != NULL; i++) { - if (ttos->subtypes[i].alias) - continue; - for (desc = ttos->subtypes[i].desc; - desc->ifmt_string != NULL; desc++) { - if (IFM_SUBTYPE(ifmw) == desc->ifmt_word) - return desc; - } + /* + * Split the comma-delimited list into separate strings. + */ + nopts = 0; + for (opt = opts; (opt = strtok(opt, ",")) != NULL; opt = NULL) + ++nopts; + if (nopts == 0) { + free(opts); + return (0); } - - return NULL; -} - -static struct ifmedia_description *get_mode_desc(int ifmw, - struct ifmedia_type_to_subtype *ttos) -{ - int i; - struct ifmedia_description *desc; - - for (i = 0; ttos->modes[i].desc != NULL; i++) { - if (ttos->modes[i].alias) - continue; - for (desc = ttos->modes[i].desc; - desc->ifmt_string != NULL; desc++) { - if (IFM_MODE(ifmw) == desc->ifmt_word) - return desc; - } + optnames = calloc(nopts, sizeof(*optnames)); + if (optnames == NULL) + err(EXIT_FAILURE, "calloc"); + opt = opts; + for (size_t i = 0; i < nopts; ++i) { + optnames[i] = opt; + opt = strchr(opt, '\0') + 1; } - return NULL; + /* + * Look up the options in the user-provided list. + */ + options = ifconfig_media_lookup_options(media, optnames, nopts); + if (options == NULL) + err(EXIT_FAILURE, "ifconfig_media_lookup_options"); + rval = 0; + for (size_t i = 0; i < nopts; ++i) { + if (options[i] == INVALID_IFMEDIA) + errx(EXIT_FAILURE, "unknown option: %s", optnames[i]); + rval |= options[i]; + } + free(options); + free(optnames); + free(opts); + return (rval); } static void -print_media_word(int ifmw, int print_toptype) +print_media(ifmedia_t media, bool print_toptype) { - struct ifmedia_description *desc; - struct ifmedia_type_to_subtype *ttos; - int seen_option = 0, i; - - /* Find the top-level interface type. */ - desc = get_toptype_desc(ifmw); - ttos = get_toptype_ttos(ifmw); - if (desc->ifmt_string == NULL) { + const char *val, **options; + + val = ifconfig_media_get_type(media); + if (val == NULL) { printf(""); return; } else if (print_toptype) { - printf("%s", desc->ifmt_string); + printf("%s", val); } - /* - * Don't print the top-level type; it's not like we can - * change it, or anything. - */ - - /* Find subtype. */ - desc = get_subtype_desc(ifmw, ttos); - if (desc == NULL) { + val = ifconfig_media_get_subtype(media); + if (val == NULL) { printf(""); return; } @@ -707,45 +401,34 @@ print_media_word(int ifmw, int print_toptype) if (print_toptype) putchar(' '); - printf("%s", desc->ifmt_string); + printf("%s", val); if (print_toptype) { - desc = get_mode_desc(ifmw, ttos); - if (desc != NULL && strcasecmp("autoselect", desc->ifmt_string)) - printf(" mode %s", desc->ifmt_string); + val = ifconfig_media_get_mode(media); + if (val != NULL && strcasecmp("autoselect", val) != 0) + printf(" mode %s", val); } - /* Find options. */ - for (i = 0; ttos->options[i].desc != NULL; i++) { - if (ttos->options[i].alias) - continue; - for (desc = ttos->options[i].desc; - desc->ifmt_string != NULL; desc++) { - if (ifmw & desc->ifmt_word) { - if (seen_option == 0) - printf(" <"); - printf("%s%s", seen_option++ ? "," : "", - desc->ifmt_string); - } - } + options = ifconfig_media_get_options(media); + if (options != NULL && options[0] != NULL) { + printf(" <%s", options[0]); + for (size_t i = 1; options[i] != NULL; ++i) + printf(",%s", options[i]); + printf(">"); } - printf("%s", seen_option ? ">" : ""); + free(options); - if (print_toptype && IFM_INST(ifmw) != 0) - printf(" instance %d", IFM_INST(ifmw)); + if (print_toptype && IFM_INST(media) != 0) + printf(" instance %d", IFM_INST(media)); } static void -print_media_word_ifconfig(int ifmw) +print_media_ifconfig(ifmedia_t media) { - struct ifmedia_description *desc; - struct ifmedia_type_to_subtype *ttos; - int seen_option = 0, i; - - /* Find the top-level interface type. */ - desc = get_toptype_desc(ifmw); - ttos = get_toptype_ttos(ifmw); - if (desc->ifmt_string == NULL) { + const char *val, **options; + + val = ifconfig_media_get_type(media); + if (val == NULL) { printf(""); return; } @@ -755,36 +438,28 @@ print_media_word_ifconfig(int ifmw) * change it, or anything. */ - /* Find subtype. */ - desc = get_subtype_desc(ifmw, ttos); - if (desc == NULL) { + val = ifconfig_media_get_subtype(media); + if (val == NULL) { printf(""); return; } - printf("media %s", desc->ifmt_string); - - desc = get_mode_desc(ifmw, ttos); - if (desc != NULL) - printf(" mode %s", desc->ifmt_string); - - /* Find options. */ - for (i = 0; ttos->options[i].desc != NULL; i++) { - if (ttos->options[i].alias) - continue; - for (desc = ttos->options[i].desc; - desc->ifmt_string != NULL; desc++) { - if (ifmw & desc->ifmt_word) { - if (seen_option == 0) - printf(" mediaopt "); - printf("%s%s", seen_option++ ? "," : "", - desc->ifmt_string); - } - } + printf("media %s", val); + + val = ifconfig_media_get_mode(media); + if (val != NULL) + printf(" mode %s", val); + + options = ifconfig_media_get_options(media); + if (options != NULL && options[0] != NULL) { + printf(" mediaopt %s", options[0]); + for (size_t i = 1; options[i] != NULL; ++i) + printf(",%s", options[i]); } + free(options); - if (IFM_INST(ifmw) != 0) - printf(" instance %d", IFM_INST(ifmw)); + if (IFM_INST(media) != 0) + printf(" instance %d", IFM_INST(media)); } /********************************************************************** From owner-dev-commits-src-all@freebsd.org Fri Mar 19 13:46:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE8E0574DA6; Fri, 19 Mar 2021 13:46: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 4F24tT4yrxz4nhk; Fri, 19 Mar 2021 13:46: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 9749216123; Fri, 19 Mar 2021 13:46: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 12JDkPXp063808; Fri, 19 Mar 2021 13:46:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JDkPZJ063807; Fri, 19 Mar 2021 13:46:25 GMT (envelope-from git) Date: Fri, 19 Mar 2021 13:46:25 GMT Message-Id: <202103191346.12JDkPZJ063807@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: e8b4c5a6226b - main - Clarify that scripted installations don't require specification of boot partitions, as there seems to be widespread confusion on this point. 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: e8b4c5a6226b6bde304380de51c347851680b7ed Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 13:46:25 -0000 The branch main has been updated by nwhitehorn: URL: https://cgit.FreeBSD.org/src/commit/?id=e8b4c5a6226b6bde304380de51c347851680b7ed commit e8b4c5a6226b6bde304380de51c347851680b7ed Author: Nathan Whitehorn AuthorDate: 2021-03-19 13:44:30 +0000 Commit: Nathan Whitehorn CommitDate: 2021-03-19 13:45:58 +0000 Clarify that scripted installations don't require specification of boot partitions, as there seems to be widespread confusion on this point. MFC after: 1 day --- usr.sbin/bsdinstall/bsdinstall.8 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usr.sbin/bsdinstall/bsdinstall.8 b/usr.sbin/bsdinstall/bsdinstall.8 index 8048e41669ee..ba261ce7301d 100644 --- a/usr.sbin/bsdinstall/bsdinstall.8 +++ b/usr.sbin/bsdinstall/bsdinstall.8 @@ -199,6 +199,10 @@ As an example, a typical invocation looks like: .Pp bsdinstall scriptedpart ada0 { 20G freebsd-ufs /, 4G freebsd-swap, 20G freebsd-ufs /var, auto freebsd-ufs /usr } .Pp +Note that the list of partitions should +.Em not +include boot partitions (e.g. EFI system partitions), which will be created automatically on whatever disk includes /. +.Pp A shorter invocation to use the default partitioning (as .Cm autopart would have used) on the same disk: From owner-dev-commits-src-all@freebsd.org Fri Mar 19 13:56:22 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29A4C574EDA; Fri, 19 Mar 2021 13:56: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 4F255y0l8mz4p6D; Fri, 19 Mar 2021 13:56: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 0CC1616342; Fri, 19 Mar 2021 13:56: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 12JDuLDo077408; Fri, 19 Mar 2021 13:56:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JDuLN9077407; Fri, 19 Mar 2021 13:56:21 GMT (envelope-from git) Date: Fri, 19 Mar 2021 13:56:21 GMT Message-Id: <202103191356.12JDuLN9077407@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: da45b4626641 - main - armv8crypto: note derivation in armv8_crypto_wrap.c 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: da45b462664148ff6f8adbe59847c6c06f295391 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 13:56:22 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=da45b462664148ff6f8adbe59847c6c06f295391 commit da45b462664148ff6f8adbe59847c6c06f295391 Author: Mitchell Horne AuthorDate: 2021-03-15 13:46:03 +0000 Commit: Mitchell Horne CommitDate: 2021-03-19 13:53:49 +0000 armv8crypto: note derivation in armv8_crypto_wrap.c This file inherits some boilerplate and structure from the analogous file in aesni(4), aesni_wrap.c. Note the derivation and the copyright holders of that file. For example, the AES-XTS bits added in 4979620ece984 were ported from aesni(4). Requested by: jmg Reviewed by: imp, gnn MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D29268 --- sys/crypto/armv8/armv8_crypto_wrap.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/crypto/armv8/armv8_crypto_wrap.c b/sys/crypto/armv8/armv8_crypto_wrap.c index eb4a431d33e9..3c0223964ee4 100644 --- a/sys/crypto/armv8/armv8_crypto_wrap.c +++ b/sys/crypto/armv8/armv8_crypto_wrap.c @@ -26,6 +26,13 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * This file is derived from aesni_wrap.c: + * Copyright (C) 2008 Damien Miller + * Copyright (c) 2010 Konstantin Belousov + * Copyright (c) 2010-2011 Pawel Jakub Dawidek + * Copyright 2012-2013 John-Mark Gurney + * Copyright (c) 2014 The FreeBSD Foundation */ /* From owner-dev-commits-src-all@freebsd.org Fri Mar 19 18:04:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 07D7757D242; Fri, 19 Mar 2021 18:04:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2BcZ6gZfz3Njn; Fri, 19 Mar 2021 18:04: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 D7DA9194D3; Fri, 19 Mar 2021 18:04: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 12JI4kYv007641; Fri, 19 Mar 2021 18:04:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JI4kqa007640; Fri, 19 Mar 2021 18:04:46 GMT (envelope-from git) Date: Fri, 19 Mar 2021 18:04:46 GMT Message-Id: <202103191804.12JI4kqa007640@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 473f6163e310 - main - cxgbe(4): use standard sysctl routines to deal with 16b values. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 473f6163e310b773dfd7e500e255d01d7328dd16 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 18:04:47 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=473f6163e310b773dfd7e500e255d01d7328dd16 commit 473f6163e310b773dfd7e500e255d01d7328dd16 Author: Navdeep Parhar AuthorDate: 2021-03-19 17:56:24 +0000 Commit: Navdeep Parhar CommitDate: 2021-03-19 17:56:24 +0000 cxgbe(4): use standard sysctl routines to deal with 16b values. These routines to handle 8b and 16b types were added in r289773 5+ years ago. MFC after: 2 weeks Sponsored by: Chelsio Communications --- sys/dev/cxgbe/adapter.h | 1 - sys/dev/cxgbe/t4_netmap.c | 30 ++++++++++++----------------- sys/dev/cxgbe/t4_sge.c | 49 ++++++++++++++++------------------------------- 3 files changed, 28 insertions(+), 52 deletions(-) diff --git a/sys/dev/cxgbe/adapter.h b/sys/dev/cxgbe/adapter.h index be890f035635..82adfac63c91 100644 --- a/sys/dev/cxgbe/adapter.h +++ b/sys/dev/cxgbe/adapter.h @@ -1272,7 +1272,6 @@ int alloc_ring(struct adapter *, size_t, bus_dma_tag_t *, bus_dmamap_t *, bus_addr_t *, void **); int free_ring(struct adapter *, bus_dma_tag_t, bus_dmamap_t, bus_addr_t, void *); -int sysctl_uint16(SYSCTL_HANDLER_ARGS); int t4_setup_adapter_queues(struct adapter *); int t4_teardown_adapter_queues(struct adapter *); int t4_setup_vi_queues(struct vi_info *); diff --git a/sys/dev/cxgbe/t4_netmap.c b/sys/dev/cxgbe/t4_netmap.c index 29284d76bdda..6078dd89829d 100644 --- a/sys/dev/cxgbe/t4_netmap.c +++ b/sys/dev/cxgbe/t4_netmap.c @@ -168,24 +168,20 @@ alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int intr_idx, CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "rx queue"); children = SYSCTL_CHILDREN(oid); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "abs_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_abs_id, - 0, sysctl_uint16, "I", "absolute id of the queue"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_cntxt_id, - 0, sysctl_uint16, "I", "SGE context id of the queue"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_cidx, 0, - sysctl_uint16, "I", "consumer index"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "abs_id", CTLFLAG_RD, + &nm_rxq->iq_abs_id, 0, "absolute id of the queue"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, + &nm_rxq->iq_cntxt_id, 0, "SGE context id of the queue"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, + &nm_rxq->iq_cidx, 0, "consumer index"); children = SYSCTL_CHILDREN(oid); oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "fl", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "freelist"); children = SYSCTL_CHILDREN(oid); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->fl_cntxt_id, - 0, sysctl_uint16, "I", "SGE context id of the freelist"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, + &nm_rxq->fl_cntxt_id, 0, "SGE context id of the freelist"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, &nm_rxq->fl_cidx, 0, "consumer index"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, @@ -252,12 +248,10 @@ alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq, int iqidx, int idx, SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, &nm_txq->cntxt_id, 0, "SGE context id of the queue"); - SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "cidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_txq->cidx, 0, - sysctl_uint16, "I", "consumer index"); - SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "pidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_txq->pidx, 0, - sysctl_uint16, "I", "producer index"); + SYSCTL_ADD_U16(&vi->ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, + &nm_txq->cidx, 0, "consumer index"); + SYSCTL_ADD_U16(&vi->ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, + &nm_txq->pidx, 0, "producer index"); return (rc); } diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c index 741b1ec5ac86..1818673b5612 100644 --- a/sys/dev/cxgbe/t4_sge.c +++ b/sys/dev/cxgbe/t4_sge.c @@ -3737,15 +3737,12 @@ add_iq_sysctls(struct sysctl_ctx_list *ctx, struct sysctl_oid *oid, "bus address of descriptor ring"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL, iq->qsize * IQ_ESIZE, "descriptor ring size in bytes"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "abs_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &iq->abs_id, 0, - sysctl_uint16, "I", "absolute id of the queue"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &iq->cntxt_id, 0, - sysctl_uint16, "I", "SGE context id of the queue"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &iq->cidx, 0, - sysctl_uint16, "I", "consumer index"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "abs_id", CTLFLAG_RD, + &iq->abs_id, 0, "absolute id of the queue"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, + &iq->cntxt_id, 0, "SGE context id of the queue"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, &iq->cidx, + 0, "consumer index"); } static void @@ -3763,9 +3760,8 @@ add_fl_sysctls(struct adapter *sc, struct sysctl_ctx_list *ctx, SYSCTL_ADD_INT(ctx, children, OID_AUTO, "dmalen", CTLFLAG_RD, NULL, fl->sidx * EQ_ESIZE + sc->params.sge.spg_len, "desc ring size in bytes"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &fl->cntxt_id, 0, - sysctl_uint16, "I", "SGE context id of the freelist"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, + &fl->cntxt_id, 0, "SGE context id of the freelist"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "padding", CTLFLAG_RD, NULL, fl_pad ? 1 : 0, "padding enabled"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "packing", CTLFLAG_RD, NULL, @@ -4275,12 +4271,10 @@ alloc_wrq(struct adapter *sc, struct vi_info *vi, struct sge_wrq *wrq, "desc ring size in bytes"); SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, &wrq->eq.cntxt_id, 0, "SGE context id of the queue"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &wrq->eq.cidx, 0, - sysctl_uint16, "I", "consumer index"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "pidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &wrq->eq.pidx, 0, - sysctl_uint16, "I", "producer index"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, + &wrq->eq.cidx, 0, "consumer index"); + SYSCTL_ADD_U16(ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, + &wrq->eq.pidx, 0, "producer index"); SYSCTL_ADD_INT(ctx, children, OID_AUTO, "sidx", CTLFLAG_RD, NULL, wrq->eq.sidx, "status page index"); SYSCTL_ADD_UQUAD(ctx, children, OID_AUTO, "tx_wrs_direct", CTLFLAG_RD, @@ -4377,12 +4371,10 @@ alloc_txq(struct vi_info *vi, struct sge_txq *txq, int idx, &eq->abs_id, 0, "absolute id of the queue"); SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, &eq->cntxt_id, 0, "SGE context id of the queue"); - SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "cidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &eq->cidx, 0, - sysctl_uint16, "I", "consumer index"); - SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "pidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &eq->pidx, 0, - sysctl_uint16, "I", "producer index"); + SYSCTL_ADD_U16(&vi->ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, + &eq->cidx, 0, "consumer index"); + SYSCTL_ADD_U16(&vi->ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, + &eq->pidx, 0, "producer index"); SYSCTL_ADD_INT(&vi->ctx, children, OID_AUTO, "sidx", CTLFLAG_RD, NULL, eq->sidx, "status page index"); @@ -6033,15 +6025,6 @@ t4_handle_wrerr_rpl(struct adapter *adap, const __be64 *rpl) return (0); } -int -sysctl_uint16(SYSCTL_HANDLER_ARGS) -{ - uint16_t *id = arg1; - int i = *id; - - return sysctl_handle_int(oidp, &i, 0, req); -} - static inline bool bufidx_used(struct adapter *sc, int idx) { From owner-dev-commits-src-all@freebsd.org Fri Mar 19 18:21:05 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0860A57D7F4; Fri, 19 Mar 2021 18:21: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 4F2BzN6rjYz3Pph; Fri, 19 Mar 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 DDEEF194FD; Fri, 19 Mar 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 12JIL4iG028912; Fri, 19 Mar 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 12JIL4Ch028911; Fri, 19 Mar 2021 18:21:04 GMT (envelope-from git) Date: Fri, 19 Mar 2021 18:21:04 GMT Message-Id: <202103191821.12JIL4Ch028911@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: d76f6b8e7389 - main - pfilctl: improve formatting of "hooks" and "heads" command output. 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: d76f6b8e7389b2b8a35c4b6f3859365ba05c7e90 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 18:21:05 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=d76f6b8e7389b2b8a35c4b6f3859365ba05c7e90 commit d76f6b8e7389b2b8a35c4b6f3859365ba05c7e90 Author: Gleb Smirnoff AuthorDate: 2021-03-19 18:18:05 +0000 Commit: Gleb Smirnoff CommitDate: 2021-03-19 18:18:05 +0000 pfilctl: improve formatting of "hooks" and "heads" command output. In "heads" output just improve the header to describe all of the columns. In "hooks" print filter name and hook name delimited with colon, so that it matches "heads" output and also can be copy-and-pasted straight into the command line for future "link" command. --- sbin/pfilctl/pfilctl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sbin/pfilctl/pfilctl.c b/sbin/pfilctl/pfilctl.c index e360c73cb279..2a56009b35b8 100644 --- a/sbin/pfilctl/pfilctl.c +++ b/sbin/pfilctl/pfilctl.c @@ -132,8 +132,8 @@ retry: } #define FMTHD "%16s %8s\n" -#define FMTHK "%29s %16s %16s\n" - printf(FMTHD, "Intercept point", "Type"); +#define FMTHK "%29s %16s:%s\n" + printf("%16s %8s %3s %16s\n", "Intercept point", "Type", "Dir", "Hook"); for (i = 0, h = 0; i < plh.pio_nheads; i++) { printf(FMTHD, plh.pio_heads[i].pio_name, typenames[plh.pio_heads[i].pio_type]); @@ -170,9 +170,9 @@ retry: goto retry; } - printf("Available hooks:\n"); + printf("%16s %16s %8s\n", "Hook", "", "Type"); for (i = 0; i < plh.pio_nhooks; i++) { - printf("\t%s:%s %s\n", plh.pio_hooks[i].pio_module, + printf("%16s:%-16s %8s\n", plh.pio_hooks[i].pio_module, plh.pio_hooks[i].pio_ruleset, typenames[plh.pio_hooks[i].pio_type]); } From owner-dev-commits-src-all@freebsd.org Fri Mar 19 18:39:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8296957ECA6; Fri, 19 Mar 2021 18:39: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 4F2CP13KKVz3RLn; Fri, 19 Mar 2021 18:39: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 650B219F54; Fri, 19 Mar 2021 18:39: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 12JIdnu9047825; Fri, 19 Mar 2021 18: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 12JIdnkk047824; Fri, 19 Mar 2021 18:39:49 GMT (envelope-from git) Date: Fri, 19 Mar 2021 18:39:49 GMT Message-Id: <202103191839.12JIdnkk047824@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: 7dd1f932c1f5 - main - tests/sys/netgraph: Further CI fixes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7dd1f932c1f51bfe10da7bc8875879cdcdd40821 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 18:39:49 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=7dd1f932c1f51bfe10da7bc8875879cdcdd40821 commit 7dd1f932c1f51bfe10da7bc8875879cdcdd40821 Author: Alex Richardson AuthorDate: 2021-03-19 18:34:29 +0000 Commit: Alex Richardson CommitDate: 2021-03-19 18:34:30 +0000 tests/sys/netgraph: Further CI fixes I was trying to debug why this test is working locally but failing in CI. While doing so I made some small changes to allow running it with set -e. It turns out the problem is that find_iface does not return anything in Jenkins, so all following tests fail with obscure error messages. To handle this case exit early if $eth is empty. Reviewed By: lwhsu Differential Revision: https://reviews.freebsd.org/D29340 --- tests/sys/netgraph/ng_macfilter_test.sh | 57 +++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/tests/sys/netgraph/ng_macfilter_test.sh b/tests/sys/netgraph/ng_macfilter_test.sh index 269de3e130aa..482f32e5d335 100755 --- a/tests/sys/netgraph/ng_macfilter_test.sh +++ b/tests/sys/netgraph/ng_macfilter_test.sh @@ -29,6 +29,8 @@ # # $FreeBSD$ +set -e + progname="$(basename $0 .sh)" entries_lst="/tmp/$progname.entries.lst" entries2_lst="/tmp/$progname.entries2.lst" @@ -124,7 +126,7 @@ test_not_ok () { local msg="$1" _test_next - _test_fails + _test_fail echo "not ok $TSTNR - $msg" return 1 @@ -183,9 +185,24 @@ test_ge () { test_not_ok "$v1 <= $v2 $msg" fi } -test_rc () { test_eq $? $1 "$2"; } -test_failure () { test_ne $? 0 "$1"; } -test_success () { test_eq $? 0 "$1"; } +test_failure () { + msg=$1 + shift + if ! "$@"; then + test_ok "$msg - \"$@\" failed as expected" + else + test_not_ok "$msg - expected \"$@\" to fail but succeeded" + fi +} +test_success () { + msg=$1 + shift + if ! "$@"; then + test_not_ok "$msg - \"$@\" failed unexpectedly" + else + test_ok "$msg - \"$@\" succeeded" + fi +} gethooks () { ngctl msg MF: 'gethooks' \ @@ -217,6 +234,13 @@ genmac () { test_title "Setting up system..." load_modules netgraph ng_socket ng_ether ng_macfilter ng_one2many eth=$(find_iface) +if [ -z "$eth" ]; then + echo "1..1" + echo "not ok 1 - Could not find a valid interface" + echo "Available interfaces:" + ifconfig + exit 1 +fi test_comment "Using $eth..." @@ -239,31 +263,23 @@ test_cnt 46 ################################################################################ test_title "Test: Duplicate default hook" -ngctl connect MF: O2M: default many99 2>/dev/null -test_failure "duplicate connect of default hook" - +test_failure "duplicate connect of default hook" ngctl connect MF: O2M: default many99 ################################################################################ test_title "Test: Add and remove hooks" -ngctl connect MF: O2M: xxx1 many$((HOOKS + 1)) -test_success "connect MF:xxx1 to O2M:many$((HOOKS + 1))" -ngctl connect MF: O2M: xxx2 many$((HOOKS + 2)) -test_success "connect MF:xxx2 to O2M:many$((HOOKS + 2))" -ngctl connect MF: O2M: xxx3 many$((HOOKS + 3)) -test_success "connect MF:xxx3 to O2M:many$((HOOKS + 3))" +test_success "connect MF:xxx1 to O2M:many$((HOOKS + 1))" ngctl connect MF: O2M: xxx1 many$((HOOKS + 1)) +test_success "connect MF:xxx2 to O2M:many$((HOOKS + 2))" ngctl connect MF: O2M: xxx2 many$((HOOKS + 2)) +test_success "connect MF:xxx3 to O2M:many$((HOOKS + 3))" ngctl connect MF: O2M: xxx3 many$((HOOKS + 3)) hooks=$(gethooks) test_eq $created_hooks:xxx1:xxx2:xxx3 $hooks 'hooks after adding xxx1-3' -ngctl rmhook MF: xxx1 -test_success "rmhook MF:xxx$i" +test_success "rmhook MF:xxx$i" ngctl rmhook MF: xxx1 hooks=$(gethooks) test_eq $created_hooks:xxx2:xxx3 $hooks 'hooks after removing xxx1' -ngctl rmhook MF: xxx2 -test_success "rmhook MF:xxx$i" +test_success "rmhook MF:xxx$i" ngctl rmhook MF: xxx2 hooks=$(gethooks) test_eq $created_hooks:xxx3 $hooks 'hooks after removing xxx2' -ngctl rmhook MF: xxx3 -test_success "rmhook MF:xxx$i" +test_success "rmhook MF:xxx$i" ngctl rmhook MF: xxx3 hooks=$(gethooks) test_eq $created_hooks $hooks 'hooks after removing xxx3' @@ -418,8 +434,7 @@ done ################################################################################ test_title "Test: Resetting macfilter..." -ngctl msg MF: reset -test_success "**** reset failed" +test_success "**** reset failed" ngctl msg MF: reset test_eq $(countmacs) 0 'MACs in table' test_bail_on_fail From owner-dev-commits-src-all@freebsd.org Fri Mar 19 18:39:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF75C57EB33; Fri, 19 Mar 2021 18: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 4F2CP24MXrz3R42; Fri, 19 Mar 2021 18: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 876FA19D2B; Fri, 19 Mar 2021 18: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 12JIdoDF047848; Fri, 19 Mar 2021 18:39:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JIdoVr047847; Fri, 19 Mar 2021 18:39:50 GMT (envelope-from git) Date: Fri, 19 Mar 2021 18:39:50 GMT Message-Id: <202103191839.12JIdoVr047847@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: ee231b27fff9 - main - Also skip sys/net/if_lagg_test:witness on non-i386 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: ee231b27fff9d6950bf36a9800c02f6474b53139 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 18:39:50 -0000 The branch main has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=ee231b27fff9d6950bf36a9800c02f6474b53139 commit ee231b27fff9d6950bf36a9800c02f6474b53139 Author: Alex Richardson AuthorDate: 2021-03-19 18:35:04 +0000 Commit: Alex Richardson CommitDate: 2021-03-19 18:35:06 +0000 Also skip sys/net/if_lagg_test:witness on non-i386 The LOR also happens on amd64 and other architectures. Ideally we would fix this. However, in order to get Jenkins green again to catch real regressions, we should skip this test for now. PR: 251726 Reviewed By: lwhsu Differential Revision: https://reviews.freebsd.org/D29341 --- tests/sys/net/if_lagg_test.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/sys/net/if_lagg_test.sh b/tests/sys/net/if_lagg_test.sh index 8d06e761db53..5aed9fd7c61b 100755 --- a/tests/sys/net/if_lagg_test.sh +++ b/tests/sys/net/if_lagg_test.sh @@ -403,8 +403,7 @@ witness_head() witness_body() { if [ "$(atf_config_get ci false)" = "true" ] && \ - [ "$(uname -p)" = "i386" ]; then - atf_skip "https://bugs.freebsd.org/244163" + atf_skip "https://bugs.freebsd.org/244163 and https://bugs.freebsd.org/251726" fi if [ `sysctl -n debug.witness.watch` -ne 1 ]; then atf_skip "witness(4) is not enabled" From owner-dev-commits-src-all@freebsd.org Fri Mar 19 18:42:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F0DC57F185; Fri, 19 Mar 2021 18:42: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 4F2CSH3BK6z3hWx; Fri, 19 Mar 2021 18:42: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 603A819FC7; Fri, 19 Mar 2021 18:42: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 12JIgdHZ059635; Fri, 19 Mar 2021 18:42:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JIgdwG059634; Fri, 19 Mar 2021 18:42:39 GMT (envelope-from git) Date: Fri, 19 Mar 2021 18:42:39 GMT Message-Id: <202103191842.12JIgdwG059634@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 0cb6fa6acc93 - stable/13 - linux: make timerfd_settime(2) set expirations count to zero 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 0cb6fa6acc93231242ef40e77518a9016ef4076a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 18:42:39 -0000 The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=0cb6fa6acc93231242ef40e77518a9016ef4076a commit 0cb6fa6acc93231242ef40e77518a9016ef4076a Author: shu AuthorDate: 2021-02-03 16:51:45 +0000 Commit: Dmitry Chagin CommitDate: 2021-03-19 18:36:11 +0000 linux: make timerfd_settime(2) set expirations count to zero On Linux, read(2) from a timerfd file descriptor returns an unsigned 8-byte integer (uint64_t) containing the number of expirations that have occurred, if the timer has already expired one or more times since its settings were last modified using timerfd_settime(), or since the last successful read(2). That's to say, once we do a read or call timerfd_settime(), timer fd's expiration count should be zero. Some Linux applications create timerfd and add it to epoll with LT mode, when event comes, they do timerfd_settime instead of read to stop event source from trigger. On FreeBSD, timerfd_settime(2) didn't set the count to zero, which caused high CPU utilization. Submitted by: ankohuu_outlook.com (Shunchao Hu) Differential Revision: https://reviews.freebsd.org/D28231 (cherry picked from commit ae71b794cbed19e5e25effc3438720ad452ab87c) --- sys/compat/linux/linux_event.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c index dfb4588392cc..54f6b083adf3 100644 --- a/sys/compat/linux/linux_event.c +++ b/sys/compat/linux/linux_event.c @@ -981,6 +981,7 @@ linux_timerfd_settime(struct thread *td, struct linux_timerfd_settime_args *args linux_timerfd_curval(tfd, &ots); tfd->tfd_time = nts; + tfd->tfd_count = 0; if (timespecisset(&nts.it_value)) { linux_timerfd_clocktime(tfd, &cts); ts = nts.it_value; From owner-dev-commits-src-all@freebsd.org Fri Mar 19 19:38:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD7305A8170; Fri, 19 Mar 2021 19:38: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 4F2Dhd54Jrz3lwP; Fri, 19 Mar 2021 19:38: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 9C8D41AC8C; Fri, 19 Mar 2021 19:38: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 12JJcPrE027484; Fri, 19 Mar 2021 19:38:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JJcPBO027483; Fri, 19 Mar 2021 19:38:25 GMT (envelope-from git) Date: Fri, 19 Mar 2021 19:38:25 GMT Message-Id: <202103191938.12JJcPBO027483@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: a1d803c16206 - main - cxgbe(4): make it safe to call setup_memwin repeatedly. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a1d803c162067b6cd334fc8a44a89f26cc82d83b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 19:38:25 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=a1d803c162067b6cd334fc8a44a89f26cc82d83b commit a1d803c162067b6cd334fc8a44a89f26cc82d83b Author: Navdeep Parhar AuthorDate: 2021-03-19 19:30:57 +0000 Commit: Navdeep Parhar CommitDate: 2021-03-19 19:37:44 +0000 cxgbe(4): make it safe to call setup_memwin repeatedly. A repeat call will recreate the memory windows in the hardware and move them to their last-known positions without repeating any of the software initialization. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_main.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 201a333aa431..a61110e99e34 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -3031,16 +3031,18 @@ setup_memwin(struct adapter *sc) } for (i = 0, mw = &sc->memwin[0]; i < NUM_MEMWIN; i++, mw_init++, mw++) { - rw_init(&mw->mw_lock, "memory window access"); - mw->mw_base = mw_init->base; - mw->mw_aperture = mw_init->aperture; - mw->mw_curpos = 0; + if (!rw_initialized(&mw->mw_lock)) { + rw_init(&mw->mw_lock, "memory window access"); + mw->mw_base = mw_init->base; + mw->mw_aperture = mw_init->aperture; + mw->mw_curpos = 0; + } t4_write_reg(sc, PCIE_MEM_ACCESS_REG(A_PCIE_MEM_ACCESS_BASE_WIN, i), (mw->mw_base + bar0) | V_BIR(0) | V_WINDOW(ilog2(mw->mw_aperture) - 10)); rw_wlock(&mw->mw_lock); - position_memwin(sc, i, 0); + position_memwin(sc, i, mw->mw_curpos); rw_wunlock(&mw->mw_lock); } From owner-dev-commits-src-all@freebsd.org Fri Mar 19 19:52:08 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 340995A8F07; Fri, 19 Mar 2021 19:52: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 4F2F0S13KQz3myT; Fri, 19 Mar 2021 19:52: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 16EFE1AF09; Fri, 19 Mar 2021 19:52: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 12JJq8iV053943; Fri, 19 Mar 2021 19:52:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JJq8U3053942; Fri, 19 Mar 2021 19:52:08 GMT (envelope-from git) Date: Fri, 19 Mar 2021 19:52:08 GMT Message-Id: <202103191952.12JJq8U3053942@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: c02c04f113fe - main - x86: consolidate hw watchpoint logic into new file 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: c02c04f113fe65001bc21363ae3ad08cf6c763eb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 19:52:08 -0000 The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c02c04f113fe65001bc21363ae3ad08cf6c763eb commit c02c04f113fe65001bc21363ae3ad08cf6c763eb Author: Mitchell Horne AuthorDate: 2021-03-19 19:39:12 +0000 Commit: Mitchell Horne CommitDate: 2021-03-19 19:51:52 +0000 x86: consolidate hw watchpoint logic into new file This is a prerequisite to using these functions outside of ddb, but also provides some cleanup and minor refactoring. This code is almost entirely duplicated between the two implementations, the only significant difference being the lack of dbreg synchronization on i386. Cleanups are: - demote some internal functions to static - use the constant NDBREGS instead of a '4' literal - remove K&R definitions - some added comments Reviewed by: kib, jhb Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29153 --- sys/amd64/amd64/db_trace.c | 216 +----------------------------------- sys/conf/files.x86 | 1 + sys/i386/i386/db_trace.c | 173 +---------------------------- sys/x86/include/x86_var.h | 3 + sys/x86/x86/dbreg.c | 267 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 281 insertions(+), 379 deletions(-) diff --git a/sys/amd64/amd64/db_trace.c b/sys/amd64/amd64/db_trace.c index 7d1544a5d0bc..5c1cd41cda15 100644 --- a/sys/amd64/amd64/db_trace.c +++ b/sys/amd64/amd64/db_trace.c @@ -128,11 +128,6 @@ static void db_nextframe(struct amd64_frame **, db_addr_t *, struct thread *); static void db_print_stack_entry(const char *, db_addr_t, void *); static void decode_syscall(int, struct thread *); -static const char * watchtype_str(int type); -int amd64_set_watch(int watchnum, unsigned long watchaddr, int size, - int access, struct dbreg *d); -int amd64_clr_watch(int watchnum, struct dbreg *d); - static void db_print_stack_entry(const char *name, db_addr_t callpc, void *frame) { @@ -391,223 +386,22 @@ db_trace_thread(struct thread *thr, int count) } int -amd64_set_watch(watchnum, watchaddr, size, access, d) - int watchnum; - unsigned long watchaddr; - int size; - int access; - struct dbreg *d; -{ - int i, len; - - if (watchnum == -1) { - for (i = 0; i < 4; i++) - if (!DBREG_DR7_ENABLED(d->dr[7], i)) - break; - if (i < 4) - watchnum = i; - else - return (-1); - } - - switch (access) { - case DBREG_DR7_EXEC: - size = 1; /* size must be 1 for an execution breakpoint */ - /* fall through */ - case DBREG_DR7_WRONLY: - case DBREG_DR7_RDWR: - break; - default: - return (-1); - } - - /* - * we can watch a 1, 2, 4, or 8 byte sized location - */ - switch (size) { - case 1: - len = DBREG_DR7_LEN_1; - break; - case 2: - len = DBREG_DR7_LEN_2; - break; - case 4: - len = DBREG_DR7_LEN_4; - break; - case 8: - len = DBREG_DR7_LEN_8; - break; - default: - return (-1); - } - - /* clear the bits we are about to affect */ - d->dr[7] &= ~DBREG_DR7_MASK(watchnum); - - /* set drN register to the address, N=watchnum */ - DBREG_DRX(d, watchnum) = watchaddr; - - /* enable the watchpoint */ - d->dr[7] |= DBREG_DR7_SET(watchnum, len, access, - DBREG_DR7_GLOBAL_ENABLE); - - return (watchnum); -} - -int -amd64_clr_watch(watchnum, d) - int watchnum; - struct dbreg *d; -{ - - if (watchnum < 0 || watchnum >= 4) - return (-1); - - d->dr[7] &= ~DBREG_DR7_MASK(watchnum); - DBREG_DRX(d, watchnum) = 0; - - return (0); -} - -int -db_md_set_watchpoint(addr, size) - db_expr_t addr; - db_expr_t size; +db_md_set_watchpoint(db_expr_t addr, db_expr_t size) { - struct dbreg *d; - struct pcpu *pc; - int avail, c, cpu, i, wsize; - - d = (struct dbreg *)PCPU_PTR(dbreg); - cpu = PCPU_GET(cpuid); - fill_dbregs(NULL, d); - - avail = 0; - for (i = 0; i < 4; i++) { - if (!DBREG_DR7_ENABLED(d->dr[7], i)) - avail++; - } - - if (avail * 8 < size) - return (-1); - - for (i = 0; i < 4 && size > 0; i++) { - if (!DBREG_DR7_ENABLED(d->dr[7], i)) { - if (size >= 8 || (avail == 1 && size > 4)) - wsize = 8; - else if (size > 2) - wsize = 4; - else - wsize = size; - amd64_set_watch(i, addr, wsize, DBREG_DR7_WRONLY, d); - addr += wsize; - size -= wsize; - avail--; - } - } - - set_dbregs(NULL, d); - CPU_FOREACH(c) { - if (c == cpu) - continue; - pc = pcpu_find(c); - memcpy(pc->pc_dbreg, d, sizeof(*d)); - pc->pc_dbreg_cmd = PC_DBREG_CMD_LOAD; - } - return (0); + return (dbreg_set_watchpoint((vm_offset_t)addr, (vm_size_t)size)); } int -db_md_clr_watchpoint(addr, size) - db_expr_t addr; - db_expr_t size; +db_md_clr_watchpoint(db_expr_t addr, db_expr_t size) { - struct dbreg *d; - struct pcpu *pc; - int i, c, cpu; - - d = (struct dbreg *)PCPU_PTR(dbreg); - cpu = PCPU_GET(cpuid); - fill_dbregs(NULL, d); - - for (i = 0; i < 4; i++) { - if (DBREG_DR7_ENABLED(d->dr[7], i)) { - if (DBREG_DRX((d), i) >= addr && - DBREG_DRX((d), i) < addr + size) - amd64_clr_watch(i, d); - } - } - - set_dbregs(NULL, d); - CPU_FOREACH(c) { - if (c == cpu) - continue; - pc = pcpu_find(c); - memcpy(pc->pc_dbreg, d, sizeof(*d)); - pc->pc_dbreg_cmd = PC_DBREG_CMD_LOAD; - } - return (0); -} - -static const char * -watchtype_str(type) - int type; -{ - switch (type) { - case DBREG_DR7_EXEC : return "execute"; break; - case DBREG_DR7_RDWR : return "read/write"; break; - case DBREG_DR7_WRONLY : return "write"; break; - default : return "invalid"; break; - } + return (dbreg_clr_watchpoint((vm_offset_t)addr, (vm_size_t)size)); } void db_md_list_watchpoints(void) { - struct dbreg d; - int i, len, type; - - fill_dbregs(NULL, &d); - - db_printf("\nhardware watchpoints:\n"); - db_printf(" watch status type len address\n"); - db_printf(" ----- -------- ---------- --- ------------------\n"); - for (i = 0; i < 4; i++) { - if (DBREG_DR7_ENABLED(d.dr[7], i)) { - type = DBREG_DR7_ACCESS(d.dr[7], i); - len = DBREG_DR7_LEN(d.dr[7], i); - if (len == DBREG_DR7_LEN_8) - len = 8; - else - len++; - db_printf(" %-5d %-8s %10s %3d ", - i, "enabled", watchtype_str(type), len); - db_printsym((db_addr_t)DBREG_DRX(&d, i), DB_STGY_ANY); - db_printf("\n"); - } else { - db_printf(" %-5d disabled\n", i); - } - } - db_printf("\ndebug register values:\n"); - for (i = 0; i < 8; i++) - if (i != 4 && i != 5) - db_printf(" dr%d 0x%016lx\n", i, DBREG_DRX(&d, i)); - db_printf("\n"); -} - -void -amd64_db_resume_dbreg(void) -{ - struct dbreg *d; - - switch (PCPU_GET(dbreg_cmd)) { - case PC_DBREG_CMD_LOAD: - d = (struct dbreg *)PCPU_PTR(dbreg); - set_dbregs(NULL, d); - PCPU_SET(dbreg_cmd, PC_DBREG_CMD_NONE); - break; - } + dbreg_list_watchpoints(); } diff --git a/sys/conf/files.x86 b/sys/conf/files.x86 index 59ff39ca053d..fd31d95fa162 100644 --- a/sys/conf/files.x86 +++ b/sys/conf/files.x86 @@ -320,6 +320,7 @@ x86/x86/bus_machdep.c standard x86/x86/busdma_bounce.c standard x86/x86/busdma_machdep.c standard x86/x86/cpu_machdep.c standard +x86/x86/dbreg.c optional ddb x86/x86/dump_machdep.c standard x86/x86/fdt_machdep.c optional fdt x86/x86/identcpu.c standard diff --git a/sys/i386/i386/db_trace.c b/sys/i386/i386/db_trace.c index 87229e74e70b..50fb1fa6355d 100644 --- a/sys/i386/i386/db_trace.c +++ b/sys/i386/i386/db_trace.c @@ -198,11 +198,6 @@ static void db_print_stack_entry(const char *, int, char **, int *, db_addr_t, void *); static void decode_syscall(int, struct thread *); -static const char * watchtype_str(int type); -int i386_set_watch(int watchnum, unsigned int watchaddr, int size, int access, - struct dbreg *d); -int i386_clr_watch(int watchnum, struct dbreg *d); - /* * Figure out how many arguments were passed into the frame at "fp". */ @@ -618,180 +613,22 @@ db_trace_thread(struct thread *thr, int count) } int -i386_set_watch(watchnum, watchaddr, size, access, d) - int watchnum; - unsigned int watchaddr; - int size; - int access; - struct dbreg *d; +db_md_set_watchpoint(db_expr_t addr, db_expr_t size) { - int i, len; - - if (watchnum == -1) { - for (i = 0; i < 4; i++) - if (!DBREG_DR7_ENABLED(d->dr[7], i)) - break; - if (i < 4) - watchnum = i; - else - return (-1); - } - - switch (access) { - case DBREG_DR7_EXEC: - size = 1; /* size must be 1 for an execution breakpoint */ - /* fall through */ - case DBREG_DR7_WRONLY: - case DBREG_DR7_RDWR: - break; - default: - return (-1); - } - /* - * we can watch a 1, 2, or 4 byte sized location - */ - switch (size) { - case 1: - len = DBREG_DR7_LEN_1; - break; - case 2: - len = DBREG_DR7_LEN_2; - break; - case 4: - len = DBREG_DR7_LEN_4; - break; - default: - return (-1); - } - - /* clear the bits we are about to affect */ - d->dr[7] &= ~DBREG_DR7_MASK(watchnum); - - /* set drN register to the address, N=watchnum */ - DBREG_DRX(d, watchnum) = watchaddr; - - /* enable the watchpoint */ - d->dr[7] |= DBREG_DR7_SET(watchnum, len, access, - DBREG_DR7_GLOBAL_ENABLE); - - return (watchnum); + return (dbreg_set_watchpoint((vm_offset_t)addr, (vm_size_t)size)); } int -i386_clr_watch(watchnum, d) - int watchnum; - struct dbreg *d; +db_md_clr_watchpoint(db_expr_t addr, db_expr_t size) { - if (watchnum < 0 || watchnum >= 4) - return (-1); - - d->dr[7] &= ~DBREG_DR7_MASK(watchnum); - DBREG_DRX(d, watchnum) = 0; - - return (0); -} - -int -db_md_set_watchpoint(addr, size) - db_expr_t addr; - db_expr_t size; -{ - struct dbreg d; - int avail, i, wsize; - - fill_dbregs(NULL, &d); - - avail = 0; - for(i = 0; i < 4; i++) { - if (!DBREG_DR7_ENABLED(d.dr[7], i)) - avail++; - } - - if (avail * 4 < size) - return (-1); - - for (i = 0; i < 4 && (size > 0); i++) { - if (!DBREG_DR7_ENABLED(d.dr[7], i)) { - if (size > 2) - wsize = 4; - else - wsize = size; - i386_set_watch(i, addr, wsize, - DBREG_DR7_WRONLY, &d); - addr += wsize; - size -= wsize; - } - } - - set_dbregs(NULL, &d); - - return(0); -} - -int -db_md_clr_watchpoint(addr, size) - db_expr_t addr; - db_expr_t size; -{ - struct dbreg d; - int i; - - fill_dbregs(NULL, &d); - - for(i = 0; i < 4; i++) { - if (DBREG_DR7_ENABLED(d.dr[7], i)) { - if ((DBREG_DRX((&d), i) >= addr) && - (DBREG_DRX((&d), i) < addr+size)) - i386_clr_watch(i, &d); - } - } - - set_dbregs(NULL, &d); - - return(0); -} - -static const char * -watchtype_str(type) - int type; -{ - switch (type) { - case DBREG_DR7_EXEC : return "execute"; break; - case DBREG_DR7_RDWR : return "read/write"; break; - case DBREG_DR7_WRONLY : return "write"; break; - default : return "invalid"; break; - } + return (dbreg_clr_watchpoint((vm_offset_t)addr, (vm_size_t)size)); } void db_md_list_watchpoints(void) { - struct dbreg d; - int i, len, type; - - fill_dbregs(NULL, &d); - - db_printf("\nhardware watchpoints:\n"); - db_printf(" watch status type len address\n"); - db_printf(" ----- -------- ---------- --- ----------\n"); - for (i = 0; i < 4; i++) { - if (DBREG_DR7_ENABLED(d.dr[7], i)) { - type = DBREG_DR7_ACCESS(d.dr[7], i); - len = DBREG_DR7_LEN(d.dr[7], i); - db_printf(" %-5d %-8s %10s %3d ", - i, "enabled", watchtype_str(type), len + 1); - db_printsym((db_addr_t)DBREG_DRX(&d, i), DB_STGY_ANY); - db_printf("\n"); - } else { - db_printf(" %-5d disabled\n", i); - } - } - db_printf("\ndebug register values:\n"); - for (i = 0; i < 8; i++) - if (i != 4 && i != 5) - db_printf(" dr%d 0x%08x\n", i, DBREG_DRX(&d, i)); - db_printf("\n"); + dbreg_list_watchpoints(); } diff --git a/sys/x86/include/x86_var.h b/sys/x86/include/x86_var.h index f31dcd47fff5..d60b4b2acbd8 100644 --- a/sys/x86/include/x86_var.h +++ b/sys/x86/include/x86_var.h @@ -120,6 +120,9 @@ vm_paddr_t cpu_getmaxphyaddr(void); bool cpu_mwait_usable(void); void cpu_probe_amdc1e(void); void cpu_setregs(void); +int dbreg_set_watchpoint(vm_offset_t addr, vm_size_t size); +int dbreg_clr_watchpoint(vm_offset_t addr, vm_size_t size); +void dbreg_list_watchpoints(void); bool disable_wp(void); void restore_wp(bool old_wp); void finishidentcpu(void); diff --git a/sys/x86/x86/dbreg.c b/sys/x86/x86/dbreg.c new file mode 100644 index 000000000000..0d28ef8dba38 --- /dev/null +++ b/sys/x86/x86/dbreg.c @@ -0,0 +1,267 @@ +/*- + * Mach Operating System + * Copyright (c) 1991,1990 Carnegie Mellon University + * All Rights Reserved. + * + * Permission to use, copy, modify and distribute this software and its + * documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR + * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +#include "opt_ddb.h" + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#define NDBREGS 4 +#ifdef __amd64__ +#define MAXWATCHSIZE 8 +#else +#define MAXWATCHSIZE 4 +#endif + +/* + * Set a watchpoint in the debug register denoted by 'watchnum'. + */ +static void +dbreg_set_watchreg(int watchnum, vm_offset_t watchaddr, vm_size_t size, + int access, struct dbreg *d) +{ + int len; + + MPASS(watchnum >= 0 && watchnum < NDBREGS); + + /* size must be 1 for an execution breakpoint */ + if (access == DBREG_DR7_EXEC) + size = 1; + + /* + * we can watch a 1, 2, or 4 byte sized location + */ + switch (size) { + case 1: + len = DBREG_DR7_LEN_1; + break; + case 2: + len = DBREG_DR7_LEN_2; + break; + case 4: + len = DBREG_DR7_LEN_4; + break; +#if MAXWATCHSIZE >= 8 + case 8: + len = DBREG_DR7_LEN_8; + break; +#endif + default: + return; + } + + /* clear the bits we are about to affect */ + d->dr[7] &= ~DBREG_DR7_MASK(watchnum); + + /* set drN register to the address, N=watchnum */ + DBREG_DRX(d, watchnum) = watchaddr; + + /* enable the watchpoint */ + d->dr[7] |= DBREG_DR7_SET(watchnum, len, access, + DBREG_DR7_GLOBAL_ENABLE); +} + +/* + * Remove a watchpoint from the debug register denoted by 'watchnum'. + */ +static void +dbreg_clr_watchreg(int watchnum, struct dbreg *d) +{ + MPASS(watchnum >= 0 && watchnum < NDBREGS); + + d->dr[7] &= ~DBREG_DR7_MASK(watchnum); + DBREG_DRX(d, watchnum) = 0; +} + +/* + * Sync the debug registers. Other cores will read these values from the PCPU + * area when they resume. See amd64_db_resume_dbreg() below. + */ +static void +dbreg_sync(struct dbreg *dp) +{ +#ifdef __amd64__ + struct pcpu *pc; + int cpu, c; + + cpu = PCPU_GET(cpuid); + CPU_FOREACH(c) { + if (c == cpu) + continue; + pc = pcpu_find(c); + memcpy(pc->pc_dbreg, dp, sizeof(*dp)); + pc->pc_dbreg_cmd = PC_DBREG_CMD_LOAD; + } +#endif +} + +int +dbreg_set_watchpoint(vm_offset_t addr, vm_size_t size) +{ + struct dbreg *d; + int avail, i, wsize; + +#ifdef __amd64__ + d = (struct dbreg *)PCPU_PTR(dbreg); +#else + /* debug registers aren't stored in PCPU on i386. */ + struct dbreg d_temp; + d = &d_temp; +#endif + + fill_dbregs(NULL, d); + + /* + * Check if there are enough available registers to cover the desired + * area. + */ + avail = 0; + for (i = 0; i < NDBREGS; i++) { + if (!DBREG_DR7_ENABLED(d->dr[7], i)) + avail++; + } + + if (avail * MAXWATCHSIZE < size) + return (-1); + + for (i = 0; i < NDBREGS && size > 0; i++) { + if (!DBREG_DR7_ENABLED(d->dr[7], i)) { + if ((size >= 8 || (avail == 1 && size > 4)) && + MAXWATCHSIZE == 8) + wsize = 8; + else if (size > 2) + wsize = 4; + else + wsize = size; + dbreg_set_watchreg(i, addr, wsize, DBREG_DR7_WRONLY, d); + addr += wsize; + size -= wsize; + avail--; + } + } + + set_dbregs(NULL, d); + dbreg_sync(d); + + return (0); +} + +int +dbreg_clr_watchpoint(vm_offset_t addr, vm_size_t size) +{ + struct dbreg *d; + int i; + +#ifdef __amd64__ + d = (struct dbreg *)PCPU_PTR(dbreg); +#else + /* debug registers aren't stored in PCPU on i386. */ + struct dbreg d_temp; + d = &d_temp; +#endif + fill_dbregs(NULL, d); + + for (i = 0; i < NDBREGS; i++) { + if (DBREG_DR7_ENABLED(d->dr[7], i)) { + if (DBREG_DRX((d), i) >= addr && + DBREG_DRX((d), i) < addr + size) + dbreg_clr_watchreg(i, d); + } + } + + set_dbregs(NULL, d); + dbreg_sync(d); + + return (0); +} + +#ifdef DDB +static const char * +watchtype_str(int type) +{ + + switch (type) { + case DBREG_DR7_EXEC: + return ("execute"); + case DBREG_DR7_RDWR: + return ("read/write"); + case DBREG_DR7_WRONLY: + return ("write"); + default: + return ("invalid"); + } +} + +void +dbreg_list_watchpoints(void) +{ + struct dbreg d; + int i, len, type; + + fill_dbregs(NULL, &d); + + db_printf("\nhardware watchpoints:\n"); + db_printf(" watch status type len address\n"); + db_printf(" ----- -------- ---------- --- ----------\n"); + for (i = 0; i < NDBREGS; i++) { + if (DBREG_DR7_ENABLED(d.dr[7], i)) { + type = DBREG_DR7_ACCESS(d.dr[7], i); + len = DBREG_DR7_LEN(d.dr[7], i); + db_printf(" %-5d %-8s %10s %3d ", + i, "enabled", watchtype_str(type), len + 1); + db_printsym((db_addr_t)DBREG_DRX(&d, i), DB_STGY_ANY); + db_printf("\n"); + } else { + db_printf(" %-5d disabled\n", i); + } + } +} +#endif + +#ifdef __amd64__ +/* Sync debug registers when resuming from debugger. */ +void +amd64_db_resume_dbreg(void) +{ + struct dbreg *d; + + switch (PCPU_GET(dbreg_cmd)) { + case PC_DBREG_CMD_LOAD: + d = (struct dbreg *)PCPU_PTR(dbreg); + set_dbregs(NULL, d); + PCPU_SET(dbreg_cmd, PC_DBREG_CMD_NONE); + break; + } +} +#endif From owner-dev-commits-src-all@freebsd.org Fri Mar 19 20:45:47 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5C0B95AAAF0; Fri, 19 Mar 2021 20:45: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 4F2GBM28tMz3rkV; Fri, 19 Mar 2021 20:45: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 3CF361B851; Fri, 19 Mar 2021 20:45: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 12JKjlJi021196; Fri, 19 Mar 2021 20:45:47 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JKjlvk021195; Fri, 19 Mar 2021 20:45:47 GMT (envelope-from git) Date: Fri, 19 Mar 2021 20:45:47 GMT Message-Id: <202103192045.12JKjlvk021195@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Navdeep Parhar Subject: git: 3cc6f777befc - main - cxgbe(4): create a separate helper routine to write the global RSS key. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: np X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3cc6f777befc2e494b39a4c0dcd91aaf99267f40 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 20:45:47 -0000 The branch main has been updated by np: URL: https://cgit.FreeBSD.org/src/commit/?id=3cc6f777befc2e494b39a4c0dcd91aaf99267f40 commit 3cc6f777befc2e494b39a4c0dcd91aaf99267f40 Author: Navdeep Parhar AuthorDate: 2021-03-19 20:28:11 +0000 Commit: Navdeep Parhar CommitDate: 2021-03-19 20:35:30 +0000 cxgbe(4): create a separate helper routine to write the global RSS key. While here, make sure only the PF driver attempts to program the global RSS key (with options RSS). The VF driver doesn't have access to those device registers. MFC after: 1 week Sponsored by: Chelsio Communications --- sys/dev/cxgbe/t4_main.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index a61110e99e34..12efa8042b64 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -5810,14 +5810,28 @@ t4_setup_intr_handlers(struct adapter *sc) return (0); } -int -adapter_full_init(struct adapter *sc) +static void +write_global_rss_key(struct adapter *sc) { - int rc, i; #ifdef RSS + int i; uint32_t raw_rss_key[RSS_KEYSIZE / sizeof(uint32_t)]; uint32_t rss_key[RSS_KEYSIZE / sizeof(uint32_t)]; + + CTASSERT(RSS_KEYSIZE == 40); + + rss_getkey((void *)&raw_rss_key[0]); + for (i = 0; i < nitems(rss_key); i++) { + rss_key[i] = htobe32(raw_rss_key[nitems(rss_key) - 1 - i]); + } + t4_write_rss_key(sc, &rss_key[0], -1, 1); #endif +} + +int +adapter_full_init(struct adapter *sc) +{ + int rc, i; ASSERT_SYNCHRONIZED_OP(sc); ADAPTER_LOCK_ASSERT_NOTOWNED(sc); @@ -5843,17 +5857,11 @@ adapter_full_init(struct adapter *sc) taskqueue_start_threads(&sc->tq[i], 1, PI_NET, "%s tq%d", device_get_nameunit(sc->dev), i); } -#ifdef RSS - MPASS(RSS_KEYSIZE == 40); - rss_getkey((void *)&raw_rss_key[0]); - for (i = 0; i < nitems(rss_key); i++) { - rss_key[i] = htobe32(raw_rss_key[nitems(rss_key) - 1 - i]); - } - t4_write_rss_key(sc, &rss_key[0], -1, 1); -#endif - if (!(sc->flags & IS_VF)) + if (!(sc->flags & IS_VF)) { + write_global_rss_key(sc); t4_intr_enable(sc); + } #ifdef KERN_TLS if (sc->flags & KERN_TLS_OK) callout_reset_sbt(&sc->ktls_tick, SBT_1MS, 0, ktls_tick, sc, From owner-dev-commits-src-all@freebsd.org Fri Mar 19 20:53:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C7135AB149; Fri, 19 Mar 2021 20:53:31 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2GMH0k8cz3sPx; Fri, 19 Mar 2021 20:53:31 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 0B31FAA55; Fri, 19 Mar 2021 20:53:31 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f182.google.com with SMTP id r14so7848353qtt.7; Fri, 19 Mar 2021 13:53:31 -0700 (PDT) X-Gm-Message-State: AOAM5329ye1VThh4wyFolmcb6Gb8ymMQf2juTCmts/1e9Qu/jpYwbTve o3DB+/U/09vtHSTWMyI7LXcDSUAOdPWsGOpn30M= X-Google-Smtp-Source: ABdhPJyCGLgQuQDh6uhGsrKJOxOr9aZS36bJrSVnqfu/sdnf4tJOwKbS4U2a3Hw9wQY7Y6iDZJPK60c3urVsvu2EQJs= X-Received: by 2002:aed:2e62:: with SMTP id j89mr526036qtd.310.1616187210518; Fri, 19 Mar 2021 13:53:30 -0700 (PDT) MIME-Version: 1.0 References: <202103182309.12IN9nXd002407@gitrepo.freebsd.org> In-Reply-To: <202103182309.12IN9nXd002407@gitrepo.freebsd.org> From: Kyle Evans Date: Fri, 19 Mar 2021 15:53:16 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: git: 929acdb19acb - main - fusefs: fix two bugs regarding fcntl file locks To: Alan Somers Cc: src-committers , "" , dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 20:53:31 -0000 On Thu, Mar 18, 2021 at 6:09 PM Alan Somers wrote: > > The branch main has been updated by asomers: > > URL: https://cgit.FreeBSD.org/src/commit/?id=929acdb19acb67cc0e6ee5439df98e28a84d4772 > > commit 929acdb19acb67cc0e6ee5439df98e28a84d4772 > Author: Alan Somers > AuthorDate: 2021-03-18 20:27:27 +0000 > Commit: Alan Somers > CommitDate: 2021-03-18 23:09:10 +0000 > > fusefs: fix two bugs regarding fcntl file locks > > 1) F_SETLKW (blocking) operations would be sent to the FUSE server as > F_SETLK (non-blocking). > > 2) Release operations, F_SETLK with lk_type = F_UNLCK, would simply > return EINVAL. > > PR: 253500 > Reported by: John Millikin > MFC after: 2 weeks > --- > sys/fs/fuse/fuse_vnops.c | 10 +++++++--- > tests/sys/fs/fusefs/flush.cc | 12 ++++++++++- > tests/sys/fs/fusefs/locks.cc | 45 +++++++++++++++++++++++++++++++++++++++++- > tests/sys/fs/fusefs/release.cc | 12 ++++++++++- > 4 files changed, 73 insertions(+), 6 deletions(-) > > diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c > index 5bbde1e278c9..cdbc42f5adf4 100644 > --- a/sys/fs/fuse/fuse_vnops.c > +++ b/sys/fs/fuse/fuse_vnops.c > @@ -437,10 +437,14 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) > op = FUSE_GETLK; > break; > case F_SETLK: > - op = FUSE_SETLK; > + if (flags & F_WAIT) > + op = FUSE_SETLKW; > + else > + op = FUSE_SETLK; > break; > - case F_SETLKW: > - op = FUSE_SETLKW; > + case F_UNLCK: > + op = FUSE_SETLK; > + flags |= F_UNLCK; > break; > default: > return EINVAL; Hi, The committed version of this appears to have brought back the redundant assignment to `flags` Thanks, Kyle Evans From owner-dev-commits-src-all@freebsd.org Fri Mar 19 21:09:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D2AE5ABDA3; Fri, 19 Mar 2021 21:09:48 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (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 4F2Gk425fPz3t9y; Fri, 19 Mar 2021 21:09:48 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-ot1-f48.google.com with SMTP id k14-20020a9d7dce0000b02901b866632f29so9845069otn.1; Fri, 19 Mar 2021 14:09:48 -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=d5ZiwTAJbLlLPOXlze3R2EBCrjncavTjmPk2PByLESA=; b=T/DZ73jkccR5QddlfrcrOM9vcdYPu30Jq/JgMMAkl+ohPMkTkr1H/bF4c5WVYPen6N PnoRmr8Tq1OTYBmxEQ84Na7CwfxN981M1To4gCx/p2aq5fpbZqqW9NVLg+h1OJsJMZyF ZvAOcQQhWwDjNVis1sxSBHLHswHXABCHAN68XdVhjrx9LZXcIOobKvvX10Kmva+JMSUE +0g/Q8RzZo8XedvxVHjkaeDKUA8TTEJf87p5peNRxATWC7vJNlnNhty5D651ggKAZXsK oDtrTSTGUbZC3NCVQUWoFlOgObp4HA2+4uo9exYcZlov2+gefp/2RaWEsZSr35Fyz3OI 83eA== X-Gm-Message-State: AOAM530i69j3H5u0c5iVTGdJrDmSd+fGdQIcBNrog+BzuvwH84QJICl8 qAY21Ps4tD7QtzhgJRpl8/lqbwqH8xG1jq1Tg/Nimv6o X-Google-Smtp-Source: ABdhPJz9/nYmAagD8I2pKJjhdUaCplhnvCuxyUfwnLktddSYfhJK9p1GkOxsWIGQCqsiBQc00sg7cqkdlVZDn/UesMY= X-Received: by 2002:a05:6830:2318:: with SMTP id u24mr2488464ote.291.1616188187075; Fri, 19 Mar 2021 14:09:47 -0700 (PDT) MIME-Version: 1.0 References: <202103182309.12IN9nXd002407@gitrepo.freebsd.org> In-Reply-To: From: Alan Somers Date: Fri, 19 Mar 2021 15:09:36 -0600 Message-ID: Subject: Re: git: 929acdb19acb - main - fusefs: fix two bugs regarding fcntl file locks To: Kyle Evans Cc: src-committers , "" , dev-commits-src-main@freebsd.org X-Rspamd-Queue-Id: 4F2Gk425fPz3t9y X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 21:09:48 -0000 On Fri, Mar 19, 2021 at 2:53 PM Kyle Evans wrote: > On Thu, Mar 18, 2021 at 6:09 PM Alan Somers wrote: > > > > The branch main has been updated by asomers: > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=929acdb19acb67cc0e6ee5439df98e28a84d4772 > > > > commit 929acdb19acb67cc0e6ee5439df98e28a84d4772 > > Author: Alan Somers > > AuthorDate: 2021-03-18 20:27:27 +0000 > > Commit: Alan Somers > > CommitDate: 2021-03-18 23:09:10 +0000 > > > > fusefs: fix two bugs regarding fcntl file locks > > > > 1) F_SETLKW (blocking) operations would be sent to the FUSE server as > > F_SETLK (non-blocking). > > > > 2) Release operations, F_SETLK with lk_type = F_UNLCK, would simply > > return EINVAL. > > > > PR: 253500 > > Reported by: John Millikin > > MFC after: 2 weeks > > --- > > sys/fs/fuse/fuse_vnops.c | 10 +++++++--- > > tests/sys/fs/fusefs/flush.cc | 12 ++++++++++- > > tests/sys/fs/fusefs/locks.cc | 45 > +++++++++++++++++++++++++++++++++++++++++- > > tests/sys/fs/fusefs/release.cc | 12 ++++++++++- > > 4 files changed, 73 insertions(+), 6 deletions(-) > > > > diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c > > index 5bbde1e278c9..cdbc42f5adf4 100644 > > --- a/sys/fs/fuse/fuse_vnops.c > > +++ b/sys/fs/fuse/fuse_vnops.c > > @@ -437,10 +437,14 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) > > op = FUSE_GETLK; > > break; > > case F_SETLK: > > - op = FUSE_SETLK; > > + if (flags & F_WAIT) > > + op = FUSE_SETLKW; > > + else > > + op = FUSE_SETLK; > > break; > > - case F_SETLKW: > > - op = FUSE_SETLKW; > > + case F_UNLCK: > > + op = FUSE_SETLK; > > + flags |= F_UNLCK; > > break; > > default: > > return EINVAL; > > Hi, > > The committed version of this appears to have brought back the > redundant assignment to `flags` > > Thanks, > > Kyle Evans > Oh crap. That's what I get for working from multiple computers, I suppose. I'll fix it. Thanks for letting me know. -Alan From owner-dev-commits-src-all@freebsd.org Fri Mar 19 22:10:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8EA395AE2C2; Fri, 19 Mar 2021 22:10: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 4F2J4T3fP0z4SvV; Fri, 19 Mar 2021 22:10: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 700491CABF; Fri, 19 Mar 2021 22:10: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 12JMAnjf035118; Fri, 19 Mar 2021 22:10:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12JMAnZL035117; Fri, 19 Mar 2021 22:10:49 GMT (envelope-from git) Date: Fri, 19 Mar 2021 22:10:49 GMT Message-Id: <202103192210.12JMAnZL035117@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: 5f742d3879de - main - nfsv4 client: fix forced dismount when sleeping on nfsv4lck 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: 5f742d3879deb1f46f2d151d5ef84f49e8d6afe6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Mar 2021 22:10:49 -0000 The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=5f742d3879deb1f46f2d151d5ef84f49e8d6afe6 commit 5f742d3879deb1f46f2d151d5ef84f49e8d6afe6 Author: Rick Macklem AuthorDate: 2021-03-19 21:09:33 +0000 Commit: Rick Macklem CommitDate: 2021-03-19 21:09:33 +0000 nfsv4 client: fix forced dismount when sleeping on nfsv4lck During a recent NFSv4 testing event a test server caused a hang where "umount -N" failed. The renew thread was sleeping on "nfsv4lck" and the "umount" was sleeping, waiting for the renew thread to terminate. This is the first of two patches that is hoped to fix the renew thread so that it will terminate when "umount -N" is done on the mount. nfsv4_lock() checks for forced dismount, but only after it wakes up from msleep(). Without this patch, a wakeup() call was required. This patch adds a 1second timeout on the msleep(), so that it will wake up and see the forced dismount flag. Normally a wakeup() will occur in less than 1second, but if a premature return from msleep() does occur, it will simply loop around and msleep() again. While here, replace the nfsmsleep() wrapper that was used for portability with the actual msleep() call and make the same change for nfsv4_getref(). MFC after: 2 weeks --- sys/fs/nfs/nfs_commonsubs.c | 10 ++++------ sys/fs/nfs/nfs_var.h | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c index d44ff122a95c..e9b2af17d8b4 100644 --- a/sys/fs/nfs/nfs_commonsubs.c +++ b/sys/fs/nfs/nfs_commonsubs.c @@ -2252,7 +2252,7 @@ nfsmout: */ int nfsv4_lock(struct nfsv4lock *lp, int iwantlock, int *isleptp, - void *mutex, struct mount *mp) + struct mtx *mutex, struct mount *mp) { if (isleptp) @@ -2280,8 +2280,7 @@ nfsv4_lock(struct nfsv4lock *lp, int iwantlock, int *isleptp, lp->nfslock_lock |= NFSV4LOCK_WANTED; if (isleptp) *isleptp = 1; - (void) nfsmsleep(&lp->nfslock_lock, mutex, - PZERO - 1, "nfsv4lck", NULL); + msleep(&lp->nfslock_lock, mutex, PVFS, "nfsv4lck", hz); if (iwantlock && !(lp->nfslock_lock & NFSV4LOCK_LOCK) && lp->nfslock_usecnt == 0) { lp->nfslock_lock &= ~NFSV4LOCK_LOCKWANTED; @@ -2331,7 +2330,7 @@ nfsv4_relref(struct nfsv4lock *lp) * return without getting a refcnt for that case. */ void -nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void *mutex, +nfsv4_getref(struct nfsv4lock *lp, int *isleptp, struct mtx *mutex, struct mount *mp) { @@ -2347,8 +2346,7 @@ nfsv4_getref(struct nfsv4lock *lp, int *isleptp, void *mutex, lp->nfslock_lock |= NFSV4LOCK_WANTED; if (isleptp) *isleptp = 1; - (void) nfsmsleep(&lp->nfslock_lock, mutex, - PZERO - 1, "nfsv4gr", NULL); + msleep(&lp->nfslock_lock, mutex, PVFS, "nfsv4gr", hz); } if (mp != NULL && NFSCL_FORCEDISM(mp)) return; diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h index 0a1fe3ce053d..aba5c5124e72 100644 --- a/sys/fs/nfs/nfs_var.h +++ b/sys/fs/nfs/nfs_var.h @@ -335,10 +335,10 @@ int nfsv4_loadattr(struct nfsrv_descript *, vnode_t, struct nfsv3_pathconf *, struct statfs *, struct nfsstatfs *, struct nfsfsinfo *, NFSACL_T *, int, int *, u_int32_t *, u_int32_t *, NFSPROC_T *, struct ucred *); -int nfsv4_lock(struct nfsv4lock *, int, int *, void *, struct mount *); +int nfsv4_lock(struct nfsv4lock *, int, int *, struct mtx *, struct mount *); void nfsv4_unlock(struct nfsv4lock *, int); void nfsv4_relref(struct nfsv4lock *); -void nfsv4_getref(struct nfsv4lock *, int *, void *, struct mount *); +void nfsv4_getref(struct nfsv4lock *, int *, struct mtx *, struct mount *); int nfsv4_getref_nonblock(struct nfsv4lock *); int nfsv4_testlock(struct nfsv4lock *); int nfsrv_mtostr(struct nfsrv_descript *, char *, int); From owner-dev-commits-src-all@freebsd.org Sat Mar 20 00:00:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B7605B0CFF; Sat, 20 Mar 2021 00:00: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 4F2LWV2dMfz4Zxw; Sat, 20 Mar 2021 00:00: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 4D8741DF78; Sat, 20 Mar 2021 00:00: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 12K00stG080365; Sat, 20 Mar 2021 00:00:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K00sbn080364; Sat, 20 Mar 2021 00:00:54 GMT (envelope-from git) Date: Sat, 20 Mar 2021 00:00:54 GMT Message-Id: <202103200000.12K00sbn080364@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: 9946b2f4e0b4 - main - Remove /usr/include/crypto/rijndael.h as well. 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: 9946b2f4e0b478de69ebd687e2132c318a4d7c21 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 00:00:54 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=9946b2f4e0b478de69ebd687e2132c318a4d7c21 commit 9946b2f4e0b478de69ebd687e2132c318a4d7c21 Author: John Baldwin AuthorDate: 2021-03-19 23:31:53 +0000 Commit: John Baldwin CommitDate: 2021-03-19 23:31:53 +0000 Remove /usr/include/crypto/rijndael.h as well. I missed this in the earlier commit. MFC after: 1 week Fixes: 283352dd4f6a3bb2f3c7cb45ce5dca3d86f5e3f4 --- ObsoleteFiles.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 2d8113dd1cce..79ed21ec18ca 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -2874,6 +2874,7 @@ OLD_FILES+=usr/include/crypto/cbc_mac.h OLD_FILES+=usr/include/crypto/deflate.h OLD_FILES+=usr/include/crypto/gfmult.h OLD_FILES+=usr/include/crypto/gmac.h +OLD_FILES+=usr/include/crypto/rijndael.h OLD_FILES+=usr/include/crypto/rmd160.h OLD_FILES+=usr/include/crypto/xform.h OLD_FILES+=usr/include/crypto/xform_auth.h From owner-dev-commits-src-all@freebsd.org Sat Mar 20 00:00:55 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A2345B09F3; Sat, 20 Mar 2021 00:00: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 4F2LWW3YkDz4bGh; Sat, 20 Mar 2021 00:00: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 6CE921DF7A; Sat, 20 Mar 2021 00:00: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 12K00tDa080383; Sat, 20 Mar 2021 00:00:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K00tKV080382; Sat, 20 Mar 2021 00:00:55 GMT (envelope-from git) Date: Sat, 20 Mar 2021 00:00:55 GMT Message-Id: <202103200000.12K00tKV080382@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: 7af04dff025d - main - Only symlink cryptodev.h into /usr/include/crypto/ 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: 7af04dff025d98e2feff979756ecde8ef0ace390 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 00:00:55 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=7af04dff025d98e2feff979756ecde8ef0ace390 commit 7af04dff025d98e2feff979756ecde8ef0ace390 Author: John Baldwin AuthorDate: 2021-03-19 23:59:44 +0000 Commit: John Baldwin CommitDate: 2021-03-19 23:59:44 +0000 Only symlink cryptodev.h into /usr/include/crypto/ I missed updating the symlink side in the earlier commit. Fixes: 283352dd4f6a3bb2f3c7cb45ce5dca3d86f5e3f4 MFC after: 1 week --- include/Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/Makefile b/include/Makefile index eebc7f0e121f..8d50aeea864f 100644 --- a/include/Makefile +++ b/include/Makefile @@ -418,10 +418,7 @@ symlinks: .PHONY .META $$(printf '../../../../%s ' sys/netpfil/pf/*.h) \ ${SDESTDIR}${INCLUDEDIR}/netpfil/pf; .endif - ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/crypto/rijndael/rijndael.h \ - ${SDESTDIR}${INCLUDEDIR}/crypto; \ - cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ - $$(printf '../../../%s ' sys/opencrypto/*.h) \ + ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} ../../../sys/opencrypto/cryptodev.h \ ${SDESTDIR}${INCLUDEDIR}/crypto; \ cd ${SRCTOP}; ${INSTALL_SYMLINK} ${TAG_ARGS:D${TAG_ARGS},dev} \ $$(printf '../../../%s ' sys/${MACHINE}/include/*.h) \ From owner-dev-commits-src-all@freebsd.org Sat Mar 20 01:42:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D0D75B5809; Sat, 20 Mar 2021 01:42: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 4F2NmT3Vm5z4kY7; Sat, 20 Mar 2021 01:42: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 6B0071F937; Sat, 20 Mar 2021 01:42: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 12K1gHfH016002; Sat, 20 Mar 2021 01:42:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K1gHmv016001; Sat, 20 Mar 2021 01:42:17 GMT (envelope-from git) Date: Sat, 20 Mar 2021 01:42:17 GMT Message-Id: <202103200142.12K1gHmv016001@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alan Somers Subject: git: 9c5aac8f2e84 - main - fusefs: fix a dead store in fuse_vnop_advlock MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9c5aac8f2e84ca4bbdf82514302c08c0453ec59b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 01:42:17 -0000 The branch main has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=9c5aac8f2e84ca4bbdf82514302c08c0453ec59b commit 9c5aac8f2e84ca4bbdf82514302c08c0453ec59b Author: Alan Somers AuthorDate: 2021-03-20 01:38:57 +0000 Commit: Alan Somers CommitDate: 2021-03-20 01:38:57 +0000 fusefs: fix a dead store in fuse_vnop_advlock kevans actually caught this in the original review and I fixed it, but then I committed an older copy of the branch. Whoops. Reported by: kevans MFC after: 13 days MFC with: 929acdb19acb67cc0e6ee5439df98e28a84d4772 Differential Revision: https://reviews.freebsd.org/D29031 --- sys/fs/fuse/fuse_vnops.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sys/fs/fuse/fuse_vnops.c b/sys/fs/fuse/fuse_vnops.c index cdbc42f5adf4..a51c1b15e7f0 100644 --- a/sys/fs/fuse/fuse_vnops.c +++ b/sys/fs/fuse/fuse_vnops.c @@ -444,7 +444,6 @@ fuse_vnop_advlock(struct vop_advlock_args *ap) break; case F_UNLCK: op = FUSE_SETLK; - flags |= F_UNLCK; break; default: return EINVAL; From owner-dev-commits-src-all@freebsd.org Sat Mar 20 07:46:01 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7F8E7575C93; Sat, 20 Mar 2021 07:46:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2Xr92ySmz3LSh; Sat, 20 Mar 2021 07:46:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58644240B1; Sat, 20 Mar 2021 07:46: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 12K7k1e3092374; Sat, 20 Mar 2021 07:46:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K7k16W092373; Sat, 20 Mar 2021 07:46:01 GMT (envelope-from git) Date: Sat, 20 Mar 2021 07:46:01 GMT Message-Id: <202103200746.12K7k16W092373@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: faf9a4e9142a - main - virtio_pci_legacy: Use the table BAR and PBA BAR from MSI-X cap 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: faf9a4e9142a02c289ee543a6091bd4b925c6a63 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 07:46:01 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=faf9a4e9142a02c289ee543a6091bd4b925c6a63 commit faf9a4e9142a02c289ee543a6091bd4b925c6a63 Author: Ka Ho Ng AuthorDate: 2021-03-20 07:40:52 +0000 Commit: Ka Ho Ng CommitDate: 2021-03-20 07:45:34 +0000 virtio_pci_legacy: Use the table BAR and PBA BAR from MSI-X cap The MSI-X resource shouldn't be assumed to be always on BAR1. The Virtio v1.1 Spec did not specify that MSI-X table and PBA BAR has to be BAR1 either. Reported by: Yuan Rui MFC after: 2 weeks Reviewed by: bryanv, jhb Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D28817 --- sys/dev/virtio/pci/virtio_pci_legacy.c | 74 +++++++++++++++++++++++++++------- 1 file changed, 60 insertions(+), 14 deletions(-) diff --git a/sys/dev/virtio/pci/virtio_pci_legacy.c b/sys/dev/virtio/pci/virtio_pci_legacy.c index 22e369097e2e..d74983099110 100644 --- a/sys/dev/virtio/pci/virtio_pci_legacy.c +++ b/sys/dev/virtio/pci/virtio_pci_legacy.c @@ -60,7 +60,8 @@ struct vtpci_legacy_softc { device_t vtpci_dev; struct vtpci_common vtpci_common; struct resource *vtpci_res; - struct resource *vtpci_msix_res; + struct resource *vtpci_msix_table_res; + struct resource *vtpci_msix_pba_res; }; static int vtpci_legacy_probe(device_t); @@ -97,6 +98,8 @@ static void vtpci_legacy_notify_vq(device_t, uint16_t, bus_size_t); static void vtpci_legacy_read_dev_config(device_t, bus_size_t, void *, int); static void vtpci_legacy_write_dev_config(device_t, bus_size_t, void *, int); +static bool vtpci_legacy_setup_msix(struct vtpci_legacy_softc *sc); +static void vtpci_legacy_teardown_msix(struct vtpci_legacy_softc *sc); static int vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *); static void vtpci_legacy_free_resources(struct vtpci_legacy_softc *); @@ -232,6 +235,13 @@ vtpci_legacy_attach(device_t dev) return (error); } + if (vtpci_is_msix_available(&sc->vtpci_common) && + !vtpci_legacy_setup_msix(sc)) { + device_printf(dev, "cannot setup MSI-x resources\n"); + error = ENXIO; + goto fail; + } + vtpci_legacy_reset(sc); /* Tell the host we've noticed this device. */ @@ -265,6 +275,7 @@ vtpci_legacy_detach(device_t dev) return (error); vtpci_legacy_reset(sc); + vtpci_legacy_teardown_msix(sc); vtpci_legacy_free_resources(sc); return (0); @@ -539,6 +550,54 @@ vtpci_legacy_write_dev_config(device_t dev, bus_size_t offset, } } +static bool +vtpci_legacy_setup_msix(struct vtpci_legacy_softc *sc) +{ + device_t dev; + int rid, table_rid; + + dev = sc->vtpci_dev; + + rid = table_rid = pci_msix_table_bar(dev); + if (rid != PCIR_BAR(0)) { + sc->vtpci_msix_table_res = bus_alloc_resource_any( + dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->vtpci_msix_table_res == NULL) + return (false); + } + + rid = pci_msix_pba_bar(dev); + if (rid != table_rid && rid != PCIR_BAR(0)) { + sc->vtpci_msix_pba_res = bus_alloc_resource_any( + dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); + if (sc->vtpci_msix_pba_res == NULL) + return (false); + } + + return (true); +} + +static void +vtpci_legacy_teardown_msix(struct vtpci_legacy_softc *sc) +{ + device_t dev; + + dev = sc->vtpci_dev; + + if (sc->vtpci_msix_pba_res != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->vtpci_msix_pba_res), + sc->vtpci_msix_pba_res); + sc->vtpci_msix_pba_res = NULL; + } + if (sc->vtpci_msix_table_res != NULL) { + bus_release_resource(dev, SYS_RES_MEMORY, + rman_get_rid(sc->vtpci_msix_table_res), + sc->vtpci_msix_table_res); + sc->vtpci_msix_table_res = NULL; + } +} + static int vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *sc) { @@ -552,13 +611,6 @@ vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *sc) &rid, RF_ACTIVE)) == NULL) return (ENXIO); - if (vtpci_is_msix_available(&sc->vtpci_common)) { - rid = PCIR_BAR(1); - if ((sc->vtpci_msix_res = bus_alloc_resource_any(dev, - SYS_RES_MEMORY, &rid, RF_ACTIVE)) == NULL) - return (ENXIO); - } - return (0); } @@ -569,12 +621,6 @@ vtpci_legacy_free_resources(struct vtpci_legacy_softc *sc) dev = sc->vtpci_dev; - if (sc->vtpci_msix_res != NULL) { - bus_release_resource(dev, SYS_RES_MEMORY, PCIR_BAR(1), - sc->vtpci_msix_res); - sc->vtpci_msix_res = NULL; - } - if (sc->vtpci_res != NULL) { bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0), sc->vtpci_res); From owner-dev-commits-src-all@freebsd.org Sat Mar 20 07:46:02 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 957B6575D20; Sat, 20 Mar 2021 07:46:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2XrB3pjGz3LnB; Sat, 20 Mar 2021 07:46:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7638F24142; Sat, 20 Mar 2021 07:46:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K7k2oe092395; Sat, 20 Mar 2021 07:46:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K7k2rc092394; Sat, 20 Mar 2021 07:46:02 GMT (envelope-from git) Date: Sat, 20 Mar 2021 07:46:02 GMT Message-Id: <202103200746.12K7k2rc092394@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: cf5d1112408d - main - virtio_pci_legacy: Allow memory space for configuration 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: cf5d1112408ddef3fdff8212599727c49ba90fa4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 07:46:02 -0000 The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=cf5d1112408ddef3fdff8212599727c49ba90fa4 commit cf5d1112408ddef3fdff8212599727c49ba90fa4 Author: Ka Ho Ng AuthorDate: 2021-03-20 07:40:55 +0000 Commit: Ka Ho Ng CommitDate: 2021-03-20 07:45:34 +0000 virtio_pci_legacy: Allow memory space for configuration For guests running under some kind of VMMs, configuration structure is available in memory space but not I/O space. Reported by: Yuan Rui MFC after: 2 weeks Reviewed by: rpokala, bryanv, jhb Approved by: philip (mentor) Differential Revision: https://reviews.freebsd.org/D28818 --- sys/dev/virtio/pci/virtio_pci_legacy.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/dev/virtio/pci/virtio_pci_legacy.c b/sys/dev/virtio/pci/virtio_pci_legacy.c index d74983099110..a17dd22aa953 100644 --- a/sys/dev/virtio/pci/virtio_pci_legacy.c +++ b/sys/dev/virtio/pci/virtio_pci_legacy.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); struct vtpci_legacy_softc { device_t vtpci_dev; struct vtpci_common vtpci_common; + int vtpci_res_type; struct resource *vtpci_res; struct resource *vtpci_msix_table_res; struct resource *vtpci_msix_pba_res; @@ -231,7 +232,7 @@ vtpci_legacy_attach(device_t dev) error = vtpci_legacy_alloc_resources(sc); if (error) { - device_printf(dev, "cannot map I/O space\n"); + device_printf(dev, "cannot map I/O space nor memory space\n"); return (error); } @@ -601,14 +602,25 @@ vtpci_legacy_teardown_msix(struct vtpci_legacy_softc *sc) static int vtpci_legacy_alloc_resources(struct vtpci_legacy_softc *sc) { + const int res_types[] = { SYS_RES_IOPORT, SYS_RES_MEMORY }; device_t dev; - int rid; + int rid, i; dev = sc->vtpci_dev; - rid = PCIR_BAR(0); - if ((sc->vtpci_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, - &rid, RF_ACTIVE)) == NULL) + /* + * Most hypervisors export the common configuration structure in IO + * space, but some use memory space; try both. + */ + for (i = 0; nitems(res_types); i++) { + rid = PCIR_BAR(0); + sc->vtpci_res_type = res_types[i]; + sc->vtpci_res = bus_alloc_resource_any(dev, res_types[i], &rid, + RF_ACTIVE); + if (sc->vtpci_res != NULL) + break; + } + if (sc->vtpci_res == NULL) return (ENXIO); return (0); @@ -622,7 +634,7 @@ vtpci_legacy_free_resources(struct vtpci_legacy_softc *sc) dev = sc->vtpci_dev; if (sc->vtpci_res != NULL) { - bus_release_resource(dev, SYS_RES_IOPORT, PCIR_BAR(0), + bus_release_resource(dev, sc->vtpci_res_type, PCIR_BAR(0), sc->vtpci_res); sc->vtpci_res = NULL; } From owner-dev-commits-src-all@freebsd.org Sat Mar 20 09:59:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B67E9579A99; Sat, 20 Mar 2021 09:59:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2bpJ4q4vz3k8V; Sat, 20 Mar 2021 09:59:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93F2A25F91; Sat, 20 Mar 2021 09:59:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K9xa1K063925; Sat, 20 Mar 2021 09:59:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K9xalS063924; Sat, 20 Mar 2021 09:59:36 GMT (envelope-from git) Date: Sat, 20 Mar 2021 09:59:36 GMT Message-Id: <202103200959.12K9xalS063924@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 0fd2e729f8c6 - stable/13 - pf: Factor out pf_krule_free() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 0fd2e729f8c69e25ec8e7951db3fa671f3ee4809 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 09:59:36 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=0fd2e729f8c69e25ec8e7951db3fa671f3ee4809 commit 0fd2e729f8c69e25ec8e7951db3fa671f3ee4809 Author: Kristof Provost AuthorDate: 2021-03-10 10:10:04 +0000 Commit: Kristof Provost CommitDate: 2021-03-19 22:38:33 +0000 pf: Factor out pf_krule_free() Reviewed by: melifaro@ MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29194 (cherry picked from commit 5e9dae8e149ae8848f52148b665f3a0d031ca40f) --- sys/net/pfvar.h | 2 ++ sys/netpfil/pf/pf_ioctl.c | 50 ++++++++++++++++++++--------------------------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 9c8c642a6ace..d2928994613c 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1639,6 +1639,8 @@ void pf_remove_if_empty_kruleset(struct pf_kruleset *); struct pf_kruleset *pf_find_kruleset(const char *); struct pf_kruleset *pf_find_or_create_kruleset(const char *); void pf_rs_initialize(void); + +void pf_krule_free(struct pf_krule *); #endif /* The fingerprint functions can be linked into userland programs (tcpdump) */ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index c32a961f5a0b..5f9eb771d0e0 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -466,15 +466,8 @@ pf_free_rule(struct pf_krule *rule) pfi_kkif_unref(rule->kif); pf_kanchor_remove(rule); pf_empty_kpool(&rule->rpool.list); - counter_u64_free(rule->evaluations); - for (int i = 0; i < 2; i++) { - counter_u64_free(rule->packets[i]); - counter_u64_free(rule->bytes[i]); - } - counter_u64_free(rule->states_cur); - counter_u64_free(rule->states_tot); - counter_u64_free(rule->src_nodes); - free(rule, M_PFRULE); + + pf_krule_free(rule); } static void @@ -1435,6 +1428,23 @@ pf_altq_get_nth_active(u_int32_t n) } #endif /* ALTQ */ +void +pf_krule_free(struct pf_krule *rule) +{ + if (rule == NULL) + return; + + counter_u64_free(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_free(rule->packets[i]); + counter_u64_free(rule->bytes[i]); + } + counter_u64_free(rule->states_cur); + counter_u64_free(rule->states_tot); + counter_u64_free(rule->src_nodes); + free(rule, M_PFRULE); +} + static void pf_kpooladdr_to_pooladdr(const struct pf_kpooladdr *kpool, struct pf_pooladdr *pool) @@ -1990,15 +2000,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td #undef ERROUT DIOCADDRULE_error: PF_RULES_WUNLOCK(); - counter_u64_free(rule->evaluations); - for (int i = 0; i < 2; i++) { - counter_u64_free(rule->packets[i]); - counter_u64_free(rule->bytes[i]); - } - counter_u64_free(rule->states_cur); - counter_u64_free(rule->states_tot); - counter_u64_free(rule->src_nodes); - free(rule, M_PFRULE); + pf_krule_free(rule); if (kif) pf_kkif_free(kif); break; @@ -2297,17 +2299,7 @@ DIOCADDRULE_error: #undef ERROUT DIOCCHANGERULE_error: PF_RULES_WUNLOCK(); - if (newrule != NULL) { - counter_u64_free(newrule->evaluations); - for (int i = 0; i < 2; i++) { - counter_u64_free(newrule->packets[i]); - counter_u64_free(newrule->bytes[i]); - } - counter_u64_free(newrule->states_cur); - counter_u64_free(newrule->states_tot); - counter_u64_free(newrule->src_nodes); - free(newrule, M_PFRULE); - } + pf_krule_free(newrule); if (kif != NULL) pf_kkif_free(kif); break; From owner-dev-commits-src-all@freebsd.org Sat Mar 20 09:59:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34870579575; Sat, 20 Mar 2021 09:59:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2bpL0PpBz3k0n; Sat, 20 Mar 2021 09:59:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D257225CC4; Sat, 20 Mar 2021 09:59:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K9xbJi064034; Sat, 20 Mar 2021 09:59:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K9xb4w064033; Sat, 20 Mar 2021 09:59:37 GMT (envelope-from git) Date: Sat, 20 Mar 2021 09:59:37 GMT Message-Id: <202103200959.12K9xb4w064033@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: d9653edbaeae - stable/12 - pf: Factor out pf_krule_free() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d9653edbaeae779ed331d1d7331ded1348f2b980 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 09:59:38 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=d9653edbaeae779ed331d1d7331ded1348f2b980 commit d9653edbaeae779ed331d1d7331ded1348f2b980 Author: Kristof Provost AuthorDate: 2021-03-10 10:10:04 +0000 Commit: Kristof Provost CommitDate: 2021-03-19 22:38:45 +0000 pf: Factor out pf_krule_free() Reviewed by: melifaro@ MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29194 (cherry picked from commit 5e9dae8e149ae8848f52148b665f3a0d031ca40f) --- sys/net/pfvar.h | 2 ++ sys/netpfil/pf/pf_ioctl.c | 50 ++++++++++++++++++++--------------------------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index 3a535d04f12f..ef25bfc85605 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1641,6 +1641,8 @@ void pf_remove_if_empty_kruleset(struct pf_kruleset *); struct pf_kruleset *pf_find_kruleset(const char *); struct pf_kruleset *pf_find_or_create_kruleset(const char *); void pf_rs_initialize(void); + +void pf_krule_free(struct pf_krule *); #endif /* The fingerprint functions can be linked into userland programs (tcpdump) */ diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index c3e8d0459c88..02ad40c6abd9 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -466,15 +466,8 @@ pf_free_rule(struct pf_krule *rule) pfi_kkif_unref(rule->kif); pf_kanchor_remove(rule); pf_empty_kpool(&rule->rpool.list); - counter_u64_free(rule->evaluations); - for (int i = 0; i < 2; i++) { - counter_u64_free(rule->packets[i]); - counter_u64_free(rule->bytes[i]); - } - counter_u64_free(rule->states_cur); - counter_u64_free(rule->states_tot); - counter_u64_free(rule->src_nodes); - free(rule, M_PFRULE); + + pf_krule_free(rule); } static void @@ -1436,6 +1429,23 @@ pf_altq_get_nth_active(u_int32_t n) } #endif /* ALTQ */ +void +pf_krule_free(struct pf_krule *rule) +{ + if (rule == NULL) + return; + + counter_u64_free(rule->evaluations); + for (int i = 0; i < 2; i++) { + counter_u64_free(rule->packets[i]); + counter_u64_free(rule->bytes[i]); + } + counter_u64_free(rule->states_cur); + counter_u64_free(rule->states_tot); + counter_u64_free(rule->src_nodes); + free(rule, M_PFRULE); +} + static void pf_kpooladdr_to_pooladdr(const struct pf_kpooladdr *kpool, struct pf_pooladdr *pool) @@ -2002,15 +2012,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td #undef ERROUT DIOCADDRULE_error: PF_RULES_WUNLOCK(); - counter_u64_free(rule->evaluations); - for (int i = 0; i < 2; i++) { - counter_u64_free(rule->packets[i]); - counter_u64_free(rule->bytes[i]); - } - counter_u64_free(rule->states_cur); - counter_u64_free(rule->states_tot); - counter_u64_free(rule->src_nodes); - free(rule, M_PFRULE); + pf_krule_free(rule); if (kif) pf_kkif_free(kif); break; @@ -2310,17 +2312,7 @@ DIOCADDRULE_error: #undef ERROUT DIOCCHANGERULE_error: PF_RULES_WUNLOCK(); - if (newrule != NULL) { - counter_u64_free(newrule->evaluations); - for (int i = 0; i < 2; i++) { - counter_u64_free(newrule->packets[i]); - counter_u64_free(newrule->bytes[i]); - } - counter_u64_free(newrule->states_cur); - counter_u64_free(newrule->states_tot); - counter_u64_free(newrule->src_nodes); - free(newrule, M_PFRULE); - } + pf_krule_free(newrule); if (kif != NULL) pf_kkif_free(kif); break; From owner-dev-commits-src-all@freebsd.org Sat Mar 20 09:59:39 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8522C579AA9; Sat, 20 Mar 2021 09:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2bpL6dPXz3k9y; Sat, 20 Mar 2021 09:59:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C78B225B3C; Sat, 20 Mar 2021 09:59:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K9xcgh064053; Sat, 20 Mar 2021 09:59:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K9xc9D064052; Sat, 20 Mar 2021 09:59:38 GMT (envelope-from git) Date: Sat, 20 Mar 2021 09:59:38 GMT Message-Id: <202103200959.12K9xc9D064052@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: bc98489262fb - stable/13 - altq: Increase maximum number of CBQ and HFSC classes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bc98489262fb1600208ce87ccefa41f6c8cb9f9b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 09:59:40 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bc98489262fb1600208ce87ccefa41f6c8cb9f9b commit bc98489262fb1600208ce87ccefa41f6c8cb9f9b Author: Kristof Provost AuthorDate: 2021-03-03 10:06:49 +0000 Commit: Kristof Provost CommitDate: 2021-03-19 22:39:01 +0000 altq: Increase maximum number of CBQ and HFSC classes In some configurations we need more classes than ALTQ supports by default. Increase the maximum number of classes we allow. This will only cost us a comparatively trivial amount of memory, so there's little reason not to do so. If ever we find we want even more we may want to consider turning these defines into a tunable, but for now do the easy thing. Reviewed by: donner@ MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29034 (cherry picked from commit 448732b8e2d9bf4e2656a2e5a9e88cc58b88d4f4) --- sys/net/altq/altq_cbq.h | 2 +- sys/net/altq/altq_hfsc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/altq/altq_cbq.h b/sys/net/altq/altq_cbq.h index a319edb72e97..70c07c11d86d 100644 --- a/sys/net/altq/altq_cbq.h +++ b/sys/net/altq/altq_cbq.h @@ -119,7 +119,7 @@ typedef struct _cbq_class_stats_ { #define CBQ_TIMEOUT 10 #define CBQ_LS_TIMEOUT (20 * hz / 1000) -#define CBQ_MAX_CLASSES 256 +#define CBQ_MAX_CLASSES 2048 /* * Define State structures. diff --git a/sys/net/altq/altq_hfsc.h b/sys/net/altq/altq_hfsc.h index 9a4f14ae8fdc..6a3f2205c972 100644 --- a/sys/net/altq/altq_hfsc.h +++ b/sys/net/altq/altq_hfsc.h @@ -60,7 +60,7 @@ struct service_curve_v1 { /* special class handles */ #define HFSC_NULLCLASS_HANDLE 0 -#define HFSC_MAX_CLASSES 64 +#define HFSC_MAX_CLASSES 2048 /* hfsc class flags */ #define HFCF_RED 0x0001 /* use RED */ From owner-dev-commits-src-all@freebsd.org Sat Mar 20 09:59:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1229579A9E; Sat, 20 Mar 2021 09:59:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2bpK59TCz3jpd; Sat, 20 Mar 2021 09:59:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9F2D725CC3; Sat, 20 Mar 2021 09:59:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K9xb98063958; Sat, 20 Mar 2021 09:59:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K9xbwk063957; Sat, 20 Mar 2021 09:59:37 GMT (envelope-from git) Date: Sat, 20 Mar 2021 09:59:37 GMT Message-Id: <202103200959.12K9xbwk063957@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 3756d591f758 - stable/13 - pf: Retrieve DSCP value from the IPv6 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 3756d591f7583887168e51672cf9324c0996defe Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 09:59:37 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=3756d591f7583887168e51672cf9324c0996defe commit 3756d591f7583887168e51672cf9324c0996defe Author: Kristof Provost AuthorDate: 2021-03-03 20:33:42 +0000 Commit: Kristof Provost CommitDate: 2021-03-19 22:38:50 +0000 pf: Retrieve DSCP value from the IPv6 header Teach pf to read the DSCP value from the IPv6 header so that we can match on them. Reviewed by: donner MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29048 (cherry picked from commit f19323847ca894af8a58839f6a2a41691a8e2245) --- sys/netpfil/pf/pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 86354e69d11f..f71f89187b58 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6384,7 +6384,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb pd.sidx = (dir == PF_IN) ? 0 : 1; pd.didx = (dir == PF_IN) ? 1 : 0; pd.af = AF_INET6; - pd.tos = 0; + pd.tos = (ntohl(h->ip6_flow) >> 20) & 0xfc; pd.tot_len = ntohs(h->ip6_plen) + sizeof(struct ip6_hdr); off = ((caddr_t)h - m->m_data) + sizeof(struct ip6_hdr); From owner-dev-commits-src-all@freebsd.org Sat Mar 20 09:59:43 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 24F83579940; Sat, 20 Mar 2021 09:59:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2bpN3GGyz3kD6; Sat, 20 Mar 2021 09:59:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2669E25B3D; Sat, 20 Mar 2021 09:59:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K9xeb8064112; Sat, 20 Mar 2021 09:59:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K9xeoR064111; Sat, 20 Mar 2021 09:59:40 GMT (envelope-from git) Date: Sat, 20 Mar 2021 09:59:40 GMT Message-Id: <202103200959.12K9xeoR064111@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 2e2e51f15ae5 - stable/12 - altq: Increase maximum number of CBQ and HFSC classes MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2e2e51f15ae521c1e3e5f399f4799697e9e5f000 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 09:59:43 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2e2e51f15ae521c1e3e5f399f4799697e9e5f000 commit 2e2e51f15ae521c1e3e5f399f4799697e9e5f000 Author: Kristof Provost AuthorDate: 2021-03-03 10:06:49 +0000 Commit: Kristof Provost CommitDate: 2021-03-19 22:39:00 +0000 altq: Increase maximum number of CBQ and HFSC classes In some configurations we need more classes than ALTQ supports by default. Increase the maximum number of classes we allow. This will only cost us a comparatively trivial amount of memory, so there's little reason not to do so. If ever we find we want even more we may want to consider turning these defines into a tunable, but for now do the easy thing. Reviewed by: donner@ MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29034 (cherry picked from commit 448732b8e2d9bf4e2656a2e5a9e88cc58b88d4f4) --- sys/net/altq/altq_cbq.h | 2 +- sys/net/altq/altq_hfsc.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/altq/altq_cbq.h b/sys/net/altq/altq_cbq.h index 64c75fe95a5f..ea305b49034e 100644 --- a/sys/net/altq/altq_cbq.h +++ b/sys/net/altq/altq_cbq.h @@ -205,7 +205,7 @@ struct cbq_getstats { #define CBQ_TIMEOUT 10 #define CBQ_LS_TIMEOUT (20 * hz / 1000) -#define CBQ_MAX_CLASSES 256 +#define CBQ_MAX_CLASSES 2048 #ifdef ALTQ3_COMPAT #define CBQ_MAX_FILTERS 256 diff --git a/sys/net/altq/altq_hfsc.h b/sys/net/altq/altq_hfsc.h index bd35b6bb65c7..f768c59ae71a 100644 --- a/sys/net/altq/altq_hfsc.h +++ b/sys/net/altq/altq_hfsc.h @@ -60,7 +60,7 @@ struct service_curve_v1 { /* special class handles */ #define HFSC_NULLCLASS_HANDLE 0 -#define HFSC_MAX_CLASSES 64 +#define HFSC_MAX_CLASSES 2048 /* hfsc class flags */ #define HFCF_RED 0x0001 /* use RED */ From owner-dev-commits-src-all@freebsd.org Sat Mar 20 09:59:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E68F55798B8; Sat, 20 Mar 2021 09:59:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2bpQ0rK7z3k93; Sat, 20 Mar 2021 09:59:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 399C225EA8; Sat, 20 Mar 2021 09:59:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K9xfM3064150; Sat, 20 Mar 2021 09:59:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K9xfHC064149; Sat, 20 Mar 2021 09:59:41 GMT (envelope-from git) Date: Sat, 20 Mar 2021 09:59:41 GMT Message-Id: <202103200959.12K9xfHC064149@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 28ed948ec1d7 - stable/12 - pf: Remove redundant kif != NULL checks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 28ed948ec1d74009bc90a661007b017c7e8471c7 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 09:59:45 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=28ed948ec1d74009bc90a661007b017c7e8471c7 commit 28ed948ec1d74009bc90a661007b017c7e8471c7 Author: Kristof Provost AuthorDate: 2021-03-10 14:50:42 +0000 Commit: Kristof Provost CommitDate: 2021-03-19 22:39:42 +0000 pf: Remove redundant kif != NULL checks pf_kkif_free() already checks for NULL, so we don't have to check before we call it. Reviewed by: melifaro@ MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29195 (cherry picked from commit 913e7dc3e0eb7df78ec0e7ecc7dd160a316a3ac6) --- sys/netpfil/pf/pf_ioctl.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 02ad40c6abd9..c50904e28dc6 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2013,8 +2013,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td DIOCADDRULE_error: PF_RULES_WUNLOCK(); pf_krule_free(rule); - if (kif) - pf_kkif_free(kif); + pf_kkif_free(kif); break; } @@ -2313,8 +2312,7 @@ DIOCADDRULE_error: DIOCCHANGERULE_error: PF_RULES_WUNLOCK(); pf_krule_free(newrule); - if (kif != NULL) - pf_kkif_free(kif); + pf_kkif_free(kif); break; } @@ -3159,8 +3157,7 @@ DIOCCHANGEADDR_error: free(newpa, M_PFRULE); } PF_RULES_WUNLOCK(); - if (kif != NULL) - pf_kkif_free(kif); + pf_kkif_free(kif); break; } From owner-dev-commits-src-all@freebsd.org Sat Mar 20 09:59:44 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE7D7579AB3; Sat, 20 Mar 2021 09:59:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2bpQ0C5hz3kBD; Sat, 20 Mar 2021 09:59:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B2AA25EA7; Sat, 20 Mar 2021 09:59:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K9xeH4064130; Sat, 20 Mar 2021 09:59:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K9xe9J064129; Sat, 20 Mar 2021 09:59:40 GMT (envelope-from git) Date: Sat, 20 Mar 2021 09:59:40 GMT Message-Id: <202103200959.12K9xe9J064129@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: acc600ea3280 - stable/13 - uma: allow uma_zfree_pcu(..., NULL) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: acc600ea3280d2f9196d1429a91cad5500eae8e0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 09:59:45 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=acc600ea3280d2f9196d1429a91cad5500eae8e0 commit acc600ea3280d2f9196d1429a91cad5500eae8e0 Author: Kristof Provost AuthorDate: 2021-03-10 14:11:59 +0000 Commit: Kristof Provost CommitDate: 2021-03-19 22:40:07 +0000 uma: allow uma_zfree_pcu(..., NULL) We already allow free(NULL) and uma_zfree(..., NULL). Make uma_zfree_pcpu(..., NULL) work as well. This also means that counter_u64_free(NULL) will work. These make cleanup code simpler. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29189 (cherry picked from commit b8f7267d499c8ef8e70b021879d3e9e087ecc32d) --- sys/vm/uma_core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 8cbd1216678a..b1762500c147 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -3171,6 +3171,11 @@ uma_zfree_pcpu_arg(uma_zone_t zone, void *pcpu_item, void *udata) #ifdef SMP MPASS(zone->uz_flags & UMA_ZONE_PCPU); #endif + + /* uma_zfree_pcu_*(..., NULL) does nothing, to match free(9). */ + if (pcpu_item == NULL) + return; + item = zpcpu_offset_to_base(pcpu_item); uma_zfree_arg(zone, item, udata); } From owner-dev-commits-src-all@freebsd.org Sat Mar 20 09:59:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66C29579A13; Sat, 20 Mar 2021 09:59:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2bpN3Dxdz3k8n; Sat, 20 Mar 2021 09:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E94B725F92; Sat, 20 Mar 2021 09:59:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K9xcEt064071; Sat, 20 Mar 2021 09:59:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K9xcrC064070; Sat, 20 Mar 2021 09:59:38 GMT (envelope-from git) Date: Sat, 20 Mar 2021 09:59:38 GMT Message-Id: <202103200959.12K9xcrC064070@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e7e1836a0efa - stable/12 - pf: Retrieve DSCP value from the IPv6 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/stable/12 X-Git-Reftype: branch X-Git-Commit: e7e1836a0efadfdb5f8e8e4c7ad41f1211f55f2d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 09:59:41 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e7e1836a0efadfdb5f8e8e4c7ad41f1211f55f2d commit e7e1836a0efadfdb5f8e8e4c7ad41f1211f55f2d Author: Kristof Provost AuthorDate: 2021-03-03 20:33:42 +0000 Commit: Kristof Provost CommitDate: 2021-03-19 22:38:50 +0000 pf: Retrieve DSCP value from the IPv6 header Teach pf to read the DSCP value from the IPv6 header so that we can match on them. Reviewed by: donner MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29048 (cherry picked from commit f19323847ca894af8a58839f6a2a41691a8e2245) --- sys/netpfil/pf/pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index d4101aab9332..625b1d6e32ca 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -6481,7 +6481,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb pd.sidx = (dir == PF_IN) ? 0 : 1; pd.didx = (dir == PF_IN) ? 1 : 0; pd.af = AF_INET6; - pd.tos = 0; + pd.tos = (ntohl(h->ip6_flow) >> 20) & 0xfc; pd.tot_len = ntohs(h->ip6_plen) + sizeof(struct ip6_hdr); off = ((caddr_t)h - m->m_data) + sizeof(struct ip6_hdr); From owner-dev-commits-src-all@freebsd.org Sat Mar 20 09:59:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35AB7579AB5; Sat, 20 Mar 2021 09:59: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 4F2bpR4B28z3jq0; Sat, 20 Mar 2021 09:59:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FCF025F94; Sat, 20 Mar 2021 09:59:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K9xgRg064170; Sat, 20 Mar 2021 09:59:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K9xg25064169; Sat, 20 Mar 2021 09:59:42 GMT (envelope-from git) Date: Sat, 20 Mar 2021 09:59:42 GMT Message-Id: <202103200959.12K9xg25064169@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: f2f8a0cb5f91 - stable/13 - Document that uma_zfree_pcpu() allows NULL now MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f2f8a0cb5f91a0e0ad83e5a5eb4857c8b675d5dd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 09:59:45 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f2f8a0cb5f91a0e0ad83e5a5eb4857c8b675d5dd commit f2f8a0cb5f91a0e0ad83e5a5eb4857c8b675d5dd Author: Kristof Provost AuthorDate: 2021-03-11 08:32:01 +0000 Commit: Kristof Provost CommitDate: 2021-03-19 22:41:02 +0000 Document that uma_zfree_pcpu() allows NULL now While here also document that for counter_u64_free(). Reviewed by: rpokala@ MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29215 (cherry picked from commit 51dc8e7f688867e73eb7edc6bc65fdc77c9d5fff) --- share/man/man9/counter.9 | 7 +++++-- share/man/man9/zone.9 | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/share/man/man9/counter.9 b/share/man/man9/counter.9 index 1eb36b571249..04376ba9c994 100644 --- a/share/man/man9/counter.9 +++ b/share/man/man9/counter.9 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 6, 2020 +.Dd March 11, 2021 .Dt COUNTER 9 .Os .Sh NAME @@ -98,10 +98,13 @@ or .Va M_WAITOK . If .Va M_NOWAIT -is specified the operation may fail. +is specified the operation may fail and return +.Dv NULL . .It Fn counter_u64_free c Free the previously allocated counter .Fa c . +It is safe to pass +.Dv NULL . .It Fn counter_u64_add c v Add .Fa v diff --git a/share/man/man9/zone.9 b/share/man/man9/zone.9 index 91c965ff69ce..7da40b13469b 100644 --- a/share/man/man9/zone.9 +++ b/share/man/man9/zone.9 @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 20, 2020 +.Dd March 11, 2021 .Dt UMA 9 .Os .Sh NAME @@ -385,6 +385,22 @@ specify an argument for the and .Dv dtor functions of the zone, respectively. +The variants +.Fn uma_zalloc_pcpu +and +.Fn uma_zfree_pcpu +allocate and free +.Va mp_ncpu +shadow copies as described for +.Dv UMA_ZONE_PCPU . +If +.Fa item +is +.Dv NULL , +then +.Fn uma_zfree_pcpu +does nothing. +.Pp The .Fn uma_zalloc_domain function allows callers to specify a fixed From owner-dev-commits-src-all@freebsd.org Sat Mar 20 09:59:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F2835796F4; Sat, 20 Mar 2021 09:59: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 4F2bpS5Xcsz3k1H; Sat, 20 Mar 2021 09:59:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6853425BBD; Sat, 20 Mar 2021 09:59:42 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K9xguU064188; Sat, 20 Mar 2021 09:59:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K9xg8e064187; Sat, 20 Mar 2021 09:59:42 GMT (envelope-from git) Date: Sat, 20 Mar 2021 09:59:42 GMT Message-Id: <202103200959.12K9xg8e064187@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: f858f6b2381c - stable/12 - pf: Simplify cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f858f6b2381c07ae75f672064e647c6c691d4b88 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 09:59:45 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f858f6b2381c07ae75f672064e647c6c691d4b88 commit f858f6b2381c07ae75f672064e647c6c691d4b88 Author: Kristof Provost AuthorDate: 2021-03-10 14:15:16 +0000 Commit: Kristof Provost CommitDate: 2021-03-19 22:41:15 +0000 pf: Simplify cleanup We can now counter_u64_free(NULL), so remove the checks. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29190 (cherry picked from commit 28dc2c954f5096ae594ed5cd7a83d66ce4bf1ded) --- sys/netpfil/pf/if_pfsync.c | 6 ++---- sys/netpfil/pf/pf.c | 12 ++++-------- sys/netpfil/pf/pf_if.c | 6 ++---- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index a9950350cb29..0f55dacd18ad 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -625,10 +625,8 @@ cleanup: cleanup_state: /* pf_state_insert() frees the state keys. */ if (st) { for (int i = 0; i < 2; i++) { - if (st->packets[i] != NULL) - counter_u64_free(st->packets[i]); - if (st->bytes[i] != NULL) - counter_u64_free(st->bytes[i]); + counter_u64_free(st->packets[i]); + counter_u64_free(st->bytes[i]); } if (st->dst.scrub) uma_zfree(V_pf_state_scrub_z, st->dst.scrub); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 625b1d6e32ca..3422cdea1e2e 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -707,10 +707,8 @@ pf_free_src_node(struct pf_ksrc_node *sn) { for (int i = 0; i < 2; i++) { - if (sn->bytes[i]) - counter_u64_free(sn->bytes[i]); - if (sn->packets[i]) - counter_u64_free(sn->packets[i]); + counter_u64_free(sn->bytes[i]); + counter_u64_free(sn->packets[i]); } uma_zfree(V_pf_sources_z, sn); } @@ -1737,10 +1735,8 @@ pf_free_state(struct pf_state *cur) cur->timeout)); for (int i = 0; i < 2; i++) { - if (cur->bytes[i] != NULL) - counter_u64_free(cur->bytes[i]); - if (cur->packets[i] != NULL) - counter_u64_free(cur->packets[i]); + counter_u64_free(cur->bytes[i]); + counter_u64_free(cur->packets[i]); } pf_normalize_tcp_cleanup(cur); diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index 48733d351a24..7e4d8033da0d 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -232,10 +232,8 @@ pf_kkif_free(struct pfi_kkif *kif) for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k < 2; k++) { - if (kif->pfik_packets[i][j][k]) - counter_u64_free(kif->pfik_packets[i][j][k]); - if (kif->pfik_bytes[i][j][k]) - counter_u64_free(kif->pfik_bytes[i][j][k]); + counter_u64_free(kif->pfik_packets[i][j][k]); + counter_u64_free(kif->pfik_bytes[i][j][k]); } } } From owner-dev-commits-src-all@freebsd.org Sat Mar 20 09:59:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A30F5798B4; Sat, 20 Mar 2021 09:59:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2bpN3DHSz3kD5; Sat, 20 Mar 2021 09:59:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E10FF25F93; Sat, 20 Mar 2021 09:59:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K9xd3p064094; Sat, 20 Mar 2021 09:59:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K9xdNn064093; Sat, 20 Mar 2021 09:59:39 GMT (envelope-from git) Date: Sat, 20 Mar 2021 09:59:39 GMT Message-Id: <202103200959.12K9xdNn064093@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 2001c1a0d2c0 - stable/13 - pf: Remove redundant kif != NULL checks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2001c1a0d2c003379c702373a9d259cb660cbff3 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 09:59:41 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=2001c1a0d2c003379c702373a9d259cb660cbff3 commit 2001c1a0d2c003379c702373a9d259cb660cbff3 Author: Kristof Provost AuthorDate: 2021-03-10 14:50:42 +0000 Commit: Kristof Provost CommitDate: 2021-03-19 22:39:39 +0000 pf: Remove redundant kif != NULL checks pf_kkif_free() already checks for NULL, so we don't have to check before we call it. Reviewed by: melifaro@ MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29195 (cherry picked from commit 913e7dc3e0eb7df78ec0e7ecc7dd160a316a3ac6) --- sys/netpfil/pf/pf_ioctl.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 5f9eb771d0e0..977f0debacaa 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2001,8 +2001,7 @@ pfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags, struct thread *td DIOCADDRULE_error: PF_RULES_WUNLOCK(); pf_krule_free(rule); - if (kif) - pf_kkif_free(kif); + pf_kkif_free(kif); break; } @@ -2300,8 +2299,7 @@ DIOCADDRULE_error: DIOCCHANGERULE_error: PF_RULES_WUNLOCK(); pf_krule_free(newrule); - if (kif != NULL) - pf_kkif_free(kif); + pf_kkif_free(kif); break; } @@ -3144,8 +3142,7 @@ DIOCCHANGEADDR_error: free(newpa, M_PFRULE); } PF_RULES_WUNLOCK(); - if (kif != NULL) - pf_kkif_free(kif); + pf_kkif_free(kif); break; } From owner-dev-commits-src-all@freebsd.org Sat Mar 20 09:59:48 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 770F25796FB; Sat, 20 Mar 2021 09:59:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2bpW0zfgz3k1S; Sat, 20 Mar 2021 09:59:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B813259C8; Sat, 20 Mar 2021 09:59: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 12K9xiVP064248; Sat, 20 Mar 2021 09:59:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K9xiwh064247; Sat, 20 Mar 2021 09:59:44 GMT (envelope-from git) Date: Sat, 20 Mar 2021 09:59:44 GMT Message-Id: <202103200959.12K9xiwh064247@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 71d3d485cca8 - stable/13 - pf: Fully remove interrupt events on vnet cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 71d3d485cca87a29792989a83a4cbaefba8f2413 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 09:59:48 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=71d3d485cca87a29792989a83a4cbaefba8f2413 commit 71d3d485cca87a29792989a83a4cbaefba8f2413 Author: Kristof Provost AuthorDate: 2021-03-10 21:56:11 +0000 Commit: Kristof Provost CommitDate: 2021-03-19 22:41:27 +0000 pf: Fully remove interrupt events on vnet cleanup swi_remove() removes the software interrupt handler but does not remove the associated interrupt event. This is visible when creating and remove a vnet jail in `procstat -t 12`. We can remove it manually with intr_event_destroy(). PR: 254171 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29211 (cherry picked from commit cecfaf9bede9665d6a10f1e575cd5d575450cff7) --- sys/net/pfvar.h | 2 ++ sys/netpfil/pf/if_pfsync.c | 10 ++++++++-- sys/netpfil/pf/pf.c | 1 + sys/netpfil/pf/pf_ioctl.c | 8 ++++++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index d2928994613c..2039e3277321 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1388,6 +1388,8 @@ VNET_DECLARE(struct pf_srchash *, pf_srchash); VNET_DECLARE(void *, pf_swi_cookie); #define V_pf_swi_cookie VNET(pf_swi_cookie) +VNET_DECLARE(struct intr_event *, pf_swi_ie); +#define V_pf_swi_ie VNET(pf_swi_ie) VNET_DECLARE(uint64_t, pf_stateid[MAXCPU]); #define V_pf_stateid VNET(pf_stateid) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 059300f6a6a7..cf2ff2ef0926 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -254,6 +254,8 @@ VNET_DEFINE_STATIC(struct pfsync_softc *, pfsyncif) = NULL; #define V_pfsyncif VNET(pfsyncif) VNET_DEFINE_STATIC(void *, pfsync_swi_cookie) = NULL; #define V_pfsync_swi_cookie VNET(pfsync_swi_cookie) +VNET_DEFINE_STATIC(struct intr_event *, pfsync_swi_ie); +#define V_pfsync_swi_ie VNET(pfsync_swi_ie) VNET_DEFINE_STATIC(struct pfsyncstats, pfsyncstats); #define V_pfsyncstats VNET(pfsyncstats) VNET_DEFINE_STATIC(int, pfsync_carp_adj) = CARP_MAXSKEW; @@ -2472,7 +2474,7 @@ vnet_pfsync_init(const void *unused __unused) V_pfsync_cloner = if_clone_simple(pfsyncname, pfsync_clone_create, pfsync_clone_destroy, 1); - error = swi_add(NULL, pfsyncname, pfsyncintr, V_pfsyncif, + error = swi_add(&V_pfsync_swi_ie, pfsyncname, pfsyncintr, V_pfsyncif, SWI_NET, INTR_MPSAFE, &V_pfsync_swi_cookie); if (error) { if_clone_detach(V_pfsync_cloner); @@ -2487,11 +2489,15 @@ VNET_SYSINIT(vnet_pfsync_init, SI_SUB_PROTO_FIREWALL, SI_ORDER_ANY, static void vnet_pfsync_uninit(const void *unused __unused) { + int ret; pfsync_pointers_uninit(); if_clone_detach(V_pfsync_cloner); - swi_remove(V_pfsync_swi_cookie); + ret = swi_remove(V_pfsync_swi_cookie); + MPASS(ret == 0); + ret = intr_event_destroy(V_pfsync_swi_ie); + MPASS(ret == 0); } VNET_SYSUNINIT(vnet_pfsync_uninit, SI_SUB_PROTO_FIREWALL, SI_ORDER_FOURTH, diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 563a81fbd4cb..2757bf9cdc54 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -388,6 +388,7 @@ SYSCTL_ULONG(_net_pf, OID_AUTO, request_maxcount, CTLFLAG_RWTUN, &pf_ioctl_maxcount, 0, "Maximum number of tables, addresses, ... in a single ioctl() call"); VNET_DEFINE(void *, pf_swi_cookie); +VNET_DEFINE(struct intr_event *, pf_swi_ie); VNET_DEFINE(uint32_t, pf_hashseed); #define V_pf_hashseed VNET(pf_hashseed) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 977f0debacaa..c930a67ecf80 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -331,7 +331,7 @@ pfattach_vnet(void) for (int i = 0; i < SCNT_MAX; i++) V_pf_status.scounters[i] = counter_u64_alloc(M_WAITOK); - if (swi_add(NULL, "pf send", pf_intr, curvnet, SWI_NET, + if (swi_add(&V_pf_swi_ie, "pf send", pf_intr, curvnet, SWI_NET, INTR_MPSAFE, &V_pf_swi_cookie) != 0) /* XXXGL: leaked all above. */ return; @@ -4670,6 +4670,7 @@ pf_load(void) static void pf_unload_vnet(void) { + int ret; V_pf_vnet_active = 0; V_pf_status.running = 0; @@ -4679,7 +4680,10 @@ pf_unload_vnet(void) shutdown_pf(); PF_RULES_WUNLOCK(); - swi_remove(V_pf_swi_cookie); + ret = swi_remove(V_pf_swi_cookie); + MPASS(ret == 0); + ret = intr_event_destroy(V_pf_swi_ie); + MPASS(ret == 0); pf_unload_vnet_purge(); From owner-dev-commits-src-all@freebsd.org Sat Mar 20 09:59:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 543BD5796F5; Sat, 20 Mar 2021 09:59: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 4F2bpS5TT5z3kBR; Sat, 20 Mar 2021 09:59: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 4FB3D25F95; Sat, 20 Mar 2021 09:59:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K9xh0l064210; Sat, 20 Mar 2021 09:59:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K9xhip064209; Sat, 20 Mar 2021 09:59:43 GMT (envelope-from git) Date: Sat, 20 Mar 2021 09:59:43 GMT Message-Id: <202103200959.12K9xhip064209@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 4ed78443da29 - stable/13 - pf: Simplify cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 4ed78443da29afe32ef7a395d2aa66b5f257ba5e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 09:59:45 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=4ed78443da29afe32ef7a395d2aa66b5f257ba5e commit 4ed78443da29afe32ef7a395d2aa66b5f257ba5e Author: Kristof Provost AuthorDate: 2021-03-10 14:15:16 +0000 Commit: Kristof Provost CommitDate: 2021-03-19 22:41:11 +0000 pf: Simplify cleanup We can now counter_u64_free(NULL), so remove the checks. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29190 (cherry picked from commit 28dc2c954f5096ae594ed5cd7a83d66ce4bf1ded) --- sys/netpfil/pf/if_pfsync.c | 6 ++---- sys/netpfil/pf/pf.c | 12 ++++-------- sys/netpfil/pf/pf_if.c | 6 ++---- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 1cdb365c98df..059300f6a6a7 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -624,10 +624,8 @@ cleanup: cleanup_state: /* pf_state_insert() frees the state keys. */ if (st) { for (int i = 0; i < 2; i++) { - if (st->packets[i] != NULL) - counter_u64_free(st->packets[i]); - if (st->bytes[i] != NULL) - counter_u64_free(st->bytes[i]); + counter_u64_free(st->packets[i]); + counter_u64_free(st->bytes[i]); } if (st->dst.scrub) uma_zfree(V_pf_state_scrub_z, st->dst.scrub); diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index f71f89187b58..563a81fbd4cb 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -707,10 +707,8 @@ pf_free_src_node(struct pf_ksrc_node *sn) { for (int i = 0; i < 2; i++) { - if (sn->bytes[i]) - counter_u64_free(sn->bytes[i]); - if (sn->packets[i]) - counter_u64_free(sn->packets[i]); + counter_u64_free(sn->bytes[i]); + counter_u64_free(sn->packets[i]); } uma_zfree(V_pf_sources_z, sn); } @@ -1739,10 +1737,8 @@ pf_free_state(struct pf_state *cur) cur->timeout)); for (int i = 0; i < 2; i++) { - if (cur->bytes[i] != NULL) - counter_u64_free(cur->bytes[i]); - if (cur->packets[i] != NULL) - counter_u64_free(cur->packets[i]); + counter_u64_free(cur->bytes[i]); + counter_u64_free(cur->packets[i]); } pf_normalize_tcp_cleanup(cur); diff --git a/sys/netpfil/pf/pf_if.c b/sys/netpfil/pf/pf_if.c index e941e3a79b91..be290a1e1f2e 100644 --- a/sys/netpfil/pf/pf_if.c +++ b/sys/netpfil/pf/pf_if.c @@ -256,10 +256,8 @@ pf_kkif_free(struct pfi_kkif *kif) for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { for (int k = 0; k < 2; k++) { - if (kif->pfik_packets[i][j][k]) - counter_u64_free(kif->pfik_packets[i][j][k]); - if (kif->pfik_bytes[i][j][k]) - counter_u64_free(kif->pfik_bytes[i][j][k]); + counter_u64_free(kif->pfik_packets[i][j][k]); + counter_u64_free(kif->pfik_bytes[i][j][k]); } } } From owner-dev-commits-src-all@freebsd.org Sat Mar 20 09:59:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFBD45796FA; Sat, 20 Mar 2021 09:59:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2bpT5TQRz3k1L; Sat, 20 Mar 2021 09:59: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 73F8725EA9; Sat, 20 Mar 2021 09:59:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12K9xhEF064228; Sat, 20 Mar 2021 09:59:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12K9xhNm064227; Sat, 20 Mar 2021 09:59:43 GMT (envelope-from git) Date: Sat, 20 Mar 2021 09:59:43 GMT Message-Id: <202103200959.12K9xhNm064227@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: f11b9574cd18 - stable/12 - pf: Fully remove interrupt events on vnet cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: f11b9574cd186762c4883e8819896c6475be3027 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 09:59:47 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=f11b9574cd186762c4883e8819896c6475be3027 commit f11b9574cd186762c4883e8819896c6475be3027 Author: Kristof Provost AuthorDate: 2021-03-10 21:56:11 +0000 Commit: Kristof Provost CommitDate: 2021-03-19 22:42:27 +0000 pf: Fully remove interrupt events on vnet cleanup swi_remove() removes the software interrupt handler but does not remove the associated interrupt event. This is visible when creating and remove a vnet jail in `procstat -t 12`. We can remove it manually with intr_event_destroy(). PR: 254171 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29211 (cherry picked from commit cecfaf9bede9665d6a10f1e575cd5d575450cff7) --- sys/net/pfvar.h | 2 ++ sys/netpfil/pf/if_pfsync.c | 10 ++++++++-- sys/netpfil/pf/pf.c | 1 + sys/netpfil/pf/pf_ioctl.c | 9 ++++++--- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h index ef25bfc85605..a5ffba6c9d93 100644 --- a/sys/net/pfvar.h +++ b/sys/net/pfvar.h @@ -1389,6 +1389,8 @@ VNET_DECLARE(struct pf_srchash *, pf_srchash); VNET_DECLARE(void *, pf_swi_cookie); #define V_pf_swi_cookie VNET(pf_swi_cookie) +VNET_DECLARE(struct intr_event *, pf_swi_ie); +#define V_pf_swi_ie VNET(pf_swi_ie) VNET_DECLARE(uint64_t, pf_stateid[MAXCPU]); #define V_pf_stateid VNET(pf_stateid) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 0f55dacd18ad..dc149ff486d5 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -254,6 +254,8 @@ VNET_DEFINE_STATIC(struct pfsync_softc *, pfsyncif) = NULL; #define V_pfsyncif VNET(pfsyncif) VNET_DEFINE_STATIC(void *, pfsync_swi_cookie) = NULL; #define V_pfsync_swi_cookie VNET(pfsync_swi_cookie) +VNET_DEFINE_STATIC(struct intr_event *, pfsync_swi_ie); +#define V_pfsync_swi_ie VNET(pfsync_swi_ie) VNET_DEFINE_STATIC(struct pfsyncstats, pfsyncstats); #define V_pfsyncstats VNET(pfsyncstats) VNET_DEFINE_STATIC(int, pfsync_carp_adj) = CARP_MAXSKEW; @@ -2469,7 +2471,7 @@ vnet_pfsync_init(const void *unused __unused) V_pfsync_cloner = if_clone_simple(pfsyncname, pfsync_clone_create, pfsync_clone_destroy, 1); - error = swi_add(NULL, pfsyncname, pfsyncintr, V_pfsyncif, + error = swi_add(&V_pfsync_swi_ie, pfsyncname, pfsyncintr, V_pfsyncif, SWI_NET, INTR_MPSAFE, &V_pfsync_swi_cookie); if (error) { if_clone_detach(V_pfsync_cloner); @@ -2484,11 +2486,15 @@ VNET_SYSINIT(vnet_pfsync_init, SI_SUB_PROTO_FIREWALL, SI_ORDER_ANY, static void vnet_pfsync_uninit(const void *unused __unused) { + int ret; pfsync_pointers_uninit(); if_clone_detach(V_pfsync_cloner); - swi_remove(V_pfsync_swi_cookie); + ret = swi_remove(V_pfsync_swi_cookie); + MPASS(ret == 0); + ret = intr_event_destroy(V_pfsync_swi_ie); + MPASS(ret == 0); } VNET_SYSUNINIT(vnet_pfsync_uninit, SI_SUB_PROTO_FIREWALL, SI_ORDER_FOURTH, diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 3422cdea1e2e..9ad45ff9607e 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -388,6 +388,7 @@ SYSCTL_ULONG(_net_pf, OID_AUTO, request_maxcount, CTLFLAG_RWTUN, &pf_ioctl_maxcount, 0, "Maximum number of tables, addresses, ... in a single ioctl() call"); VNET_DEFINE(void *, pf_swi_cookie); +VNET_DEFINE(struct intr_event *, pf_swi_ie); VNET_DEFINE(uint32_t, pf_hashseed); #define V_pf_hashseed VNET(pf_hashseed) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index c50904e28dc6..d5e09ea1c443 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -331,7 +331,7 @@ pfattach_vnet(void) for (int i = 0; i < SCNT_MAX; i++) V_pf_status.scounters[i] = counter_u64_alloc(M_WAITOK); - if (swi_add(NULL, "pf send", pf_intr, curvnet, SWI_NET, + if (swi_add(&V_pf_swi_ie, "pf send", pf_intr, curvnet, SWI_NET, INTR_MPSAFE, &V_pf_swi_cookie) != 0) /* XXXGL: leaked all above. */ return; @@ -4669,7 +4669,7 @@ pf_load(void) static void pf_unload_vnet(void) { - int error; + int error, ret; V_pf_vnet_active = 0; V_pf_status.running = 0; @@ -4688,7 +4688,10 @@ pf_unload_vnet(void) shutdown_pf(); PF_RULES_WUNLOCK(); - swi_remove(V_pf_swi_cookie); + ret = swi_remove(V_pf_swi_cookie); + MPASS(ret == 0); + ret = intr_event_destroy(V_pf_swi_ie); + MPASS(ret == 0); pf_unload_vnet_purge(); From owner-dev-commits-src-all@freebsd.org Sat Mar 20 10:11:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8BE5357A91E; Sat, 20 Mar 2021 10:11: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 4F2c4V3RZjz3mSn; Sat, 20 Mar 2021 10:11: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 5EF1A25FD7; Sat, 20 Mar 2021 10:11: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 12KABs9h090328; Sat, 20 Mar 2021 10:11:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KABsTR090327; Sat, 20 Mar 2021 10:11:54 GMT (envelope-from git) Date: Sat, 20 Mar 2021 10:11:54 GMT Message-Id: <202103201011.12KABsTR090327@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: f86032a31d99 - stable/13 - i386: Fix a few typos MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f86032a31d998691d071fcd3bdf1957ebce64dc8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 10:11:54 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=f86032a31d998691d071fcd3bdf1957ebce64dc8 commit f86032a31d998691d071fcd3bdf1957ebce64dc8 Author: Gordon Bergling AuthorDate: 2021-03-13 15:10:01 +0000 Commit: Gordon Bergling CommitDate: 2021-03-20 10:10:35 +0000 i386: Fix a few typos - wheter -> whether - while here, fix some whitespace issues (cherry picked from commit 564a3ac63abe166c6174ed3a58e78859a738ee58) --- sys/i386/i386/initcpu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/i386/i386/initcpu.c b/sys/i386/i386/initcpu.c index 9ba269af2b32..ee2d7ec224e5 100644 --- a/sys/i386/i386/initcpu.c +++ b/sys/i386/i386/initcpu.c @@ -2,21 +2,21 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) KATO Takenori, 1997, 1998. - * + * * All rights reserved. Unpublished rights reserved under the copyright * laws of Japan. - * + * * 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 as * the first lines of this file unmodified. * 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. @@ -837,7 +837,7 @@ enable_K5_wt_alloc(void) msr |= AMD_WT_ALLOC_TME | AMD_WT_ALLOC_FRE; /* - * There is no way to know wheter 15-16M hole exists or not. + * There is no way to know whether 15-16M hole exists or not. * Therefore, we disable write allocate for this range. */ wrmsr(0x86, 0x0ff00f0); @@ -890,7 +890,7 @@ enable_K6_wt_alloc(void) whcr |= 0x0001LL; #else /* - * There is no way to know wheter 15-16M hole exists or not. + * There is no way to know whether 15-16M hole exists or not. * Therefore, we disable write allocate for this range. */ whcr &= ~0x0001LL; @@ -940,7 +940,7 @@ enable_K6_2_wt_alloc(void) whcr |= 1LL << 16; #else /* - * There is no way to know wheter 15-16M hole exists or not. + * There is no way to know whether 15-16M hole exists or not. * Therefore, we disable write allocate for this range. */ whcr &= ~(1LL << 16); From owner-dev-commits-src-all@freebsd.org Sat Mar 20 10:12:31 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE76C57ABB8; Sat, 20 Mar 2021 10:12: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 4F2c5C556bz3mgX; Sat, 20 Mar 2021 10:12: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 A1B7825BE6; Sat, 20 Mar 2021 10:12: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 12KACVcU090520; Sat, 20 Mar 2021 10:12:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KACV1D090519; Sat, 20 Mar 2021 10:12:31 GMT (envelope-from git) Date: Sat, 20 Mar 2021 10:12:31 GMT Message-Id: <202103201012.12KACV1D090519@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 52f66bc3ff72 - stable/13 - arm64: Add support for bcm2838 RNG MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 52f66bc3ff72aa266a5dbe86913b0fee68861258 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 10:12:31 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=52f66bc3ff72aa266a5dbe86913b0fee68861258 commit 52f66bc3ff72aa266a5dbe86913b0fee68861258 Author: Gordon Bergling AuthorDate: 2021-03-06 11:28:35 +0000 Commit: Gordon Bergling CommitDate: 2021-03-20 10:12:13 +0000 arm64: Add support for bcm2838 RNG The hardware random number generator of the RPi4 differs slightly from the version found on the RPi3. This commit extends the existing bcm2835_rng driver to function on the RPi4. Submitted by: James Mintram Reviewed by: markm, cem, delphij Approved by: csprng(cem, markm) Differential Revision: https://reviews.freebsd.org/D22493 (cherry picked from commit e797dc58bd29c5bc0873fc620fc11d5332f90e7f) --- sys/arm/broadcom/bcm2835/bcm2835_rng.c | 174 +++++++++++++++++++++++++-------- 1 file changed, 133 insertions(+), 41 deletions(-) diff --git a/sys/arm/broadcom/bcm2835/bcm2835_rng.c b/sys/arm/broadcom/bcm2835/bcm2835_rng.c index b73580c5eb53..c403bc3542e0 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_rng.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_rng.c @@ -69,21 +69,26 @@ static device_probe_t bcm2835_rng_probe; #define RNG_RBG2X 0x00000002 /* RBG 2X SPEED */ #define RNG_RBGEN_BIT 0x00000001 /* Enable RNG bit */ -#define RNG_STATUS 0x04 /* RNG status register */ -#define RND_VAL_SHIFT 24 /* Shift for valid words */ -#define RND_VAL_MASK 0x000000ff /* Number valid words mask */ -#define RND_VAL_WARM_CNT 0x40000 /* RNG Warm Up count */ -#define RND_WARM_CNT 0xfffff /* RNG Warm Up Count mask */ +#define BCM2835_RNG_STATUS 0x04 /* BCM2835 RNG status register */ +#define BCM2838_RNG_STATUS 0x18 /* BCM2838 RNG status register */ -#define RNG_DATA 0x08 /* RNG Data Register */ +#define BCM2838_RNG_COUNT 0x24 /* How many values available */ +#define BCM2838_COUNT_VAL_MASK 0x000000ff + +#define BCM2835_RND_VAL_SHIFT 24 /* Shift for valid words */ +#define BCM2835_RND_VAL_MASK 0x000000ff /* Number valid words mask */ +#define BCM2835_RND_VAL_WARM_CNT 0x40000 /* RNG Warm Up count */ +#define BCM2835_RND_WARM_CNT 0xfffff /* RNG Warm Up Count mask */ + +#define BCM2835_RNG_DATA 0x08 /* RNG Data Register */ +#define BCM2838_RNG_DATA 0x20 #define RNG_FF_THRES 0x0c #define RNG_FF_THRES_MASK 0x0000001f -#define RNG_INT_MASK 0x10 -#define RNG_INT_OFF_BIT 0x00000001 +#define BCM2835_RNG_INT_MASK 0x10 +#define BCM2835_RNG_INT_OFF_BIT 0x00000001 #define RNG_FF_DEFAULT 0x10 /* FIFO threshold default */ - #define RNG_FIFO_WORDS (RNG_FF_DEFAULT / sizeof(uint32_t)) #define RNG_NUM_OSCILLATORS 6 @@ -91,11 +96,55 @@ static device_probe_t bcm2835_rng_probe; #define RNG_CALLOUT_TICKS (hz * 4) +struct bcm_rng_conf { + bus_size_t control_reg; + bus_size_t status_reg; + bus_size_t count_reg; + bus_size_t data_reg; + bus_size_t intr_mask_reg; + uint32_t intr_disable_bit; + uint32_t count_value_shift; + uint32_t count_value_mask; + uint32_t warmup_count; + bool allow_2x_mode; + bool can_diagnose; + /* XXX diag regs */ +}; + +static const struct bcm_rng_conf bcm2835_rng_conf = { + .control_reg = RNG_CTRL, + .status_reg = BCM2835_RNG_STATUS, + .count_reg = BCM2835_RNG_STATUS, /* Same register */ + .data_reg = BCM2835_RNG_DATA, + .intr_mask_reg = BCM2835_RNG_INT_MASK, + .intr_disable_bit = BCM2835_RNG_INT_OFF_BIT, + .count_value_shift = BCM2835_RND_VAL_SHIFT, + .count_value_mask = BCM2835_RND_VAL_MASK, + .warmup_count = BCM2835_RND_VAL_WARM_CNT, + .allow_2x_mode = true, + .can_diagnose = true +}; + +static const struct bcm_rng_conf bcm2838_rng_conf = { + .control_reg = RNG_CTRL, + .status_reg = BCM2838_RNG_STATUS, + .count_reg = BCM2838_RNG_COUNT, + .data_reg = BCM2838_RNG_DATA, + .intr_mask_reg = 0, + .intr_disable_bit = 0, + .count_value_shift = 0, + .count_value_mask = BCM2838_COUNT_VAL_MASK, + .warmup_count = 0, + .allow_2x_mode = false, + .can_diagnose = false +}; + struct bcm2835_rng_softc { device_t sc_dev; struct resource * sc_mem_res; struct resource * sc_irq_res; void * sc_intr_hdl; + struct bcm_rng_conf const* conf; uint32_t sc_buf[RNG_FIFO_WORDS]; struct callout sc_rngto; int sc_stall_count; @@ -104,8 +153,15 @@ struct bcm2835_rng_softc { }; static struct ofw_compat_data compat_data[] = { - {"broadcom,bcm2835-rng", 1}, - {"brcm,bcm2835-rng", 1}, + {"broadcom,bcm2835-rng", (uintptr_t)&bcm2835_rng_conf}, + {"brcm,bcm2835-rng", (uintptr_t)&bcm2835_rng_conf}, + + {"brcm,bcm2711-rng200", (uintptr_t)&bcm2838_rng_conf}, + {"brcm,bcm2838-rng", (uintptr_t)&bcm2838_rng_conf}, + {"brcm,bcm2838-rng200", (uintptr_t)&bcm2838_rng_conf}, + {"brcm,bcm7211-rng", (uintptr_t)&bcm2838_rng_conf}, + {"brcm,bcm7278-rng", (uintptr_t)&bcm2838_rng_conf}, + {"brcm,iproc-rng200", (uintptr_t)&bcm2838_rng_conf}, {NULL, 0} }; @@ -144,8 +200,12 @@ bcm2835_rng_dump_registers(struct bcm2835_rng_softc *sc, struct sbuf *sbp) uint32_t comblk2_osc, comblk1_osc, jclk_byp_div, val; int i; + if (!sc->conf->can_diagnose) + /* Not implemented. */ + return; + /* Display RNG control register contents */ - val = bcm2835_rng_read4(sc, RNG_CTRL); + val = bcm2835_rng_read4(sc, sc->conf->control_reg); sbuf_printf(sbp, "RNG_CTRL (%08x)\n", val); comblk2_osc = (val & RNG_COMBLK2_OSC) >> RNG_COMBLK2_OSC_SHIFT; @@ -181,20 +241,20 @@ bcm2835_rng_dump_registers(struct bcm2835_rng_softc *sc, struct sbuf *sbp) sbuf_cat(sbp, " RNG_RBGEN_BIT: RBG enabled\n"); /* Display RNG status register contents */ - val = bcm2835_rng_read4(sc, RNG_STATUS); + val = bcm2835_rng_read4(sc, sc->conf->status_reg); sbuf_printf(sbp, "RNG_CTRL (%08x)\n", val); sbuf_printf(sbp, " RND_VAL: %02x\n", - (val >> RND_VAL_SHIFT) & RND_VAL_MASK); - sbuf_printf(sbp, " RND_WARM_CNT: %05x\n", val & RND_WARM_CNT); + (val >> sc->conf->count_value_shift) & sc->conf->count_value_mask); + sbuf_printf(sbp, " RND_WARM_CNT: %05x\n", val & sc->conf->warmup_count); /* Display FIFO threshold register contents */ val = bcm2835_rng_read4(sc, RNG_FF_THRES); sbuf_printf(sbp, "RNG_FF_THRES: %05x\n", val & RNG_FF_THRES_MASK); /* Display interrupt mask register contents */ - val = bcm2835_rng_read4(sc, RNG_INT_MASK); + val = bcm2835_rng_read4(sc, sc->conf->intr_mask_reg); sbuf_printf(sbp, "RNG_INT_MASK: interrupt %s\n", - ((val & RNG_INT_OFF_BIT) != 0) ? "disabled" : "enabled"); + ((val & sc->conf->intr_disable_bit) != 0) ? "disabled" : "enabled"); } static void @@ -203,9 +263,9 @@ bcm2835_rng_disable_intr(struct bcm2835_rng_softc *sc) uint32_t mask; /* Set the interrupt off bit in the interrupt mask register */ - mask = bcm2835_rng_read4(sc, RNG_INT_MASK); - mask |= RNG_INT_OFF_BIT; - bcm2835_rng_write4(sc, RNG_INT_MASK, mask); + mask = bcm2835_rng_read4(sc, sc->conf->intr_mask_reg); + mask |= sc->conf->intr_disable_bit; + bcm2835_rng_write4(sc, sc->conf->intr_mask_reg, mask); } static void @@ -214,17 +274,20 @@ bcm2835_rng_start(struct bcm2835_rng_softc *sc) uint32_t ctrl; /* Disable the interrupt */ - bcm2835_rng_disable_intr(sc); + if (sc->conf->intr_mask_reg) + bcm2835_rng_disable_intr(sc); /* Set the warmup count */ - bcm2835_rng_write4(sc, RNG_STATUS, RND_VAL_WARM_CNT); + if (sc->conf->warmup_count > 0) + bcm2835_rng_write4(sc, sc->conf->status_reg, + sc->conf->warmup_count); /* Enable the RNG */ - ctrl = bcm2835_rng_read4(sc, RNG_CTRL); + ctrl = bcm2835_rng_read4(sc, sc->conf->control_reg); ctrl |= RNG_RBGEN_BIT; - if (sc->sc_rbg2x) + if (sc->sc_rbg2x && sc->conf->allow_2x_mode) ctrl |= RNG_RBG2X; - bcm2835_rng_write4(sc, RNG_CTRL, ctrl); + bcm2835_rng_write4(sc, sc->conf->control_reg, ctrl); } static void @@ -233,16 +296,39 @@ bcm2835_rng_stop(struct bcm2835_rng_softc *sc) uint32_t ctrl; /* Disable the RNG */ - ctrl = bcm2835_rng_read4(sc, RNG_CTRL); + ctrl = bcm2835_rng_read4(sc, sc->conf->control_reg); ctrl &= ~RNG_RBGEN_BIT; - bcm2835_rng_write4(sc, RNG_CTRL, ctrl); + bcm2835_rng_write4(sc, sc->conf->control_reg, ctrl); +} + +static void +bcm2835_rng_enqueue_harvest(struct bcm2835_rng_softc *sc, uint32_t nread) +{ + char *sc_buf_chunk; + uint32_t chunk_size; + uint32_t cnt; + + chunk_size = sizeof(((struct harvest_event *)0)->he_entropy); + cnt = nread * sizeof(uint32_t); + sc_buf_chunk = (void*)sc->sc_buf; + + while (cnt > 0) { + uint32_t size; + + size = MIN(cnt, chunk_size); + + random_harvest_queue(sc_buf_chunk, size, RANDOM_PURE_BROADCOM); + + sc_buf_chunk += size; + cnt -= size; + } } static void bcm2835_rng_harvest(void *arg) { uint32_t *dest; - uint32_t status; + uint32_t hwcount; u_int cnt, nread, num_avail, num_words; int seen_underrun, num_stalls; struct bcm2835_rng_softc *sc = arg; @@ -250,11 +336,13 @@ bcm2835_rng_harvest(void *arg) dest = sc->sc_buf; nread = num_words = 0; seen_underrun = num_stalls = 0; + for (cnt = sizeof(sc->sc_buf) / sizeof(uint32_t); cnt > 0; cnt -= num_words) { - /* Read status register to find out how many words available */ - status = bcm2835_rng_read4(sc, RNG_STATUS); - num_avail = (status >> RND_VAL_SHIFT) & RND_VAL_MASK; + /* Read count register to find out how many words available */ + hwcount = bcm2835_rng_read4(sc, sc->conf->count_reg); + num_avail = (hwcount >> sc->conf->count_value_shift) & + sc->conf->count_value_mask; /* If we have none... */ if (num_avail == 0) { @@ -282,15 +370,13 @@ bcm2835_rng_harvest(void *arg) /* Pull MIN(num_avail, cnt) words from the FIFO */ num_words = (num_avail > cnt) ? cnt : num_avail; - bcm2835_rng_read_multi4(sc, RNG_DATA, dest, + bcm2835_rng_read_multi4(sc, sc->conf->data_reg, dest, num_words); dest += num_words; nread += num_words; } - cnt = nread * sizeof(uint32_t); - if (cnt > 0) - random_harvest_queue(sc->sc_buf, cnt, RANDOM_PURE_BROADCOM); + bcm2835_rng_enqueue_harvest(sc, nread); callout_reset(&sc->sc_rngto, RNG_CALLOUT_TICKS, bcm2835_rng_harvest, sc); } @@ -347,7 +433,7 @@ bcm2835_rng_probe(device_t dev) if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); - device_set_desc(dev, "Broadcom BCM2835 RNG"); + device_set_desc(dev, "Broadcom BCM2835/BCM2838 RNG"); return (BUS_PROBE_DEFAULT); } @@ -363,13 +449,18 @@ bcm2835_rng_attach(device_t dev) error = 0; sc = device_get_softc(dev); sc->sc_dev = dev; + + sc->conf = (void const*)ofw_bus_search_compatible(dev, compat_data)->ocd_data; + KASSERT(sc->conf != NULL, ("bcm2835_rng_attach: sc->conf == NULL")); + sc->sc_stall_count = RNG_STALL_COUNT_DEFAULT; /* Initialize callout */ callout_init(&sc->sc_rngto, CALLOUT_MPSAFE); - TUNABLE_INT_FETCH("bcmrng.2xspeed", &sc->sc_rbg2x); TUNABLE_INT_FETCH("bcmrng.stall_count", &sc->sc_stall_count); + if (sc->conf->allow_2x_mode) + TUNABLE_INT_FETCH("bcmrng.2xspeed", &sc->sc_rbg2x); /* Allocate memory resources */ rid = 0; @@ -402,9 +493,10 @@ bcm2835_rng_attach(device_t dev) SYSCTL_ADD_LONG(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "underrun", CTLFLAG_RD, &sc->sc_underrun, "Number of FIFO underruns"); - SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, - "2xspeed", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, - sysctl_bcm2835_rng_2xspeed, "I", "Enable RBG 2X SPEED"); + if (sc->conf->allow_2x_mode) + SYSCTL_ADD_PROC(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, + "2xspeed", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, sc, 0, + sysctl_bcm2835_rng_2xspeed, "I", "Enable RBG 2X SPEED"); SYSCTL_ADD_INT(sysctl_ctx, SYSCTL_CHILDREN(sysctl_tree), OID_AUTO, "stall_count", CTLFLAG_RW, &sc->sc_stall_count, RNG_STALL_COUNT_DEFAULT, "Number of underruns to assume RNG stall"); @@ -414,7 +506,7 @@ bcm2835_rng_attach(device_t dev) sysctl_bcm2835_rng_dump, "S", "Dump RNG registers"); #endif - /* + /* * Schedule the initial harvesting one second from now, which should give the * hardware RNG plenty of time to generate the first random bytes. */ From owner-dev-commits-src-all@freebsd.org Sat Mar 20 10:13:14 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C543A57AC18; Sat, 20 Mar 2021 10:13: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 4F2c625CMTz3n0R; Sat, 20 Mar 2021 10:13: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 A5B8D2621A; Sat, 20 Mar 2021 10:13: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 12KADEIH090732; Sat, 20 Mar 2021 10:13:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KADETO090729; Sat, 20 Mar 2021 10:13:14 GMT (envelope-from git) Date: Sat, 20 Mar 2021 10:13:14 GMT Message-Id: <202103201013.12KADETO090729@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 12bd7bc8447f - stable/13 - Fix a few typos in comments MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 12bd7bc8447f5103e800e6e464089a00ecaec0fb Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 10:13:14 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=12bd7bc8447f5103e800e6e464089a00ecaec0fb commit 12bd7bc8447f5103e800e6e464089a00ecaec0fb Author: Gordon Bergling AuthorDate: 2021-03-13 15:37:28 +0000 Commit: Gordon Bergling CommitDate: 2021-03-20 10:13:01 +0000 Fix a few typos in comments - trough -> through MFC after: 1 week (cherry picked from commit 183502d1625fbcc3600fbe1d196758b946749569) --- share/man/man4/ng_macfilter.4 | 2 +- sys/netinet/sctp_ss_functions.c | 2 +- sys/netpfil/ipfw/nat64/nat64_translate.c | 2 +- sys/sys/soundcard.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/share/man/man4/ng_macfilter.4 b/share/man/man4/ng_macfilter.4 index 5d8b9a4f780b..895d3560136b 100644 --- a/share/man/man4/ng_macfilter.4 +++ b/share/man/man4/ng_macfilter.4 @@ -45,7 +45,7 @@ address. .Pp This processing is done when traffic flows from the .Dq ether -hook trough +hook through .Nm macfilter to one of the outgoing hooks. Outbound hooks can be added to and remove from diff --git a/sys/netinet/sctp_ss_functions.c b/sys/netinet/sctp_ss_functions.c index 5f10d3e9bcb7..5557015cd2a9 100644 --- a/sys/netinet/sctp_ss_functions.c +++ b/sys/netinet/sctp_ss_functions.c @@ -583,7 +583,7 @@ sctp_ss_prio_set_value(struct sctp_tcb *stcb, struct sctp_association *asoc, /* * Fair bandwidth algorithm. - * Maintains an equal troughput per stream. + * Maintains an equal throughput per stream. */ static void sctp_ss_fb_clear(struct sctp_tcb *stcb, struct sctp_association *asoc, diff --git a/sys/netpfil/ipfw/nat64/nat64_translate.c b/sys/netpfil/ipfw/nat64/nat64_translate.c index e8fffe03497c..4ed3bfa765f6 100644 --- a/sys/netpfil/ipfw/nat64/nat64_translate.c +++ b/sys/netpfil/ipfw/nat64/nat64_translate.c @@ -722,7 +722,7 @@ nat64_icmp6_reflect(struct mbuf *m, uint8_t type, uint8_t code, uint32_t mtu, /* * Move pkthdr from original mbuf. We should have initialized some * fields, because we can reinject this mbuf to netisr and it will - * go trough input path (it requires at least rcvif should be set). + * go through input path (it requires at least rcvif should be set). * Also do M_ALIGN() to reduce chances of need to allocate new mbuf * in the chain, when we will do M_PREPEND() or make some type of * tunneling. diff --git a/sys/sys/soundcard.h b/sys/sys/soundcard.h index 41cd8593914a..285f26986434 100644 --- a/sys/sys/soundcard.h +++ b/sys/sys/soundcard.h @@ -484,7 +484,7 @@ struct sysex_info { * This structure is also used with ioctl(SNDCTL_PGMR_IFACE) which allows * a patch manager daemon to read and write device parameters. This * ioctl available through /dev/sequencer also. Avoid using it since it's - * extremely hardware dependent. In addition access trough /dev/sequencer + * extremely hardware dependent. In addition access through /dev/sequencer * may confuse the patch manager daemon. */ From owner-dev-commits-src-all@freebsd.org Sat Mar 20 10:13:49 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDC2557A945; Sat, 20 Mar 2021 10:13: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 4F2c6j5XCMz3nHb; Sat, 20 Mar 2021 10:13: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 B12AE25ED2; Sat, 20 Mar 2021 10:13: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 12KADnbD090920; Sat, 20 Mar 2021 10:13:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KADnKJ090919; Sat, 20 Mar 2021 10:13:49 GMT (envelope-from git) Date: Sat, 20 Mar 2021 10:13:49 GMT Message-Id: <202103201013.12KADnKJ090919@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: bb70c9d2f921 - stable/13 - net80211: Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: bb70c9d2f9212b8ce78d5817eae79f1221afafd9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 10:13:49 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=bb70c9d2f9212b8ce78d5817eae79f1221afafd9 commit bb70c9d2f9212b8ce78d5817eae79f1221afafd9 Author: Gordon Bergling AuthorDate: 2021-03-13 14:51:30 +0000 Commit: Gordon Bergling CommitDate: 2021-03-20 10:13:31 +0000 net80211: Fix a typo in a comment - destionation -> destination - while here, fix some whitespace issues (cherry picked from commit d197bf2b20e7efc6ffef520bf96d5f642e26a015) --- sys/net80211/ieee80211_hwmp.c | 62 +++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c index 75c3eeb7c759..4fbcc9051c47 100644 --- a/sys/net80211/ieee80211_hwmp.c +++ b/sys/net80211/ieee80211_hwmp.c @@ -1,33 +1,33 @@ -/*- +/*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2009 The FreeBSD Foundation - * All rights reserved. - * + * Copyright (c) 2009 The FreeBSD Foundation + * All rights reserved. + * * This software was developed by Rui Paulo 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 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 #ifdef __FreeBSD__ __FBSDID("$FreeBSD$"); @@ -282,7 +282,7 @@ hwmp_vdetach(struct ieee80211vap *vap) callout_drain(&hs->hs_roottimer); IEEE80211_FREE(vap->iv_hwmp, M_80211_VAP); vap->iv_hwmp = NULL; -} +} static int hwmp_newstate(struct ieee80211vap *vap, enum ieee80211_state ostate, int arg) @@ -378,7 +378,7 @@ verify_mesh_perr_len(struct ieee80211vap *vap, } iefrm_t += IEEE80211_MESHPERR_NDEST_OFFSET + 1; /* flag is next field */ - /* We need to check each destionation flag to know size */ + /* We need to check each destination flag to know size */ for(i = 0; ipreq_lifetime = le32dec(iefrm_t); iefrm_t += 4; preq->preq_metric = le32dec(iefrm_t); iefrm_t += 4; preq->preq_tcount = *iefrm_t++; - + for (i = 0; i < preq->preq_tcount; i++) { preq->preq_targets[i].target_flags = *iefrm_t++; IEEE80211_ADDR_COPY( @@ -983,7 +983,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, return; } /* - * Acceptance criteria: if unicast addressed + * Acceptance criteria: if unicast addressed * AND no valid forwarding for Target of PREQ, discard this PREQ. */ if(rttarg != NULL) From owner-dev-commits-src-all@freebsd.org Sat Mar 20 10:22:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6CA657ACF4; Sat, 20 Mar 2021 10:22: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 4F2cJk6DGRz3nr0; Sat, 20 Mar 2021 10:22: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 C884A2623B; Sat, 20 Mar 2021 10:22:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12KAMUqV003727; Sat, 20 Mar 2021 10:22:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KAMUW6003726; Sat, 20 Mar 2021 10:22:30 GMT (envelope-from git) Date: Sat, 20 Mar 2021 10:22:30 GMT Message-Id: <202103201022.12KAMUW6003726@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 001d849a4871 - stable/13 - find(1): Mark -not as an extensions to POSIX MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 001d849a4871e3792a69ad3dfb24061018712bac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 10:22:31 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=001d849a4871e3792a69ad3dfb24061018712bac commit 001d849a4871e3792a69ad3dfb24061018712bac Author: Daniel Ebdrup Jensen AuthorDate: 2021-02-23 15:23:09 +0000 Commit: Gordon Bergling CommitDate: 2021-03-20 10:20:28 +0000 find(1): Mark -not as an extensions to POSIX While here, change mdoc macro from Ic to Fl. PR: 253499 Reported by: Michael Siegel (cherry picked from commit 75e6f664c469927ca73ecd7b16a8058bc292a451) --- usr.bin/find/find.1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1 index ce7a231c3c7d..43b1262352a6 100644 --- a/usr.bin/find/find.1 +++ b/usr.bin/find/find.1 @@ -31,7 +31,7 @@ .\" @(#)find.1 8.7 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd April 18, 2020 +.Dd February 23, 2021 .Dt FIND 1 .Os .Sh NAME @@ -1016,9 +1016,9 @@ and as well as .Ic -amin , -anewer , -cmin , -cnewer , -delete , -empty , -fstype , .Ic -iname , -inum , -iregex , -ls , -maxdepth , -mindepth , -mmin , -.Ic -path , -print0 , -regex , -sparse +.Ic -not , -path , -print0 , -regex , -sparse and all of the -.Ic -B* +.Fl B* birthtime related primaries are extensions to .St -p1003.1-2001 . .Pp From owner-dev-commits-src-all@freebsd.org Sat Mar 20 10:22:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F45E57B12E; Sat, 20 Mar 2021 10:22: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 4F2cJm04nLz3nZy; Sat, 20 Mar 2021 10:22: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 E9DCD261CD; Sat, 20 Mar 2021 10:22: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 12KAMVV6003750; Sat, 20 Mar 2021 10:22:31 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KAMVJZ003749; Sat, 20 Mar 2021 10:22:31 GMT (envelope-from git) Date: Sat, 20 Mar 2021 10:22:31 GMT Message-Id: <202103201022.12KAMVJZ003749@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 0f51ceaad1ba - stable/13 - find(1): Refine the HISTORY within the 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 0f51ceaad1bad4f108a4bebe56bea034b7bdbe6b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 10:22:32 -0000 The branch stable/13 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=0f51ceaad1bad4f108a4bebe56bea034b7bdbe6b commit 0f51ceaad1bad4f108a4bebe56bea034b7bdbe6b Author: Gordon Bergling AuthorDate: 2021-03-13 18:28:26 +0000 Commit: Gordon Bergling CommitDate: 2021-03-20 10:20:57 +0000 find(1): Refine the HISTORY within the manual page. A simple find command appeared in Version 1 AT&T UNIX and was removed in Version 3 AT&T UNIX. It was rewritten for Version 5 AT&T UNIX and later be enhanced for the Programmer's Workbench (PWB). These changes were later incorporated in AT&T UNIX v7. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D29114 (cherry picked from commit a9275d996c229a30879baa42a6d02d24663ac43b) --- usr.bin/find/find.1 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1 index 43b1262352a6..0c5c113479a3 100644 --- a/usr.bin/find/find.1 +++ b/usr.bin/find/find.1 @@ -31,7 +31,7 @@ .\" @(#)find.1 8.7 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd February 23, 2021 +.Dd March 13, 2021 .Dt FIND 1 .Os .Sh NAME @@ -1071,10 +1071,17 @@ and .Xr sed 1 options. .Sh HISTORY -A +A simple .Nm command appeared in -.At v1 . +.At v1 +and was removed in +.At v3 . +It was rewritten for +.At v5 +and later be enhanced for the Programmer's Workbench (PWB). +These changes were later incorporated in +.At v7. .Sh BUGS The special characters used by .Nm From owner-dev-commits-src-all@freebsd.org Sat Mar 20 10:24:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C22B857B290; Sat, 20 Mar 2021 10:24: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 4F2cM556fPz3p4y; Sat, 20 Mar 2021 10:24: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 987D025EF1; Sat, 20 Mar 2021 10:24: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 12KAOXFO004165; Sat, 20 Mar 2021 10:24:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KAOX6O004164; Sat, 20 Mar 2021 10:24:33 GMT (envelope-from git) Date: Sat, 20 Mar 2021 10:24:33 GMT Message-Id: <202103201024.12KAOX6O004164@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: 82f434c2b443 - stable/12 - i386: Fix a few typos MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 82f434c2b443befada1ef1225a375b00aa5574c6 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 10:24:33 -0000 The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=82f434c2b443befada1ef1225a375b00aa5574c6 commit 82f434c2b443befada1ef1225a375b00aa5574c6 Author: Gordon Bergling AuthorDate: 2021-03-13 15:10:01 +0000 Commit: Gordon Bergling CommitDate: 2021-03-20 10:23:56 +0000 i386: Fix a few typos - wheter -> whether - while here, fix some whitespace issues (cherry picked from commit 564a3ac63abe166c6174ed3a58e78859a738ee58) --- sys/i386/i386/initcpu.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/i386/i386/initcpu.c b/sys/i386/i386/initcpu.c index a080e0b6ccc4..58cced8b3b0d 100644 --- a/sys/i386/i386/initcpu.c +++ b/sys/i386/i386/initcpu.c @@ -2,21 +2,21 @@ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * * Copyright (c) KATO Takenori, 1997, 1998. - * + * * All rights reserved. Unpublished rights reserved under the copyright * laws of Japan. - * + * * 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 as * the first lines of this file unmodified. * 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. @@ -844,7 +844,7 @@ enable_K5_wt_alloc(void) msr |= AMD_WT_ALLOC_TME | AMD_WT_ALLOC_FRE; /* - * There is no way to know wheter 15-16M hole exists or not. + * There is no way to know whether 15-16M hole exists or not. * Therefore, we disable write allocate for this range. */ wrmsr(0x86, 0x0ff00f0); @@ -897,7 +897,7 @@ enable_K6_wt_alloc(void) whcr |= 0x0001LL; #else /* - * There is no way to know wheter 15-16M hole exists or not. + * There is no way to know whether 15-16M hole exists or not. * Therefore, we disable write allocate for this range. */ whcr &= ~0x0001LL; @@ -947,7 +947,7 @@ enable_K6_2_wt_alloc(void) whcr |= 1LL << 16; #else /* - * There is no way to know wheter 15-16M hole exists or not. + * There is no way to know whether 15-16M hole exists or not. * Therefore, we disable write allocate for this range. */ whcr &= ~(1LL << 16); From owner-dev-commits-src-all@freebsd.org Sat Mar 20 10:25:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C6DD57B401; Sat, 20 Mar 2021 10:25: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 4F2cNH44lvz3pBn; Sat, 20 Mar 2021 10:25: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 7F58925EF2; Sat, 20 Mar 2021 10:25: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 12KAPZH1004427; Sat, 20 Mar 2021 10:25:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KAPZGe004426; Sat, 20 Mar 2021 10:25:35 GMT (envelope-from git) Date: Sat, 20 Mar 2021 10:25:35 GMT Message-Id: <202103201025.12KAPZGe004426@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: d57aee49378e - stable/12 - net80211: Fix a typo in a comment MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: d57aee49378e2066b53dca9e306b4697b7c74858 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 10:25:35 -0000 The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=d57aee49378e2066b53dca9e306b4697b7c74858 commit d57aee49378e2066b53dca9e306b4697b7c74858 Author: Gordon Bergling AuthorDate: 2021-03-13 14:51:30 +0000 Commit: Gordon Bergling CommitDate: 2021-03-20 10:25:21 +0000 net80211: Fix a typo in a comment - destionation -> destination - while here, fix some whitespace issues (cherry picked from commit d197bf2b20e7efc6ffef520bf96d5f642e26a015) --- sys/net80211/ieee80211_hwmp.c | 62 +++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/sys/net80211/ieee80211_hwmp.c b/sys/net80211/ieee80211_hwmp.c index e2cd800e7bca..170ac57b21b2 100644 --- a/sys/net80211/ieee80211_hwmp.c +++ b/sys/net80211/ieee80211_hwmp.c @@ -1,33 +1,33 @@ -/*- +/*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * - * Copyright (c) 2009 The FreeBSD Foundation - * All rights reserved. - * + * Copyright (c) 2009 The FreeBSD Foundation + * All rights reserved. + * * This software was developed by Rui Paulo 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 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 #ifdef __FreeBSD__ __FBSDID("$FreeBSD$"); @@ -276,7 +276,7 @@ hwmp_vdetach(struct ieee80211vap *vap) callout_drain(&hs->hs_roottimer); IEEE80211_FREE(vap->iv_hwmp, M_80211_VAP); vap->iv_hwmp = NULL; -} +} static int hwmp_newstate(struct ieee80211vap *vap, enum ieee80211_state ostate, int arg) @@ -372,7 +372,7 @@ verify_mesh_perr_len(struct ieee80211vap *vap, } iefrm_t += IEEE80211_MESHPERR_NDEST_OFFSET + 1; /* flag is next field */ - /* We need to check each destionation flag to know size */ + /* We need to check each destination flag to know size */ for(i = 0; ipreq_lifetime = le32dec(iefrm_t); iefrm_t += 4; preq->preq_metric = le32dec(iefrm_t); iefrm_t += 4; preq->preq_tcount = *iefrm_t++; - + for (i = 0; i < preq->preq_tcount; i++) { preq->preq_targets[i].target_flags = *iefrm_t++; IEEE80211_ADDR_COPY( @@ -977,7 +977,7 @@ hwmp_recv_preq(struct ieee80211vap *vap, struct ieee80211_node *ni, return; } /* - * Acceptance criteria: if unicast addressed + * Acceptance criteria: if unicast addressed * AND no valid forwarding for Target of PREQ, discard this PREQ. */ if(rttarg != NULL) From owner-dev-commits-src-all@freebsd.org Sat Mar 20 10:26:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B80757B2A9; Sat, 20 Mar 2021 10:26: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 4F2cP33Zrvz3pKn; Sat, 20 Mar 2021 10:26: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 6DB7C261D5; Sat, 20 Mar 2021 10:26: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 12KAQFeo004641; Sat, 20 Mar 2021 10:26:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KAQF0u004640; Sat, 20 Mar 2021 10:26:15 GMT (envelope-from git) Date: Sat, 20 Mar 2021 10:26:15 GMT Message-Id: <202103201026.12KAQF0u004640@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: a03c85daaefc - stable/12 - find(1): Mark -not as an extensions to POSIX MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: gbe X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: a03c85daaefc58693208f2c74aaf46e5932ff1d2 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 10:26:15 -0000 The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=a03c85daaefc58693208f2c74aaf46e5932ff1d2 commit a03c85daaefc58693208f2c74aaf46e5932ff1d2 Author: Daniel Ebdrup Jensen AuthorDate: 2021-02-23 15:23:09 +0000 Commit: Gordon Bergling CommitDate: 2021-03-20 10:25:58 +0000 find(1): Mark -not as an extensions to POSIX While here, change mdoc macro from Ic to Fl. PR: 253499 Reported by: Michael Siegel (cherry picked from commit 75e6f664c469927ca73ecd7b16a8058bc292a451) --- usr.bin/find/find.1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1 index ce7a231c3c7d..43b1262352a6 100644 --- a/usr.bin/find/find.1 +++ b/usr.bin/find/find.1 @@ -31,7 +31,7 @@ .\" @(#)find.1 8.7 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd April 18, 2020 +.Dd February 23, 2021 .Dt FIND 1 .Os .Sh NAME @@ -1016,9 +1016,9 @@ and as well as .Ic -amin , -anewer , -cmin , -cnewer , -delete , -empty , -fstype , .Ic -iname , -inum , -iregex , -ls , -maxdepth , -mindepth , -mmin , -.Ic -path , -print0 , -regex , -sparse +.Ic -not , -path , -print0 , -regex , -sparse and all of the -.Ic -B* +.Fl B* birthtime related primaries are extensions to .St -p1003.1-2001 . .Pp From owner-dev-commits-src-all@freebsd.org Sat Mar 20 10:27:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8445A57B24C; Sat, 20 Mar 2021 10:27:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2cQ92yVRz3pWl; Sat, 20 Mar 2021 10:27:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5885C264A0; Sat, 20 Mar 2021 10:27:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12KARDOX004896; Sat, 20 Mar 2021 10:27:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KARD7R004895; Sat, 20 Mar 2021 10:27:13 GMT (envelope-from git) Date: Sat, 20 Mar 2021 10:27:13 GMT Message-Id: <202103201027.12KARD7R004895@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gordon Bergling Subject: git: af0cea80104a - stable/12 - find(1): Refine the HISTORY within the 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/stable/12 X-Git-Reftype: branch X-Git-Commit: af0cea80104a048da05b818ebcb85ad8b3ba89a0 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 10:27:13 -0000 The branch stable/12 has been updated by gbe (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=af0cea80104a048da05b818ebcb85ad8b3ba89a0 commit af0cea80104a048da05b818ebcb85ad8b3ba89a0 Author: Gordon Bergling AuthorDate: 2021-03-13 18:28:26 +0000 Commit: Gordon Bergling CommitDate: 2021-03-20 10:26:28 +0000 find(1): Refine the HISTORY within the manual page. A simple find command appeared in Version 1 AT&T UNIX and was removed in Version 3 AT&T UNIX. It was rewritten for Version 5 AT&T UNIX and later be enhanced for the Programmer's Workbench (PWB). These changes were later incorporated in AT&T UNIX v7. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D29114 (cherry picked from commit a9275d996c229a30879baa42a6d02d24663ac43b) --- usr.bin/find/find.1 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/usr.bin/find/find.1 b/usr.bin/find/find.1 index 43b1262352a6..0c5c113479a3 100644 --- a/usr.bin/find/find.1 +++ b/usr.bin/find/find.1 @@ -31,7 +31,7 @@ .\" @(#)find.1 8.7 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd February 23, 2021 +.Dd March 13, 2021 .Dt FIND 1 .Os .Sh NAME @@ -1071,10 +1071,17 @@ and .Xr sed 1 options. .Sh HISTORY -A +A simple .Nm command appeared in -.At v1 . +.At v1 +and was removed in +.At v3 . +It was rewritten for +.At v5 +and later be enhanced for the Programmer's Workbench (PWB). +These changes were later incorporated in +.At v7. .Sh BUGS The special characters used by .Nm From owner-dev-commits-src-all@freebsd.org Sat Mar 20 13:02:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19BB457FD47; Sat, 20 Mar 2021 13:02:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F2gsF08xRz4TG4; Sat, 20 Mar 2021 13:02:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ECA1E27FFB; Sat, 20 Mar 2021 13:02:24 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12KD2OJh015271; Sat, 20 Mar 2021 13:02:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KD2OxK015270; Sat, 20 Mar 2021 13:02:24 GMT (envelope-from git) Date: Sat, 20 Mar 2021 13:02:24 GMT Message-Id: <202103201302.12KD2OxK015270@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 8c9e45503fe4 - main - tools/build: Improve host-symlinks failure mode MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8c9e45503fe41732f72e1a4cc9a231e63b4289ba Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 13:02:25 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=8c9e45503fe41732f72e1a4cc9a231e63b4289ba commit 8c9e45503fe41732f72e1a4cc9a231e63b4289ba Author: Jessica Clarke AuthorDate: 2021-03-20 13:00:34 +0000 Commit: Jessica Clarke CommitDate: 2021-03-20 13:00:34 +0000 tools/build: Improve host-symlinks failure mode Since set -e is enabled by sys.mk, if the tool cannot be found in PATH then the entire shell command line fails, causing us to not print the error message below and instead silently (due to the @) fail, only getting the usual "Error code 1" print from bmake. Thus, provide a dummy default that will never exist (the same as is used by meta2deps.sh) if which fails so that we get the error message as intended. MFC after: 1 week --- tools/build/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/build/Makefile b/tools/build/Makefile index effe8b9cb31d..31d027f75ce2 100644 --- a/tools/build/Makefile +++ b/tools/build/Makefile @@ -301,7 +301,8 @@ _host_tools_to_symlink:=${_host_tools_to_symlink:Nsh} host-symlinks: @echo "Linking host tools into ${DESTDIR}/bin" .for _tool in ${_host_tools_to_symlink} - @export PATH=$${PATH}:/usr/local/bin; source_path=`which ${_tool}`; \ + @export PATH=$${PATH}:/usr/local/bin; \ + source_path=`which ${_tool} || echo /dev/null/no/such`; \ if [ ! -e "$${source_path}" ] ; then \ echo "Cannot find host tool '${_tool}' in PATH ($$PATH)." >&2; false; \ fi; \ From owner-dev-commits-src-all@freebsd.org Sat Mar 20 14:46:28 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED8045AAFF0; Sat, 20 Mar 2021 14:46: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 4F2k9J6QJYz4b5T; Sat, 20 Mar 2021 14:46: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 CF1EF1551; Sat, 20 Mar 2021 14:46: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 12KEkSDc047815; Sat, 20 Mar 2021 14:46:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KEkSGB047814; Sat, 20 Mar 2021 14:46:28 GMT (envelope-from git) Date: Sat, 20 Mar 2021 14:46:28 GMT Message-Id: <202103201446.12KEkSGB047814@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 305b1903c8f4 - stable/13 - pfctl: Add missing 'va' code point name MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 305b1903c8f44157fa5512f428b737c99015d880 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 14:46:29 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=305b1903c8f44157fa5512f428b737c99015d880 commit 305b1903c8f44157fa5512f428b737c99015d880 Author: Kristof Provost AuthorDate: 2021-03-04 12:50:28 +0000 Commit: Kristof Provost CommitDate: 2021-03-20 14:45:48 +0000 pfctl: Add missing 'va' code point name Add the 'va' (voice-admit, RFC5865) symbolic name. Reviewed by: rgrimes, gbe (man page) MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29069 (cherry picked from commit b4e3f3c2de6e6dc614f99615e50d0d87f3367ca0) --- sbin/pfctl/parse.y | 3 ++- share/man/man5/pf.conf.5 | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 1182dde3b079..9db85538feaf 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -6342,7 +6342,8 @@ map_tos(char *s, int *val) { "lowdelay", IPTOS_LOWDELAY }, { "netcontrol", IPTOS_PREC_NETCONTROL }, { "reliability", IPTOS_RELIABILITY }, - { "throughput", IPTOS_THROUGHPUT } + { "throughput", IPTOS_THROUGHPUT }, + { "va", IPTOS_DSCP_VA } }; const struct keywords *p; diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 8846199deccb..d31d20e29bea 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -681,6 +681,7 @@ given as one of .Ar reliability , or one of the DiffServ Code Points: .Ar ef , +.Ar va , .Ar af11 No ... Ar af43 , .Ar cs0 No ... Ar cs7 ; or as either hex or decimal. @@ -1737,6 +1738,7 @@ given as one of .Ar reliability , or one of the DiffServ Code Points: .Ar ef , +.Ar va , .Ar af11 No ... Ar af43 , .Ar cs0 No ... Ar cs7 ; or as either hex or decimal. From owner-dev-commits-src-all@freebsd.org Sat Mar 20 14:46:30 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2816F5AB2BB; Sat, 20 Mar 2021 14:46: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 4F2k9L0NLLz4ZsG; Sat, 20 Mar 2021 14:46: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 F3F7B18C6; Sat, 20 Mar 2021 14:46: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 12KEkTef047837; Sat, 20 Mar 2021 14:46:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KEkTxO047836; Sat, 20 Mar 2021 14:46:29 GMT (envelope-from git) Date: Sat, 20 Mar 2021 14:46:29 GMT Message-Id: <202103201446.12KEkTxO047836@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 12349e667ced - stable/13 - pf tests: Test tos/dscp matching MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 12349e667cede9bf3a38d618a25525ccf1b5f9bc Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 14:46:30 -0000 The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=12349e667cede9bf3a38d618a25525ccf1b5f9bc commit 12349e667cede9bf3a38d618a25525ccf1b5f9bc Author: Kristof Provost AuthorDate: 2021-03-03 20:15:39 +0000 Commit: Kristof Provost CommitDate: 2021-03-20 14:45:48 +0000 pf tests: Test tos/dscp matching MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29078 (cherry picked from commit 9d3b2bcf761041bbe79da3de25f2e4142d90b46a) --- tests/sys/netpfil/pf/Makefile | 3 +- tests/sys/netpfil/pf/tos.sh | 95 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 1 deletion(-) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index 6b1e34b69a6d..d89c1d7a7a4b 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -21,7 +21,8 @@ ATF_TESTS_SH+= anchor \ set_tos \ src_track \ synproxy \ - table + table \ + tos ${PACKAGE}FILES+= CVE-2019-5597.py \ CVE-2019-5598.py \ diff --git a/tests/sys/netpfil/pf/tos.sh b/tests/sys/netpfil/pf/tos.sh new file mode 100644 index 000000000000..4e2832ba3317 --- /dev/null +++ b/tests/sys/netpfil/pf/tos.sh @@ -0,0 +1,95 @@ +# $FreeBSD$ +# +# 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. + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "v4" "cleanup" +v4_head() +{ + atf_set descr 'tos matching test' + atf_set require.user root +} + +v4_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz "pass" \ + "block in tos va" + + atf_check -s exit:0 -o ignore ping -t 1 -c 1 192.0.2.2 + atf_check -s exit:2 -o ignore ping -t 1 -c 1 -z 0xb0 192.0.2.2 +} + +v4_cleanup() +{ + pft_cleanup +} + +atf_test_case "v6" "cleanup" +v6_head() +{ + atf_set descr 'IPv6 tos matching test' + atf_set require.user root +} + +v6_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a inet6 2001:db8:42::1/64 up no_dad -ifdisabled + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b inet6 2001:db8:42::2/64 \ + up no_dad -ifdisabled + jexec alcatraz pfctl -e + + pft_set_rules alcatraz "pass" \ + "block in tos va" + + atf_check -s exit:0 -o ignore ping6 -t 1 -c 1 2001:db8:42::2 + atf_check -s exit:2 -o ignore ping6 -t 1 -c 1 -z 176 2001:db8:42::2 +} + +v6_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "v4" + atf_add_test_case "v6" +} From owner-dev-commits-src-all@freebsd.org Sat Mar 20 14:49:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 415115AB664; Sat, 20 Mar 2021 14:49: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 4F2kDY1Nqbz4bv7; Sat, 20 Mar 2021 14:49: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 226751A90; Sat, 20 Mar 2021 14:49: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 12KEnHW8048374; Sat, 20 Mar 2021 14:49:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KEnHDj048373; Sat, 20 Mar 2021 14:49:17 GMT (envelope-from git) Date: Sat, 20 Mar 2021 14:49:17 GMT Message-Id: <202103201449.12KEnHDj048373@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 5856802668ac - stable/12 - pfctl: Add missing 'va' code point name MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 5856802668ac672efec6ac8bbfa69d34eb2e75a8 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 14:49:17 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=5856802668ac672efec6ac8bbfa69d34eb2e75a8 commit 5856802668ac672efec6ac8bbfa69d34eb2e75a8 Author: Kristof Provost AuthorDate: 2021-03-04 12:50:28 +0000 Commit: Kristof Provost CommitDate: 2021-03-20 14:48:51 +0000 pfctl: Add missing 'va' code point name Add the 'va' (voice-admit, RFC5865) symbolic name. Reviewed by: rgrimes, gbe (man page) MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29069 (cherry picked from commit b4e3f3c2de6e6dc614f99615e50d0d87f3367ca0) --- sbin/pfctl/parse.y | 3 ++- share/man/man5/pf.conf.5 | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/sbin/pfctl/parse.y b/sbin/pfctl/parse.y index 4e7434a8a53e..ed4a09c0d14c 100644 --- a/sbin/pfctl/parse.y +++ b/sbin/pfctl/parse.y @@ -6334,7 +6334,8 @@ map_tos(char *s, int *val) { "lowdelay", IPTOS_LOWDELAY }, { "netcontrol", IPTOS_PREC_NETCONTROL }, { "reliability", IPTOS_RELIABILITY }, - { "throughput", IPTOS_THROUGHPUT } + { "throughput", IPTOS_THROUGHPUT }, + { "va", IPTOS_DSCP_VA } }; const struct keywords *p; diff --git a/share/man/man5/pf.conf.5 b/share/man/man5/pf.conf.5 index 0faf4c445a61..d8c18252ea91 100644 --- a/share/man/man5/pf.conf.5 +++ b/share/man/man5/pf.conf.5 @@ -682,6 +682,7 @@ given as one of .Ar reliability , or one of the DiffServ Code Points: .Ar ef , +.Ar va , .Ar af11 No ... Ar af43 , .Ar cs0 No ... Ar cs7 ; or as either hex or decimal. @@ -1738,6 +1739,7 @@ given as one of .Ar reliability , or one of the DiffServ Code Points: .Ar ef , +.Ar va , .Ar af11 No ... Ar af43 , .Ar cs0 No ... Ar cs7 ; or as either hex or decimal. From owner-dev-commits-src-all@freebsd.org Sat Mar 20 14:49:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BE795AB461; Sat, 20 Mar 2021 14: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 4F2kDZ2fXvz4bv8; Sat, 20 Mar 2021 14: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 4DFB41556; Sat, 20 Mar 2021 14: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 12KEnIff048392; Sat, 20 Mar 2021 14: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 12KEnIs5048391; Sat, 20 Mar 2021 14:49:18 GMT (envelope-from git) Date: Sat, 20 Mar 2021 14:49:18 GMT Message-Id: <202103201449.12KEnIs5048391@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e72bcc45ad15 - stable/12 - pf tests: Test tos/dscp matching MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e72bcc45ad1551f4390ed84b53c73970c3e6c8f9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 14:49:18 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e72bcc45ad1551f4390ed84b53c73970c3e6c8f9 commit e72bcc45ad1551f4390ed84b53c73970c3e6c8f9 Author: Kristof Provost AuthorDate: 2021-03-03 20:15:39 +0000 Commit: Kristof Provost CommitDate: 2021-03-20 14:48:51 +0000 pf tests: Test tos/dscp matching MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D29078 (cherry picked from commit 9d3b2bcf761041bbe79da3de25f2e4142d90b46a) --- tests/sys/netpfil/pf/Makefile | 1 + tests/sys/netpfil/pf/tos.sh | 95 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/tests/sys/netpfil/pf/Makefile b/tests/sys/netpfil/pf/Makefile index 4a07298c4900..e216caf1c55e 100644 --- a/tests/sys/netpfil/pf/Makefile +++ b/tests/sys/netpfil/pf/Makefile @@ -20,6 +20,7 @@ ATF_TESTS_SH+= anchor \ set_skip \ pfsync \ table \ + tos \ icmp ${PACKAGE}FILES+= utils.subr \ diff --git a/tests/sys/netpfil/pf/tos.sh b/tests/sys/netpfil/pf/tos.sh new file mode 100644 index 000000000000..4e2832ba3317 --- /dev/null +++ b/tests/sys/netpfil/pf/tos.sh @@ -0,0 +1,95 @@ +# $FreeBSD$ +# +# 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. + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "v4" "cleanup" +v4_head() +{ + atf_set descr 'tos matching test' + atf_set require.user root +} + +v4_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz "pass" \ + "block in tos va" + + atf_check -s exit:0 -o ignore ping -t 1 -c 1 192.0.2.2 + atf_check -s exit:2 -o ignore ping -t 1 -c 1 -z 0xb0 192.0.2.2 +} + +v4_cleanup() +{ + pft_cleanup +} + +atf_test_case "v6" "cleanup" +v6_head() +{ + atf_set descr 'IPv6 tos matching test' + atf_set require.user root +} + +v6_body() +{ + pft_init + + epair=$(vnet_mkepair) + ifconfig ${epair}a inet6 2001:db8:42::1/64 up no_dad -ifdisabled + + vnet_mkjail alcatraz ${epair}b + jexec alcatraz ifconfig ${epair}b inet6 2001:db8:42::2/64 \ + up no_dad -ifdisabled + jexec alcatraz pfctl -e + + pft_set_rules alcatraz "pass" \ + "block in tos va" + + atf_check -s exit:0 -o ignore ping6 -t 1 -c 1 2001:db8:42::2 + atf_check -s exit:2 -o ignore ping6 -t 1 -c 1 -z 176 2001:db8:42::2 +} + +v6_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "v4" + atf_add_test_case "v6" +} From owner-dev-commits-src-all@freebsd.org Sat Mar 20 14:49:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4FBF5AB66C; Sat, 20 Mar 2021 14:49: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 4F2kDb3Rndz4bfB; Sat, 20 Mar 2021 14:49: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 6786418D6; Sat, 20 Mar 2021 14:49: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 12KEnJR0048415; Sat, 20 Mar 2021 14:49:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KEnJqJ048414; Sat, 20 Mar 2021 14:49:19 GMT (envelope-from git) Date: Sat, 20 Mar 2021 14:49:19 GMT Message-Id: <202103201449.12KEnJqJ048414@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: e6e75224a5ae - stable/12 - pf tests: Fix unsupported ping6 argument MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: e6e75224a5ae60db848b8c5e6021375a1340744a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 14:49:20 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e6e75224a5ae60db848b8c5e6021375a1340744a commit e6e75224a5ae60db848b8c5e6021375a1340744a Author: Kristof Provost AuthorDate: 2021-03-20 14:47:50 +0000 Commit: Kristof Provost CommitDate: 2021-03-20 14:48:51 +0000 pf tests: Fix unsupported ping6 argument ping6 (in stable/12) does not support '-t'. Change it to '-X'. Direct commit to stable/12. Sponsored by: Rubicon Communications, LLC ("Netgate") --- tests/sys/netpfil/pf/tos.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/sys/netpfil/pf/tos.sh b/tests/sys/netpfil/pf/tos.sh index 4e2832ba3317..ea41f890871a 100644 --- a/tests/sys/netpfil/pf/tos.sh +++ b/tests/sys/netpfil/pf/tos.sh @@ -79,8 +79,8 @@ v6_body() pft_set_rules alcatraz "pass" \ "block in tos va" - atf_check -s exit:0 -o ignore ping6 -t 1 -c 1 2001:db8:42::2 - atf_check -s exit:2 -o ignore ping6 -t 1 -c 1 -z 176 2001:db8:42::2 + atf_check -s exit:0 -o ignore ping6 -X 1 -c 1 2001:db8:42::2 + atf_check -s exit:2 -o ignore ping6 -X 1 -c 1 -z 176 2001:db8:42::2 } v6_cleanup() From owner-dev-commits-src-all@freebsd.org Sat Mar 20 15:18:50 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BCA05ABE7B; Sat, 20 Mar 2021 15:18: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 4F2ktf370Tz4dD8; Sat, 20 Mar 2021 15:18: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 531DC1B62; Sat, 20 Mar 2021 15:18: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 12KFIoaK093417; Sat, 20 Mar 2021 15:18:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KFIobw093416; Sat, 20 Mar 2021 15:18:50 GMT (envelope-from git) Date: Sat, 20 Mar 2021 15:18:50 GMT Message-Id: <202103201518.12KFIobw093416@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 097e0b895576 - stable/12 - Add warning to the Linuxulator makefiles that building it outside of a kernel does not make sence. 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 097e0b8955762c043b01ba247e59d704a83d222a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 15:18:50 -0000 The branch stable/12 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=097e0b8955762c043b01ba247e59d704a83d222a commit 097e0b8955762c043b01ba247e59d704a83d222a Author: Dmitry Chagin AuthorDate: 2019-05-13 18:28:40 +0000 Commit: Dmitry Chagin CommitDate: 2021-03-20 15:18:01 +0000 Add warning to the Linuxulator makefiles that building it outside of a kernel does not make sence. PR: 222861 MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20179 (cherry picked from commit 6e4cf32e95841b4c3ef0caeb80802bf528a35cd0) --- sys/modules/linprocfs/Makefile | 4 ++++ sys/modules/linsysfs/Makefile | 4 ++++ sys/modules/linux/Makefile | 4 ++++ sys/modules/linux64/Makefile | 4 ++++ sys/modules/linux_common/Makefile | 4 ++++ 5 files changed, 20 insertions(+) diff --git a/sys/modules/linprocfs/Makefile b/sys/modules/linprocfs/Makefile index 6408a9882147..fa7ac8725d14 100644 --- a/sys/modules/linprocfs/Makefile +++ b/sys/modules/linprocfs/Makefile @@ -7,4 +7,8 @@ SRCS= vnode_if.h \ device_if.h bus_if.h \ linprocfs.c +.if !defined(KERNBUILDDIR) +.warning Building Linuxulator outside of a kernel does not make sense +.endif + .include diff --git a/sys/modules/linsysfs/Makefile b/sys/modules/linsysfs/Makefile index 6eaa844e9ea5..058fbbc521b1 100644 --- a/sys/modules/linsysfs/Makefile +++ b/sys/modules/linsysfs/Makefile @@ -7,4 +7,8 @@ SRCS= vnode_if.h \ device_if.h bus_if.h pci_if.h \ linsysfs.c +.if !defined(KERNBUILDDIR) +.warning Building Linuxulator outside of a kernel does not make sense +.endif + .include diff --git a/sys/modules/linux/Makefile b/sys/modules/linux/Makefile index 7ff1fdd1a17e..7065c1f0f6cd 100644 --- a/sys/modules/linux/Makefile +++ b/sys/modules/linux/Makefile @@ -80,4 +80,8 @@ ${VDSO}.so: linux${SFX}_locore.o linux${SFX}_genassym.o: offset.inc ${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon ${.IMPSRC} +.if !defined(KERNBUILDDIR) +.warning Building Linuxulator outside of a kernel does not make sense +.endif + .include diff --git a/sys/modules/linux64/Makefile b/sys/modules/linux64/Makefile index f084df6cc466..046eeeda30f2 100644 --- a/sys/modules/linux64/Makefile +++ b/sys/modules/linux64/Makefile @@ -55,4 +55,8 @@ linux_support.o: assym.inc linux_assym.h linux_genassym.o: offset.inc ${CC} -c ${CFLAGS:N-flto:N-fno-common} -fcommon ${.IMPSRC} +.if !defined(KERNBUILDDIR) +.warning Building Linuxulator outside of a kernel does not make sense +.endif + .include diff --git a/sys/modules/linux_common/Makefile b/sys/modules/linux_common/Makefile index 9fb0210810fb..5b49a7409997 100644 --- a/sys/modules/linux_common/Makefile +++ b/sys/modules/linux_common/Makefile @@ -15,4 +15,8 @@ EXPORT_SYMS+= linux_ioctl_unregister_handler EXPORT_SYMS+= linux_get_osname EXPORT_SYMS+= linux_get_osrelease +.if !defined(KERNBUILDDIR) +.warning Building Linuxulator outside of a kernel does not make sense +.endif + .include From owner-dev-commits-src-all@freebsd.org Sat Mar 20 17:27:53 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CFD8F5AF57D; Sat, 20 Mar 2021 17:27: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 4F2nlY5b2Tz4n1M; Sat, 20 Mar 2021 17:27: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 AE28139E2; Sat, 20 Mar 2021 17:27: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 12KHRrX1075134; Sat, 20 Mar 2021 17:27:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KHRrj8075133; Sat, 20 Mar 2021 17:27:53 GMT (envelope-from git) Date: Sat, 20 Mar 2021 17:27:53 GMT Message-Id: <202103201727.12KHRrj8075133@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: ee7ffaa2e6e0 - main - netmap: fix issues in nm_os_extmem_create() 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: ee7ffaa2e6e08b63efb4673610875d40964d5058 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 17:27:53 -0000 The branch main has been updated by vmaffione: URL: https://cgit.FreeBSD.org/src/commit/?id=ee7ffaa2e6e08b63efb4673610875d40964d5058 commit ee7ffaa2e6e08b63efb4673610875d40964d5058 Author: Vincenzo Maffione AuthorDate: 2021-03-20 17:15:50 +0000 Commit: Vincenzo Maffione CommitDate: 2021-03-20 17:15:50 +0000 netmap: fix issues in nm_os_extmem_create() - Call vm_object_reference() before vm_map_lookup_done(). - Use vm_mmap_to_errno() to convert vm_map_* return values to errno. - Fix memory leak of e->obj. Reported by: markj Reviewed by: markj MFC after: 1 week --- sys/dev/netmap/netmap_freebsd.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/dev/netmap/netmap_freebsd.c b/sys/dev/netmap/netmap_freebsd.c index e37815dc88d5..2cedea4440fe 100644 --- a/sys/dev/netmap/netmap_freebsd.c +++ b/sys/dev/netmap/netmap_freebsd.c @@ -664,6 +664,7 @@ nm_os_vi_detach(struct ifnet *ifp) #ifdef WITH_EXTMEM #include +#include #include struct nm_os_extmem { vm_object_t obj; @@ -726,17 +727,18 @@ nm_os_extmem_create(unsigned long p, struct nmreq_pools_info *pi, int *perror) &obj, &index, &prot, &wired); if (rv != KERN_SUCCESS) { nm_prerr("address %lx not found", p); + error = vm_mmap_to_errno(rv); goto out_free; } + vm_object_reference(obj); + /* check that we are given the whole vm_object ? */ vm_map_lookup_done(map, entry); - // XXX can we really use obj after releasing the map lock? e->obj = obj; - vm_object_reference(obj); - /* wire the memory and add the vm_object to the kernel map, - * to make sure that it is not fred even if the processes that - * are mmap()ing it all exit + /* Wire the memory and add the vm_object to the kernel map, + * to make sure that it is not freed even if all the processes + * that are mmap()ing should munmap() it. */ e->kva = vm_map_min(kernel_map); e->size = obj->size << PAGE_SHIFT; @@ -745,12 +747,14 @@ nm_os_extmem_create(unsigned long p, struct nmreq_pools_info *pi, int *perror) VM_PROT_READ | VM_PROT_WRITE, 0); if (rv != KERN_SUCCESS) { nm_prerr("vm_map_find(%zx) failed", (size_t)e->size); + error = vm_mmap_to_errno(rv); goto out_rel; } rv = vm_map_wire(kernel_map, e->kva, e->kva + e->size, VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); if (rv != KERN_SUCCESS) { nm_prerr("vm_map_wire failed"); + error = vm_mmap_to_errno(rv); goto out_rem; } @@ -760,9 +764,9 @@ nm_os_extmem_create(unsigned long p, struct nmreq_pools_info *pi, int *perror) out_rem: vm_map_remove(kernel_map, e->kva, e->kva + e->size); - e->obj = NULL; out_rel: vm_object_deallocate(e->obj); + e->obj = NULL; out_free: nm_os_free(e); out: From owner-dev-commits-src-all@freebsd.org Sat Mar 20 17:58:27 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 211E45B0736; Sat, 20 Mar 2021 17:58: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 4F2pQq0VGfz4pVn; Sat, 20 Mar 2021 17:58: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 03B5244EF; Sat, 20 Mar 2021 17:58:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12KHwQ32017138; Sat, 20 Mar 2021 17:58:26 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KHwQna017137; Sat, 20 Mar 2021 17:58:26 GMT (envelope-from git) Date: Sat, 20 Mar 2021 17:58:26 GMT Message-Id: <202103201758.12KHwQna017137@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Jessica Clarke Subject: git: 839fdcfc0c1d - main - elftoolchain: Support building on Arm-based Macs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jrtc27 X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 839fdcfc0c1dba34f728813d9756515ad82ff58a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 17:58:27 -0000 The branch main has been updated by jrtc27: URL: https://cgit.FreeBSD.org/src/commit/?id=839fdcfc0c1dba34f728813d9756515ad82ff58a commit 839fdcfc0c1dba34f728813d9756515ad82ff58a Author: Jessica Clarke AuthorDate: 2021-03-20 17:58:10 +0000 Commit: Jessica Clarke CommitDate: 2021-03-20 17:58:10 +0000 elftoolchain: Support building on Arm-based Macs Currently macOS and DragonFlyBSD get their own special case and only handle x86. Since all the FreeBSD cases should be general enough for macOS and DragonFlyBSD (and the x86 ones are identical to the existing ones) we can just delete the special cases and reuse the FreeBSD ones. Note that upstream has since removed all the architecture-specific checks in this file, with the only code relevant to us being an endianness check that uses the generic compiler-provided macros. Thus this patch will not be upstreamed, and will be dropped in a future vendor import. Reviewed by: dim MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29352 --- contrib/elftoolchain/libelf/_libelf_config.h | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/contrib/elftoolchain/libelf/_libelf_config.h b/contrib/elftoolchain/libelf/_libelf_config.h index 05869757f663..0f16f3aefde5 100644 --- a/contrib/elftoolchain/libelf/_libelf_config.h +++ b/contrib/elftoolchain/libelf/_libelf_config.h @@ -26,25 +26,11 @@ * $Id: _libelf_config.h 3764 2019-06-28 21:44:46Z emaste $ */ -#if defined(__APPLE__) || defined(__DragonFly__) - -#if defined(__amd64__) -#define LIBELF_ARCH EM_X86_64 -#define LIBELF_BYTEORDER ELFDATA2LSB -#define LIBELF_CLASS ELFCLASS64 -#elif defined(__i386__) -#define LIBELF_ARCH EM_386 -#define LIBELF_BYTEORDER ELFDATA2LSB -#define LIBELF_CLASS ELFCLASS32 -#endif - -#endif /* __DragonFly__ */ - -#ifdef __FreeBSD__ +#if defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) /* * Define LIBELF_{ARCH,BYTEORDER,CLASS} based on the machine architecture. - * See also: . + * See also: on FreeBSD. */ #if defined(__amd64__) @@ -126,9 +112,9 @@ #define LIBELF_CLASS ELFCLASS64 #else -#error Unknown FreeBSD architecture. +#error Unknown architecture. #endif -#endif /* __FreeBSD__ */ +#endif /* defined(__APPLE__) || defined(__DragonFly__) || defined(__FreeBSD__) */ /* * Definitions for Minix3. From owner-dev-commits-src-all@freebsd.org Sat Mar 20 22:15:52 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7CE4A5B5A38; Sat, 20 Mar 2021 22:15: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 4F2w7r39Qsz3JV9; Sat, 20 Mar 2021 22:15: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 5F19C7993; Sat, 20 Mar 2021 22:15: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 12KMFq7i081058; Sat, 20 Mar 2021 22:15:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12KMFqvD081057; Sat, 20 Mar 2021 22:15:52 GMT (envelope-from git) Date: Sat, 20 Mar 2021 22:15:52 GMT Message-Id: <202103202215.12KMFqvD081057@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: 15deee52d6d5 - main - Move GH_BC ObsoleteFiles.inc section to OptionalObsoleteFiles.inc 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: 15deee52d6d5ea7dd950116ff63aa2c33fcd47f5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Mar 2021 22:15:52 -0000 The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=15deee52d6d5ea7dd950116ff63aa2c33fcd47f5 commit 15deee52d6d5ea7dd950116ff63aa2c33fcd47f5 Author: Dimitry Andric AuthorDate: 2021-03-20 22:15:01 +0000 Commit: Dimitry Andric CommitDate: 2021-03-20 22:15:01 +0000 Move GH_BC ObsoleteFiles.inc section to OptionalObsoleteFiles.inc Optional features belong in the latter file, and should be tested using: .if ${MK_FEATURE} == no [...] .endif --- ObsoleteFiles.inc | 9 --------- tools/build/mk/OptionalObsoleteFiles.inc | 8 ++++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 79ed21ec18ca..2132dc4289b4 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -2884,15 +2884,6 @@ OLD_FILES+=usr/include/crypto/xform_enc.h # 20210305: removed Poly1305_* symbols OLD_FILES+=usr/include/crypto/xform_poly1305.h -# 20210304: remove old bc and dc support and test files -.if !defined(WITHOUT_GH_BC) -OLD_FILES+=usr/share/misc/bc.library -OLD_FILES+=usr/tests/usr.bin/dc/Kyuafile -OLD_FILES+=usr/tests/usr.bin/dc/bcode -OLD_FILES+=usr/tests/usr.bin/dc/inout -OLD_DIRS+=usr/tests/usr.bin/dc -.endif - # 20210302: fmtree removed OLD_FILES+=usr/sbin/fmtree OLD_FILES+=usr/share/man/man8/fmtree.8.gz diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc index 44cd4a4281e7..5a534a91c057 100644 --- a/tools/build/mk/OptionalObsoleteFiles.inc +++ b/tools/build/mk/OptionalObsoleteFiles.inc @@ -2139,6 +2139,14 @@ OLD_FILES+=usr/share/man/man1/llvm-cov.1.gz OLD_FILES+=usr/share/man/man1/llvm-profdata.1.gz .endif +.if ${MK_GH_BC} == no +OLD_FILES+=usr/share/misc/bc.library +OLD_FILES+=usr/tests/usr.bin/dc/Kyuafile +OLD_FILES+=usr/tests/usr.bin/dc/bcode +OLD_FILES+=usr/tests/usr.bin/dc/inout +OLD_DIRS+=usr/tests/usr.bin/dc +.endif + .if ${MK_GOOGLETEST} == no OLD_FILES+=usr/include/gmock/gmock-actions.h OLD_FILES+=usr/include/gmock/gmock-cardinalities.h From owner-dev-commits-src-all@freebsd.org Sun Mar 21 00:10:34 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2CC735B868F; Sun, 21 Mar 2021 00:10: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 4F2yhB0rfjz3Q42; Sun, 21 Mar 2021 00:10: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 1017A11486; Sun, 21 Mar 2021 00:10: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 12L0AXPD043527; Sun, 21 Mar 2021 00:10:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12L0AXhr043526; Sun, 21 Mar 2021 00:10:33 GMT (envelope-from git) Date: Sun, 21 Mar 2021 00:10:33 GMT Message-Id: <202103210010.12L0AXhr043526@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Daniel Ebdrup Jensen Subject: git: 815209920f1d - main - rc.conf(5): Remove left-over variables MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: debdrup X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 815209920f1d024ca55270c106565a0b770a8c00 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 00:10:34 -0000 The branch main has been updated by debdrup (doc committer): URL: https://cgit.FreeBSD.org/src/commit/?id=815209920f1d024ca55270c106565a0b770a8c00 commit 815209920f1d024ca55270c106565a0b770a8c00 Author: Tobias Rehbein AuthorDate: 2021-03-21 00:01:31 +0000 Commit: Daniel Ebdrup Jensen CommitDate: 2021-03-21 00:08:36 +0000 rc.conf(5): Remove left-over variables ipv6_ipfilter_rules was obsoleted because of ipfilter was updated, and rc_parallel_start was reverted to undergo further refinement. PR: 254398 Fixes: e2ad10e84792, f61831d2e8bd --- share/man/man5/rc.conf.5 | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/share/man/man5/rc.conf.5 b/share/man/man5/rc.conf.5 index c5261974b475..01c4a8436496 100644 --- a/share/man/man5/rc.conf.5 +++ b/share/man/man5/rc.conf.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 19, 2021 +.Dd March 21, 2021 .Dt RC.CONF 5 .Os .Sh NAME @@ -140,14 +140,6 @@ If set to show .Dq Starting foo: when faststart is used (e.g., at boot time). -.It Va rc_parallel_start -.Pq Vt bool -If set to -.Dq Li YES , -enable parallel startup of services. -Care should be taken to ensure that no loops occur, by using -.Nm rcorder -.Fl p . .It Va early_late_divider .Pq Vt str The name of the script that should be used as the @@ -804,16 +796,6 @@ This variable contains the name of the filter rule definition file. The file is expected to be readable for the .Xr ipf 8 command to execute. -.\" ----- ipv6_ipfilter_rules setting --------------------------- -.It Va ipv6_ipfilter_rules -.Pq Vt str -Set to -.Pa /etc/ipf6.rules -by default. -This variable contains the IPv6 filter rule definition file. -The file is expected to be readable for the -.Xr ipf 8 -command to execute. .\" ----- ipfilter_flags setting -------------------------------- .It Va ipfilter_flags .Pq Vt str From owner-dev-commits-src-all@freebsd.org Sun Mar 21 00:41:57 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BBB855B8D2C for ; Sun, 21 Mar 2021 00:41: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 4F2zNP4qszz3gyj; Sun, 21 Mar 2021 00:41: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 9908D113EA; Sun, 21 Mar 2021 00:41: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 12L0fv39089416; Sun, 21 Mar 2021 00:41:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12L0fvQ3089414; Sun, 21 Mar 2021 00:41:57 GMT (envelope-from git) Date: Sun, 21 Mar 2021 00:41:57 GMT Message-Id: <202103210041.12L0fvQ3089414@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org From: Martin Matuska Subject: git: 48a1c304e82e - vendor/openzfs - Update vendor/openzfs to master-891568c99 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/vendor/openzfs X-Git-Reftype: branch X-Git-Commit: 48a1c304e82e33d5a3dd722a6ef4519dd998614b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 00:41:57 -0000 The branch vendor/openzfs has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=48a1c304e82e33d5a3dd722a6ef4519dd998614b commit 48a1c304e82e33d5a3dd722a6ef4519dd998614b Author: Martin Matuska AuthorDate: 2021-03-21 00:39:51 +0000 Commit: Martin Matuska CommitDate: 2021-03-21 00:39:51 +0000 Update vendor/openzfs to master-891568c99 Notable upstream pull request merges: #11652 Split dmu_zfetch() speculation and execution parts #11682 Fix zfs_get_data access to files with wrong generation #11735 Clean up RAIDZ/DRAID ereport code #11737 Initialize metaslab range trees in metaslab_init #11739 FreeBSD: make seqc asserts conditional on replay #11763 Allow setting bootfs property on pools with indirect vdevs #11767 FreeBSD: Fix memory leaks in kstats --- README.md | 2 +- cmd/raidz_test/raidz_test.c | 2 - cmd/ztest/ztest.c | 4 +- config/kernel-bio_max_segs.m4 | 23 ++ config/kernel-generic_fillattr.m4 | 28 +++ config/kernel-inode-create.m4 | 43 +++- config/kernel-inode-getattr.m4 | 63 ++++- config/kernel-is_owner_or_cap.m4 | 23 +- config/kernel-mkdir-umode-t.m4 | 32 --- config/kernel-mkdir.m4 | 65 +++++ config/kernel-mknod.m4 | 30 +++ config/kernel-rename.m4 | 50 +++- config/kernel-setattr-prepare.m4 | 45 +++- config/kernel-symlink.m4 | 30 +++ config/kernel-xattr-handler.m4 | 78 ++++-- config/kernel.m4 | 20 +- configure.ac | 1 + include/os/linux/kernel/linux/kmap_compat.h | 4 +- include/os/linux/kernel/linux/vfs_compat.h | 24 +- include/os/linux/kernel/linux/xattr_compat.h | 17 +- include/os/linux/zfs/sys/zfs_vnops_os.h | 3 +- include/os/linux/zfs/sys/zfs_znode_impl.h | 8 +- include/os/linux/zfs/sys/zpl.h | 18 ++ include/sys/dmu_zfetch.h | 23 +- include/sys/vdev_raidz.h | 2 + include/sys/vdev_raidz_impl.h | 7 +- include/sys/zil.h | 3 +- include/sys/zio.h | 10 +- include/sys/zvol_impl.h | 4 +- man/man5/zfs-module-parameters.5 | 25 +- man/man8/zfs-allow.8 | 3 + man/man8/zgenhostid.8 | 4 +- man/man8/zpoolconcepts.8 | 17 ++ module/os/freebsd/spl/spl_kstat.c | 11 +- module/os/freebsd/zfs/sysctl_os.c | 6 - module/os/freebsd/zfs/zfs_acl.c | 9 +- module/os/linux/zfs/abd_os.c | 10 +- module/os/linux/zfs/policy.c | 2 +- module/os/linux/zfs/vdev_disk.c | 5 + module/os/linux/zfs/zfs_ctldir.c | 3 +- module/os/linux/zfs/zfs_uio.c | 4 +- module/os/linux/zfs/zfs_vfsops.c | 6 +- module/os/linux/zfs/zfs_vnops_os.c | 5 +- module/os/linux/zfs/zpl_ctldir.c | 51 +++- module/os/linux/zfs/zpl_file.c | 2 +- module/os/linux/zfs/zpl_inode.c | 52 +++- module/os/linux/zfs/zpl_xattr.c | 4 +- module/zfs/dbuf.c | 5 +- module/zfs/dmu.c | 35 ++- module/zfs/dmu_zfetch.c | 250 +++++++++++-------- module/zfs/metaslab.c | 149 +++++------- module/zfs/refcount.c | 10 +- module/zfs/vdev.c | 4 +- module/zfs/vdev_draid.c | 240 +------------------ module/zfs/vdev_indirect.c | 1 - module/zfs/vdev_mirror.c | 5 +- module/zfs/vdev_raidz.c | 266 +++------------------ module/zfs/zfs_fm.c | 8 +- module/zfs/zfs_fuid.c | 4 - module/zfs/zfs_log.c | 5 + module/zfs/zfs_vnops.c | 14 +- module/zfs/zil.c | 3 +- module/zfs/zio.c | 4 +- module/zfs/zvol.c | 3 +- tests/runfiles/common.run | 8 +- tests/runfiles/freebsd.run | 4 + tests/runfiles/sanity.run | 4 + tests/zfs-tests/tests/functional/acl/Makefile.am | 2 +- .../zfs-tests/tests/functional/acl/off/.gitignore | 1 + .../zfs-tests/tests/functional/acl/off/Makefile.am | 16 ++ .../zfs-tests/tests/functional/acl/off/cleanup.ksh | 33 +++ .../zfs-tests/tests/functional/acl/off/dosmode.ksh | 199 +++++++++++++++ .../functional/acl/off/dosmode_readonly_write.c | 61 +++++ .../tests/functional/acl/off/posixmode.ksh | 145 +++++++++++ tests/zfs-tests/tests/functional/acl/off/setup.ksh | 44 ++++ .../tests/functional/redacted_send/Makefile.am | 1 + .../functional/redacted_send/redacted_panic.ksh | 44 ++++ 77 files changed, 1565 insertions(+), 884 deletions(-) diff --git a/README.md b/README.md index 31d99386e90e..d666df7af309 100644 --- a/README.md +++ b/README.md @@ -32,4 +32,4 @@ For more details see the NOTICE, LICENSE and COPYRIGHT files; `UCRL-CODE-235197` # Supported Kernels * The `META` file contains the officially recognized supported Linux kernel versions. - * Supported FreeBSD versions are 12-STABLE and 13-CURRENT. + * Supported FreeBSD versions are any supported branches and releases starting from 12.2-RELEASE. diff --git a/cmd/raidz_test/raidz_test.c b/cmd/raidz_test/raidz_test.c index e3eb4f4ce44a..9a8be549c5cb 100644 --- a/cmd/raidz_test/raidz_test.c +++ b/cmd/raidz_test/raidz_test.c @@ -448,7 +448,6 @@ vdev_raidz_map_alloc_expanded(abd_t *abd, uint64_t size, uint64_t offset, rr->rr_missingdata = 0; rr->rr_missingparity = 0; rr->rr_firstdatacol = nparity; - rr->rr_abd_copy = NULL; rr->rr_abd_empty = NULL; rr->rr_nempty = 0; @@ -459,7 +458,6 @@ vdev_raidz_map_alloc_expanded(abd_t *abd, uint64_t size, uint64_t offset, } rr->rr_col[c].rc_devidx = child_id; rr->rr_col[c].rc_offset = child_offset; - rr->rr_col[c].rc_gdata = NULL; rr->rr_col[c].rc_orig_data = NULL; rr->rr_col[c].rc_error = 0; rr->rr_col[c].rc_tried = 0; diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c index 1a030280704a..7193eafe3d21 100644 --- a/cmd/ztest/ztest.c +++ b/cmd/ztest/ztest.c @@ -2287,8 +2287,8 @@ ztest_get_done(zgd_t *zgd, int error) } static int -ztest_get_data(void *arg, lr_write_t *lr, char *buf, struct lwb *lwb, - zio_t *zio) +ztest_get_data(void *arg, uint64_t arg2, lr_write_t *lr, char *buf, + struct lwb *lwb, zio_t *zio) { ztest_ds_t *zd = arg; objset_t *os = zd->zd_os; diff --git a/config/kernel-bio_max_segs.m4 b/config/kernel-bio_max_segs.m4 new file mode 100644 index 000000000000..a90d75455c13 --- /dev/null +++ b/config/kernel-bio_max_segs.m4 @@ -0,0 +1,23 @@ +dnl # +dnl # 5.12 API change removes BIO_MAX_PAGES in favor of bio_max_segs() +dnl # which will handle the logic of setting the upper-bound to a +dnl # BIO_MAX_PAGES, internally. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS], [ + ZFS_LINUX_TEST_SRC([bio_max_segs], [ + #include + ],[ + bio_max_segs(1); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_BIO_MAX_SEGS], [ + AC_MSG_CHECKING([whether bio_max_segs() exists]) + ZFS_LINUX_TEST_RESULT([bio_max_segs], [ + AC_MSG_RESULT(yes) + + AC_DEFINE([HAVE_BIO_MAX_SEGS], 1, [bio_max_segs() is implemented]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-generic_fillattr.m4 b/config/kernel-generic_fillattr.m4 new file mode 100644 index 000000000000..50c8031305b3 --- /dev/null +++ b/config/kernel-generic_fillattr.m4 @@ -0,0 +1,28 @@ +dnl # +dnl # 5.12 API +dnl # +dnl # generic_fillattr in linux/fs.h now requires a struct user_namespace* +dnl # as the first arg, to support idmapped mounts. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS], [ + ZFS_LINUX_TEST_SRC([generic_fillattr_userns], [ + #include + ],[ + struct user_namespace *userns = NULL; + struct inode *in = NULL; + struct kstat *k = NULL; + generic_fillattr(userns, in, k); + ]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS], [ + AC_MSG_CHECKING([whether generic_fillattr requres struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([generic_fillattr_userns], [ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_GENERIC_FILLATTR_USERNS, 1, + [generic_fillattr requires struct user_namespace*]) + ],[ + AC_MSG_RESULT([no]) + ]) +]) + diff --git a/config/kernel-inode-create.m4 b/config/kernel-inode-create.m4 index 9f28bcbd4f7f..a6ea11fb61b2 100644 --- a/config/kernel-inode-create.m4 +++ b/config/kernel-inode-create.m4 @@ -1,7 +1,25 @@ -dnl # -dnl # 3.6 API change -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_FLAGS], [ +AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE], [ + dnl # + dnl # 5.12 API change that added the struct user_namespace* arg + dnl # to the front of this function type's arg list. + dnl # + ZFS_LINUX_TEST_SRC([create_userns], [ + #include + #include + + int inode_create(struct user_namespace *userns, + struct inode *inode ,struct dentry *dentry, + umode_t umode, bool flag) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .create = inode_create, + }; + ],[]) + + dnl # + dnl # 3.6 API change + dnl # ZFS_LINUX_TEST_SRC([create_flags], [ #include #include @@ -16,11 +34,20 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_CREATE_FLAGS], [ ],[]) ]) -AC_DEFUN([ZFS_AC_KERNEL_CREATE_FLAGS], [ - AC_MSG_CHECKING([whether iops->create() passes flags]) - ZFS_LINUX_TEST_RESULT([create_flags], [ +AC_DEFUN([ZFS_AC_KERNEL_CREATE], [ + AC_MSG_CHECKING([whether iops->create() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([create_userns], [ AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IOPS_CREATE_USERNS, 1, + [iops->create() takes struct user_namespace*]) ],[ - ZFS_LINUX_TEST_ERROR([iops->create()]) + AC_MSG_RESULT(no) + + AC_MSG_CHECKING([whether iops->create() passes flags]) + ZFS_LINUX_TEST_RESULT([create_flags], [ + AC_MSG_RESULT(yes) + ],[ + ZFS_LINUX_TEST_ERROR([iops->create()]) + ]) ]) ]) diff --git a/config/kernel-inode-getattr.m4 b/config/kernel-inode-getattr.m4 index 48391d66f8bd..f62e82f5230a 100644 --- a/config/kernel-inode-getattr.m4 +++ b/config/kernel-inode-getattr.m4 @@ -1,8 +1,29 @@ -dnl # -dnl # Linux 4.11 API -dnl # See torvalds/linux@a528d35 -dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [ + dnl # + dnl # Linux 5.12 API + dnl # The getattr I/O operations handler type was extended to require + dnl # a struct user_namespace* as its first arg, to support idmapped + dnl # mounts. + dnl # + ZFS_LINUX_TEST_SRC([inode_operations_getattr_userns], [ + #include + + int test_getattr( + struct user_namespace *userns, + const struct path *p, struct kstat *k, + u32 request_mask, unsigned int query_flags) + { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .getattr = test_getattr, + }; + ],[]) + + dnl # + dnl # Linux 4.11 API + dnl # See torvalds/linux@a528d35 + dnl # ZFS_LINUX_TEST_SRC([inode_operations_getattr_path], [ #include @@ -33,21 +54,39 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [ ]) AC_DEFUN([ZFS_AC_KERNEL_INODE_GETATTR], [ - AC_MSG_CHECKING([whether iops->getattr() takes a path]) - ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [ + dnl # + dnl # Kernel 5.12 test + dnl # + AC_MSG_CHECKING([whether iops->getattr() takes user_namespace]) + ZFS_LINUX_TEST_RESULT([inode_operations_getattr_userns], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1, - [iops->getattr() takes a path]) + AC_DEFINE(HAVE_USERNS_IOPS_GETATTR, 1, + [iops->getattr() takes struct user_namespace*]) ],[ AC_MSG_RESULT(no) - AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount]) - ZFS_LINUX_TEST_RESULT([inode_operations_getattr_vfsmount], [ + dnl # + dnl # Kernel 4.11 test + dnl # + AC_MSG_CHECKING([whether iops->getattr() takes a path]) + ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1, - [iops->getattr() takes a vfsmount]) + AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1, + [iops->getattr() takes a path]) ],[ AC_MSG_RESULT(no) + + dnl # + dnl # Kernel < 4.11 test + dnl # + AC_MSG_CHECKING([whether iops->getattr() takes a vfsmount]) + ZFS_LINUX_TEST_RESULT([inode_operations_getattr_vfsmount], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_VFSMOUNT_IOPS_GETATTR, 1, + [iops->getattr() takes a vfsmount]) + ],[ + AC_MSG_RESULT(no) + ]) ]) ]) ]) diff --git a/config/kernel-is_owner_or_cap.m4 b/config/kernel-is_owner_or_cap.m4 index 3df6163da270..3c3c6ad2240f 100644 --- a/config/kernel-is_owner_or_cap.m4 +++ b/config/kernel-is_owner_or_cap.m4 @@ -11,13 +11,32 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE], [ struct inode *ip = NULL; (void) inode_owner_or_capable(ip); ]) + + ZFS_LINUX_TEST_SRC([inode_owner_or_capable_idmapped], [ + #include + ],[ + struct inode *ip = NULL; + (void) inode_owner_or_capable(&init_user_ns, ip); + ]) ]) AC_DEFUN([ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE], [ AC_MSG_CHECKING([whether inode_owner_or_capable() exists]) ZFS_LINUX_TEST_RESULT([inode_owner_or_capable], [ AC_MSG_RESULT(yes) - ],[ - ZFS_LINUX_TEST_ERROR([capability]) + AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1, + [inode_owner_or_capable() exists]) + ], [ + AC_MSG_RESULT(no) + + AC_MSG_CHECKING( + [whether inode_owner_or_capable() takes user_ns]) + ZFS_LINUX_TEST_RESULT([inode_owner_or_capable_idmapped], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE_IDMAPPED, 1, + [inode_owner_or_capable() takes user_ns]) + ],[ + ZFS_LINUX_TEST_ERROR([capability]) + ]) ]) ]) diff --git a/config/kernel-mkdir-umode-t.m4 b/config/kernel-mkdir-umode-t.m4 deleted file mode 100644 index 19599670df3b..000000000000 --- a/config/kernel-mkdir-umode-t.m4 +++ /dev/null @@ -1,32 +0,0 @@ -dnl # -dnl # 3.3 API change -dnl # The VFS .create, .mkdir and .mknod callbacks were updated to take a -dnl # umode_t type rather than an int. The expectation is that any backport -dnl # would also change all three prototypes. However, if it turns out that -dnl # some distribution doesn't backport the whole thing this could be -dnl # broken apart into three separate checks. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T], [ - ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [ - #include - - int mkdir(struct inode *inode, struct dentry *dentry, - umode_t umode) { return 0; } - - static const struct inode_operations - iops __attribute__ ((unused)) = { - .mkdir = mkdir, - }; - ],[]) -]) - -AC_DEFUN([ZFS_AC_KERNEL_MKDIR_UMODE_T], [ - AC_MSG_CHECKING([whether iops->create()/mkdir()/mknod() take umode_t]) - ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_MKDIR_UMODE_T, 1, - [iops->create()/mkdir()/mknod() take umode_t]) - ],[ - ZFS_LINUX_TEST_ERROR([mkdir()]) - ]) -]) diff --git a/config/kernel-mkdir.m4 b/config/kernel-mkdir.m4 new file mode 100644 index 000000000000..a162bcd880ff --- /dev/null +++ b/config/kernel-mkdir.m4 @@ -0,0 +1,65 @@ +dnl # +dnl # Supported mkdir() interfaces checked newest to oldest. +dnl # +AC_DEFUN([ZFS_AC_KERNEL_SRC_MKDIR], [ + dnl # + dnl # 5.12 API change + dnl # The struct user_namespace arg was added as the first argument to + dnl # mkdir() + dnl # + ZFS_LINUX_TEST_SRC([mkdir_user_namespace], [ + #include + + int mkdir(struct user_namespace *userns, + struct inode *inode, struct dentry *dentry, + umode_t umode) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .mkdir = mkdir, + }; + ],[]) + + dnl # + dnl # 3.3 API change + dnl # The VFS .create, .mkdir and .mknod callbacks were updated to take a + dnl # umode_t type rather than an int. The expectation is that any backport + dnl # would also change all three prototypes. However, if it turns out that + dnl # some distribution doesn't backport the whole thing this could be + dnl # broken apart into three separate checks. + dnl # + ZFS_LINUX_TEST_SRC([inode_operations_mkdir], [ + #include + + int mkdir(struct inode *inode, struct dentry *dentry, + umode_t umode) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .mkdir = mkdir, + }; + ],[]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_MKDIR], [ + dnl # + dnl # 5.12 API change + dnl # The struct user_namespace arg was added as the first argument to + dnl # mkdir() of the iops structure. + dnl # + AC_MSG_CHECKING([whether iops->mkdir() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([mkdir_user_namespace], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IOPS_MKDIR_USERNS, 1, + [iops->mkdir() takes struct user_namespace*]) + ],[ + AC_MSG_CHECKING([whether iops->mkdir() takes umode_t]) + ZFS_LINUX_TEST_RESULT([inode_operations_mkdir], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MKDIR_UMODE_T, 1, + [iops->mkdir() takes umode_t]) + ],[ + ZFS_LINUX_TEST_ERROR([mkdir()]) + ]) + ]) +]) diff --git a/config/kernel-mknod.m4 b/config/kernel-mknod.m4 new file mode 100644 index 000000000000..ffe45106003a --- /dev/null +++ b/config/kernel-mknod.m4 @@ -0,0 +1,30 @@ +AC_DEFUN([ZFS_AC_KERNEL_SRC_MKNOD], [ + dnl # + dnl # 5.12 API change that added the struct user_namespace* arg + dnl # to the front of this function type's arg list. + dnl # + ZFS_LINUX_TEST_SRC([mknod_userns], [ + #include + #include + + int tmp_mknod(struct user_namespace *userns, + struct inode *inode ,struct dentry *dentry, + umode_t u, dev_t d) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .mknod = tmp_mknod, + }; + ],[]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_MKNOD], [ + AC_MSG_CHECKING([whether iops->mknod() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([mknod_userns], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IOPS_MKNOD_USERNS, 1, + [iops->mknod() takes struct user_namespace*]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-rename.m4 b/config/kernel-rename.m4 index f707391539d8..31d199f33bba 100644 --- a/config/kernel-rename.m4 +++ b/config/kernel-rename.m4 @@ -1,10 +1,10 @@ -dnl # -dnl # 4.9 API change, -dnl # iops->rename2() merged into iops->rename(), and iops->rename() now wants -dnl # flags. -dnl # -AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS], [ - ZFS_LINUX_TEST_SRC([inode_operations_rename], [ +AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME], [ + dnl # + dnl # 4.9 API change, + dnl # iops->rename2() merged into iops->rename(), and iops->rename() now wants + dnl # flags. + dnl # + ZFS_LINUX_TEST_SRC([inode_operations_rename_flags], [ #include int rename_fn(struct inode *sip, struct dentry *sdp, struct inode *tip, struct dentry *tdp, @@ -15,15 +15,41 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS], [ .rename = rename_fn, }; ],[]) + + dnl # + dnl # 5.12 API change, + dnl # + dnl # Linux 5.12 introduced passing struct user_namespace* as the first argument + dnl # of the rename() and other inode_operations members. + dnl # + ZFS_LINUX_TEST_SRC([inode_operations_rename_userns], [ + #include + int rename_fn(struct user_namespace *user_ns, struct inode *sip, + struct dentry *sdp, struct inode *tip, struct dentry *tdp, + unsigned int flags) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .rename = rename_fn, + }; + ],[]) ]) -AC_DEFUN([ZFS_AC_KERNEL_RENAME_WANTS_FLAGS], [ - AC_MSG_CHECKING([whether iops->rename() wants flags]) - ZFS_LINUX_TEST_RESULT([inode_operations_rename], [ +AC_DEFUN([ZFS_AC_KERNEL_RENAME], [ + AC_MSG_CHECKING([whether iops->rename() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([inode_operations_rename_userns], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1, - [iops->rename() wants flags]) + AC_DEFINE(HAVE_IOPS_RENAME_USERNS, 1, + [iops->rename() takes struct user_namespace*]) ],[ AC_MSG_RESULT(no) + + ZFS_LINUX_TEST_RESULT([inode_operations_rename_flags], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_RENAME_WANTS_FLAGS, 1, + [iops->rename() wants flags]) + ],[ + AC_MSG_RESULT(no) + ]) ]) ]) diff --git a/config/kernel-setattr-prepare.m4 b/config/kernel-setattr-prepare.m4 index 45408c45c69b..24245aa53448 100644 --- a/config/kernel-setattr-prepare.m4 +++ b/config/kernel-setattr-prepare.m4 @@ -1,27 +1,52 @@ -dnl # -dnl # 4.9 API change -dnl # The inode_change_ok() function has been renamed setattr_prepare() -dnl # and updated to take a dentry rather than an inode. -dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_SETATTR_PREPARE], [ + dnl # + dnl # 4.9 API change + dnl # The inode_change_ok() function has been renamed setattr_prepare() + dnl # and updated to take a dentry rather than an inode. + dnl # ZFS_LINUX_TEST_SRC([setattr_prepare], [ #include ], [ struct dentry *dentry = NULL; struct iattr *attr = NULL; int error __attribute__ ((unused)) = - setattr_prepare(dentry, attr); + setattr_prepare(dentry, attr); + ]) + + dnl # + dnl # 5.12 API change + dnl # The setattr_prepare() function has been changed to accept a new argument + dnl # for struct user_namespace* + dnl # + ZFS_LINUX_TEST_SRC([setattr_prepare_userns], [ + #include + ], [ + struct dentry *dentry = NULL; + struct iattr *attr = NULL; + struct user_namespace *userns = NULL; + int error __attribute__ ((unused)) = + setattr_prepare(userns, dentry, attr); ]) ]) AC_DEFUN([ZFS_AC_KERNEL_SETATTR_PREPARE], [ - AC_MSG_CHECKING([whether setattr_prepare() is available]) - ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare], + AC_MSG_CHECKING([whether setattr_prepare() is available and accepts struct user_namespace*]) + ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare_userns], [setattr_prepare], [fs/attr.c], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_SETATTR_PREPARE, 1, - [setattr_prepare() is available]) + AC_DEFINE(HAVE_SETATTR_PREPARE_USERNS, 1, + [setattr_prepare() accepts user_namespace]) ], [ AC_MSG_RESULT(no) + + AC_MSG_CHECKING([whether setattr_prepare() is available, doesn't accept user_namespace]) + ZFS_LINUX_TEST_RESULT_SYMBOL([setattr_prepare], + [setattr_prepare], [fs/attr.c], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_SETATTR_PREPARE_NO_USERNS, 1, + [setattr_prepare() is available, doesn't accept user_namespace]) + ], [ + AC_MSG_RESULT(no) + ]) ]) ]) diff --git a/config/kernel-symlink.m4 b/config/kernel-symlink.m4 new file mode 100644 index 000000000000..d90366d04b72 --- /dev/null +++ b/config/kernel-symlink.m4 @@ -0,0 +1,30 @@ +AC_DEFUN([ZFS_AC_KERNEL_SRC_SYMLINK], [ + dnl # + dnl # 5.12 API change that added the struct user_namespace* arg + dnl # to the front of this function type's arg list. + dnl # + ZFS_LINUX_TEST_SRC([symlink_userns], [ + #include + #include + + int tmp_symlink(struct user_namespace *userns, + struct inode *inode ,struct dentry *dentry, + const char *path) { return 0; } + + static const struct inode_operations + iops __attribute__ ((unused)) = { + .symlink = tmp_symlink, + }; + ],[]) +]) + +AC_DEFUN([ZFS_AC_KERNEL_SYMLINK], [ + AC_MSG_CHECKING([whether iops->symlink() takes struct user_namespace*]) + ZFS_LINUX_TEST_RESULT([symlink_userns], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IOPS_SYMLINK_USERNS, 1, + [iops->symlink() takes struct user_namespace*]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/config/kernel-xattr-handler.m4 b/config/kernel-xattr-handler.m4 index 137bf4a8aff0..00b1e74a9ccb 100644 --- a/config/kernel-xattr-handler.m4 +++ b/config/kernel-xattr-handler.m4 @@ -152,6 +152,21 @@ dnl # dnl # Supported xattr handler set() interfaces checked newest to oldest. dnl # AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [ + ZFS_LINUX_TEST_SRC([xattr_handler_set_userns], [ + #include + + int set(const struct xattr_handler *handler, + struct user_namespace *mnt_userns, + struct dentry *dentry, struct inode *inode, + const char *name, const void *buffer, + size_t size, int flags) + { return 0; } + static const struct xattr_handler + xops __attribute__ ((unused)) = { + .set = set, + }; + ],[]) + ZFS_LINUX_TEST_SRC([xattr_handler_set_dentry_inode], [ #include @@ -194,45 +209,58 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_XATTR_HANDLER_SET], [ AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [ dnl # - dnl # 4.7 API change, - dnl # The xattr_handler->set() callback was changed to take both - dnl # dentry and inode. + dnl # 5.12 API change, + dnl # The xattr_handler->set() callback was changed to 8 arguments, and + dnl # struct user_namespace* was inserted as arg #2 dnl # - AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode]) - ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [ + AC_MSG_CHECKING([whether xattr_handler->set() wants dentry, inode, and user_namespace]) + ZFS_LINUX_TEST_RESULT([xattr_handler_set_userns], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1, - [xattr_handler->set() wants both dentry and inode]) + AC_DEFINE(HAVE_XATTR_SET_USERNS, 1, + [xattr_handler->set() takes user_namespace]) ],[ dnl # - dnl # 4.4 API change, - dnl # The xattr_handler->set() callback was changed to take a - dnl # xattr_handler, and handler_flags argument was removed and - dnl # should be accessed by handler->flags. + dnl # 4.7 API change, + dnl # The xattr_handler->set() callback was changed to take both + dnl # dentry and inode. dnl # AC_MSG_RESULT(no) - AC_MSG_CHECKING( - [whether xattr_handler->set() wants xattr_handler]) - ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [ + AC_MSG_CHECKING([whether xattr_handler->set() wants dentry and inode]) + ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry_inode], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1, - [xattr_handler->set() wants xattr_handler]) + AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1, + [xattr_handler->set() wants both dentry and inode]) ],[ dnl # - dnl # 2.6.33 API change, - dnl # The xattr_handler->set() callback was changed - dnl # to take a dentry instead of an inode, and a - dnl # handler_flags argument was added. + dnl # 4.4 API change, + dnl # The xattr_handler->set() callback was changed to take a + dnl # xattr_handler, and handler_flags argument was removed and + dnl # should be accessed by handler->flags. dnl # AC_MSG_RESULT(no) AC_MSG_CHECKING( - [whether xattr_handler->set() wants dentry]) - ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [ + [whether xattr_handler->set() wants xattr_handler]) + ZFS_LINUX_TEST_RESULT([xattr_handler_set_xattr_handler], [ AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1, - [xattr_handler->set() wants dentry]) + AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1, + [xattr_handler->set() wants xattr_handler]) ],[ - ZFS_LINUX_TEST_ERROR([xattr set()]) + dnl # + dnl # 2.6.33 API change, + dnl # The xattr_handler->set() callback was changed + dnl # to take a dentry instead of an inode, and a + dnl # handler_flags argument was added. + dnl # + AC_MSG_RESULT(no) + AC_MSG_CHECKING( + [whether xattr_handler->set() wants dentry]) + ZFS_LINUX_TEST_RESULT([xattr_handler_set_dentry], [ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1, + [xattr_handler->set() wants dentry]) + ],[ + ZFS_LINUX_TEST_ERROR([xattr set()]) + ]) ]) ]) ]) diff --git a/config/kernel.m4 b/config/kernel.m4 index f31be845f5d9..dfb6165d879d 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -79,9 +79,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_EVICT_INODE ZFS_AC_KERNEL_SRC_DIRTY_INODE ZFS_AC_KERNEL_SRC_SHRINKER - ZFS_AC_KERNEL_SRC_MKDIR_UMODE_T + ZFS_AC_KERNEL_SRC_MKDIR ZFS_AC_KERNEL_SRC_LOOKUP_FLAGS - ZFS_AC_KERNEL_SRC_CREATE_FLAGS + ZFS_AC_KERNEL_SRC_CREATE ZFS_AC_KERNEL_SRC_GET_LINK ZFS_AC_KERNEL_SRC_PUT_LINK ZFS_AC_KERNEL_SRC_TMPFILE @@ -115,7 +115,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_KUIDGID_T ZFS_AC_KERNEL_SRC_KUID_HELPERS ZFS_AC_KERNEL_SRC_MODULE_PARAM_CALL_CONST - ZFS_AC_KERNEL_SRC_RENAME_WANTS_FLAGS + ZFS_AC_KERNEL_SRC_RENAME ZFS_AC_KERNEL_SRC_CURRENT_TIME ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES ZFS_AC_KERNEL_SRC_IN_COMPAT_SYSCALL @@ -125,6 +125,10 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ ZFS_AC_KERNEL_SRC_KSTRTOUL ZFS_AC_KERNEL_SRC_PERCPU ZFS_AC_KERNEL_SRC_CPU_HOTPLUG + ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS + ZFS_AC_KERNEL_SRC_MKNOD + ZFS_AC_KERNEL_SRC_SYMLINK + ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS AC_MSG_CHECKING([for available kernel interfaces]) ZFS_LINUX_TEST_COMPILE_ALL([kabi]) @@ -177,9 +181,9 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_EVICT_INODE ZFS_AC_KERNEL_DIRTY_INODE ZFS_AC_KERNEL_SHRINKER - ZFS_AC_KERNEL_MKDIR_UMODE_T + ZFS_AC_KERNEL_MKDIR ZFS_AC_KERNEL_LOOKUP_FLAGS - ZFS_AC_KERNEL_CREATE_FLAGS + ZFS_AC_KERNEL_CREATE ZFS_AC_KERNEL_GET_LINK ZFS_AC_KERNEL_PUT_LINK ZFS_AC_KERNEL_TMPFILE @@ -213,7 +217,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_KUIDGID_T ZFS_AC_KERNEL_KUID_HELPERS ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST - ZFS_AC_KERNEL_RENAME_WANTS_FLAGS + ZFS_AC_KERNEL_RENAME ZFS_AC_KERNEL_CURRENT_TIME ZFS_AC_KERNEL_USERNS_CAPABILITIES ZFS_AC_KERNEL_IN_COMPAT_SYSCALL @@ -223,6 +227,10 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ ZFS_AC_KERNEL_KSTRTOUL ZFS_AC_KERNEL_PERCPU ZFS_AC_KERNEL_CPU_HOTPLUG + ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS + ZFS_AC_KERNEL_MKNOD + ZFS_AC_KERNEL_SYMLINK + ZFS_AC_KERNEL_BIO_MAX_SEGS ]) dnl # diff --git a/configure.ac b/configure.ac index 07f590b390bd..e31d12271394 100644 --- a/configure.ac +++ b/configure.ac @@ -240,6 +240,7 @@ AC_CONFIG_FILES([ tests/zfs-tests/tests/Makefile tests/zfs-tests/tests/functional/Makefile tests/zfs-tests/tests/functional/acl/Makefile + tests/zfs-tests/tests/functional/acl/off/Makefile tests/zfs-tests/tests/functional/acl/posix/Makefile tests/zfs-tests/tests/functional/acl/posix-sa/Makefile tests/zfs-tests/tests/functional/alloc_class/Makefile diff --git a/include/os/linux/kernel/linux/kmap_compat.h b/include/os/linux/kernel/linux/kmap_compat.h index a7e63944ea16..42f463ab9ae9 100644 --- a/include/os/linux/kernel/linux/kmap_compat.h +++ b/include/os/linux/kernel/linux/kmap_compat.h @@ -30,8 +30,8 @@ #include /* 2.6.37 API change */ -#define zfs_kmap_atomic(page, km_type) kmap_atomic(page) -#define zfs_kunmap_atomic(addr, km_type) kunmap_atomic(addr) +#define zfs_kmap_atomic(page) kmap_atomic(page) +#define zfs_kunmap_atomic(addr) kunmap_atomic(addr) /* 5.0 API change - no more 'type' argument for access_ok() */ #ifdef HAVE_ACCESS_OK_TYPE diff --git a/include/os/linux/kernel/linux/vfs_compat.h b/include/os/linux/kernel/linux/vfs_compat.h index c35e80d31cd7..91e908598fbb 100644 --- a/include/os/linux/kernel/linux/vfs_compat.h +++ b/include/os/linux/kernel/linux/vfs_compat.h @@ -343,7 +343,8 @@ static inline void zfs_gid_write(struct inode *ip, gid_t gid) /* * 4.9 API change */ -#ifndef HAVE_SETATTR_PREPARE +#if !(defined(HAVE_SETATTR_PREPARE_NO_USERNS) || \ + defined(HAVE_SETATTR_PREPARE_USERNS)) static inline int setattr_prepare(struct dentry *dentry, struct iattr *ia) { @@ -389,6 +390,15 @@ func(const struct path *path, struct kstat *stat, u32 request_mask, \ { \ return (func##_impl(path, stat, request_mask, query_flags)); \ } +#elif defined(HAVE_USERNS_IOPS_GETATTR) +#define ZPL_GETATTR_WRAPPER(func) \ +static int \ +func(struct user_namespace *user_ns, const struct path *path, \ + struct kstat *stat, u32 request_mask, unsigned int query_flags) \ +{ \ + return (func##_impl(user_ns, path, stat, request_mask, \ + query_flags)); \ +} #else #error #endif @@ -436,4 +446,16 @@ zpl_is_32bit_api(void) #endif } +/* + * 5.12 API change + * To support id-mapped mounts, generic_fillattr() was modified to + * accept a new struct user_namespace* as its first arg. + */ +#ifdef HAVE_GENERIC_FILLATTR_USERNS +#define zpl_generic_fillattr(user_ns, ip, sp) \ + generic_fillattr(user_ns, ip, sp) +#else +#define zpl_generic_fillattr(user_ns, ip, sp) generic_fillattr(ip, sp) +#endif + #endif /* _ZFS_VFS_H */ diff --git a/include/os/linux/kernel/linux/xattr_compat.h b/include/os/linux/kernel/linux/xattr_compat.h index 8348e99198af..54690727eab9 100644 --- a/include/os/linux/kernel/linux/xattr_compat.h +++ b/include/os/linux/kernel/linux/xattr_compat.h @@ -119,12 +119,27 @@ fn(struct dentry *dentry, const char *name, void *buffer, size_t size, \ #error "Unsupported kernel" #endif +/* + * 5.12 API change, + * The xattr_handler->set() callback was changed to take the + * struct user_namespace* as the first arg, to support idmapped + * mounts. + */ +#if defined(HAVE_XATTR_SET_USERNS) +#define ZPL_XATTR_SET_WRAPPER(fn) \ +static int \ +fn(const struct xattr_handler *handler, struct user_namespace *user_ns, \ + struct dentry *dentry, struct inode *inode, const char *name, \ + const void *buffer, size_t size, int flags) \ +{ \ + return (__ ## fn(inode, name, buffer, size, flags)); \ +} /* * 4.7 API change, * The xattr_handler->set() callback was changed to take a both dentry and *** 3312 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Mar 21 01:25:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 55FDD5B9EFE; Sun, 21 Mar 2021 01:25: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 4F30Ln1tsxz3kkJ; Sun, 21 Mar 2021 01:25: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 338F411D5D; Sun, 21 Mar 2021 01:25: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 12L1Pb2Z046851; Sun, 21 Mar 2021 01:25:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12L1PaZZ046850; Sun, 21 Mar 2021 01:25:36 GMT (envelope-from git) Date: Sun, 21 Mar 2021 01:25:36 GMT Message-Id: <202103210125.12L1PaZZ046850@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Martin Matuska Subject: git: f9693bef8dc8 - main - zfs: merge OpenZFS master-891568c99 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: f9693bef8dc83284e7ac905adc346f7d866b5245 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 01:25:37 -0000 The branch main has been updated by mm: URL: https://cgit.FreeBSD.org/src/commit/?id=f9693bef8dc83284e7ac905adc346f7d866b5245 commit f9693bef8dc83284e7ac905adc346f7d866b5245 Merge: 815209920f1d 48a1c304e82e Author: Martin Matuska AuthorDate: 2021-03-21 00:46:08 +0000 Commit: Martin Matuska CommitDate: 2021-03-21 01:17:59 +0000 zfs: merge OpenZFS master-891568c99 Notable upstream pull request merges: #11652 Split dmu_zfetch() speculation and execution parts #11682 Fix zfs_get_data access to files with wrong generation #11735 Clean up RAIDZ/DRAID ereport code #11737 Initialize metaslab range trees in metaslab_init #11739 FreeBSD: make seqc asserts conditional on replay #11763 Allow setting bootfs property on pools with indirect vdevs #11767 FreeBSD: Fix memory leaks in kstats Obtained from: OpenZFS MFC after: 2 weeks sys/contrib/openzfs/README.md | 2 +- sys/contrib/openzfs/cmd/raidz_test/raidz_test.c | 2 - sys/contrib/openzfs/cmd/ztest/ztest.c | 4 +- sys/contrib/openzfs/config/kernel-bio_max_segs.m4 | 23 ++ .../openzfs/config/kernel-generic_fillattr.m4 | 28 +++ sys/contrib/openzfs/config/kernel-inode-create.m4 | 43 +++- sys/contrib/openzfs/config/kernel-inode-getattr.m4 | 63 ++++- .../openzfs/config/kernel-is_owner_or_cap.m4 | 23 +- sys/contrib/openzfs/config/kernel-mkdir-umode-t.m4 | 32 --- sys/contrib/openzfs/config/kernel-mkdir.m4 | 65 +++++ sys/contrib/openzfs/config/kernel-mknod.m4 | 30 +++ sys/contrib/openzfs/config/kernel-rename.m4 | 50 +++- .../openzfs/config/kernel-setattr-prepare.m4 | 45 +++- sys/contrib/openzfs/config/kernel-symlink.m4 | 30 +++ sys/contrib/openzfs/config/kernel-xattr-handler.m4 | 78 ++++-- sys/contrib/openzfs/config/kernel.m4 | 20 +- sys/contrib/openzfs/configure.ac | 1 + .../include/os/linux/kernel/linux/kmap_compat.h | 4 +- .../include/os/linux/kernel/linux/vfs_compat.h | 24 +- .../include/os/linux/kernel/linux/xattr_compat.h | 17 +- .../include/os/linux/zfs/sys/zfs_vnops_os.h | 3 +- .../include/os/linux/zfs/sys/zfs_znode_impl.h | 8 +- sys/contrib/openzfs/include/os/linux/zfs/sys/zpl.h | 18 ++ sys/contrib/openzfs/include/sys/dmu_zfetch.h | 23 +- sys/contrib/openzfs/include/sys/vdev_raidz.h | 2 + sys/contrib/openzfs/include/sys/vdev_raidz_impl.h | 7 +- sys/contrib/openzfs/include/sys/zil.h | 3 +- sys/contrib/openzfs/include/sys/zio.h | 10 +- sys/contrib/openzfs/include/sys/zvol_impl.h | 4 +- .../openzfs/man/man5/zfs-module-parameters.5 | 25 +- sys/contrib/openzfs/man/man8/zfs-allow.8 | 3 + sys/contrib/openzfs/man/man8/zgenhostid.8 | 4 +- sys/contrib/openzfs/man/man8/zpoolconcepts.8 | 17 ++ .../openzfs/module/os/freebsd/spl/spl_kstat.c | 11 +- .../openzfs/module/os/freebsd/zfs/sysctl_os.c | 6 - sys/contrib/openzfs/module/os/linux/zfs/abd_os.c | 10 +- sys/contrib/openzfs/module/os/linux/zfs/policy.c | 2 +- .../openzfs/module/os/linux/zfs/vdev_disk.c | 5 + .../openzfs/module/os/linux/zfs/zfs_ctldir.c | 3 +- sys/contrib/openzfs/module/os/linux/zfs/zfs_uio.c | 4 +- .../openzfs/module/os/linux/zfs/zfs_vfsops.c | 6 +- .../openzfs/module/os/linux/zfs/zfs_vnops_os.c | 5 +- .../openzfs/module/os/linux/zfs/zpl_ctldir.c | 51 +++- sys/contrib/openzfs/module/os/linux/zfs/zpl_file.c | 2 +- .../openzfs/module/os/linux/zfs/zpl_inode.c | 52 +++- .../openzfs/module/os/linux/zfs/zpl_xattr.c | 4 +- sys/contrib/openzfs/module/zfs/dbuf.c | 5 +- sys/contrib/openzfs/module/zfs/dmu.c | 35 ++- sys/contrib/openzfs/module/zfs/dmu_zfetch.c | 250 +++++++++++-------- sys/contrib/openzfs/module/zfs/metaslab.c | 149 +++++------- sys/contrib/openzfs/module/zfs/refcount.c | 10 +- sys/contrib/openzfs/module/zfs/vdev.c | 4 +- sys/contrib/openzfs/module/zfs/vdev_draid.c | 240 +------------------ sys/contrib/openzfs/module/zfs/vdev_indirect.c | 1 - sys/contrib/openzfs/module/zfs/vdev_mirror.c | 5 +- sys/contrib/openzfs/module/zfs/vdev_raidz.c | 266 +++------------------ sys/contrib/openzfs/module/zfs/zfs_fm.c | 8 +- sys/contrib/openzfs/module/zfs/zfs_fuid.c | 4 - sys/contrib/openzfs/module/zfs/zfs_log.c | 5 + sys/contrib/openzfs/module/zfs/zfs_vnops.c | 14 +- sys/contrib/openzfs/module/zfs/zil.c | 3 +- sys/contrib/openzfs/module/zfs/zio.c | 4 +- sys/contrib/openzfs/module/zfs/zvol.c | 3 +- sys/contrib/openzfs/tests/runfiles/common.run | 8 +- sys/contrib/openzfs/tests/runfiles/freebsd.run | 4 + sys/contrib/openzfs/tests/runfiles/sanity.run | 4 + .../zfs-tests/tests/functional/acl/Makefile.am | 2 +- .../zfs-tests/tests/functional/acl/off/.gitignore | 1 + .../zfs-tests/tests/functional/acl/off/Makefile.am | 16 ++ .../zfs-tests/tests/functional/acl/off/cleanup.ksh | 33 +++ .../zfs-tests/tests/functional/acl/off/dosmode.ksh | 199 +++++++++++++++ .../functional/acl/off/dosmode_readonly_write.c | 61 +++++ .../tests/functional/acl/off/posixmode.ksh | 145 +++++++++++ .../zfs-tests/tests/functional/acl/off/setup.ksh | 44 ++++ .../tests/functional/redacted_send/Makefile.am | 1 + .../functional/redacted_send/redacted_panic.ksh | 44 ++++ sys/modules/zfs/zfs_config.h | 4 +- 77 files changed, 1561 insertions(+), 883 deletions(-) diff --cc sys/contrib/openzfs/README.md index 31d99386e90e,000000000000..d666df7af309 mode 100644,000000..100644 --- a/sys/contrib/openzfs/README.md +++ b/sys/contrib/openzfs/README.md @@@ -1,35 -1,0 +1,35 @@@ +![img](https://openzfs.github.io/openzfs-docs/_static/img/logo/480px-Open-ZFS-Secondary-Logo-Colour-halfsize.png) + +OpenZFS is an advanced file system and volume manager which was originally +developed for Solaris and is now maintained by the OpenZFS community. +This repository contains the code for running OpenZFS on Linux and FreeBSD. + +[![codecov](https://codecov.io/gh/openzfs/zfs/branch/master/graph/badge.svg)](https://codecov.io/gh/openzfs/zfs) +[![coverity](https://scan.coverity.com/projects/1973/badge.svg)](https://scan.coverity.com/projects/openzfs-zfs) + +# Official Resources + + * [Documentation](https://openzfs.github.io/openzfs-docs/) - for using and developing this repo + * [ZoL Site](https://zfsonlinux.org) - Linux release info & links + * [Mailing lists](https://openzfs.github.io/openzfs-docs/Project%20and%20Community/Mailing%20Lists.html) + * [OpenZFS site](http://open-zfs.org/) - for conference videos and info on other platforms (illumos, OSX, Windows, etc) + +# Installation + +Full documentation for installing OpenZFS on your favorite operating system can +be found at the [Getting Started Page](https://openzfs.github.io/openzfs-docs/Getting%20Started/index.html). + +# Contribute & Develop + +We have a separate document with [contribution guidelines](./.github/CONTRIBUTING.md). + +We have a [Code of Conduct](./CODE_OF_CONDUCT.md). + +# Release + +OpenZFS is released under a CDDL license. +For more details see the NOTICE, LICENSE and COPYRIGHT files; `UCRL-CODE-235197` + +# Supported Kernels + * The `META` file contains the officially recognized supported Linux kernel versions. - * Supported FreeBSD versions are 12-STABLE and 13-CURRENT. ++ * Supported FreeBSD versions are any supported branches and releases starting from 12.2-RELEASE. diff --cc sys/contrib/openzfs/config/kernel-bio_max_segs.m4 index 000000000000,a90d75455c13..a90d75455c13 mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/kernel-bio_max_segs.m4 +++ b/sys/contrib/openzfs/config/kernel-bio_max_segs.m4 diff --cc sys/contrib/openzfs/config/kernel-generic_fillattr.m4 index 000000000000,50c8031305b3..50c8031305b3 mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/kernel-generic_fillattr.m4 +++ b/sys/contrib/openzfs/config/kernel-generic_fillattr.m4 diff --cc sys/contrib/openzfs/config/kernel-mkdir.m4 index 000000000000,a162bcd880ff..a162bcd880ff mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/kernel-mkdir.m4 +++ b/sys/contrib/openzfs/config/kernel-mkdir.m4 diff --cc sys/contrib/openzfs/config/kernel-mknod.m4 index 000000000000,ffe45106003a..ffe45106003a mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/kernel-mknod.m4 +++ b/sys/contrib/openzfs/config/kernel-mknod.m4 diff --cc sys/contrib/openzfs/config/kernel-symlink.m4 index 000000000000,d90366d04b72..d90366d04b72 mode 000000,100644..100644 --- a/sys/contrib/openzfs/config/kernel-symlink.m4 +++ b/sys/contrib/openzfs/config/kernel-symlink.m4 diff --cc sys/contrib/openzfs/module/os/linux/zfs/zfs_uio.c index 3b0f824115f8,000000000000..3e3fda20c72c mode 100644,000000..100644 --- a/sys/contrib/openzfs/module/os/linux/zfs/zfs_uio.c +++ b/sys/contrib/openzfs/module/os/linux/zfs/zfs_uio.c @@@ -1,333 -1,0 +1,333 @@@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ +/* All Rights Reserved */ + +/* + * University Copyright- Copyright (c) 1982, 1986, 1988 + * The Regents of the University of California + * All Rights Reserved + * + * University Acknowledgment- Portions of this document are derived from + * software developed by the University of California, Berkeley, and its + * contributors. + */ +/* + * Copyright (c) 2015 by Chunwei Chen. All rights reserved. + */ + +#ifdef _KERNEL + +#include +#include +#include +#include +#include +#include + +/* + * Move "n" bytes at byte address "p"; "rw" indicates the direction + * of the move, and the I/O parameters are provided in "uio", which is + * update to reflect the data which was moved. Returns 0 on success or + * a non-zero errno on failure. + */ +static int +zfs_uiomove_iov(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio) +{ + const struct iovec *iov = uio->uio_iov; + size_t skip = uio->uio_skip; + ulong_t cnt; + + while (n && uio->uio_resid) { + cnt = MIN(iov->iov_len - skip, n); + switch (uio->uio_segflg) { + case UIO_USERSPACE: + /* + * p = kernel data pointer + * iov->iov_base = user data pointer + */ + if (rw == UIO_READ) { + if (copy_to_user(iov->iov_base+skip, p, cnt)) + return (EFAULT); + } else { + unsigned long b_left = 0; + if (uio->uio_fault_disable) { + if (!zfs_access_ok(VERIFY_READ, + (iov->iov_base + skip), cnt)) { + return (EFAULT); + } + pagefault_disable(); + b_left = + __copy_from_user_inatomic(p, + (iov->iov_base + skip), cnt); + pagefault_enable(); + } else { + b_left = + copy_from_user(p, + (iov->iov_base + skip), cnt); + } + if (b_left > 0) { + unsigned long c_bytes = + cnt - b_left; + uio->uio_skip += c_bytes; + ASSERT3U(uio->uio_skip, <, + iov->iov_len); + uio->uio_resid -= c_bytes; + uio->uio_loffset += c_bytes; + return (EFAULT); + } + } + break; + case UIO_SYSSPACE: + if (rw == UIO_READ) + bcopy(p, iov->iov_base + skip, cnt); + else + bcopy(iov->iov_base + skip, p, cnt); + break; + default: + ASSERT(0); + } + skip += cnt; + if (skip == iov->iov_len) { + skip = 0; + uio->uio_iov = (++iov); + uio->uio_iovcnt--; + } + uio->uio_skip = skip; + uio->uio_resid -= cnt; + uio->uio_loffset += cnt; + p = (caddr_t)p + cnt; + n -= cnt; + } + return (0); +} + +static int +zfs_uiomove_bvec(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio) +{ + const struct bio_vec *bv = uio->uio_bvec; + size_t skip = uio->uio_skip; + ulong_t cnt; + + while (n && uio->uio_resid) { + void *paddr; + cnt = MIN(bv->bv_len - skip, n); + - paddr = zfs_kmap_atomic(bv->bv_page, KM_USER1); ++ paddr = zfs_kmap_atomic(bv->bv_page); + if (rw == UIO_READ) + bcopy(p, paddr + bv->bv_offset + skip, cnt); + else + bcopy(paddr + bv->bv_offset + skip, p, cnt); - zfs_kunmap_atomic(paddr, KM_USER1); ++ zfs_kunmap_atomic(paddr); + + skip += cnt; + if (skip == bv->bv_len) { + skip = 0; + uio->uio_bvec = (++bv); + uio->uio_iovcnt--; + } + uio->uio_skip = skip; + uio->uio_resid -= cnt; + uio->uio_loffset += cnt; + p = (caddr_t)p + cnt; + n -= cnt; + } + return (0); +} + +#if defined(HAVE_VFS_IOV_ITER) +static int +zfs_uiomove_iter(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio, + boolean_t revert) +{ + size_t cnt = MIN(n, uio->uio_resid); + + if (uio->uio_skip) + iov_iter_advance(uio->uio_iter, uio->uio_skip); + + if (rw == UIO_READ) + cnt = copy_to_iter(p, cnt, uio->uio_iter); + else + cnt = copy_from_iter(p, cnt, uio->uio_iter); + + /* + * When operating on a full pipe no bytes are processed. + * In which case return EFAULT which is converted to EAGAIN + * by the kernel's generic_file_splice_read() function. + */ + if (cnt == 0) + return (EFAULT); + + /* + * Revert advancing the uio_iter. This is set by zfs_uiocopy() + * to avoid consuming the uio and its iov_iter structure. + */ + if (revert) + iov_iter_revert(uio->uio_iter, cnt); + + uio->uio_resid -= cnt; + uio->uio_loffset += cnt; + + return (0); +} +#endif + +int +zfs_uiomove(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio) +{ + if (uio->uio_segflg == UIO_BVEC) + return (zfs_uiomove_bvec(p, n, rw, uio)); +#if defined(HAVE_VFS_IOV_ITER) + else if (uio->uio_segflg == UIO_ITER) + return (zfs_uiomove_iter(p, n, rw, uio, B_FALSE)); +#endif + else + return (zfs_uiomove_iov(p, n, rw, uio)); +} +EXPORT_SYMBOL(zfs_uiomove); + +/* + * Fault in the pages of the first n bytes specified by the uio structure. + * 1 byte in each page is touched and the uio struct is unmodified. Any + * error will terminate the process as this is only a best attempt to get + * the pages resident. + */ +int +zfs_uio_prefaultpages(ssize_t n, zfs_uio_t *uio) +{ + if (uio->uio_segflg == UIO_SYSSPACE || uio->uio_segflg == UIO_BVEC) { + /* There's never a need to fault in kernel pages */ + return (0); +#if defined(HAVE_VFS_IOV_ITER) + } else if (uio->uio_segflg == UIO_ITER) { + /* + * At least a Linux 4.9 kernel, iov_iter_fault_in_readable() + * can be relied on to fault in user pages when referenced. + */ + if (iov_iter_fault_in_readable(uio->uio_iter, n)) + return (EFAULT); +#endif + } else { + /* Fault in all user pages */ + ASSERT3S(uio->uio_segflg, ==, UIO_USERSPACE); + const struct iovec *iov = uio->uio_iov; + int iovcnt = uio->uio_iovcnt; + size_t skip = uio->uio_skip; + uint8_t tmp; + caddr_t p; + + for (; n > 0 && iovcnt > 0; iov++, iovcnt--, skip = 0) { + ulong_t cnt = MIN(iov->iov_len - skip, n); + /* empty iov */ + if (cnt == 0) + continue; + n -= cnt; + /* touch each page in this segment. */ + p = iov->iov_base + skip; + while (cnt) { + if (get_user(tmp, (uint8_t *)p)) + return (EFAULT); + ulong_t incr = MIN(cnt, PAGESIZE); + p += incr; + cnt -= incr; + } + /* touch the last byte in case it straddles a page. */ + p--; + if (get_user(tmp, (uint8_t *)p)) + return (EFAULT); + } + } + + if (iterp && iov_iter_fault_in_readable(iterp, n)) + return (EFAULT); +#endif + return (0); +} +EXPORT_SYMBOL(zfs_uio_prefaultpages); + +/* + * The same as zfs_uiomove() but doesn't modify uio structure. + * return in cbytes how many bytes were copied. + */ +int +zfs_uiocopy(void *p, size_t n, zfs_uio_rw_t rw, zfs_uio_t *uio, size_t *cbytes) +{ + zfs_uio_t uio_copy; + int ret; + + bcopy(uio, &uio_copy, sizeof (zfs_uio_t)); + + if (uio->uio_segflg == UIO_BVEC) + ret = zfs_uiomove_bvec(p, n, rw, &uio_copy); +#if defined(HAVE_VFS_IOV_ITER) + else if (uio->uio_segflg == UIO_ITER) + ret = zfs_uiomove_iter(p, n, rw, &uio_copy, B_TRUE); +#endif + else + ret = zfs_uiomove_iov(p, n, rw, &uio_copy); + + *cbytes = uio->uio_resid - uio_copy.uio_resid; + + return (ret); +} +EXPORT_SYMBOL(zfs_uiocopy); + +/* + * Drop the next n chars out of *uio. + */ +void +zfs_uioskip(zfs_uio_t *uio, size_t n) +{ + if (n > uio->uio_resid) + return; + + if (uio->uio_segflg == UIO_BVEC) { + uio->uio_skip += n; + while (uio->uio_iovcnt && + uio->uio_skip >= uio->uio_bvec->bv_len) { + uio->uio_skip -= uio->uio_bvec->bv_len; + uio->uio_bvec++; + uio->uio_iovcnt--; + } +#if defined(HAVE_VFS_IOV_ITER) + } else if (uio->uio_segflg == UIO_ITER) { + iov_iter_advance(uio->uio_iter, n); +#endif + } else { + uio->uio_skip += n; + while (uio->uio_iovcnt && + uio->uio_skip >= uio->uio_iov->iov_len) { + uio->uio_skip -= uio->uio_iov->iov_len; + uio->uio_iov++; + uio->uio_iovcnt--; + } + } + uio->uio_loffset += n; + uio->uio_resid -= n; +} +EXPORT_SYMBOL(zfs_uioskip); + +#endif /* _KERNEL */ diff --cc sys/contrib/openzfs/module/zfs/zio.c index 262ca24b1443,000000000000..a7820e75670b mode 100644,000000..100644 --- a/sys/contrib/openzfs/module/zfs/zio.c +++ b/sys/contrib/openzfs/module/zfs/zio.c @@@ -1,5036 -1,0 +1,5036 @@@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2020 by Delphix. All rights reserved. + * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2017, Intel Corporation. + * Copyright (c) 2019, Klara Inc. + * Copyright (c) 2019, Allan Jude + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * ========================================================================== + * I/O type descriptions + * ========================================================================== + */ +const char *zio_type_name[ZIO_TYPES] = { + /* + * Note: Linux kernel thread name length is limited + * so these names will differ from upstream open zfs. + */ + "z_null", "z_rd", "z_wr", "z_fr", "z_cl", "z_ioctl", "z_trim" +}; + +int zio_dva_throttle_enabled = B_TRUE; +int zio_deadman_log_all = B_FALSE; + +/* + * ========================================================================== + * I/O kmem caches + * ========================================================================== + */ +kmem_cache_t *zio_cache; +kmem_cache_t *zio_link_cache; +kmem_cache_t *zio_buf_cache[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]; +kmem_cache_t *zio_data_buf_cache[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]; +#if defined(ZFS_DEBUG) && !defined(_KERNEL) +uint64_t zio_buf_cache_allocs[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]; +uint64_t zio_buf_cache_frees[SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT]; +#endif + +/* Mark IOs as "slow" if they take longer than 30 seconds */ +int zio_slow_io_ms = (30 * MILLISEC); + +#define BP_SPANB(indblkshift, level) \ + (((uint64_t)1) << ((level) * ((indblkshift) - SPA_BLKPTRSHIFT))) +#define COMPARE_META_LEVEL 0x80000000ul +/* + * The following actions directly effect the spa's sync-to-convergence logic. + * The values below define the sync pass when we start performing the action. + * Care should be taken when changing these values as they directly impact + * spa_sync() performance. Tuning these values may introduce subtle performance + * pathologies and should only be done in the context of performance analysis. + * These tunables will eventually be removed and replaced with #defines once + * enough analysis has been done to determine optimal values. + * + * The 'zfs_sync_pass_deferred_free' pass must be greater than 1 to ensure that + * regular blocks are not deferred. + * + * Starting in sync pass 8 (zfs_sync_pass_dont_compress), we disable + * compression (including of metadata). In practice, we don't have this + * many sync passes, so this has no effect. + * + * The original intent was that disabling compression would help the sync + * passes to converge. However, in practice disabling compression increases + * the average number of sync passes, because when we turn compression off, a + * lot of block's size will change and thus we have to re-allocate (not + * overwrite) them. It also increases the number of 128KB allocations (e.g. + * for indirect blocks and spacemaps) because these will not be compressed. + * The 128K allocations are especially detrimental to performance on highly + * fragmented systems, which may have very few free segments of this size, + * and may need to load new metaslabs to satisfy 128K allocations. + */ +int zfs_sync_pass_deferred_free = 2; /* defer frees starting in this pass */ +int zfs_sync_pass_dont_compress = 8; /* don't compress starting in this pass */ +int zfs_sync_pass_rewrite = 2; /* rewrite new bps starting in this pass */ + +/* + * An allocating zio is one that either currently has the DVA allocate + * stage set or will have it later in its lifetime. + */ +#define IO_IS_ALLOCATING(zio) ((zio)->io_orig_pipeline & ZIO_STAGE_DVA_ALLOCATE) + +/* + * Enable smaller cores by excluding metadata + * allocations as well. + */ +int zio_exclude_metadata = 0; +int zio_requeue_io_start_cut_in_line = 1; + +#ifdef ZFS_DEBUG +int zio_buf_debug_limit = 16384; +#else +int zio_buf_debug_limit = 0; +#endif + +static inline void __zio_execute(zio_t *zio); + +static void zio_taskq_dispatch(zio_t *, zio_taskq_type_t, boolean_t); + +void +zio_init(void) +{ + size_t c; + + zio_cache = kmem_cache_create("zio_cache", + sizeof (zio_t), 0, NULL, NULL, NULL, NULL, NULL, 0); + zio_link_cache = kmem_cache_create("zio_link_cache", + sizeof (zio_link_t), 0, NULL, NULL, NULL, NULL, NULL, 0); + + /* + * For small buffers, we want a cache for each multiple of + * SPA_MINBLOCKSIZE. For larger buffers, we want a cache + * for each quarter-power of 2. + */ + for (c = 0; c < SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; c++) { + size_t size = (c + 1) << SPA_MINBLOCKSHIFT; + size_t p2 = size; + size_t align = 0; + size_t data_cflags, cflags; + + data_cflags = KMC_NODEBUG; + cflags = (zio_exclude_metadata || size > zio_buf_debug_limit) ? + KMC_NODEBUG : 0; + +#if defined(_ILP32) && defined(_KERNEL) + /* + * Cache size limited to 1M on 32-bit platforms until ARC + * buffers no longer require virtual address space. + */ + if (size > zfs_max_recordsize) + break; +#endif + + while (!ISP2(p2)) + p2 &= p2 - 1; + +#ifndef _KERNEL + /* + * If we are using watchpoints, put each buffer on its own page, + * to eliminate the performance overhead of trapping to the + * kernel when modifying a non-watched buffer that shares the + * page with a watched buffer. + */ + if (arc_watch && !IS_P2ALIGNED(size, PAGESIZE)) + continue; + /* + * Here's the problem - on 4K native devices in userland on + * Linux using O_DIRECT, buffers must be 4K aligned or I/O + * will fail with EINVAL, causing zdb (and others) to coredump. + * Since userland probably doesn't need optimized buffer caches, + * we just force 4K alignment on everything. + */ + align = 8 * SPA_MINBLOCKSIZE; +#else + if (size < PAGESIZE) { + align = SPA_MINBLOCKSIZE; + } else if (IS_P2ALIGNED(size, p2 >> 2)) { + align = PAGESIZE; + } +#endif + + if (align != 0) { + char name[36]; + if (cflags == data_cflags) { + /* + * Resulting kmem caches would be identical. + * Save memory by creating only one. + */ + (void) snprintf(name, sizeof (name), + "zio_buf_comb_%lu", (ulong_t)size); + zio_buf_cache[c] = kmem_cache_create(name, + size, align, NULL, NULL, NULL, NULL, NULL, + cflags); + zio_data_buf_cache[c] = zio_buf_cache[c]; + continue; + } + (void) snprintf(name, sizeof (name), "zio_buf_%lu", + (ulong_t)size); + zio_buf_cache[c] = kmem_cache_create(name, size, + align, NULL, NULL, NULL, NULL, NULL, cflags); + + (void) snprintf(name, sizeof (name), "zio_data_buf_%lu", + (ulong_t)size); + zio_data_buf_cache[c] = kmem_cache_create(name, size, + align, NULL, NULL, NULL, NULL, NULL, data_cflags); + } + } + + while (--c != 0) { + ASSERT(zio_buf_cache[c] != NULL); + if (zio_buf_cache[c - 1] == NULL) + zio_buf_cache[c - 1] = zio_buf_cache[c]; + + ASSERT(zio_data_buf_cache[c] != NULL); + if (zio_data_buf_cache[c - 1] == NULL) + zio_data_buf_cache[c - 1] = zio_data_buf_cache[c]; + } + + zio_inject_init(); + + lz4_init(); +} + +void +zio_fini(void) +{ + size_t i, j, n; + kmem_cache_t *cache; + + n = SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT; + +#if defined(ZFS_DEBUG) && !defined(_KERNEL) + for (i = 0; i < n; i++) { + if (zio_buf_cache_allocs[i] != zio_buf_cache_frees[i]) + (void) printf("zio_fini: [%d] %llu != %llu\n", + (int)((i + 1) << SPA_MINBLOCKSHIFT), + (long long unsigned)zio_buf_cache_allocs[i], + (long long unsigned)zio_buf_cache_frees[i]); + } +#endif + + /* + * The same kmem cache can show up multiple times in both zio_buf_cache + * and zio_data_buf_cache. Do a wasteful but trivially correct scan to + * sort it out. + */ + for (i = 0; i < n; i++) { + cache = zio_buf_cache[i]; + if (cache == NULL) + continue; + for (j = i; j < n; j++) { + if (cache == zio_buf_cache[j]) + zio_buf_cache[j] = NULL; + if (cache == zio_data_buf_cache[j]) + zio_data_buf_cache[j] = NULL; + } + kmem_cache_destroy(cache); + } + + for (i = 0; i < n; i++) { + cache = zio_data_buf_cache[i]; + if (cache == NULL) + continue; + for (j = i; j < n; j++) { + if (cache == zio_data_buf_cache[j]) + zio_data_buf_cache[j] = NULL; + } + kmem_cache_destroy(cache); + } + + for (i = 0; i < n; i++) { + if (zio_buf_cache[i] != NULL) + panic("zio_fini: zio_buf_cache[%d] != NULL", (int)i); + if (zio_data_buf_cache[i] != NULL) + panic("zio_fini: zio_data_buf_cache[%d] != NULL", (int)i); + } + + kmem_cache_destroy(zio_link_cache); + kmem_cache_destroy(zio_cache); + + zio_inject_fini(); + + lz4_fini(); +} + +/* + * ========================================================================== + * Allocate and free I/O buffers + * ========================================================================== + */ + +/* + * Use zio_buf_alloc to allocate ZFS metadata. This data will appear in a + * crashdump if the kernel panics, so use it judiciously. Obviously, it's + * useful to inspect ZFS metadata, but if possible, we should avoid keeping + * excess / transient data in-core during a crashdump. + */ +void * +zio_buf_alloc(size_t size) +{ + size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; + + VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); +#if defined(ZFS_DEBUG) && !defined(_KERNEL) + atomic_add_64(&zio_buf_cache_allocs[c], 1); +#endif + + return (kmem_cache_alloc(zio_buf_cache[c], KM_PUSHPAGE)); +} + +/* + * Use zio_data_buf_alloc to allocate data. The data will not appear in a + * crashdump if the kernel panics. This exists so that we will limit the amount + * of ZFS data that shows up in a kernel crashdump. (Thus reducing the amount + * of kernel heap dumped to disk when the kernel panics) + */ +void * +zio_data_buf_alloc(size_t size) +{ + size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; + + VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); + + return (kmem_cache_alloc(zio_data_buf_cache[c], KM_PUSHPAGE)); +} + +void +zio_buf_free(void *buf, size_t size) +{ + size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; + + VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); +#if defined(ZFS_DEBUG) && !defined(_KERNEL) + atomic_add_64(&zio_buf_cache_frees[c], 1); +#endif + + kmem_cache_free(zio_buf_cache[c], buf); +} + +void +zio_data_buf_free(void *buf, size_t size) +{ + size_t c = (size - 1) >> SPA_MINBLOCKSHIFT; + + VERIFY3U(c, <, SPA_MAXBLOCKSIZE >> SPA_MINBLOCKSHIFT); + + kmem_cache_free(zio_data_buf_cache[c], buf); +} + +static void +zio_abd_free(void *abd, size_t size) +{ + abd_free((abd_t *)abd); +} + +/* + * ========================================================================== + * Push and pop I/O transform buffers + * ========================================================================== + */ +void +zio_push_transform(zio_t *zio, abd_t *data, uint64_t size, uint64_t bufsize, + zio_transform_func_t *transform) +{ + zio_transform_t *zt = kmem_alloc(sizeof (zio_transform_t), KM_SLEEP); + + zt->zt_orig_abd = zio->io_abd; + zt->zt_orig_size = zio->io_size; + zt->zt_bufsize = bufsize; + zt->zt_transform = transform; + + zt->zt_next = zio->io_transform_stack; + zio->io_transform_stack = zt; + + zio->io_abd = data; + zio->io_size = size; +} + +void +zio_pop_transforms(zio_t *zio) +{ + zio_transform_t *zt; + + while ((zt = zio->io_transform_stack) != NULL) { + if (zt->zt_transform != NULL) + zt->zt_transform(zio, + zt->zt_orig_abd, zt->zt_orig_size); + + if (zt->zt_bufsize != 0) + abd_free(zio->io_abd); + + zio->io_abd = zt->zt_orig_abd; + zio->io_size = zt->zt_orig_size; + zio->io_transform_stack = zt->zt_next; + + kmem_free(zt, sizeof (zio_transform_t)); + } +} + +/* + * ========================================================================== + * I/O transform callbacks for subblocks, decompression, and decryption + * ========================================================================== + */ +static void +zio_subblock(zio_t *zio, abd_t *data, uint64_t size) +{ + ASSERT(zio->io_size > size); + + if (zio->io_type == ZIO_TYPE_READ) + abd_copy(data, zio->io_abd, size); +} + +static void +zio_decompress(zio_t *zio, abd_t *data, uint64_t size) +{ + if (zio->io_error == 0) { + void *tmp = abd_borrow_buf(data, size); + int ret = zio_decompress_data(BP_GET_COMPRESS(zio->io_bp), + zio->io_abd, tmp, zio->io_size, size, + &zio->io_prop.zp_complevel); + abd_return_buf_copy(data, tmp, size); + + if (zio_injection_enabled && ret == 0) + ret = zio_handle_fault_injection(zio, EINVAL); + + if (ret != 0) + zio->io_error = SET_ERROR(EIO); + } +} + +static void +zio_decrypt(zio_t *zio, abd_t *data, uint64_t size) +{ + int ret; + void *tmp; + blkptr_t *bp = zio->io_bp; + spa_t *spa = zio->io_spa; + uint64_t dsobj = zio->io_bookmark.zb_objset; + uint64_t lsize = BP_GET_LSIZE(bp); + dmu_object_type_t ot = BP_GET_TYPE(bp); + uint8_t salt[ZIO_DATA_SALT_LEN]; + uint8_t iv[ZIO_DATA_IV_LEN]; + uint8_t mac[ZIO_DATA_MAC_LEN]; + boolean_t no_crypt = B_FALSE; + *** 5391 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Mar 21 01:39:33 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 482405BA868; Sun, 21 Mar 2021 01:39:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F30fs1CwRz3krV; Sun, 21 Mar 2021 01:39:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mx1.sbone.de (cross.sbone.de [195.201.62.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id E0F92286D7; Sun, 21 Mar 2021 01:39:32 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 82C898D4A172; Sun, 21 Mar 2021 01:39:30 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 5E376E707B3; Sun, 21 Mar 2021 01:39:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id pS2M2cTz4FsG; Sun, 21 Mar 2021 01:39:27 +0000 (UTC) Received: from [127.0.0.1] (unknown [IPv6:fde9:577b:c1a9:4902:79d8:45c4:6b20:2cd]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 7B3BBE707AF; Sun, 21 Mar 2021 01:39:27 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Emmanuel Vadot" , "Dr Robert N. M. Watson" 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 Date: Sun, 21 Mar 2021 01:39:24 +0000 X-Mailer: MailMate (2.0BETAr6151) Message-ID: <690AB8BF-69F3-465A-BB2F-F72145935195@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="UTF-8"; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 01:39:33 -0000 On 16 Mar 2021, at 6:13, Emmanuel Vadot wrote: Hi manu, Cc: rwatson > The branch main has been updated by manu: > > URL: = > https://cgit.FreeBSD.org/src/commit/?id=3D8c3eaf244a417a4ee105834410a52= 144206102e5 > > 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 =2E. > @@ -175,6 +193,11 @@ INCSGROUPS=3D INCS \ > VERIEXEC \ > WG > > +.if ${MK_AUDIT} !=3D "no" > +INCSGROUPS+=3D BSM > +INCSGROUPS+=3D SECAUDIT > +.endif > + > .if ${MK_IPFILTER} !=3D "no" > INCSGROUPS+=3D IPFILTER > .endif This breaks builds for WITHOUT_AUDIT=3D I believe. Files in libc = (gen/fstab.c) include sys/mount.h which includes sys/ucred.h which = unconditionally includes bsm/audit.h (and has been for a decade or more, = and so does sys/sysent.h) which now is not found anymore if audit is = turned off. I believe sys/ucred.h can be fixed: iff --git a/sys/sys/ucred.h b/sys/sys/ucred.h index 6a9becb54c7..b23374f48c9 100644 --- a/sys/sys/ucred.h +++ b/sys/sys/ucred.h @@ -38,8 +38,8 @@ #if defined(_KERNEL) || defined(_WANT_UCRED) #include #include -#endif #include +#endif struct loginclass; Sadly this won=E2=80=99t fix lib/libkvm/kvm_proc.c and = lib/libprocstat/libprocstat.c which define _WANT_UCRED and at least = kvm_proc.c and probably kdump and rpcgen consumers rely on sysent and = whatever else I missed with a quick look again which are not as easily = fixed. How do we check in kernel header files for user space build options to = be set correctly? That would actually not fix the problem for sysent.h = as we=E2=80=99d have a missing type. And for ucred with the places actua= lly = asking for it as well. Given we cannot change the size of these structs = I believe we have to unconditionally install at least audit.h (for now)? /bz From owner-dev-commits-src-all@freebsd.org Sun Mar 21 02:13:51 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B5B25BB03B; Sun, 21 Mar 2021 02:13: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 4F31QR3V9Jz3mQ3; Sun, 21 Mar 2021 02:13: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 6AB4212A73; Sun, 21 Mar 2021 02:13: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 12L2DphU016512; Sun, 21 Mar 2021 02:13:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12L2DpLG016511; Sun, 21 Mar 2021 02:13:51 GMT (envelope-from git) Date: Sun, 21 Mar 2021 02:13:51 GMT Message-Id: <202103210213.12L2DpLG016511@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: dc559c846d05 - stable/13 - fusefs: set d_off during VOP_READDIR MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: dc559c846d052ccb1996adcac2e6aba1675b4627 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 02:13:51 -0000 The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=dc559c846d052ccb1996adcac2e6aba1675b4627 commit dc559c846d052ccb1996adcac2e6aba1675b4627 Author: Alan Somers AuthorDate: 2021-02-12 01:01:10 +0000 Commit: Alan Somers CommitDate: 2021-03-21 02:00:33 +0000 fusefs: set d_off during VOP_READDIR This allows d_off to be used with lseek to position the file so that getdirentries(2) will return the next entry. It is not used by readdir(3). PR: 253411 Reported by: John Millikin Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D28605 (cherry picked from commit 71befc35061b3c9d8cc07e34c5dce622c848fcdb) --- sys/fs/fuse/fuse_internal.c | 13 ++++---- tests/sys/fs/fusefs/Makefile | 3 ++ tests/sys/fs/fusefs/readdir.cc | 74 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 74 insertions(+), 16 deletions(-) diff --git a/sys/fs/fuse/fuse_internal.c b/sys/fs/fuse/fuse_internal.c index 60f9a7319e00..a5f646e5f449 100644 --- a/sys/fs/fuse/fuse_internal.c +++ b/sys/fs/fuse/fuse_internal.c @@ -583,7 +583,7 @@ fuse_internal_readdir_processdata(struct uio *uio, u_long **cookiesp) { int err = 0; - int bytesavail; + int oreclen; size_t freclen; struct dirent *de; @@ -620,10 +620,10 @@ fuse_internal_readdir_processdata(struct uio *uio, err = EINVAL; break; } - bytesavail = GENERIC_DIRSIZ((struct pseudo_dirent *) + oreclen = GENERIC_DIRSIZ((struct pseudo_dirent *) &fudge->namelen); - if (bytesavail > uio_resid(uio)) { + if (oreclen > uio_resid(uio)) { /* Out of space for the dir so we are done. */ err = -1; break; @@ -633,12 +633,13 @@ fuse_internal_readdir_processdata(struct uio *uio, * the requested offset in the directory is found. */ if (*fnd_start != 0) { - fiov_adjust(cookediov, bytesavail); - bzero(cookediov->base, bytesavail); + fiov_adjust(cookediov, oreclen); + bzero(cookediov->base, oreclen); de = (struct dirent *)cookediov->base; de->d_fileno = fudge->ino; - de->d_reclen = bytesavail; + de->d_off = fudge->off; + de->d_reclen = oreclen; de->d_type = fudge->type; de->d_namlen = fudge->namelen; memcpy((char *)cookediov->base + sizeof(struct dirent) - diff --git a/tests/sys/fs/fusefs/Makefile b/tests/sys/fs/fusefs/Makefile index 2c858ff42dd1..832b30dc6911 100644 --- a/tests/sys/fs/fusefs/Makefile +++ b/tests/sys/fs/fusefs/Makefile @@ -71,6 +71,9 @@ FUSEFS= ${SRCTOP}/sys/fs/fuse MOUNT= ${SRCTOP}/sbin/mount # Suppress warnings that GCC generates for the libc++ and gtest headers. CXXWARNFLAGS.gcc+= -Wno-placement-new -Wno-attributes +# Suppress Wcast-align for readdir.cc, because it is unavoidable when using +# getdirentries. +CXXWARNFLAGS.readdir.cc+= -Wno-cast-align .if ${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 80000 CXXWARNFLAGS+= -Wno-class-memaccess .endif diff --git a/tests/sys/fs/fusefs/readdir.cc b/tests/sys/fs/fusefs/readdir.cc index 8f0b9742890e..b6b807f350e9 100644 --- a/tests/sys/fs/fusefs/readdir.cc +++ b/tests/sys/fs/fusefs/readdir.cc @@ -62,6 +62,9 @@ void expect_lookup(const char *relpath, uint64_t ino) } }; +const char dot[] = "."; +const char dotdot[] = ".."; + /* FUSE_READDIR returns nothing but "." and ".." */ TEST_F(Readdir, dots) { @@ -72,8 +75,6 @@ TEST_F(Readdir, dots) struct dirent *de; vector ents(2); vector empty_ents(0); - const char dot[] = "."; - const char dotdot[] = ".."; expect_lookup(RELPATH, ino); expect_opendir(ino); @@ -98,11 +99,6 @@ TEST_F(Readdir, dots) de = readdir(dir); ASSERT_NE(nullptr, de) << strerror(errno); EXPECT_EQ(2ul, de->d_fileno); - /* - * fuse(4) doesn't actually set d_off, which is ok for now because - * nothing uses it. - */ - //EXPECT_EQ(2000, de->d_off); EXPECT_EQ(DT_DIR, de->d_type); EXPECT_EQ(sizeof(dotdot), de->d_namlen); EXPECT_EQ(0, strcmp(dotdot, de->d_name)); @@ -111,7 +107,6 @@ TEST_F(Readdir, dots) de = readdir(dir); ASSERT_NE(nullptr, de) << strerror(errno); EXPECT_EQ(3ul, de->d_fileno); - //EXPECT_EQ(3000, de->d_off); EXPECT_EQ(DT_DIR, de->d_type); EXPECT_EQ(sizeof(dot), de->d_namlen); EXPECT_EQ(0, strcmp(dot, de->d_name)); @@ -153,8 +148,11 @@ TEST_F(Readdir, eio) leakdir(dir); } -/* getdirentries(2) can use a larger buffer size than readdir(3) */ -TEST_F(Readdir, getdirentries) +/* + * getdirentries(2) can use a larger buffer size than readdir(3). It also has + * some additional non-standardized fields in the returned dirent. + */ +TEST_F(Readdir, getdirentries_empty) { const char FULLPATH[] = "mountpoint/some_dir"; const char RELPATH[] = "some_dir"; @@ -186,6 +184,62 @@ TEST_F(Readdir, getdirentries) leak(fd); } +/* + * The dirent.d_off field can be used with lseek to position the directory so + * that getdirentries will return the subsequent dirent. + */ +TEST_F(Readdir, getdirentries_seek) +{ + const char FULLPATH[] = "mountpoint/some_dir"; + const char RELPATH[] = "some_dir"; + vector ents0(2); + vector ents1(1); + uint64_t ino = 42; + int fd; + const size_t bufsize = 8192; + char buf[bufsize]; + struct dirent *de0, *de1; + ssize_t r; + + expect_lookup(RELPATH, ino); + expect_opendir(ino); + + ents0[0].d_fileno = 2; + ents0[0].d_off = 2000; + ents0[0].d_namlen = sizeof(dotdot); + ents0[0].d_type = DT_DIR; + strncpy(ents0[0].d_name, dotdot, ents0[0].d_namlen); + expect_readdir(ino, 0, ents0); + ents0[1].d_fileno = 3; + ents0[1].d_off = 3000; + ents0[1].d_namlen = sizeof(dot); + ents0[1].d_type = DT_DIR; + ents1[0].d_fileno = 3; + ents1[0].d_off = 3000; + ents1[0].d_namlen = sizeof(dot); + ents1[0].d_type = DT_DIR; + strncpy(ents1[0].d_name, dot, ents1[0].d_namlen); + expect_readdir(ino, 0, ents0); + expect_readdir(ino, 2000, ents1); + + fd = open(FULLPATH, O_DIRECTORY); + ASSERT_LE(0, fd) << strerror(errno); + r = getdirentries(fd, buf, sizeof(buf), 0); + ASSERT_LT(0, r) << strerror(errno); + de0 = (struct dirent*)&buf[0]; + ASSERT_EQ(2000, de0->d_off); + ASSERT_LT(de0->d_reclen + offsetof(struct dirent, d_fileno), bufsize); + de1 = (struct dirent*)(&(buf[de0->d_reclen])); + ASSERT_EQ(3ul, de1->d_fileno); + + r = lseek(fd, de0->d_off, SEEK_SET); + ASSERT_LE(0, r); + r = getdirentries(fd, buf, sizeof(buf), 0); + ASSERT_LT(0, r) << strerror(errno); + de0 = (struct dirent*)&buf[0]; + ASSERT_EQ(3000, de0->d_off); +} + /* * Nothing bad should happen if getdirentries is called on two file descriptors * which were concurrently open, but one has already been closed. From owner-dev-commits-src-all@freebsd.org Sun Mar 21 02:21:04 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6603D5BB68C; Sun, 21 Mar 2021 02: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 4F31Zm2WY1z3n7W; Sun, 21 Mar 2021 02: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 4973212B69; Sun, 21 Mar 2021 02: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 12L2L415028148; Sun, 21 Mar 2021 02: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 12L2L4j5028147; Sun, 21 Mar 2021 02:21:04 GMT (envelope-from git) Date: Sun, 21 Mar 2021 02:21:04 GMT Message-Id: <202103210221.12L2L4j5028147@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: aa9ff8f76041 - stable/13 - fortune: add a tip about gstat MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: aa9ff8f7604102bbb28c6b72618c176d7f2c09af Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 02:21:04 -0000 The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=aa9ff8f7604102bbb28c6b72618c176d7f2c09af commit aa9ff8f7604102bbb28c6b72618c176d7f2c09af Author: Alan Somers AuthorDate: 2021-02-26 15:06:07 +0000 Commit: Alan Somers CommitDate: 2021-03-21 02:15:05 +0000 fortune: add a tip about gstat (cherry picked from commit 60a632f047cdb6e5314711f593a4d3b1f1d8dde9) --- usr.bin/fortune/datfiles/freebsd-tips | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/usr.bin/fortune/datfiles/freebsd-tips b/usr.bin/fortune/datfiles/freebsd-tips index 3325fdce090f..46f5ec31f8d6 100644 --- a/usr.bin/fortune/datfiles/freebsd-tips +++ b/usr.bin/fortune/datfiles/freebsd-tips @@ -799,3 +799,9 @@ always have space left this way. -- Benedict Reuschling % +Sometimes a single slow HDD can cripple the performance of your entire system. You can spot one like this: + +# gstat -I5s | sort -rn -k9 | head + + -- Alan Somers +% From owner-dev-commits-src-all@freebsd.org Sun Mar 21 02:29:46 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 62C7A5BB4D7; Sun, 21 Mar 2021 02:29: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 4F31mp2PCRz3nBy; Sun, 21 Mar 2021 02:29: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 4116A12F1A; Sun, 21 Mar 2021 02:29: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 12L2Tk7E031122; Sun, 21 Mar 2021 02:29:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12L2TkHY031121; Sun, 21 Mar 2021 02:29:46 GMT (envelope-from git) Date: Sun, 21 Mar 2021 02:29:46 GMT Message-Id: <202103210229.12L2TkHY031121@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Jason A. Harmening" Subject: git: d22883d71544 - main - Remove PCPU_INC MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jah X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: d22883d715440f743ab427396f0a87b72e724d18 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 02:29:46 -0000 The branch main has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=d22883d715440f743ab427396f0a87b72e724d18 commit d22883d715440f743ab427396f0a87b72e724d18 Author: Jason A. Harmening AuthorDate: 2021-03-10 04:43:01 +0000 Commit: Jason A. Harmening CommitDate: 2021-03-21 02:23:59 +0000 Remove PCPU_INC e4b8deb22227 removed the last in-tree uses of PCPU_INC(). Its potential benefit is also practically nonexistent. Non-x86 platforms already implement it as PCPU_ADD(..., 1), and according to [0] there are no recent x86 processors for which the 'inc' instruction provides a performance benefit over the equivalent memory-operand form of the 'add' instruction. The only remaining benefit of 'inc' is smaller instruction size, which in this case is inconsequential given the limited number of per-CPU data consumers. [0]: https://www.agner.org/optimize/instruction_tables.pdf Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D29308 --- sys/amd64/include/pcpu.h | 29 ----------------------------- sys/arm/include/pcpu.h | 1 - sys/arm64/include/pcpu.h | 1 - sys/i386/include/pcpu.h | 24 ------------------------ sys/mips/include/pcpu.h | 1 - sys/powerpc/include/pcpu.h | 1 - sys/riscv/include/pcpu.h | 1 - 7 files changed, 58 deletions(-) diff --git a/sys/amd64/include/pcpu.h b/sys/amd64/include/pcpu.h index 6326fbdae0be..dc99d4249bd2 100644 --- a/sys/amd64/include/pcpu.h +++ b/sys/amd64/include/pcpu.h @@ -179,34 +179,6 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); *__PCPU_PTR(name) += __val; \ } while (0) -/* - * Increments the value of the per-cpu counter name. The implementation - * must be atomic with respect to interrupts. - */ -#define __PCPU_INC(name) do { \ - CTASSERT(sizeof(__pcpu_type(name)) == 1 || \ - sizeof(__pcpu_type(name)) == 2 || \ - sizeof(__pcpu_type(name)) == 4 || \ - sizeof(__pcpu_type(name)) == 8); \ - if (sizeof(__pcpu_type(name)) == 1) { \ - __asm __volatile("incb %%gs:%0" \ - : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\ - : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\ - } else if (sizeof(__pcpu_type(name)) == 2) { \ - __asm __volatile("incw %%gs:%0" \ - : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\ - : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\ - } else if (sizeof(__pcpu_type(name)) == 4) { \ - __asm __volatile("incl %%gs:%0" \ - : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\ - : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\ - } else if (sizeof(__pcpu_type(name)) == 8) { \ - __asm __volatile("incq %%gs:%0" \ - : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\ - : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\ - } \ -} while (0) - /* * Sets the value of the per-cpu variable name to value val. */ @@ -239,7 +211,6 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); #define PCPU_GET(member) __PCPU_GET(pc_ ## member) #define PCPU_ADD(member, val) __PCPU_ADD(pc_ ## member, val) -#define PCPU_INC(member) __PCPU_INC(pc_ ## member) #define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) diff --git a/sys/arm/include/pcpu.h b/sys/arm/include/pcpu.h index 4d609b10bf73..2353b1d06b17 100644 --- a/sys/arm/include/pcpu.h +++ b/sys/arm/include/pcpu.h @@ -136,7 +136,6 @@ set_tls(void *tls) #define PCPU_GET(member) (get_pcpu()->pc_ ## member) #define PCPU_ADD(member, value) (get_pcpu()->pc_ ## member += (value)) -#define PCPU_INC(member) PCPU_ADD(member, 1) #define PCPU_PTR(member) (&get_pcpu()->pc_ ## member) #define PCPU_SET(member,value) (get_pcpu()->pc_ ## member = (value)) diff --git a/sys/arm64/include/pcpu.h b/sys/arm64/include/pcpu.h index ce4dc46e1609..09f6361c651c 100644 --- a/sys/arm64/include/pcpu.h +++ b/sys/arm64/include/pcpu.h @@ -73,7 +73,6 @@ get_curthread(void) #define PCPU_GET(member) (pcpup->pc_ ## member) #define PCPU_ADD(member, value) (pcpup->pc_ ## member += (value)) -#define PCPU_INC(member) PCPU_ADD(member, 1) #define PCPU_PTR(member) (&pcpup->pc_ ## member) #define PCPU_SET(member,value) (pcpup->pc_ ## member = (value)) diff --git a/sys/i386/include/pcpu.h b/sys/i386/include/pcpu.h index 9e65d179dc36..a4c7968ea85f 100644 --- a/sys/i386/include/pcpu.h +++ b/sys/i386/include/pcpu.h @@ -169,29 +169,6 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); *__PCPU_PTR(name) += __val; \ } while (0) -/* - * Increments the value of the per-cpu counter name. The implementation - * must be atomic with respect to interrupts. - */ -#define __PCPU_INC(name) do { \ - CTASSERT(sizeof(__pcpu_type(name)) == 1 || \ - sizeof(__pcpu_type(name)) == 2 || \ - sizeof(__pcpu_type(name)) == 4); \ - if (sizeof(__pcpu_type(name)) == 1) { \ - __asm __volatile("incb %%fs:%0" \ - : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\ - : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\ - } else if (sizeof(__pcpu_type(name)) == 2) { \ - __asm __volatile("incw %%fs:%0" \ - : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\ - : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\ - } else if (sizeof(__pcpu_type(name)) == 4) { \ - __asm __volatile("incl %%fs:%0" \ - : "=m" (*(__pcpu_type(name) *)(__pcpu_offset(name)))\ - : "m" (*(__pcpu_type(name) *)(__pcpu_offset(name))));\ - } \ -} while (0) - /* * Sets the value of the per-cpu variable name to value val. */ @@ -224,7 +201,6 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); #define PCPU_GET(member) __PCPU_GET(pc_ ## member) #define PCPU_ADD(member, val) __PCPU_ADD(pc_ ## member, val) -#define PCPU_INC(member) __PCPU_INC(pc_ ## member) #define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) diff --git a/sys/mips/include/pcpu.h b/sys/mips/include/pcpu.h index fea594729e90..879f2d8afb90 100644 --- a/sys/mips/include/pcpu.h +++ b/sys/mips/include/pcpu.h @@ -83,7 +83,6 @@ extern struct pcpu *pcpup; #define PCPU_ADD(member, value) (PCPUP->pc_ ## member += (value)) #define PCPU_GET(member) (PCPUP->pc_ ## member) -#define PCPU_INC(member) PCPU_ADD(member, 1) #define PCPU_PTR(member) (&PCPUP->pc_ ## member) #define PCPU_SET(member,value) (PCPUP->pc_ ## member = (value)) #define PCPU_LAZY_INC(member) (++PCPUP->pc_ ## member) diff --git a/sys/powerpc/include/pcpu.h b/sys/powerpc/include/pcpu.h index 31c4b2c47c70..288e12c1f2ab 100644 --- a/sys/powerpc/include/pcpu.h +++ b/sys/powerpc/include/pcpu.h @@ -168,7 +168,6 @@ __curthread(void) * with respect to preemption. */ #define PCPU_ADD(member, value) (pcpup->pc_ ## member += (value)) -#define PCPU_INC(member) PCPU_ADD(member, 1) #define PCPU_PTR(member) (&pcpup->pc_ ## member) #define PCPU_SET(member,value) (pcpup->pc_ ## member = (value)) diff --git a/sys/riscv/include/pcpu.h b/sys/riscv/include/pcpu.h index 5068596462fc..af5eb6fd5c41 100644 --- a/sys/riscv/include/pcpu.h +++ b/sys/riscv/include/pcpu.h @@ -79,7 +79,6 @@ get_curthread(void) #define PCPU_GET(member) (get_pcpu()->pc_ ## member) #define PCPU_ADD(member, value) (get_pcpu()->pc_ ## member += (value)) -#define PCPU_INC(member) PCPU_ADD(member, 1) #define PCPU_PTR(member) (&get_pcpu()->pc_ ## member) #define PCPU_SET(member,value) (get_pcpu()->pc_ ## member = (value)) From owner-dev-commits-src-all@freebsd.org Sun Mar 21 04:13:21 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 069945BD7DB; Sun, 21 Mar 2021 04:13: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 4F344J6jVsz3tL9; Sun, 21 Mar 2021 04:13: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 D78C014659; Sun, 21 Mar 2021 04:13: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 12L4DKLf085515; Sun, 21 Mar 2021 04:13:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12L4DKSS085514; Sun, 21 Mar 2021 04:13:20 GMT (envelope-from git) Date: Sun, 21 Mar 2021 04:13:20 GMT Message-Id: <202103210413.12L4DKSS085514@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alan Somers Subject: git: 2d1c164591ff - stable/13 - Speed up geom_stats_resync in the presence of many devices MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: asomers X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 2d1c164591ff5993cfca4b1190a345e40529593f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 04:13:21 -0000 The branch stable/13 has been updated by asomers: URL: https://cgit.FreeBSD.org/src/commit/?id=2d1c164591ff5993cfca4b1190a345e40529593f commit 2d1c164591ff5993cfca4b1190a345e40529593f Author: Alan Somers AuthorDate: 2021-02-27 15:59:40 +0000 Commit: Alan Somers CommitDate: 2021-03-21 02:23:42 +0000 Speed up geom_stats_resync in the presence of many devices The old code had a O(n) loop, where n is the size of /dev/devstat. Multiply that by another O(n) loop in devstat_mmap for a total of O(n^2). This change adds DIOCGMEDIASIZE support to /dev/devstat so userland can quickly determine the right amount of memory to map, eliminating the O(n) loop in userland. This change decreases the time to run "gstat -bI0.001" with 16,384 md devices from 29.7s to 4.2s. Also, fix a memory leak first reported as PR 203097. Sponsored by: Axcient Reviewed by: mav, imp Differential Revision: https://reviews.freebsd.org/D28968 (cherry picked from commit ab63da3564e8ab0907f9d8eb565774848ffdadeb) --- lib/libgeom/geom_stats.c | 26 +++++++++++++++++--------- sys/kern/subr_devstat.c | 21 +++++++++++++++++++++ 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/lib/libgeom/geom_stats.c b/lib/libgeom/geom_stats.c index ebf7868c3c65..450ee491ea1c 100644 --- a/lib/libgeom/geom_stats.c +++ b/lib/libgeom/geom_stats.c @@ -32,9 +32,12 @@ */ #include +#include +#include #include #include #include +#include #include #include #include @@ -53,7 +56,7 @@ geom_stats_close(void) { if (statsfd == -1) return; - munmap(statp, npages *pagesize); + munmap(statp, npages * pagesize); statp = NULL; close (statsfd); statsfd = -1; @@ -63,17 +66,22 @@ void geom_stats_resync(void) { void *p; + off_t mediasize; + int error; if (statsfd == -1) return; - for (;;) { - p = mmap(statp, (npages + 1) * pagesize, - PROT_READ, MAP_SHARED, statsfd, 0); - if (p == MAP_FAILED) - break; - else - statp = p; - npages++; + error = ioctl(statsfd, DIOCGMEDIASIZE, &mediasize); + if (error) + err(1, "DIOCGMEDIASIZE(" _PATH_DEV DEVSTAT_DEVICE_NAME ")"); + + munmap(statp, npages * pagesize); + p = mmap(statp, mediasize, PROT_READ, MAP_SHARED, statsfd, 0); + if (p == MAP_FAILED) + err(1, "mmap(/dev/devstat):"); + else { + statp = p; + npages = mediasize / pagesize; } } diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index 091164a11fcf..98a41fd179c2 100644 --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -473,10 +474,12 @@ SYSCTL_INT(_kern_devstat, OID_AUTO, version, CTLFLAG_RD, #define statsperpage (PAGE_SIZE / sizeof(struct devstat)) +static d_ioctl_t devstat_ioctl; static d_mmap_t devstat_mmap; static struct cdevsw devstat_cdevsw = { .d_version = D_VERSION, + .d_ioctl = devstat_ioctl, .d_mmap = devstat_mmap, .d_name = "devstat", }; @@ -487,9 +490,26 @@ struct statspage { u_int nfree; }; +static size_t pagelist_pages = 0; static TAILQ_HEAD(, statspage) pagelist = TAILQ_HEAD_INITIALIZER(pagelist); static MALLOC_DEFINE(M_DEVSTAT, "devstat", "Device statistics"); +static int +devstat_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, + struct thread *td) +{ + int error = ENOTTY; + + switch (cmd) { + case DIOCGMEDIASIZE: + error = 0; + *(off_t *)data = pagelist_pages * PAGE_SIZE; + break; + } + + return (error); +} + static int devstat_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, int nprot, vm_memattr_t *memattr) @@ -556,6 +576,7 @@ devstat_alloc(void) * head but the order on the list determine the * sequence of the mapping so we can't do that. */ + pagelist_pages++; TAILQ_INSERT_TAIL(&pagelist, spp, list); } else break; From owner-dev-commits-src-all@freebsd.org Sun Mar 21 05:34:41 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A16A5BEFC1; Sun, 21 Mar 2021 05:34: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 4F35t92FRRz4S4s; Sun, 21 Mar 2021 05:34: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 314DA157E5; Sun, 21 Mar 2021 05:34: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 12L5Yf7E097164; Sun, 21 Mar 2021 05:34:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12L5YfAu097163; Sun, 21 Mar 2021 05:34:41 GMT (envelope-from git) Date: Sun, 21 Mar 2021 05:34:41 GMT Message-Id: <202103210534.12L5YfAu097163@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 925f44f33862 - stable/12 - Complete LOCAL_PEERCRED support. Cache pid of the remote process in the struct xucred. Do not bump XUCRED_VERSION as struct layout is not changed. 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 925f44f33862908f9a2e72520a17af148c7d0db5 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 05:34:41 -0000 The branch stable/12 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=925f44f33862908f9a2e72520a17af148c7d0db5 commit 925f44f33862908f9a2e72520a17af148c7d0db5 Author: Dmitry Chagin AuthorDate: 2019-05-30 14:24:26 +0000 Commit: Dmitry Chagin CommitDate: 2021-03-21 05:33:42 +0000 Complete LOCAL_PEERCRED support. Cache pid of the remote process in the struct xucred. Do not bump XUCRED_VERSION as struct layout is not changed. PR: 215202 Differential Revision: https://reviews.freebsd.org/D20415 (cherry picked from commit c5afec6e895a11c64f58eb99e493adb8ad5dc361) --- crypto/heimdal/lib/ipc/server.c | 2 +- share/man/man4/unix.4 | 1 + sys/compat/linux/linux_socket.c | 5 +---- sys/kern/kern_prot.c | 8 ++++++++ sys/kern/uipc_usrreq.c | 8 ++++---- sys/sys/ucred.h | 7 ++++++- usr.sbin/mountd/mountd.c | 2 +- 7 files changed, 22 insertions(+), 11 deletions(-) diff --git a/crypto/heimdal/lib/ipc/server.c b/crypto/heimdal/lib/ipc/server.c index e4cb03ce2753..7b5b49ec019c 100644 --- a/crypto/heimdal/lib/ipc/server.c +++ b/crypto/heimdal/lib/ipc/server.c @@ -550,7 +550,7 @@ update_client_creds(struct client *c) { c->unixrights.uid = peercred.cr_uid; c->unixrights.gid = peercred.cr_gid; - c->unixrights.pid = 0; + c->unixrights.pid = peercred.cr_pid; return 1; } } diff --git a/share/man/man4/unix.4 b/share/man/man4/unix.4 index ca7dc903f73e..569e6dd25208 100644 --- a/share/man/man4/unix.4 +++ b/share/man/man4/unix.4 @@ -312,6 +312,7 @@ struct xucred { uid_t cr_uid; /* effective user id */ short cr_ngroups; /* number of groups */ gid_t cr_groups[XU_NGROUPS]; /* groups */ + pid_t cr_pid; /* process id of the sending process */ }; .Ed The diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index 3d0de9838339..6007d9dc726b 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -1538,10 +1538,7 @@ linux_getsockopt(struct thread *td, struct linux_getsockopt_args *args) name, &xu, UIO_SYSSPACE, &xulen); if (error != 0) return (error); - /* - * XXX Use 0 for pid as the FreeBSD does not cache peer pid. - */ - lxu.pid = 0; + lxu.pid = xu.cr_pid; lxu.uid = xu.cr_uid; lxu.gid = xu.cr_gid; return (copyout(&lxu, PTRIN(args->optval), sizeof(lxu))); diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index 0f4814c59e78..b276540ec8d5 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1931,6 +1931,14 @@ cru2x(struct ucred *cr, struct xucred *xcr) ngroups * sizeof(*cr->cr_groups)); } +void inline +cru2xt(struct thread *td, struct xucred *xcr) +{ + + cru2x(td->td_ucred, xcr); + xcr->cr_pid = td->td_proc->p_pid; +} + /* * Set initial process credentials. * Callers are responsible for providing the reference for provided credentials. diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index ade65c01c471..25f27837d6d5 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -892,7 +892,7 @@ uipc_listen(struct socket *so, int backlog, struct thread *td) SOCK_LOCK(so); error = solisten_proto_check(so); if (error == 0) { - cru2x(td->td_ucred, &unp->unp_peercred); + cru2xt(td, &unp->unp_peercred); solisten_proto(so, backlog); } SOCK_UNLOCK(so); @@ -1638,7 +1638,7 @@ void unp_copy_peercred(struct thread *td, struct unpcb *client_unp, struct unpcb *server_unp, struct unpcb *listen_unp) { - cru2x(td->td_ucred, &client_unp->unp_peercred); + cru2xt(td, &client_unp->unp_peercred); client_unp->unp_flags |= UNP_HAVEPC; memcpy(&server_unp->unp_peercred, &listen_unp->unp_peercred, @@ -2812,8 +2812,8 @@ db_print_xucred(int indent, struct xucred *xu) int comma, i; db_print_indent(indent); - db_printf("cr_version: %u cr_uid: %u cr_ngroups: %d\n", - xu->cr_version, xu->cr_uid, xu->cr_ngroups); + db_printf("cr_version: %u cr_uid: %u cr_pid: %d cr_ngroups: %d\n", + xu->cr_version, xu->cr_uid, xu->cr_pid, xu->cr_ngroups); db_print_indent(indent); db_printf("cr_groups: "); comma = 0; diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h index e2e0c998bff8..f7079ad92c1c 100644 --- a/sys/sys/ucred.h +++ b/sys/sys/ucred.h @@ -87,10 +87,14 @@ struct xucred { uid_t cr_uid; /* effective user id */ short cr_ngroups; /* number of groups */ gid_t cr_groups[XU_NGROUPS]; /* groups */ - void *_cr_unused1; /* compatibility with old ucred */ + union { + void *_cr_unused1; /* compatibility with old ucred */ + pid_t _pid; + } _cr; }; #define XUCRED_VERSION 0 +#define cr_pid _cr._pid /* This can be used for both ucred and xucred structures. */ #define cr_gid cr_groups[0] @@ -114,6 +118,7 @@ void crfree(struct ucred *cr); struct ucred *crget(void); struct ucred *crhold(struct ucred *cr); void cru2x(struct ucred *cr, struct xucred *xcr); +void cru2xt(struct thread *td, struct xucred *xcr); void crsetgroups(struct ucred *cr, int n, gid_t *groups); int groupmember(gid_t gid, struct ucred *cred); #endif /* _KERNEL */ diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 2ea9516246c0..2936a1962a33 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -273,7 +273,7 @@ static struct xucred def_anon = { (uid_t)65534, 1, { (gid_t)65533 }, - NULL + { NULL } }; static int force_v2 = 0; static int resvport_only = 1; From owner-dev-commits-src-all@freebsd.org Sun Mar 21 05:35:36 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53E905BF12F; Sun, 21 Mar 2021 05:35: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 4F35vD1xY8z4SJm; Sun, 21 Mar 2021 05:35: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 3569F154D2; Sun, 21 Mar 2021 05:35: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 12L5ZaM3097413; Sun, 21 Mar 2021 05:35:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12L5ZaRE097412; Sun, 21 Mar 2021 05:35:36 GMT (envelope-from git) Date: Sun, 21 Mar 2021 05:35:36 GMT Message-Id: <202103210535.12L5ZaRE097412@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 3430e229287c - stable/12 - Remove wrong inline keyword. 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 3430e229287ce440f834e023bb33bb21a666fc0f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 05:35:36 -0000 The branch stable/12 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=3430e229287ce440f834e023bb33bb21a666fc0f commit 3430e229287ce440f834e023bb33bb21a666fc0f Author: Dmitry Chagin AuthorDate: 2019-05-30 16:11:20 +0000 Commit: Dmitry Chagin CommitDate: 2021-03-21 05:35:11 +0000 Remove wrong inline keyword. Reported by: markj MFC after: 1 week (cherry picked from commit c8124e20e5493651b5adca11c0c796cdcf5b2696) --- sys/kern/kern_prot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/kern_prot.c b/sys/kern/kern_prot.c index b276540ec8d5..681718d571d2 100644 --- a/sys/kern/kern_prot.c +++ b/sys/kern/kern_prot.c @@ -1931,7 +1931,7 @@ cru2x(struct ucred *cr, struct xucred *xcr) ngroups * sizeof(*cr->cr_groups)); } -void inline +void cru2xt(struct thread *td, struct xucred *xcr) { From owner-dev-commits-src-all@freebsd.org Sun Mar 21 06:08:09 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CD98D5BFB16; Sun, 21 Mar 2021 06:08: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 4F36cn5NsVz4Tcr; Sun, 21 Mar 2021 06:08: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 AC28815B2C; Sun, 21 Mar 2021 06:08: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 12L689L4040300; Sun, 21 Mar 2021 06:08:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12L689UT040299; Sun, 21 Mar 2021 06:08:09 GMT (envelope-from git) Date: Sun, 21 Mar 2021 06:08:09 GMT Message-Id: <202103210608.12L689UT040299@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 2c31ae65cd92 - stable/12 - Merge tcsh 6.22.03-ceccc7f 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 2c31ae65cd9271eaf24da4fbd8f508af75e62a13 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 06:08:09 -0000 The branch stable/12 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=2c31ae65cd9271eaf24da4fbd8f508af75e62a13 commit 2c31ae65cd9271eaf24da4fbd8f508af75e62a13 Author: Dmitry Chagin AuthorDate: 2021-03-14 16:33:13 +0000 Commit: Dmitry Chagin CommitDate: 2021-03-21 06:07:18 +0000 Merge tcsh 6.22.03-ceccc7f PR: 252663 (cherry picked from commit 5224c2a3bc95b431f729f3692f264395248d8acc) --- contrib/tcsh/FAQ | 339 ++-- contrib/tcsh/Fixes | 23 + contrib/tcsh/Imakefile | 14 +- contrib/tcsh/Makefile.ADMIN | 24 + contrib/tcsh/Makefile.in | 11 +- contrib/tcsh/Makefile.std | 2 +- contrib/tcsh/Makefile.vms | 2 +- contrib/tcsh/README.md | 9 +- contrib/tcsh/configure | 3803 +++++++++++++++++++++++++------------------ contrib/tcsh/dot.login | 12 + contrib/tcsh/dot.tcshrc | 110 ++ contrib/tcsh/ed.chared.c | 18 +- contrib/tcsh/ed.inputl.c | 2 +- contrib/tcsh/ed.screen.c | 2 +- contrib/tcsh/ed.xmap.c | 2 +- contrib/tcsh/host.defs | 2 +- contrib/tcsh/patchlevel.h | 6 +- contrib/tcsh/sh.c | 17 +- contrib/tcsh/sh.dir.c | 41 +- contrib/tcsh/sh.dol.c | 132 +- contrib/tcsh/sh.exp.c | 2 +- contrib/tcsh/sh.func.c | 5 +- contrib/tcsh/sh.glob.c | 11 +- contrib/tcsh/sh.h | 6 +- contrib/tcsh/sh.hist.c | 10 +- contrib/tcsh/sh.lex.c | 47 +- contrib/tcsh/sh.misc.c | 21 +- contrib/tcsh/sh.set.c | 14 +- contrib/tcsh/tc.alloc.c | 10 + contrib/tcsh/tc.disc.c | 4 + contrib/tcsh/tc.os.c | 2 +- contrib/tcsh/tc.prompt.c | 2 +- contrib/tcsh/tcsh.man | 21 +- contrib/tcsh/tcsh.man.new | 64 +- contrib/tcsh/tw.parse.c | 4 +- 35 files changed, 2855 insertions(+), 1939 deletions(-) diff --git a/contrib/tcsh/FAQ b/contrib/tcsh/FAQ index 92aadc726683..93773c52433a 100644 --- a/contrib/tcsh/FAQ +++ b/contrib/tcsh/FAQ @@ -1,237 +1,190 @@ + * Home + * FAQ + * Y2K + __________________________________________________________________ - [Home] FAQ +FAQ - Home | RecentChanges | Preferences - _________________________________________________________________ + For the people who do not read the manual! - This is for people who do not read the manual! + Why is the meta key broken in tcsh-5.20 and up? - So far people who don't read manuals don't read this either... I may - call it README.*PLEASE* in the future, but then the same people won't - be able to get ftp it... :-) - _________________________________________________________________ - - 1. Where can I find tcsh sources? - - See http://www.tcsh.org/MostRecentRelease for download locations. - _________________________________________________________________ - - 2. Why is the meta key broken in tcsh-5.20 and up? - - On some machines the tty is not set up to pass 8 bit characters by - default. Tcsh 5.19 used to try to determine if pass8 should be set by + On some machines the tty is not set up to pass 8 bit characters by + default. Tcsh 5.19 used to try to determine if pass8 should be set by looking at the terminal's meta key. Unfortunately there is no good way - of determining if the terminal can really pass 8 characters or not. - Consider if you are logged in through a modem line with 7 bits and - parity and your terminal has a meta key. Then tcsh 5.19 would set + of determining if the terminal can really pass 8 characters or not. + Consider if you are logged in through a modem line with 7 bits and + parity and your terminal has a meta key. Then tcsh 5.19 would set wrongly set pass8. - If you did like the previous behavior you can add in /etc/csh.login, - or in .login: - + If you did like the previous behavior you can add in /etc/csh.login, or + in .login: if ( $?tcsh && $?prompt ) then if ( "`echotc meta`" == "yes" ) then stty pass8 endif endif - If you don't have pass8, maybe one of these would work.. - + If you don't have pass8, maybe one of these would work: stty -parity -evenp -oddp cs8 -istrip (rs6000) stty -parenb -istrip cs8 - Finally, tcsh will bind all printable meta characters to the self - insert command. If you don't want that to happen (i.e. use the + Finally, tcsh will bind all printable meta characters to the self + insert command. If you don't want that to happen (i.e. use the printable meta characters for commands) setenv NOREBIND. - _________________________________________________________________ - 3. I ran 'dbxtool &' and 'shelltool &' from tcsh, and they end up in - cbreak and no echo mode? - - These programs are broken. Background jobs should not try to look at - the tty. What happens is that dbxtool looks in stderr to inherit the - tty setups, but tcsh sets up the tty in cbreak and -echo modes, so - that it can do line editing. This cannot be fixed because tcsh cannot - give away the tty. Pick one of the following as a workaround: + I ran dbxtool & and shelltool & from tcsh, and they end up in cbreak and no + echo mode? + These programs are broken. Background jobs should not try to look at + the tty. What happens is that dbxtool looks in stderr to inherit the + tty setups, but tcsh sets up the tty in cbreak and -echo modes, so that + it can do line editing. This cannot be fixed because tcsh cannot give + away the tty. Pick one of the following as a workaround: dbxtool < /dev/null >& /dev/null & /usr/etc/setsid dbxtool & - If that does not work, for dbxtool at least you can add "sh stty sane" - in your .dbxinit - _________________________________________________________________ + If that does not work, for dbxtool at least you can add sh stty sane in + your .dbxinit file. - 4. I tried to compile tcsh and it cannot find ? + I tried to compile tcsh and it cannot find ? - Your system does not support NLS. Undefine NLS in config_f.h and it + Your system does not support NLS. Undefine NLS in config_f.h and it should work fine. - _________________________________________________________________ - - 5. Where can I get csh sources? - - Csh sources are now available with the 4.4BSD networking - distributions. You don't need csh sources to compile tcsh-6.0x. - _________________________________________________________________ - - 6. I just made tcsh my login shell, and I cannot ftp any more? - - Newer versions of the ftp daemon check for the validity of the user's - shell before they allow logins. The list of valid login shells is - either hardcoded or it is usually in a file called /etc/shells. If it - is hard-coded, then you are out of luck and your best bet is to get a - newer version of ftpd. Otherwise add tcsh to the list of shells. [For - AIX this file is called /etc/security/login.cfg.] Remember that the - full path is required. If there is no /etc/shells, and you are - creating one, remember to add /bin/csh, /bin/sh, and any other valid - shells for your system, so that other people can ftp too :-) - _________________________________________________________________ - - 7. I am using SunView or OpenWindows and editing is screwed up. In - particular my arrow keys and backspace don't work right. What am I - doing wrong? - - Well, cmdtool tries to do its own command line editing and the effect - you get is one of using an editor inside an editor. Both try to - interpret the arrow key sequences and cmdtool wins since it gets them - first. The solutions are in my order of preference: - 1. Don't use suntools - 2. Use shelltool instead of cmdtool. - 3. Unset edit in tcsh. - _________________________________________________________________ + Where can I get csh sources? + + Csh sources are now available with the 4.4BSD networking distributions. + You don't need csh sources to compile tcsh-6.0x. + + I just made tcsh my login shell, and I cannot ftp any more? + + Newer versions of the ftp daemon check for the validity of the user's + shell before they allow logins. The list of valid login shells is + either hardcoded or it is usually in a file called /etc/shells. If it + is hard-coded, then you are out of luck and your best bet is to get a + newer version of ftpd. Otherwise add tcsh to the list of shells. (For + AIX this file is called /etc/security/login.cfg.) Remember that the + full path is required. If there is no /etc/shells, and you are creating + one, remember to add /bin/csh, /bin/sh, and any other valid shells for + your system, so that other people can ftp too. - 8. On a SPARCstation running Solaris 2.x and OpenWindows 3.1, inside a - cmdtool, the short-cut key sequence to clear log (i.e. Meta-e or - Diamond-e) doesn't work: it just echos 'e'; or + I am using SunView or OpenWindows and editing is screwed up. In particular my + arrow keys and backspace don't work right. What am I doing wrong? + + Well, cmdtool tries to do its own command line editing and the effect + you get is one of using an editor inside an editor. Both try to + interpret the arrow key sequences and cmdtool wins since it gets them + first. The solutions are in my order of preference: + * Don't use suntools + * Use shelltool instead of cmdtool. + * Unset edit in tcsh. + + On a SPARCstation running Solaris 2.x and OpenWindows 3.1, inside a cmdtool, + the short-cut key sequence to clear log (i.e. Meta-e or Diamond-e) doesn't + work: it just echos ‘e’; or Unset edit in tcsh. - _________________________________________________________________ - 9. On a SPARCstation running Solaris 2.x and OpenWindows 3.1, maketool - (within SPARCworks) doesn't work: it just does a `cd' to the working - directory then stops. + On a SPARCstation running Solaris 2.x and OpenWindows 3.1, maketool (within + SPARCworks) doesn't work: it just does a `cd’ to the working directory then + stops. - Unset edit in tcsh. Using shelltool instead of cmdtool does not fix + Unset edit in tcsh. Using shelltool instead of cmdtool does not fix this. - _________________________________________________________________ - 10. I rlogin to another machine, and then no matter what I tell 'stty' - I cannot get it to pass 8 bit characters? + I rlogin to another machine, and then no matter what I tell stty I cannot get + it to pass 8 bit characters? - Maybe you need to use 'rlogin -8' to tell rlogin to pass 8 bit + Maybe you need to use rlogin -8 to tell rlogin to pass 8 bit characters. - _________________________________________________________________ - 11. Where do I get the public domain directory library? + Where do I get the public domain directory library? - Anonymous ftp to prep.ai.mit.edu:/pub/gnu/dirent.tar.Z - _________________________________________________________________ + Anonymous ftp to ftp://prep.ai.mit.edu/pub/gnu/dirent.tar.Z - 12. I compiled tcsh using gcc, and when I start up it says: tcsh: - Warning no access to tty (Invalid Argument). Thus no job control in - this shell + I compiled tcsh using gcc, and when I start up it says: tcsh: Warning no + access to tty (Invalid Argument). Thus no job control in this shell - Your file is not ansi compliant. You have one of 3 + Your file is not ansi compliant. You have one of 3 choices: + * Run fixincludes from the gcc distribution. + * Add -traditional to the gcc flags. + * Compile with cc. - 1. Run fixincludes from the gcc distribution. - 2. Add -traditional to the gcc flags. - 3. Compile with cc. - _________________________________________________________________ - - 13. I compiled tcsh with the SunOS unbundled compiler and now things - get echo'ed twice. + I compiled tcsh with the SunOS unbundled compiler and now things get echoed + twice. It is a bug in the unbundled optimizer. Lower the optimization level. - _________________________________________________________________ - 14. How can I use the arrow keys with hpterm? + How can I use the arrow keys with hpterm? Hp terminals use the arrow keys internally. You can tell hpterm not to do that, by sending it the termcap sequence smkx. Since this has to be - done all the time, the easiest thing is to put it as an alias for + done all the time, the easiest thing is to put it as an alias for precmd, or inside the prompt: - if ($term == "hp") then set prompt="%{`echotc smkx`%}$prompt" endif - Note that by doing that you cannot use pgup and pgdn to scroll... Also - if you are using termcap, replace "smkx" with "ks"... - _________________________________________________________________ + Note that by doing that you cannot use pgup and pgdn to scroll… Also if + you are using termcap, replace smkx with ks. - 15. On POSIX machines ^C and ^Z will do not work when tcsh is a login - shell? + On POSIX machines ^C and ^Z do not work when tcsh is a login shell? Make sure that the interrupt character is set to ^C and suspend is set - to ^Z; 'stty -a' will show you the current stty settings; 'stty intr - ^C susp ^Z' will set them to ^C and ^Z respectively. - _________________________________________________________________ + to ^Z; stty -a will show you the current stty settings; stty intr ^C + susp ^Z will set them to ^C and ^Z respectively. - 16. I am trying to compile tcsh and I am getting compile errors that - look like: + I am trying to compile tcsh and I am getting compile errors that look like: - >sh.c:???: `STR???' undeclared, outside of functions [gcc] - >"sh.c", line ???: STR??? undefined [cc] + sh.c:???: `STR???' undeclared, outside of functions [gcc] + "sh.c", line ???: STR??? undefined [cc] - You interrupted make, while it was making the automatically generated - headers. Type 'make clean; make' - _________________________________________________________________ + You interrupted make, while it was making the automatically generated + headers. Type make clean; make - 17. On the cray, sometimes the CR/LF mapping gets screwed up. + On the cray, sometimes the CR/LF mapping gets screwed up. - You are probably logged in to the cray via telnet. Cray's telnetd - implements line mode selection the telnet client you are using does - not implement telnet line mode. This cause the Cray's telnetd to try - to use KLUDGELINEMODE. You can turn off telnet line mode from the cray - side by doing a "stty -extproc", or you can get the Cray AIC to build - a telnetd without KLUDGELINEMODE, or you can compile a new telnet - client (from the BSD net2 tape), or at least on the suns use: 'mode - character'. - _________________________________________________________________ + You are probably logged in to the cray via telnet. Cray's telnetd + implements line mode selection the telnet client you are using does not + implement telnet line mode. This cause the Cray's telnetd to try to use + KLUDGELINEMODE. You can turn off telnet line mode from the cray side by + doing a stty -extproc, or you can get the Cray AIC to build a telnetd + without KLUDGELINEMODE, or you can compile a new telnet client (from + the BSD net2 tape), or at least on the suns use: mode character. - 18. On AU/X, I made tcsh my startup shell, but the mac desktop is not - starting up (no X11 or Finder), and I only get console emulation. + On AU/X, I made tcsh my startup shell, but the mac desktop is not starting up + (no X11 or Finder), and I only get console emulation. - This is another manifestation of item 5. Just add the pathname to tcsh - in /etc/shells and everything should work fine. - _________________________________________________________________ + Add the pathname to tcsh in /etc/shells and everything should work + fine. - 19. On machines that use YP (NIS) tilde expansion might end up in - /dev/null + On machines that use YP (NIS) tilde expansion might end up in /dev/null - If this happens complain to your vendor, to get a new version of NIS. + If this happens complain to your vendor, to get a new version of NIS. You can fix that in tcsh by defining YPBUGS in config.h - _________________________________________________________________ - 20. Script on SGI 4.0.5 does not give us a tty, so we cannot have job - control. + Script on SGI 4.0.5 does not give us a tty, so we cannot have job control. Their csh does not have job control either. Try: - % script % cat > /dev/tty - _________________________________________________________________ - 21. I start tcsh and it takes a couple of minutes to get the prompt. + I start tcsh and it takes a couple of minutes to get the prompt. - You have defined REMOTEHOST and your DNS is not responding. Either + You have defined REMOTEHOST and your DNS is not responding. Either undefine REMOTEHOST and recompile or fix your DNS. - _________________________________________________________________ - - 22. If you need help generating your .cshrc file, check out: - http://www.imada.sdu.dk/~blackie/dotfile/ + If you need help generating your .cshrc file, check out: - or - http://www.dotfiles.com - _________________________________________________________________ + * https://github.com/tcsh-org/tcsh/blob/master/dot.tcshrc + * https://github.com/tcsh-org/tcsh/blob/master/dot.login - 23. On POSIX systems the kernel will send hup signals to all the - processes in the foreground process group if 'stty hupcl' is set. + On POSIX systems the kernel will send hup signals to all the processes in the + foreground process group if ‘stty hupcl’ is set. For example - ./tcsh echo $$ 591 @@ -240,65 +193,51 @@ Will kill everything, since hup will be sent to all tcsh processes. To avoid that you can set stty -hupcl, but it is not recommended. - _________________________________________________________________ - 24. When I rsh the meta key stops working on the remote machine. + When I rsh the meta key stops working on the remote machine. - Try using rsh -8; this option is undocumented on some systems, but it - works. If that does not work, get and use ssh/sshd. You'll be better + Try using rsh -8; this option is undocumented on some systems, but it + works. If that does not work, get and use ssh/sshd. You'll be better off from a security point of view anyway. - _________________________________________________________________ - 25. Tcsh compiled under hp/ux-10.x does not pass resource limits - correctly when ran on hp/ux-11.x systems. + Tcsh compiled under hp/ux-10.x does not pass resource limits correctly when + ran on hp/ux-11.x systems. - This is a problem with lack of ABI compatibility between the two + This is a problem with lack of ABI compatibility between the two systems. The only solution is to recompile. - _________________________________________________________________ - 26. Refreshing in command line editing can appear broken on some OS's + Refreshing in command line editing can appear broken on some OS's - This is because the termcap/terminfo description lies about the - ability of the terminal to use tabs. At least on Compaq/DEC Alpha - OSF/1 3.x and 4.x systems, stty -tabs will cause problems. - _________________________________________________________________ + This is because the termcap/terminfo description lies about the ability + of the terminal to use tabs. At least on Compaq/DEC Alpha OSF/1 3.x and + 4.x systems, stty -tabs will cause problems. - 27. Where can I learn the merits of tcsh vs. bash vs. csh vs. sh etc? + Where can I learn the merits of tcsh vs. bash vs. csh vs. sh etc? - You can read the manual page section titled [NEW FEATURES] listing + You can read the manual page section titled [NEW FEATURES] listing features that tcsh adds to csh. - You can read Tom Christiansen's [Csh Programming Considered Harmful], - a document advocating that csh (and by extension, tcsh) should not be + You can read Tom Christiansen's Csh Programming Considered Harmful, a + document advocating that csh (and by extension, tcsh) should not be used for writing shell scripts. - XXX: Need to find something about [bash], but bash is sh-compatible - and has many of the same interactive features of tcsh (command - completion does not appear to be as flexible, though). - - [Curtains up: introducing the Z shell] has a pretty good rundown on - zsh. Aside from the arguments about csh being evil, tcsh appears to - compare well with zsh [zsh]. Zsh is sh and ksh compatible, with many - of the interactive features of tcsh. - _________________________________________________________________ - - 28. Why does FreeBSD's tcsh do history browsing differently than I - expect? + XXX: Need to find something about bash, but bash is sh-compatible and + has many of the same interactive features of tcsh (command completion + does not appear to be as flexible, though). - On FreeBSD, by default, the up arrow is set to - "history-search-backward", rather than the default "up-history". As a - result, if you type (part of) a word and press up arrow, you'll see - previous commands that match the prefix. Pretty useful, actually, - although it takes some getting used to. You can use bindkey to see - your settings, and to rebind up & down differently if desired. - _________________________________________________________________ + Curtains up: introducing the Z shell has a pretty good rundown on zsh. + Aside from the arguments about csh being evil, tcsh appears to compare + well with zsh. Zsh is sh and ksh compatible, with many of the + interactive features of tcsh. - Everything else is a bug :-( + Why does FreeBSD's tcsh do history browsing differently than I expect? - Christos - _________________________________________________________________ + On FreeBSD, by default, the up arrow is set to history-search-backward, + rather than the default up-history. As a result, if you type (part of) + a word and press up arrow, you'll see previous commands that match the + prefix. Pretty useful, actually, although it takes some getting used + to. You can use bindkey to see your settings, and to rebind up & down + differently if desired. + __________________________________________________________________ - Home | RecentChanges | Preferences - Edit text of this page | View other revisions - Last edited April 29, 2004 15:02 (diff) - Search: ____________________ + Page content last updated on 2019-12-31 diff --git a/contrib/tcsh/Fixes b/contrib/tcsh/Fixes index db401f23fad0..e539c8241a86 100644 --- a/contrib/tcsh/Fixes +++ b/contrib/tcsh/Fixes @@ -1,3 +1,25 @@ + 14. Don't crash with 'bindkey "^0" clear-screen' (Karl Jeacle) + 13. Fix $x:q:h and $x:q:t return the whole string for strings not containing / + 12. V6.22.03 - 20201118 + 11. Fix $x:q:h and $x:q:t to not crash (alzwded) with strings containing / + 10. Block SIGHUP while writing history/directory stack (Brett Frankenberger) + 9. Fixed reversed test that broke history merging (Brett Frankenberger) + 8. Prevent recursive entry for writing history (Brett Frankenberger) + 7. alxwded@github, keep track of the :g and :a modifiers per modifier they + affect. + 6. alzwded@github, fix infinite loop with :gas variable modifier + 5. PR/88: Add a Q: modifier that preserves empty arguments leaving :q + alone. + 4. V6.22.02 - 20191204 + 3. Fix version in configure.ac + 2. V6.22.01 - 20191201 + 1. undo PR/88: Preserve empty arguments in :q, since it breaks + $ set x="" + $ alias test "echo "\""$x:q"\"" is working." + $ alias test + echo " + + 6. V6.22.00 - 20191128 5. PR/113: Sobomax: avoid infinite loops for -c commands when stdout is not a tty. 4. Avoid infinite loops during history loads when merging, print a better @@ -6,6 +28,7 @@ 2. PR/94: Small apple issues (SAVESIGVEC, HOSTTYPE) 1. PR/81: Fix range matching issue where we were comparing with the range character instead of the start of range. [l-z]* would match foo + 12. V6.21.00 - 20190508 11. Abort history loading on words and lines too long https://bugzilla.redhat.com/show_bug.cgi?id=1598502 diff --git a/contrib/tcsh/Imakefile b/contrib/tcsh/Imakefile index be2bebe17ca9..bd1b43b1a24e 100644 --- a/contrib/tcsh/Imakefile +++ b/contrib/tcsh/Imakefile @@ -492,14 +492,15 @@ SHSRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c \ sh.char.c sh.exp.c sh.file.c sh.func.c \ sh.glob.c sh.hist.c sh.init.c sh.lex.c \ sh.misc.c sh.parse.c sh.print.c sh.proc.c \ - sh.sem.c sh.set.c sh.time.c glob.c \ + sh.sem.c sh.set.c sh.time.c dotlock.c dotlock.h glob.c \ sh.char.h sh.dir.h sh.proc.h sh.h \ sh.decls.h glob.h ${SYSSRCS} SHOBJS= sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \ sh.char.${SUF} sh.exp.${SUF} sh.file.${SUF} sh.func.${SUF} \ sh.glob.${SUF} sh.hist.${SUF} sh.init.${SUF} sh.lex.${SUF} \ sh.misc.${SUF} sh.parse.${SUF} sh.print.${SUF} sh.proc.${SUF} \ - sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} glob.${SUF} ${SYSOBJS} + sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} dotlock.${SUF} glob.${SUF} \ + ${SYSOBJS} TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \ tw.comp.c tw.color.c @@ -512,9 +513,10 @@ EDOBJS= ed.chared.${SUF} ed.refresh.${SUF} ed.screen.${SUF} ed.init.${SUF} \ ed.inputl.${SUF} ed.defns.${SUF} ed.xmap.${SUF} ed.term.${SUF} TCSRCS= tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \ - tc.func.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \ - tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \ - tc.who.c tc.h + tc.func.c tc.nls.c tc.nls.h tc.os.c tc.os.h tc.printf.c tc.prompt.c \ + tc.disc.${SUF} tc.func.${SUF} tc.nls.${SUF} tc.os.${SUF} \ + tc.printf.${SUF} tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h \ + tc.vers.c tc.wait.h tc.who.c tc.h TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \ tc.disc.${SUF} tc.func.${SUF} tc.os.${SUF} tc.printf.${SUF} \ tc.prompt.${SUF} tc.sched.${SUF} tc.sig.${SUF} tc.str.${SUF} \ @@ -524,7 +526,7 @@ MISCF = Makefile.std BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md \ FAQ WishList config_f.h eight-bit.me glob.3 patchlevel.h pathnames.h \ tcsh.man Ported src.desc Imakefile imake.config complete.tcsh \ Makefile.vms termcap.vms snames.h host.defs gethost.c tcsh.man2html \ - Makefile.in configure.ac Makefile.win32 aclocal.m4 + Makefile.in configure.ac Makefile.win32 aclocal.m4 dot.login dot.tcshrc CONFSRCS=config/[a-z]* diff --git a/contrib/tcsh/Makefile.ADMIN b/contrib/tcsh/Makefile.ADMIN new file mode 100644 index 000000000000..5ad3bb8fb3c5 --- /dev/null +++ b/contrib/tcsh/Makefile.ADMIN @@ -0,0 +1,24 @@ +# +# Makefile.ADMIN +# +# Maintenance tasks +# +# You can refetch files from the website, then run "git diff" to +# sanity check any changes before committing. +# + +LYNX= lynx -dump -nolist +TRIM= expand | sed -e 's/^ *$$//' | cat -s +WEB= https://www.tcsh.org + +PAGES= FAQ + +all: ${PAGES} + +.for i in ${PAGES} +$i: force + ${LYNX} ${WEB}/${i:tl}/ | ${TRIM} > ${.TARGET} +.endfor + +.DUMMY: force +force: diff --git a/contrib/tcsh/Makefile.in b/contrib/tcsh/Makefile.in index 210b7de72dfe..c6b5f2554cc0 100644 --- a/contrib/tcsh/Makefile.in +++ b/contrib/tcsh/Makefile.in @@ -6,6 +6,7 @@ # things; Paul Placeway, CIS Dept., Ohio State University # SHELL=/bin/sh +ENVCMD=/usr/bin/env VERSION=@PACKAGE_VERSION@ BUILD=tcsh$(EXEEXT) VPATH=@srcdir@ @@ -410,7 +411,7 @@ AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \ pathnames.h tcsh.man Ported src.desc Imakefile imake.config \ complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \ gethost.c tcsh.man2html configure.ac configure config.h.in \ - tests/testsuite.at aclocal.m4 + tests/testsuite.at aclocal.m4 dot.login dot.tcshrc TESTFILES= tests/aliases.at tests/arguments.at tests/commands.at \ tests/expr.at tests/lexical.at tests/mb-eucjp.at \ tests/mb-utf8.at tests/noexec.at tests/parenthesis.at tests/syntax.at \ @@ -634,6 +635,8 @@ veryclean: clean ${RM} -f Makefile config.h config_p.h ${RM} -f config.status config.cache config.log tcsh.ps ${RM} -f missing + ${RM} -f testsuite.log + ${RM} -rf testsuite.dir ${RM} -rf autom4te.cache ${RM} -f *~ #* @@ -735,8 +738,10 @@ $(srcdir)/stamp-h.in: $(srcdir)/configure.ac cd $(srcdir) && autoheader @echo timestamp > $(srcdir)/stamp-h.in -check: atconfig $(srcdir)/tests/testsuite - $(SHELL) $(srcdir)/tests/testsuite +check test: atconfig $(srcdir)/tests/testsuite + $(ENVCMD) - \ + USER="$(USER)" \ + $(SHELL) $(srcdir)/tests/testsuite # # Dependencies diff --git a/contrib/tcsh/Makefile.std b/contrib/tcsh/Makefile.std index 3466d4ceac86..8c479fa1f213 100644 --- a/contrib/tcsh/Makefile.std +++ b/contrib/tcsh/Makefile.std @@ -320,7 +320,7 @@ AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \ pathnames.h tcsh.man Ported src.desc Imakefile imake.config \ complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \ gethost.c tcsh.man2html configure.ac configure config.h.in \ - aclocal.m4 + aclocal.m4 dot.login dot.tcshrc VHSRCS=${PVSRCS} ${AVSRCS} diff --git a/contrib/tcsh/Makefile.vms b/contrib/tcsh/Makefile.vms index bc241147e253..2e3f4adbfed4 100644 --- a/contrib/tcsh/Makefile.vms +++ b/contrib/tcsh/Makefile.vms @@ -297,7 +297,7 @@ AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \ WishList config_f.h eight-bit.me glob.3 patchlevel.h \ pathnames.h tcsh.man Ported src.desc Imakefile imake.config \ complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \ - gethost.c tcsh.man2html configure.ac aclocal.m4 + gethost.c tcsh.man2html configure.ac aclocal.m4 dot.login dot.tcshrc VHSRCS=${PVSRCS} ${AVSRCS} diff --git a/contrib/tcsh/README.md b/contrib/tcsh/README.md index 58a30738daa6..df6671b0316e 100644 --- a/contrib/tcsh/README.md +++ b/contrib/tcsh/README.md @@ -5,7 +5,7 @@ The Tcsh source code is available on GitHub as a read-only repo mirror at: -> http://github.com/tcsh-org/tcsh +> https://github.com/tcsh-org/tcsh Instructions for compiling Tcsh can be found in [BUILDING]. @@ -20,7 +20,10 @@ the tcsh mailing list: > https://mailman.astron.com/mailman/listinfo/tcsh [![Build Status][status]][travis] +[![Coverity Scan][badge]][coverity] [BUILDING]: BUILDING -[status]: https://travis-ci.org/tcsh-org/tcsh.svg?branch=master -[travis]: https://travis-ci.org/tcsh-org/tcsh +[badge]: https://scan.coverity.com/projects/20307/badge.svg +[coverity]: https://scan.coverity.com/projects/tcsh-org-tcsh +[status]: https://travis-ci.com/tcsh-org/tcsh.svg?branch=master +[travis]: https://travis-ci.com/tcsh-org/tcsh diff --git a/contrib/tcsh/configure b/contrib/tcsh/configure index 4e724c2bfb80..27a6bec356a0 100755 --- a/contrib/tcsh/configure +++ b/contrib/tcsh/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for tcsh 6.21.00. +# Generated by GNU Autoconf 2.69 for tcsh 6.22.03. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='tcsh' PACKAGE_TARNAME='tcsh' -PACKAGE_VERSION='6.21.00' -PACKAGE_STRING='tcsh 6.21.00' +PACKAGE_VERSION='6.22.03' +PACKAGE_STRING='tcsh 6.22.03' PACKAGE_BUGREPORT='https://bugs.astron.com/' PACKAGE_URL='' @@ -628,10 +628,10 @@ BUILD_CATALOGS HESLIB HESDEF DFLAGS -LTLIBICONV -LIBICONV CC_FOR_GETHOST GENCAT +LTLIBICONV +LIBICONV EGREP GREP CPP @@ -1250,7 +1250,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures tcsh 6.21.00 to adapt to many kinds of systems. +\`configure' configures tcsh 6.22.03 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1315,7 +1315,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of tcsh 6.21.00:";; + short | recursive ) echo "Configuration of tcsh 6.22.03:";; esac cat <<\_ACEOF @@ -1411,7 +1411,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -tcsh configure 6.21.00 +tcsh configure 6.22.03 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2174,7 +2174,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by tcsh $as_me 6.21.00, which was +It was created by tcsh $as_me 6.22.03, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2723,278 +2723,222 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking cached host tuple" >&5 -$as_echo_n "checking cached host tuple... " >&6; } -if { test x"${ac_cv_host_system_type+set}" = x"set" && - test x"$ac_cv_host_system_type" != x"$host"; }; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: different" >&5 -$as_echo "different" >&6; } - as_fn_error $? "remove config.cache and re-run configure" "$LINENO" 5 + + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } -fi -ac_cv_host_system_type="$host" + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -case "${host}" in +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - ## Alpha (DEC) machines. - alpha*-dec-osf* ) - tcsh_config_file=decosf1 - ;; +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - ## Ultrix - *-dec-ultrix* ) - tcsh_config_file=ultrix - ;; + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi - ## DGUX - *-dg-dguxR4* ) - tcsh_config_file=dgux5.4 - ;; - m88k-dg-dgux5.4R* ) - tcsh_config_file=dgux5.4 - ;; +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - ## HP/UX - *-hp-hpux7* ) - tcsh_config_file=hpux7 - ;; - *-hp-hpux[89]* ) - tcsh_config_file=hpux8 - ;; - *-hp-hpux1[0-9]* ) - tcsh_config_file=hpux11 - ;; +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - ## IBM AIX systems - *-ibm-aix*) - tcsh_config_file=aix - ;; - ## SX-4 - sx4-nec-*) - CC='cc -h0,ansi,novector,float0' - LDFLAGS='-Gsmall' - tcsh_config_file=superux8 - ;; + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. *** 5135 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Mar 21 06:09:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 386E65BFC28; Sun, 21 Mar 2021 06:09: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 4F36f018djz4Trr; Sun, 21 Mar 2021 06:09: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 1A41E15B2D; Sun, 21 Mar 2021 06:09: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 12L69C6d040568; Sun, 21 Mar 2021 06:09:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12L69Bga040566; Sun, 21 Mar 2021 06:09:11 GMT (envelope-from git) Date: Sun, 21 Mar 2021 06:09:11 GMT Message-Id: <202103210609.12L69Bga040566@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: ea1f0ecc15bc - stable/13 - Merge tcsh 6.22.03-ceccc7f 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/stable/13 X-Git-Reftype: branch X-Git-Commit: ea1f0ecc15bc5a314cf5beccc7384a21d04ca40f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 06:09:12 -0000 The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=ea1f0ecc15bc5a314cf5beccc7384a21d04ca40f commit ea1f0ecc15bc5a314cf5beccc7384a21d04ca40f Author: Dmitry Chagin AuthorDate: 2021-03-14 16:33:13 +0000 Commit: Dmitry Chagin CommitDate: 2021-03-21 06:08:54 +0000 Merge tcsh 6.22.03-ceccc7f PR: 252663 (cherry picked from commit 5224c2a3bc95b431f729f3692f264395248d8acc) --- contrib/tcsh/FAQ | 339 ++-- contrib/tcsh/Fixes | 23 + contrib/tcsh/Imakefile | 14 +- contrib/tcsh/Makefile.ADMIN | 24 + contrib/tcsh/Makefile.in | 11 +- contrib/tcsh/Makefile.std | 2 +- contrib/tcsh/Makefile.vms | 2 +- contrib/tcsh/README.md | 9 +- contrib/tcsh/configure | 3803 +++++++++++++++++++++++++------------------ contrib/tcsh/dot.login | 12 + contrib/tcsh/dot.tcshrc | 110 ++ contrib/tcsh/ed.chared.c | 18 +- contrib/tcsh/ed.inputl.c | 2 +- contrib/tcsh/ed.screen.c | 2 +- contrib/tcsh/ed.xmap.c | 2 +- contrib/tcsh/host.defs | 2 +- contrib/tcsh/patchlevel.h | 6 +- contrib/tcsh/sh.c | 17 +- contrib/tcsh/sh.dir.c | 41 +- contrib/tcsh/sh.dol.c | 132 +- contrib/tcsh/sh.exp.c | 2 +- contrib/tcsh/sh.func.c | 5 +- contrib/tcsh/sh.glob.c | 11 +- contrib/tcsh/sh.h | 6 +- contrib/tcsh/sh.hist.c | 10 +- contrib/tcsh/sh.lex.c | 47 +- contrib/tcsh/sh.misc.c | 21 +- contrib/tcsh/sh.set.c | 14 +- contrib/tcsh/tc.alloc.c | 10 + contrib/tcsh/tc.disc.c | 4 + contrib/tcsh/tc.os.c | 2 +- contrib/tcsh/tc.prompt.c | 2 +- contrib/tcsh/tcsh.man | 21 +- contrib/tcsh/tcsh.man.new | 64 +- contrib/tcsh/tw.parse.c | 4 +- 35 files changed, 2855 insertions(+), 1939 deletions(-) diff --git a/contrib/tcsh/FAQ b/contrib/tcsh/FAQ index 92aadc726683..93773c52433a 100644 --- a/contrib/tcsh/FAQ +++ b/contrib/tcsh/FAQ @@ -1,237 +1,190 @@ + * Home + * FAQ + * Y2K + __________________________________________________________________ - [Home] FAQ +FAQ - Home | RecentChanges | Preferences - _________________________________________________________________ + For the people who do not read the manual! - This is for people who do not read the manual! + Why is the meta key broken in tcsh-5.20 and up? - So far people who don't read manuals don't read this either... I may - call it README.*PLEASE* in the future, but then the same people won't - be able to get ftp it... :-) - _________________________________________________________________ - - 1. Where can I find tcsh sources? - - See http://www.tcsh.org/MostRecentRelease for download locations. - _________________________________________________________________ - - 2. Why is the meta key broken in tcsh-5.20 and up? - - On some machines the tty is not set up to pass 8 bit characters by - default. Tcsh 5.19 used to try to determine if pass8 should be set by + On some machines the tty is not set up to pass 8 bit characters by + default. Tcsh 5.19 used to try to determine if pass8 should be set by looking at the terminal's meta key. Unfortunately there is no good way - of determining if the terminal can really pass 8 characters or not. - Consider if you are logged in through a modem line with 7 bits and - parity and your terminal has a meta key. Then tcsh 5.19 would set + of determining if the terminal can really pass 8 characters or not. + Consider if you are logged in through a modem line with 7 bits and + parity and your terminal has a meta key. Then tcsh 5.19 would set wrongly set pass8. - If you did like the previous behavior you can add in /etc/csh.login, - or in .login: - + If you did like the previous behavior you can add in /etc/csh.login, or + in .login: if ( $?tcsh && $?prompt ) then if ( "`echotc meta`" == "yes" ) then stty pass8 endif endif - If you don't have pass8, maybe one of these would work.. - + If you don't have pass8, maybe one of these would work: stty -parity -evenp -oddp cs8 -istrip (rs6000) stty -parenb -istrip cs8 - Finally, tcsh will bind all printable meta characters to the self - insert command. If you don't want that to happen (i.e. use the + Finally, tcsh will bind all printable meta characters to the self + insert command. If you don't want that to happen (i.e. use the printable meta characters for commands) setenv NOREBIND. - _________________________________________________________________ - 3. I ran 'dbxtool &' and 'shelltool &' from tcsh, and they end up in - cbreak and no echo mode? - - These programs are broken. Background jobs should not try to look at - the tty. What happens is that dbxtool looks in stderr to inherit the - tty setups, but tcsh sets up the tty in cbreak and -echo modes, so - that it can do line editing. This cannot be fixed because tcsh cannot - give away the tty. Pick one of the following as a workaround: + I ran dbxtool & and shelltool & from tcsh, and they end up in cbreak and no + echo mode? + These programs are broken. Background jobs should not try to look at + the tty. What happens is that dbxtool looks in stderr to inherit the + tty setups, but tcsh sets up the tty in cbreak and -echo modes, so that + it can do line editing. This cannot be fixed because tcsh cannot give + away the tty. Pick one of the following as a workaround: dbxtool < /dev/null >& /dev/null & /usr/etc/setsid dbxtool & - If that does not work, for dbxtool at least you can add "sh stty sane" - in your .dbxinit - _________________________________________________________________ + If that does not work, for dbxtool at least you can add sh stty sane in + your .dbxinit file. - 4. I tried to compile tcsh and it cannot find ? + I tried to compile tcsh and it cannot find ? - Your system does not support NLS. Undefine NLS in config_f.h and it + Your system does not support NLS. Undefine NLS in config_f.h and it should work fine. - _________________________________________________________________ - - 5. Where can I get csh sources? - - Csh sources are now available with the 4.4BSD networking - distributions. You don't need csh sources to compile tcsh-6.0x. - _________________________________________________________________ - - 6. I just made tcsh my login shell, and I cannot ftp any more? - - Newer versions of the ftp daemon check for the validity of the user's - shell before they allow logins. The list of valid login shells is - either hardcoded or it is usually in a file called /etc/shells. If it - is hard-coded, then you are out of luck and your best bet is to get a - newer version of ftpd. Otherwise add tcsh to the list of shells. [For - AIX this file is called /etc/security/login.cfg.] Remember that the - full path is required. If there is no /etc/shells, and you are - creating one, remember to add /bin/csh, /bin/sh, and any other valid - shells for your system, so that other people can ftp too :-) - _________________________________________________________________ - - 7. I am using SunView or OpenWindows and editing is screwed up. In - particular my arrow keys and backspace don't work right. What am I - doing wrong? - - Well, cmdtool tries to do its own command line editing and the effect - you get is one of using an editor inside an editor. Both try to - interpret the arrow key sequences and cmdtool wins since it gets them - first. The solutions are in my order of preference: - 1. Don't use suntools - 2. Use shelltool instead of cmdtool. - 3. Unset edit in tcsh. - _________________________________________________________________ + Where can I get csh sources? + + Csh sources are now available with the 4.4BSD networking distributions. + You don't need csh sources to compile tcsh-6.0x. + + I just made tcsh my login shell, and I cannot ftp any more? + + Newer versions of the ftp daemon check for the validity of the user's + shell before they allow logins. The list of valid login shells is + either hardcoded or it is usually in a file called /etc/shells. If it + is hard-coded, then you are out of luck and your best bet is to get a + newer version of ftpd. Otherwise add tcsh to the list of shells. (For + AIX this file is called /etc/security/login.cfg.) Remember that the + full path is required. If there is no /etc/shells, and you are creating + one, remember to add /bin/csh, /bin/sh, and any other valid shells for + your system, so that other people can ftp too. - 8. On a SPARCstation running Solaris 2.x and OpenWindows 3.1, inside a - cmdtool, the short-cut key sequence to clear log (i.e. Meta-e or - Diamond-e) doesn't work: it just echos 'e'; or + I am using SunView or OpenWindows and editing is screwed up. In particular my + arrow keys and backspace don't work right. What am I doing wrong? + + Well, cmdtool tries to do its own command line editing and the effect + you get is one of using an editor inside an editor. Both try to + interpret the arrow key sequences and cmdtool wins since it gets them + first. The solutions are in my order of preference: + * Don't use suntools + * Use shelltool instead of cmdtool. + * Unset edit in tcsh. + + On a SPARCstation running Solaris 2.x and OpenWindows 3.1, inside a cmdtool, + the short-cut key sequence to clear log (i.e. Meta-e or Diamond-e) doesn't + work: it just echos ‘e’; or Unset edit in tcsh. - _________________________________________________________________ - 9. On a SPARCstation running Solaris 2.x and OpenWindows 3.1, maketool - (within SPARCworks) doesn't work: it just does a `cd' to the working - directory then stops. + On a SPARCstation running Solaris 2.x and OpenWindows 3.1, maketool (within + SPARCworks) doesn't work: it just does a `cd’ to the working directory then + stops. - Unset edit in tcsh. Using shelltool instead of cmdtool does not fix + Unset edit in tcsh. Using shelltool instead of cmdtool does not fix this. - _________________________________________________________________ - 10. I rlogin to another machine, and then no matter what I tell 'stty' - I cannot get it to pass 8 bit characters? + I rlogin to another machine, and then no matter what I tell stty I cannot get + it to pass 8 bit characters? - Maybe you need to use 'rlogin -8' to tell rlogin to pass 8 bit + Maybe you need to use rlogin -8 to tell rlogin to pass 8 bit characters. - _________________________________________________________________ - 11. Where do I get the public domain directory library? + Where do I get the public domain directory library? - Anonymous ftp to prep.ai.mit.edu:/pub/gnu/dirent.tar.Z - _________________________________________________________________ + Anonymous ftp to ftp://prep.ai.mit.edu/pub/gnu/dirent.tar.Z - 12. I compiled tcsh using gcc, and when I start up it says: tcsh: - Warning no access to tty (Invalid Argument). Thus no job control in - this shell + I compiled tcsh using gcc, and when I start up it says: tcsh: Warning no + access to tty (Invalid Argument). Thus no job control in this shell - Your file is not ansi compliant. You have one of 3 + Your file is not ansi compliant. You have one of 3 choices: + * Run fixincludes from the gcc distribution. + * Add -traditional to the gcc flags. + * Compile with cc. - 1. Run fixincludes from the gcc distribution. - 2. Add -traditional to the gcc flags. - 3. Compile with cc. - _________________________________________________________________ - - 13. I compiled tcsh with the SunOS unbundled compiler and now things - get echo'ed twice. + I compiled tcsh with the SunOS unbundled compiler and now things get echoed + twice. It is a bug in the unbundled optimizer. Lower the optimization level. - _________________________________________________________________ - 14. How can I use the arrow keys with hpterm? + How can I use the arrow keys with hpterm? Hp terminals use the arrow keys internally. You can tell hpterm not to do that, by sending it the termcap sequence smkx. Since this has to be - done all the time, the easiest thing is to put it as an alias for + done all the time, the easiest thing is to put it as an alias for precmd, or inside the prompt: - if ($term == "hp") then set prompt="%{`echotc smkx`%}$prompt" endif - Note that by doing that you cannot use pgup and pgdn to scroll... Also - if you are using termcap, replace "smkx" with "ks"... - _________________________________________________________________ + Note that by doing that you cannot use pgup and pgdn to scroll… Also if + you are using termcap, replace smkx with ks. - 15. On POSIX machines ^C and ^Z will do not work when tcsh is a login - shell? + On POSIX machines ^C and ^Z do not work when tcsh is a login shell? Make sure that the interrupt character is set to ^C and suspend is set - to ^Z; 'stty -a' will show you the current stty settings; 'stty intr - ^C susp ^Z' will set them to ^C and ^Z respectively. - _________________________________________________________________ + to ^Z; stty -a will show you the current stty settings; stty intr ^C + susp ^Z will set them to ^C and ^Z respectively. - 16. I am trying to compile tcsh and I am getting compile errors that - look like: + I am trying to compile tcsh and I am getting compile errors that look like: - >sh.c:???: `STR???' undeclared, outside of functions [gcc] - >"sh.c", line ???: STR??? undefined [cc] + sh.c:???: `STR???' undeclared, outside of functions [gcc] + "sh.c", line ???: STR??? undefined [cc] - You interrupted make, while it was making the automatically generated - headers. Type 'make clean; make' - _________________________________________________________________ + You interrupted make, while it was making the automatically generated + headers. Type make clean; make - 17. On the cray, sometimes the CR/LF mapping gets screwed up. + On the cray, sometimes the CR/LF mapping gets screwed up. - You are probably logged in to the cray via telnet. Cray's telnetd - implements line mode selection the telnet client you are using does - not implement telnet line mode. This cause the Cray's telnetd to try - to use KLUDGELINEMODE. You can turn off telnet line mode from the cray - side by doing a "stty -extproc", or you can get the Cray AIC to build - a telnetd without KLUDGELINEMODE, or you can compile a new telnet - client (from the BSD net2 tape), or at least on the suns use: 'mode - character'. - _________________________________________________________________ + You are probably logged in to the cray via telnet. Cray's telnetd + implements line mode selection the telnet client you are using does not + implement telnet line mode. This cause the Cray's telnetd to try to use + KLUDGELINEMODE. You can turn off telnet line mode from the cray side by + doing a stty -extproc, or you can get the Cray AIC to build a telnetd + without KLUDGELINEMODE, or you can compile a new telnet client (from + the BSD net2 tape), or at least on the suns use: mode character. - 18. On AU/X, I made tcsh my startup shell, but the mac desktop is not - starting up (no X11 or Finder), and I only get console emulation. + On AU/X, I made tcsh my startup shell, but the mac desktop is not starting up + (no X11 or Finder), and I only get console emulation. - This is another manifestation of item 5. Just add the pathname to tcsh - in /etc/shells and everything should work fine. - _________________________________________________________________ + Add the pathname to tcsh in /etc/shells and everything should work + fine. - 19. On machines that use YP (NIS) tilde expansion might end up in - /dev/null + On machines that use YP (NIS) tilde expansion might end up in /dev/null - If this happens complain to your vendor, to get a new version of NIS. + If this happens complain to your vendor, to get a new version of NIS. You can fix that in tcsh by defining YPBUGS in config.h - _________________________________________________________________ - 20. Script on SGI 4.0.5 does not give us a tty, so we cannot have job - control. + Script on SGI 4.0.5 does not give us a tty, so we cannot have job control. Their csh does not have job control either. Try: - % script % cat > /dev/tty - _________________________________________________________________ - 21. I start tcsh and it takes a couple of minutes to get the prompt. + I start tcsh and it takes a couple of minutes to get the prompt. - You have defined REMOTEHOST and your DNS is not responding. Either + You have defined REMOTEHOST and your DNS is not responding. Either undefine REMOTEHOST and recompile or fix your DNS. - _________________________________________________________________ - - 22. If you need help generating your .cshrc file, check out: - http://www.imada.sdu.dk/~blackie/dotfile/ + If you need help generating your .cshrc file, check out: - or - http://www.dotfiles.com - _________________________________________________________________ + * https://github.com/tcsh-org/tcsh/blob/master/dot.tcshrc + * https://github.com/tcsh-org/tcsh/blob/master/dot.login - 23. On POSIX systems the kernel will send hup signals to all the - processes in the foreground process group if 'stty hupcl' is set. + On POSIX systems the kernel will send hup signals to all the processes in the + foreground process group if ‘stty hupcl’ is set. For example - ./tcsh echo $$ 591 @@ -240,65 +193,51 @@ Will kill everything, since hup will be sent to all tcsh processes. To avoid that you can set stty -hupcl, but it is not recommended. - _________________________________________________________________ - 24. When I rsh the meta key stops working on the remote machine. + When I rsh the meta key stops working on the remote machine. - Try using rsh -8; this option is undocumented on some systems, but it - works. If that does not work, get and use ssh/sshd. You'll be better + Try using rsh -8; this option is undocumented on some systems, but it + works. If that does not work, get and use ssh/sshd. You'll be better off from a security point of view anyway. - _________________________________________________________________ - 25. Tcsh compiled under hp/ux-10.x does not pass resource limits - correctly when ran on hp/ux-11.x systems. + Tcsh compiled under hp/ux-10.x does not pass resource limits correctly when + ran on hp/ux-11.x systems. - This is a problem with lack of ABI compatibility between the two + This is a problem with lack of ABI compatibility between the two systems. The only solution is to recompile. - _________________________________________________________________ - 26. Refreshing in command line editing can appear broken on some OS's + Refreshing in command line editing can appear broken on some OS's - This is because the termcap/terminfo description lies about the - ability of the terminal to use tabs. At least on Compaq/DEC Alpha - OSF/1 3.x and 4.x systems, stty -tabs will cause problems. - _________________________________________________________________ + This is because the termcap/terminfo description lies about the ability + of the terminal to use tabs. At least on Compaq/DEC Alpha OSF/1 3.x and + 4.x systems, stty -tabs will cause problems. - 27. Where can I learn the merits of tcsh vs. bash vs. csh vs. sh etc? + Where can I learn the merits of tcsh vs. bash vs. csh vs. sh etc? - You can read the manual page section titled [NEW FEATURES] listing + You can read the manual page section titled [NEW FEATURES] listing features that tcsh adds to csh. - You can read Tom Christiansen's [Csh Programming Considered Harmful], - a document advocating that csh (and by extension, tcsh) should not be + You can read Tom Christiansen's Csh Programming Considered Harmful, a + document advocating that csh (and by extension, tcsh) should not be used for writing shell scripts. - XXX: Need to find something about [bash], but bash is sh-compatible - and has many of the same interactive features of tcsh (command - completion does not appear to be as flexible, though). - - [Curtains up: introducing the Z shell] has a pretty good rundown on - zsh. Aside from the arguments about csh being evil, tcsh appears to - compare well with zsh [zsh]. Zsh is sh and ksh compatible, with many - of the interactive features of tcsh. - _________________________________________________________________ - - 28. Why does FreeBSD's tcsh do history browsing differently than I - expect? + XXX: Need to find something about bash, but bash is sh-compatible and + has many of the same interactive features of tcsh (command completion + does not appear to be as flexible, though). - On FreeBSD, by default, the up arrow is set to - "history-search-backward", rather than the default "up-history". As a - result, if you type (part of) a word and press up arrow, you'll see - previous commands that match the prefix. Pretty useful, actually, - although it takes some getting used to. You can use bindkey to see - your settings, and to rebind up & down differently if desired. - _________________________________________________________________ + Curtains up: introducing the Z shell has a pretty good rundown on zsh. + Aside from the arguments about csh being evil, tcsh appears to compare + well with zsh. Zsh is sh and ksh compatible, with many of the + interactive features of tcsh. - Everything else is a bug :-( + Why does FreeBSD's tcsh do history browsing differently than I expect? - Christos - _________________________________________________________________ + On FreeBSD, by default, the up arrow is set to history-search-backward, + rather than the default up-history. As a result, if you type (part of) + a word and press up arrow, you'll see previous commands that match the + prefix. Pretty useful, actually, although it takes some getting used + to. You can use bindkey to see your settings, and to rebind up & down + differently if desired. + __________________________________________________________________ - Home | RecentChanges | Preferences - Edit text of this page | View other revisions - Last edited April 29, 2004 15:02 (diff) - Search: ____________________ + Page content last updated on 2019-12-31 diff --git a/contrib/tcsh/Fixes b/contrib/tcsh/Fixes index db401f23fad0..e539c8241a86 100644 --- a/contrib/tcsh/Fixes +++ b/contrib/tcsh/Fixes @@ -1,3 +1,25 @@ + 14. Don't crash with 'bindkey "^0" clear-screen' (Karl Jeacle) + 13. Fix $x:q:h and $x:q:t return the whole string for strings not containing / + 12. V6.22.03 - 20201118 + 11. Fix $x:q:h and $x:q:t to not crash (alzwded) with strings containing / + 10. Block SIGHUP while writing history/directory stack (Brett Frankenberger) + 9. Fixed reversed test that broke history merging (Brett Frankenberger) + 8. Prevent recursive entry for writing history (Brett Frankenberger) + 7. alxwded@github, keep track of the :g and :a modifiers per modifier they + affect. + 6. alzwded@github, fix infinite loop with :gas variable modifier + 5. PR/88: Add a Q: modifier that preserves empty arguments leaving :q + alone. + 4. V6.22.02 - 20191204 + 3. Fix version in configure.ac + 2. V6.22.01 - 20191201 + 1. undo PR/88: Preserve empty arguments in :q, since it breaks + $ set x="" + $ alias test "echo "\""$x:q"\"" is working." + $ alias test + echo " + + 6. V6.22.00 - 20191128 5. PR/113: Sobomax: avoid infinite loops for -c commands when stdout is not a tty. 4. Avoid infinite loops during history loads when merging, print a better @@ -6,6 +28,7 @@ 2. PR/94: Small apple issues (SAVESIGVEC, HOSTTYPE) 1. PR/81: Fix range matching issue where we were comparing with the range character instead of the start of range. [l-z]* would match foo + 12. V6.21.00 - 20190508 11. Abort history loading on words and lines too long https://bugzilla.redhat.com/show_bug.cgi?id=1598502 diff --git a/contrib/tcsh/Imakefile b/contrib/tcsh/Imakefile index be2bebe17ca9..bd1b43b1a24e 100644 --- a/contrib/tcsh/Imakefile +++ b/contrib/tcsh/Imakefile @@ -492,14 +492,15 @@ SHSRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c \ sh.char.c sh.exp.c sh.file.c sh.func.c \ sh.glob.c sh.hist.c sh.init.c sh.lex.c \ sh.misc.c sh.parse.c sh.print.c sh.proc.c \ - sh.sem.c sh.set.c sh.time.c glob.c \ + sh.sem.c sh.set.c sh.time.c dotlock.c dotlock.h glob.c \ sh.char.h sh.dir.h sh.proc.h sh.h \ sh.decls.h glob.h ${SYSSRCS} SHOBJS= sh.${SUF} sh.dir.${SUF} sh.dol.${SUF} sh.err.${SUF} sh.exec.${SUF} \ sh.char.${SUF} sh.exp.${SUF} sh.file.${SUF} sh.func.${SUF} \ sh.glob.${SUF} sh.hist.${SUF} sh.init.${SUF} sh.lex.${SUF} \ sh.misc.${SUF} sh.parse.${SUF} sh.print.${SUF} sh.proc.${SUF} \ - sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} glob.${SUF} ${SYSOBJS} + sh.sem.${SUF} sh.set.${SUF} sh.time.${SUF} dotlock.${SUF} glob.${SUF} \ + ${SYSOBJS} TWSRCS= tw.decls.h tw.h tw.help.c tw.init.c tw.parse.c tw.spell.c \ tw.comp.c tw.color.c @@ -512,9 +513,10 @@ EDOBJS= ed.chared.${SUF} ed.refresh.${SUF} ed.screen.${SUF} ed.init.${SUF} \ ed.inputl.${SUF} ed.defns.${SUF} ed.xmap.${SUF} ed.term.${SUF} TCSRCS= tc.alloc.c tc.bind.c tc.const.c tc.decls.h tc.disc.c \ - tc.func.c tc.os.c tc.os.h tc.printf.c tc.prompt.c \ - tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h tc.vers.c tc.wait.h \ - tc.who.c tc.h + tc.func.c tc.nls.c tc.nls.h tc.os.c tc.os.h tc.printf.c tc.prompt.c \ + tc.disc.${SUF} tc.func.${SUF} tc.nls.${SUF} tc.os.${SUF} \ + tc.printf.${SUF} tc.sched.c tc.sig.c tc.sig.h tc.str.c sh.types.h \ + tc.vers.c tc.wait.h tc.who.c tc.h TCOBJS= tc.alloc.${SUF} tc.bind.${SUF} tc.const.${SUF} tc.defs.${SUF} \ tc.disc.${SUF} tc.func.${SUF} tc.os.${SUF} tc.printf.${SUF} \ tc.prompt.${SUF} tc.sched.${SUF} tc.sig.${SUF} tc.str.${SUF} \ @@ -524,7 +526,7 @@ MISCF = Makefile.std BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md \ FAQ WishList config_f.h eight-bit.me glob.3 patchlevel.h pathnames.h \ tcsh.man Ported src.desc Imakefile imake.config complete.tcsh \ Makefile.vms termcap.vms snames.h host.defs gethost.c tcsh.man2html \ - Makefile.in configure.ac Makefile.win32 aclocal.m4 + Makefile.in configure.ac Makefile.win32 aclocal.m4 dot.login dot.tcshrc CONFSRCS=config/[a-z]* diff --git a/contrib/tcsh/Makefile.ADMIN b/contrib/tcsh/Makefile.ADMIN new file mode 100644 index 000000000000..5ad3bb8fb3c5 --- /dev/null +++ b/contrib/tcsh/Makefile.ADMIN @@ -0,0 +1,24 @@ +# +# Makefile.ADMIN +# +# Maintenance tasks +# +# You can refetch files from the website, then run "git diff" to +# sanity check any changes before committing. +# + +LYNX= lynx -dump -nolist +TRIM= expand | sed -e 's/^ *$$//' | cat -s +WEB= https://www.tcsh.org + +PAGES= FAQ + +all: ${PAGES} + +.for i in ${PAGES} +$i: force + ${LYNX} ${WEB}/${i:tl}/ | ${TRIM} > ${.TARGET} +.endfor + +.DUMMY: force +force: diff --git a/contrib/tcsh/Makefile.in b/contrib/tcsh/Makefile.in index 210b7de72dfe..c6b5f2554cc0 100644 --- a/contrib/tcsh/Makefile.in +++ b/contrib/tcsh/Makefile.in @@ -6,6 +6,7 @@ # things; Paul Placeway, CIS Dept., Ohio State University # SHELL=/bin/sh +ENVCMD=/usr/bin/env VERSION=@PACKAGE_VERSION@ BUILD=tcsh$(EXEEXT) VPATH=@srcdir@ @@ -410,7 +411,7 @@ AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \ pathnames.h tcsh.man Ported src.desc Imakefile imake.config \ complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \ gethost.c tcsh.man2html configure.ac configure config.h.in \ - tests/testsuite.at aclocal.m4 + tests/testsuite.at aclocal.m4 dot.login dot.tcshrc TESTFILES= tests/aliases.at tests/arguments.at tests/commands.at \ tests/expr.at tests/lexical.at tests/mb-eucjp.at \ tests/mb-utf8.at tests/noexec.at tests/parenthesis.at tests/syntax.at \ @@ -634,6 +635,8 @@ veryclean: clean ${RM} -f Makefile config.h config_p.h ${RM} -f config.status config.cache config.log tcsh.ps ${RM} -f missing + ${RM} -f testsuite.log + ${RM} -rf testsuite.dir ${RM} -rf autom4te.cache ${RM} -f *~ #* @@ -735,8 +738,10 @@ $(srcdir)/stamp-h.in: $(srcdir)/configure.ac cd $(srcdir) && autoheader @echo timestamp > $(srcdir)/stamp-h.in -check: atconfig $(srcdir)/tests/testsuite - $(SHELL) $(srcdir)/tests/testsuite +check test: atconfig $(srcdir)/tests/testsuite + $(ENVCMD) - \ + USER="$(USER)" \ + $(SHELL) $(srcdir)/tests/testsuite # # Dependencies diff --git a/contrib/tcsh/Makefile.std b/contrib/tcsh/Makefile.std index 3466d4ceac86..8c479fa1f213 100644 --- a/contrib/tcsh/Makefile.std +++ b/contrib/tcsh/Makefile.std @@ -320,7 +320,7 @@ AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \ pathnames.h tcsh.man Ported src.desc Imakefile imake.config \ complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \ gethost.c tcsh.man2html configure.ac configure config.h.in \ - aclocal.m4 + aclocal.m4 dot.login dot.tcshrc VHSRCS=${PVSRCS} ${AVSRCS} diff --git a/contrib/tcsh/Makefile.vms b/contrib/tcsh/Makefile.vms index bc241147e253..2e3f4adbfed4 100644 --- a/contrib/tcsh/Makefile.vms +++ b/contrib/tcsh/Makefile.vms @@ -297,7 +297,7 @@ AVSRCS= BUILDING Fixes MAKEDIFFS MAKESHAR NewThings README.md FAQ \ WishList config_f.h eight-bit.me glob.3 patchlevel.h \ pathnames.h tcsh.man Ported src.desc Imakefile imake.config \ complete.tcsh vmsreadme.txt termcap.vms snames.h host.defs \ - gethost.c tcsh.man2html configure.ac aclocal.m4 + gethost.c tcsh.man2html configure.ac aclocal.m4 dot.login dot.tcshrc VHSRCS=${PVSRCS} ${AVSRCS} diff --git a/contrib/tcsh/README.md b/contrib/tcsh/README.md index 58a30738daa6..df6671b0316e 100644 --- a/contrib/tcsh/README.md +++ b/contrib/tcsh/README.md @@ -5,7 +5,7 @@ The Tcsh source code is available on GitHub as a read-only repo mirror at: -> http://github.com/tcsh-org/tcsh +> https://github.com/tcsh-org/tcsh Instructions for compiling Tcsh can be found in [BUILDING]. @@ -20,7 +20,10 @@ the tcsh mailing list: > https://mailman.astron.com/mailman/listinfo/tcsh [![Build Status][status]][travis] +[![Coverity Scan][badge]][coverity] [BUILDING]: BUILDING -[status]: https://travis-ci.org/tcsh-org/tcsh.svg?branch=master -[travis]: https://travis-ci.org/tcsh-org/tcsh +[badge]: https://scan.coverity.com/projects/20307/badge.svg +[coverity]: https://scan.coverity.com/projects/tcsh-org-tcsh +[status]: https://travis-ci.com/tcsh-org/tcsh.svg?branch=master +[travis]: https://travis-ci.com/tcsh-org/tcsh diff --git a/contrib/tcsh/configure b/contrib/tcsh/configure index 4e724c2bfb80..27a6bec356a0 100755 --- a/contrib/tcsh/configure +++ b/contrib/tcsh/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for tcsh 6.21.00. +# Generated by GNU Autoconf 2.69 for tcsh 6.22.03. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='tcsh' PACKAGE_TARNAME='tcsh' -PACKAGE_VERSION='6.21.00' -PACKAGE_STRING='tcsh 6.21.00' +PACKAGE_VERSION='6.22.03' +PACKAGE_STRING='tcsh 6.22.03' PACKAGE_BUGREPORT='https://bugs.astron.com/' PACKAGE_URL='' @@ -628,10 +628,10 @@ BUILD_CATALOGS HESLIB HESDEF DFLAGS -LTLIBICONV -LIBICONV CC_FOR_GETHOST GENCAT +LTLIBICONV +LIBICONV EGREP GREP CPP @@ -1250,7 +1250,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures tcsh 6.21.00 to adapt to many kinds of systems. +\`configure' configures tcsh 6.22.03 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1315,7 +1315,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of tcsh 6.21.00:";; + short | recursive ) echo "Configuration of tcsh 6.22.03:";; esac cat <<\_ACEOF @@ -1411,7 +1411,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -tcsh configure 6.21.00 +tcsh configure 6.22.03 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2174,7 +2174,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by tcsh $as_me 6.21.00, which was +It was created by tcsh $as_me 6.22.03, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2723,278 +2723,222 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking cached host tuple" >&5 -$as_echo_n "checking cached host tuple... " >&6; } -if { test x"${ac_cv_host_system_type+set}" = x"set" && - test x"$ac_cv_host_system_type" != x"$host"; }; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: different" >&5 -$as_echo "different" >&6; } - as_fn_error $? "remove config.cache and re-run configure" "$LINENO" 5 + + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } -fi -ac_cv_host_system_type="$host" + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi -case "${host}" in +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - ## Alpha (DEC) machines. - alpha*-dec-osf* ) - tcsh_config_file=decosf1 - ;; +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - ## Ultrix - *-dec-ultrix* ) - tcsh_config_file=ultrix - ;; + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi - ## DGUX - *-dg-dguxR4* ) - tcsh_config_file=dgux5.4 - ;; - m88k-dg-dgux5.4R* ) - tcsh_config_file=dgux5.4 - ;; +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS - ## HP/UX - *-hp-hpux7* ) - tcsh_config_file=hpux7 - ;; - *-hp-hpux[89]* ) - tcsh_config_file=hpux8 - ;; - *-hp-hpux1[0-9]* ) - tcsh_config_file=hpux11 - ;; +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi - ## IBM AIX systems - *-ibm-aix*) - tcsh_config_file=aix - ;; - ## SX-4 - sx4-nec-*) - CC='cc -h0,ansi,novector,float0' - LDFLAGS='-Gsmall' - tcsh_config_file=superux8 - ;; + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. *** 5135 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Mar 21 07:06:19 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 02E555694ED; Sun, 21 Mar 2021 07:06: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 4F37vt6cxpz4X6F; Sun, 21 Mar 2021 07:06: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 D5A7B16A8D; Sun, 21 Mar 2021 07:06: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 12L76IZK023478; Sun, 21 Mar 2021 07:06:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12L76IhV023477; Sun, 21 Mar 2021 07:06:18 GMT (envelope-from git) Date: Sun, 21 Mar 2021 07:06:18 GMT Message-Id: <202103210706.12L76IhV023477@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: bf1863de6b1f - stable/12 - linux: make timerfd_settime(2) set expirations count to zero 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/stable/12 X-Git-Reftype: branch X-Git-Commit: bf1863de6b1fb813192e45639b4cfde65a624b6b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 07:06:19 -0000 The branch stable/12 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=bf1863de6b1fb813192e45639b4cfde65a624b6b commit bf1863de6b1fb813192e45639b4cfde65a624b6b Author: shu AuthorDate: 2021-02-03 16:51:45 +0000 Commit: Dmitry Chagin CommitDate: 2021-03-21 07:03:22 +0000 linux: make timerfd_settime(2) set expirations count to zero On Linux, read(2) from a timerfd file descriptor returns an unsigned 8-byte integer (uint64_t) containing the number of expirations that have occurred, if the timer has already expired one or more times since its settings were last modified using timerfd_settime(), or since the last successful read(2). That's to say, once we do a read or call timerfd_settime(), timer fd's expiration count should be zero. Some Linux applications create timerfd and add it to epoll with LT mode, when event comes, they do timerfd_settime instead of read to stop event source from trigger. On FreeBSD, timerfd_settime(2) didn't set the count to zero, which caused high CPU utilization. PR: 252820 Submitted by: ankohuu_outlook.com (Shunchao Hu) Differential Revision: https://reviews.freebsd.org/D28231 (cherry picked from commit ae71b794cbed19e5e25effc3438720ad452ab87c) --- sys/compat/linux/linux_event.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/compat/linux/linux_event.c b/sys/compat/linux/linux_event.c index 498471fd7dd1..b1d88eb3f402 100644 --- a/sys/compat/linux/linux_event.c +++ b/sys/compat/linux/linux_event.c @@ -1276,6 +1276,7 @@ linux_timerfd_settime(struct thread *td, struct linux_timerfd_settime_args *args linux_timerfd_curval(tfd, &ots); tfd->tfd_time = nts; + tfd->tfd_count = 0; if (timespecisset(&nts.it_value)) { linux_timerfd_clocktime(tfd, &cts); ts = nts.it_value; From owner-dev-commits-src-all@freebsd.org Sun Mar 21 10:33:07 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4134856F0ED; Sun, 21 Mar 2021 10:33: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 4F3DVW1DgYz4jHX; Sun, 21 Mar 2021 10:33: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 1D56B19599; Sun, 21 Mar 2021 10:33: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 12LAX7wY016811; Sun, 21 Mar 2021 10:33:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LAX7ZV016810; Sun, 21 Mar 2021 10:33:07 GMT (envelope-from git) Date: Sun, 21 Mar 2021 10:33:07 GMT Message-Id: <202103211033.12LAX7ZV016810@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 2b61bda2c75f - stable/12 - Use C11 anonymous unions. 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/stable/12 X-Git-Reftype: branch X-Git-Commit: 2b61bda2c75f30f6eadd18fb891fd885e4c8d19d Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 10:33:07 -0000 The branch stable/12 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=2b61bda2c75f30f6eadd18fb891fd885e4c8d19d commit 2b61bda2c75f30f6eadd18fb891fd885e4c8d19d Author: Dmitry Chagin AuthorDate: 2019-06-10 05:28:03 +0000 Commit: Dmitry Chagin CommitDate: 2021-03-21 10:32:03 +0000 Use C11 anonymous unions. PR: 215202 Reported by: glebius (cherry picked from commit a5ec4a9dba5629dfe146ae9534e91e5e957747eb) --- sys/sys/ucred.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h index f7079ad92c1c..9713623de6cc 100644 --- a/sys/sys/ucred.h +++ b/sys/sys/ucred.h @@ -89,12 +89,11 @@ struct xucred { gid_t cr_groups[XU_NGROUPS]; /* groups */ union { void *_cr_unused1; /* compatibility with old ucred */ - pid_t _pid; - } _cr; + pid_t cr_pid; + }; }; #define XUCRED_VERSION 0 -#define cr_pid _cr._pid /* This can be used for both ucred and xucred structures. */ #define cr_gid cr_groups[0] From owner-dev-commits-src-all@freebsd.org Sun Mar 21 15:45:11 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BD23579565; Sun, 21 Mar 2021 15:45: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 4F3MQb3823z3HZ1; Sun, 21 Mar 2021 15:45: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 5EBB21D631; Sun, 21 Mar 2021 15:45: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 12LFjBPQ050234; Sun, 21 Mar 2021 15:45:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LFjBS4050233; Sun, 21 Mar 2021 15:45:11 GMT (envelope-from git) Date: Sun, 21 Mar 2021 15:45:11 GMT Message-Id: <202103211545.12LFjBS4050233@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Stefan Eßer Subject: git: cd0355bd261e - stable/13 - Vendor import of bc 3.3.4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: cd0355bd261e6b8f23c2dd91394d2d345e674b22 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 15:45:11 -0000 The branch stable/13 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=cd0355bd261e6b8f23c2dd91394d2d345e674b22 commit cd0355bd261e6b8f23c2dd91394d2d345e674b22 Author: Stefan Eßer AuthorDate: 2021-03-19 08:39:56 +0000 Commit: Stefan Eßer CommitDate: 2021-03-21 15:42:34 +0000 Vendor import of bc 3.3.4 This update performs an implicit flush of the output when a script calls read() in case a prompt is to be displayed in line-buffered output mode. (cherry picked from commit 893ecb52db5ed47d6c1e8698334d34e0df651612) --- contrib/bc/Makefile.in | 2 +- contrib/bc/NEWS.md | 9 +++++++++ contrib/bc/README.md | 10 +--------- contrib/bc/src/program.c | 4 ++++ 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in index db8e24967996..aab7f9b569e5 100644 --- a/contrib/bc/Makefile.in +++ b/contrib/bc/Makefile.in @@ -29,7 +29,7 @@ # .POSIX: -VERSION = 3.3.3 +VERSION = 3.3.4 SRC = %%SRC%% OBJ = %%OBJ%% diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index 3a3433077d50..3374ab57bc41 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,5 +1,14 @@ # News +## 3.3.4 + +This is a production release that fixes a small bug. + +The bug was that output was not flushed before a `read()` call, so prompts +without a newline on the end were not flushed before the `read()` call. + +This is such a tiny bug that users only need to upgrade if they are affected. + ## 3.3.3 This is a production release with one tweak and fixes for manuals. diff --git a/contrib/bc/README.md b/contrib/bc/README.md index 2f95e16ed246..6a37a8bfb8da 100644 --- a/contrib/bc/README.md +++ b/contrib/bc/README.md @@ -42,8 +42,7 @@ Systems that are known to work: * HP-UX* (except for history) Please submit bug reports if this `bc` does not build out of the box on any -system besides Windows. If Windows binaries are needed, they can be found at -[xstatic][6]. +system besides Windows. ## Build @@ -52,12 +51,6 @@ This `bc` should build unmodified on any POSIX-compliant system. For more complex build requirements than the ones below, see the [build manual][5]. -### Pre-built Binaries - -It is possible to download pre-compiled binaries for a wide list of platforms, -including Linux- and Windows-based systems, from [xstatic][6]. This link always -points to the latest release of `bc`. - ### Default For the default build with optimization, use the following commands in the root @@ -329,7 +322,6 @@ Folders: [1]: https://www.gnu.org/software/bc/ [4]: ./LICENSE.md [5]: ./manuals/build.md -[6]: https://pkg.musl.cc/bc/ [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 diff --git a/contrib/bc/src/program.c b/contrib/bc/src/program.c index d4e386d4ac1b..6ab794736f79 100644 --- a/contrib/bc/src/program.c +++ b/contrib/bc/src/program.c @@ -1928,6 +1928,10 @@ void bc_program_exec(BcProgram *p) { case BC_INST_READ: { + // We want to flush output before + // this in case there is a prompt. + bc_file_flush(&vm.fout); + bc_program_read(p); ip = bc_vec_top(&p->stack); From owner-dev-commits-src-all@freebsd.org Sun Mar 21 15:53:37 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AE447579F51; Sun, 21 Mar 2021 15:53: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 4F3McK4ZnHz3JlN; Sun, 21 Mar 2021 15:53: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 903651D4CE; Sun, 21 Mar 2021 15:53: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 12LFrbD6063661; Sun, 21 Mar 2021 15:53:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LFrbmV063656; Sun, 21 Mar 2021 15:53:37 GMT (envelope-from git) Date: Sun, 21 Mar 2021 15:53:37 GMT Message-Id: <202103211553.12LFrbmV063656@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Stefan Eßer Subject: git: 92db69bf8762 - stable/12 - bc: Upgrade to version 3.2.4 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 92db69bf876227ae9bf97874404a156bb5926334 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 15:53:37 -0000 The branch stable/12 has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=92db69bf876227ae9bf97874404a156bb5926334 commit 92db69bf876227ae9bf97874404a156bb5926334 Author: Stefan Eßer AuthorDate: 2020-12-27 20:53:09 +0000 Commit: Stefan Eßer CommitDate: 2021-03-21 15:53:30 +0000 bc: Upgrade to version 3.2.4 This update changes the behavior of "-e" or "-f" in BC_ENV_ARGS: Use of these options on the command line makes bc exit after executing the given commands. These options will not cause bc to exit when passed via the environment (but EOF in STDIN or -e or -f on the command line will make bc exit as before). The same applies to DC_ENV_ARGS with regard to the dc program. Make length(0) and length(0.0) return 1 for compatibility with GNU bc and the traditional FreeBSD bc. Fix a potential division by zero error in a non-standard (extended) math library function. (cherry picked from commit e458944cf9deec51d03ec751050a58ddf43e796f) (cherry picked from commit 9a995fe186257315e7b3d01e24c55d86bb18fd32) (cherry picked from commit 4aa71da8dc004aa5027836259433e5bff3cd9104) (cherry picked from commit 028616d0dd69a3da7a30cb94d35f040bf2ced6b9) (cherry picked from commit f165641df4da1752f8bb1f55c1e602cdb657fba4) (cherry picked from commit 893ecb52db5ed47d6c1e8698334d34e0df651612) --- contrib/bc/.gitignore | 9 + contrib/bc/.travis.yml | 42 --- contrib/bc/LICENSE.md | 52 ++- contrib/bc/Makefile.in | 122 ++++-- contrib/bc/NEWS.md | 97 +++++ contrib/bc/NOTICE.md | 2 +- contrib/bc/README.md | 21 +- contrib/bc/codecov.yml | 3 - contrib/bc/configure.sh | 345 +++++++++++++---- contrib/bc/exec-install.sh | 2 +- contrib/bc/functions.sh | 90 +++-- contrib/bc/gen/bc_help.txt | 2 +- contrib/bc/gen/dc_help.txt | 2 +- contrib/bc/gen/lib.bc | 2 +- contrib/bc/gen/lib2.bc | 4 +- contrib/bc/gen/strgen.c | 4 +- contrib/bc/gen/strgen.sh | 4 +- contrib/bc/include/args.h | 4 +- contrib/bc/include/bc.h | 2 +- contrib/bc/include/bcl.h | 2 +- contrib/bc/include/dc.h | 2 +- contrib/bc/include/file.h | 2 +- contrib/bc/include/history.h | 2 +- contrib/bc/include/lang.h | 2 +- contrib/bc/include/lex.h | 2 +- contrib/bc/include/library.h | 2 +- contrib/bc/include/num.h | 4 +- contrib/bc/include/opt.h | 2 +- contrib/bc/include/parse.h | 2 +- contrib/bc/include/program.h | 2 +- contrib/bc/include/rand.h | 31 +- contrib/bc/include/read.h | 2 +- contrib/bc/include/status.h | 22 +- contrib/bc/include/vector.h | 3 +- contrib/bc/include/vm.h | 20 +- contrib/bc/karatsuba.py | 12 +- contrib/bc/link.sh | 2 +- contrib/bc/locale_install.sh | 2 +- contrib/bc/locale_uninstall.sh | 2 +- contrib/bc/locales/de_DE.ISO8859-1.msg | 2 +- contrib/bc/locales/de_DE.UTF-8.msg | 2 +- contrib/bc/locales/en_US.msg | 2 +- contrib/bc/locales/es_ES.ISO8859-1.msg | 2 +- contrib/bc/locales/es_ES.UTF-8.msg | 2 +- contrib/bc/locales/fr_FR.ISO8859-1.msg | 2 +- contrib/bc/locales/fr_FR.UTF-8.msg | 2 +- contrib/bc/locales/ja_JP.UTF-8.msg | 2 +- contrib/bc/locales/ja_JP.eucJP.msg | 2 +- contrib/bc/locales/nl_NL.ISO8859-1.msg | 2 +- contrib/bc/locales/nl_NL.UTF-8.msg | 2 +- contrib/bc/locales/pl_PL.ISO8859-2.msg | 2 +- contrib/bc/locales/pl_PL.UTF-8.msg | 2 +- contrib/bc/locales/pt_PT.ISO8859-1.msg | 2 +- contrib/bc/locales/pt_PT.UTF-8.msg | 2 +- contrib/bc/locales/ru_RU.CP1251.msg | 2 +- contrib/bc/locales/ru_RU.CP866.msg | 2 +- contrib/bc/locales/ru_RU.ISO8859-5.msg | 2 +- contrib/bc/locales/ru_RU.KOI8-R.msg | 2 +- contrib/bc/locales/ru_RU.UTF-8.msg | 2 +- contrib/bc/locales/zh_CN.GB18030.msg | 2 +- contrib/bc/locales/zh_CN.GB2312.msg | 2 +- contrib/bc/locales/zh_CN.GBK.msg | 2 +- contrib/bc/locales/zh_CN.UTF-8.msg | 2 +- contrib/bc/locales/zh_CN.eucCN.msg | 2 +- contrib/bc/manpage.sh | 2 +- contrib/bc/manuals/bc.1.md.in | 81 ++-- contrib/bc/manuals/bc/A.1 | 92 +++-- contrib/bc/manuals/bc/A.1.md | 79 ++-- contrib/bc/manuals/bc/E.1 | 86 +++-- contrib/bc/manuals/bc/E.1.md | 70 ++-- contrib/bc/manuals/bc/EH.1 | 86 +++-- contrib/bc/manuals/bc/EH.1.md | 70 ++-- contrib/bc/manuals/bc/EHN.1 | 86 +++-- contrib/bc/manuals/bc/EHN.1.md | 70 ++-- contrib/bc/manuals/bc/EHNP.1 | 86 +++-- contrib/bc/manuals/bc/EHNP.1.md | 70 ++-- contrib/bc/manuals/bc/EHP.1 | 86 +++-- contrib/bc/manuals/bc/EHP.1.md | 70 ++-- contrib/bc/manuals/bc/EN.1 | 86 +++-- contrib/bc/manuals/bc/EN.1.md | 70 ++-- contrib/bc/manuals/bc/ENP.1 | 86 +++-- contrib/bc/manuals/bc/ENP.1.md | 70 ++-- contrib/bc/manuals/bc/EP.1 | 86 +++-- contrib/bc/manuals/bc/EP.1.md | 70 ++-- contrib/bc/manuals/bc/H.1 | 92 +++-- contrib/bc/manuals/bc/H.1.md | 79 ++-- contrib/bc/manuals/bc/HN.1 | 92 +++-- contrib/bc/manuals/bc/HN.1.md | 79 ++-- contrib/bc/manuals/bc/HNP.1 | 92 +++-- contrib/bc/manuals/bc/HNP.1.md | 79 ++-- contrib/bc/manuals/bc/HP.1 | 92 +++-- contrib/bc/manuals/bc/HP.1.md | 79 ++-- contrib/bc/manuals/bc/N.1 | 92 +++-- contrib/bc/manuals/bc/N.1.md | 79 ++-- contrib/bc/manuals/bc/NP.1 | 92 +++-- contrib/bc/manuals/bc/NP.1.md | 79 ++-- contrib/bc/manuals/bc/P.1 | 92 +++-- contrib/bc/manuals/bc/P.1.md | 79 ++-- contrib/bc/manuals/bcl.3 | 4 +- contrib/bc/manuals/bcl.3.md | 78 ++-- contrib/bc/manuals/build.md | 16 + contrib/bc/manuals/dc.1.md.in | 60 +-- contrib/bc/manuals/dc/A.1 | 78 ++-- contrib/bc/manuals/dc/A.1.md | 60 +-- contrib/bc/manuals/dc/E.1 | 72 ++-- contrib/bc/manuals/dc/E.1.md | 55 +-- contrib/bc/manuals/dc/EH.1 | 72 ++-- contrib/bc/manuals/dc/EH.1.md | 55 +-- contrib/bc/manuals/dc/EHN.1 | 72 ++-- contrib/bc/manuals/dc/EHN.1.md | 55 +-- contrib/bc/manuals/dc/EHNP.1 | 72 ++-- contrib/bc/manuals/dc/EHNP.1.md | 55 +-- contrib/bc/manuals/dc/EHP.1 | 72 ++-- contrib/bc/manuals/dc/EHP.1.md | 55 +-- contrib/bc/manuals/dc/EN.1 | 72 ++-- contrib/bc/manuals/dc/EN.1.md | 55 +-- contrib/bc/manuals/dc/ENP.1 | 72 ++-- contrib/bc/manuals/dc/ENP.1.md | 55 +-- contrib/bc/manuals/dc/EP.1 | 72 ++-- contrib/bc/manuals/dc/EP.1.md | 55 +-- contrib/bc/manuals/dc/H.1 | 78 ++-- contrib/bc/manuals/dc/H.1.md | 60 +-- contrib/bc/manuals/dc/HN.1 | 78 ++-- contrib/bc/manuals/dc/HN.1.md | 60 +-- contrib/bc/manuals/dc/HNP.1 | 78 ++-- contrib/bc/manuals/dc/HNP.1.md | 60 +-- contrib/bc/manuals/dc/HP.1 | 78 ++-- contrib/bc/manuals/dc/HP.1.md | 60 +-- contrib/bc/manuals/dc/N.1 | 78 ++-- contrib/bc/manuals/dc/N.1.md | 60 +-- contrib/bc/manuals/dc/NP.1 | 78 ++-- contrib/bc/manuals/dc/NP.1.md | 60 +-- contrib/bc/manuals/dc/P.1 | 78 ++-- contrib/bc/manuals/dc/P.1.md | 60 +-- contrib/bc/manuals/header.txt | 2 +- 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 | 24 +- contrib/bc/src/args.c | 6 +- contrib/bc/src/bc.c | 2 +- contrib/bc/src/bc_lex.c | 2 +- contrib/bc/src/bc_parse.c | 2 +- contrib/bc/src/data.c | 4 +- contrib/bc/src/dc.c | 2 +- contrib/bc/src/dc_lex.c | 6 +- contrib/bc/src/dc_parse.c | 2 +- contrib/bc/src/file.c | 4 +- contrib/bc/src/history.c | 15 +- contrib/bc/src/lang.c | 14 +- contrib/bc/src/lex.c | 4 +- contrib/bc/src/library.c | 12 +- contrib/bc/src/main.c | 13 +- contrib/bc/src/num.c | 12 +- contrib/bc/src/opt.c | 2 +- contrib/bc/src/parse.c | 8 +- contrib/bc/src/program.c | 35 +- contrib/bc/src/rand.c | 42 +-- contrib/bc/src/read.c | 6 +- contrib/bc/src/vector.c | 8 +- contrib/bc/src/vm.c | 92 ++++- contrib/bc/tests/afl.py | 22 +- contrib/bc/tests/all.sh | 191 +--------- contrib/bc/tests/bc/all.txt | 6 +- contrib/bc/tests/bc/length.txt | 3 + contrib/bc/tests/bc/length_results.txt | 5 +- contrib/bc/tests/bc/lib2.txt | 6 + contrib/bc/tests/bc/lib2_results.txt | 6 + contrib/bc/tests/bc/scripts/all.txt | 15 + contrib/bc/tests/bc/scripts/bessel.bc | 9 +- contrib/bc/tests/bc/timeconst.sh | 9 +- contrib/bc/tests/bcl.c | 2 +- contrib/bc/tests/dc/all.txt | 1 + contrib/bc/tests/dc/errors/30.txt | 1 + contrib/bc/tests/dc/errors/31.txt | 1 + contrib/bc/tests/dc/length.txt | 129 +++++++ contrib/bc/tests/dc/length_results.txt | 129 +++++++ contrib/bc/tests/dc/scripts/all.txt | 9 + contrib/bc/tests/diff.sh | 51 +++ contrib/bc/tests/errors.sh | 20 +- contrib/bc/tests/extra_required.txt | 7 + contrib/bc/tests/fuzzing/bc.dict | 68 ++++ contrib/bc/tests/fuzzing/bc_inputs1/abs.txt | 7 + contrib/bc/tests/fuzzing/bc_inputs1/add.txt | 146 ++++++++ contrib/bc/tests/fuzzing/bc_inputs1/arctangent.txt | 26 ++ contrib/bc/tests/fuzzing/bc_inputs1/array.bc | 60 +++ contrib/bc/tests/fuzzing/bc_inputs1/arrays.txt | 10 + .../bc/tests/fuzzing/bc_inputs1/assignments.txt | 122 ++++++ contrib/bc/tests/fuzzing/bc_inputs1/basic.txt | 7 + contrib/bc/tests/fuzzing/bc_inputs1/boolean.txt | 184 ++++++++++ contrib/bc/tests/fuzzing/bc_inputs1/cosine.txt | 44 +++ contrib/bc/tests/fuzzing/bc_inputs1/decimal.txt | 35 ++ contrib/bc/tests/fuzzing/bc_inputs1/divide.txt | 31 ++ .../bc/tests/fuzzing/bc_inputs1/engineering.txt | 19 + contrib/bc/tests/fuzzing/bc_inputs1/exponent.txt | 22 ++ contrib/bc/tests/fuzzing/bc_inputs1/functions.bc | 7 + contrib/bc/tests/fuzzing/bc_inputs1/functions.txt | 13 + contrib/bc/tests/fuzzing/bc_inputs1/globals.txt | 21 ++ contrib/bc/tests/fuzzing/bc_inputs1/len.bc | 48 +++ contrib/bc/tests/fuzzing/bc_inputs1/length.txt | 59 +++ contrib/bc/tests/fuzzing/bc_inputs1/lib10.txt | 4 + contrib/bc/tests/fuzzing/bc_inputs1/lib11.txt | 4 + contrib/bc/tests/fuzzing/bc_inputs1/lib12.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs1/lib2.txt | 15 + contrib/bc/tests/fuzzing/bc_inputs1/lib3.txt | 6 + contrib/bc/tests/fuzzing/bc_inputs1/lib4.txt | 10 + contrib/bc/tests/fuzzing/bc_inputs1/lib5.txt | 2 + contrib/bc/tests/fuzzing/bc_inputs1/lib6.txt | 5 + contrib/bc/tests/fuzzing/bc_inputs1/lib7.txt | 12 + contrib/bc/tests/fuzzing/bc_inputs1/lib8.txt | 3 + contrib/bc/tests/fuzzing/bc_inputs2/lib13.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib14.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib15.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib16.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib19.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib20.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib21.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib22.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib23.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/lib24.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs2/log.txt | 22 ++ contrib/bc/tests/fuzzing/bc_inputs2/misc.txt | 13 + contrib/bc/tests/fuzzing/bc_inputs2/misc1.txt | 76 ++++ contrib/bc/tests/fuzzing/bc_inputs2/misc2.txt | 110 ++++++ contrib/bc/tests/fuzzing/bc_inputs2/misc3.txt | 12 + contrib/bc/tests/fuzzing/bc_inputs2/modulus.txt | 69 ++++ contrib/bc/tests/fuzzing/bc_inputs2/multiply.txt | 40 ++ contrib/bc/tests/fuzzing/bc_inputs2/pi.txt | 4 + contrib/bc/tests/fuzzing/bc_inputs2/places.txt | 19 + contrib/bc/tests/fuzzing/bc_inputs2/power.txt | 44 +++ contrib/bc/tests/fuzzing/bc_inputs2/print2.txt | 194 ++++++++++ contrib/bc/tests/fuzzing/bc_inputs2/references.bc | 408 +++++++++++++++++++++ contrib/bc/tests/fuzzing/bc_inputs2/scale.txt | 57 +++ contrib/bc/tests/fuzzing/bc_inputs2/scientific.txt | 51 +++ contrib/bc/tests/fuzzing/bc_inputs2/shift.txt | 281 ++++++++++++++ contrib/bc/tests/fuzzing/bc_inputs2/sine.txt | 207 +++++++++++ contrib/bc/tests/fuzzing/bc_inputs3/01.txt | 339 +++++++++++++++++ contrib/bc/tests/fuzzing/bc_inputs3/02.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/03.txt | 2 + contrib/bc/tests/fuzzing/bc_inputs3/04.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/05.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/06.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/07.txt | 8 + contrib/bc/tests/fuzzing/bc_inputs3/08.txt | 3 + contrib/bc/tests/fuzzing/bc_inputs3/09.txt | 11 + contrib/bc/tests/fuzzing/bc_inputs3/10.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/11.txt | 99 +++++ contrib/bc/tests/fuzzing/bc_inputs3/12.txt | 2 + contrib/bc/tests/fuzzing/bc_inputs3/13.txt | 56 +++ contrib/bc/tests/fuzzing/bc_inputs3/14.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/15.txt | 3 + contrib/bc/tests/fuzzing/bc_inputs3/16.txt | 1 + contrib/bc/tests/fuzzing/bc_inputs3/17.txt | 11 + contrib/bc/tests/fuzzing/bc_inputs3/18.txt | 3 + contrib/bc/tests/fuzzing/bc_inputs3/19.txt | 5 + contrib/bc/tests/fuzzing/bc_inputs3/20.txt | 51 +++ contrib/bc/tests/fuzzing/bc_inputs3/21.txt | 10 + contrib/bc/tests/fuzzing/bc_inputs3/22.txt | 2 + contrib/bc/tests/fuzzing/bc_inputs3/23.txt | Bin 0 -> 1024 bytes contrib/bc/tests/fuzzing/bc_inputs3/24.txt | 4 + contrib/bc/tests/fuzzing/bc_inputs3/sqrt.txt | 14 + contrib/bc/tests/fuzzing/bc_inputs3/strings.txt | 12 + contrib/bc/tests/fuzzing/bc_inputs3/subtract.txt | 153 ++++++++ contrib/bc/tests/fuzzing/bc_inputs3/trunc.txt | 15 + contrib/bc/tests/fuzzing/bc_inputs3/void.txt | 20 + contrib/bc/tests/fuzzing/dc_inputs/01.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/02.txt | 5 + contrib/bc/tests/fuzzing/dc_inputs/03.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/04.txt | 9 + contrib/bc/tests/fuzzing/dc_inputs/05.txt | 3 + contrib/bc/tests/fuzzing/dc_inputs/06.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/07.txt | 3 + contrib/bc/tests/fuzzing/dc_inputs/08.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/09.txt | 9 + contrib/bc/tests/fuzzing/dc_inputs/10.txt | 11 + contrib/bc/tests/fuzzing/dc_inputs/11.txt | 4 + contrib/bc/tests/fuzzing/dc_inputs/12.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/13.txt | 7 + contrib/bc/tests/fuzzing/dc_inputs/14.txt | 7 + contrib/bc/tests/fuzzing/dc_inputs/15.txt | 11 + contrib/bc/tests/fuzzing/dc_inputs/16.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/17.txt | 20 + contrib/bc/tests/fuzzing/dc_inputs/18.txt | 3 + contrib/bc/tests/fuzzing/dc_inputs/19.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/20.txt | 3 + contrib/bc/tests/fuzzing/dc_inputs/21.txt | 5 + contrib/bc/tests/fuzzing/dc_inputs/22.txt | 36 ++ contrib/bc/tests/fuzzing/dc_inputs/23.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/24.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/25.txt | 6 + contrib/bc/tests/fuzzing/dc_inputs/26.txt | 155 ++++++++ contrib/bc/tests/fuzzing/dc_inputs/27.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/28.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/29.txt | 13 + contrib/bc/tests/fuzzing/dc_inputs/30.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/31.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/abs.txt | 7 + contrib/bc/tests/fuzzing/dc_inputs/add.txt | 33 ++ contrib/bc/tests/fuzzing/dc_inputs/array.dc | 2 + contrib/bc/tests/fuzzing/dc_inputs/boolean.txt | 80 ++++ contrib/bc/tests/fuzzing/dc_inputs/decimal.txt | 36 ++ contrib/bc/tests/fuzzing/dc_inputs/divide.txt | 33 ++ contrib/bc/tests/fuzzing/dc_inputs/divmod.txt | 64 ++++ contrib/bc/tests/fuzzing/dc_inputs/else.dc | 4 + contrib/bc/tests/fuzzing/dc_inputs/engineering.txt | 19 + contrib/bc/tests/fuzzing/dc_inputs/loop.dc | 3 + contrib/bc/tests/fuzzing/dc_inputs/misc.txt | 1 + contrib/bc/tests/fuzzing/dc_inputs/modexp.txt | 103 ++++++ contrib/bc/tests/fuzzing/dc_inputs/modulus.txt | 70 ++++ contrib/bc/tests/fuzzing/dc_inputs/multiply.txt | 42 +++ contrib/bc/tests/fuzzing/dc_inputs/places.txt | 14 + contrib/bc/tests/fuzzing/dc_inputs/power.txt | 36 ++ contrib/bc/tests/fuzzing/dc_inputs/quit.dc | 2 + contrib/bc/tests/fuzzing/dc_inputs/scientific.txt | 51 +++ contrib/bc/tests/fuzzing/dc_inputs/shift.txt | 42 +++ contrib/bc/tests/fuzzing/dc_inputs/sqrt.txt | 14 + contrib/bc/tests/fuzzing/dc_inputs/stdin.txt | 205 +++++++++++ contrib/bc/tests/fuzzing/dc_inputs/stream.dc | 2 + contrib/bc/tests/fuzzing/dc_inputs/strings.txt | 50 +++ contrib/bc/tests/fuzzing/dc_inputs/subtract.txt | 33 ++ contrib/bc/tests/fuzzing/dc_inputs/trunc.txt | 11 + contrib/bc/tests/fuzzing/dc_inputs/vars.txt | 2 + contrib/bc/tests/fuzzing/dc_inputs/weird.dc | 2 + contrib/bc/tests/other.sh | 271 ++++++++++++++ contrib/bc/tests/radamsa.sh | 2 +- contrib/bc/tests/randmath.py | 2 +- contrib/bc/tests/read.sh | 23 +- contrib/bc/tests/script.sh | 28 +- contrib/bc/tests/scripts.sh | 9 +- contrib/bc/tests/stdin.sh | 23 +- contrib/bc/tests/test.sh | 32 +- 331 files changed, 9268 insertions(+), 2752 deletions(-) diff --git a/contrib/bc/.gitignore b/contrib/bc/.gitignore index fb9bc5ab6aa2..5c2bbae866c0 100644 --- a/contrib/bc/.gitignore +++ b/contrib/bc/.gitignore @@ -34,6 +34,13 @@ config.mak timeconst.bc Makefile +tests/fuzzing/bc_outputs1/* +tests/fuzzing/bc_outputs2/* +tests/fuzzing/bc_outputs3/* +tests/fuzzing/dc_outputs/* +tests/bc_outputs/* +tests/dc_outputs/* + .gdb_history # Ignore the generated test files @@ -57,5 +64,7 @@ perf.data.old *.html *.profraw +core.* + cscope*.out tags diff --git a/contrib/bc/.travis.yml b/contrib/bc/.travis.yml deleted file mode 100644 index 91694a821284..000000000000 --- a/contrib/bc/.travis.yml +++ /dev/null @@ -1,42 +0,0 @@ -dist: bionic - -language: c - -arch: - - amd64 - - arm64 - - ppc64le - -compiler: - - gcc - -env: - global: - - CODECOV_TOKEN="040ce7eb-5bc7-4040-8324-364f3ef4baa3" - - CFLAGS="-coverage -DBC_RAND_BUILTIN=0" - matrix: - - CONFIGURE_ARGS=-fHNPOg GEN_HOST=1 LONG_BIT=64 - - CONFIGURE_ARGS=-bfHNPOg GEN_HOST=1 LONG_BIT=64 - - CONFIGURE_ARGS=-dfHNPOg GEN_HOST=1 LONG_BIT=64 - - CONFIGURE_ARGS=-fEHNPOg GEN_HOST=1 LONG_BIT=64 - - CONFIGURE_ARGS=-bfEHNPOg GEN_HOST=1 LONG_BIT=64 - - CONFIGURE_ARGS=-dfEHNPOg GEN_HOST=1 LONG_BIT=64 - - CONFIGURE_ARGS=-fHNPOg GEN_HOST=1 LONG_BIT=32 - - CONFIGURE_ARGS=-bfHNPOg GEN_HOST=1 LONG_BIT=32 - - CONFIGURE_ARGS=-dfHNPOg GEN_HOST=1 LONG_BIT=32 - - CONFIGURE_ARGS=-fEHNPOg GEN_HOST=1 LONG_BIT=32 - - CONFIGURE_ARGS=-bfEHNPOg GEN_HOST=1 LONG_BIT=32 - - CONFIGURE_ARGS=-dfEHNPOg GEN_HOST=1 LONG_BIT=32 - -before_install: - - sudo apt-get install -y dc - - pip install --user codecov - -before_script: - - curl -o tests/bc/scripts/timeconst.bc https://raw.githubusercontent.com/torvalds/linux/master/kernel/time/timeconst.bc - -after_success: - - bash <(curl -s https://codecov.io/bash) - -script: - - if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then ./configure.sh "$CONFIGURE_ARGS" && make -j4 && make -j4 test ; fi diff --git a/contrib/bc/LICENSE.md b/contrib/bc/LICENSE.md index 1681a053e0de..269e131cc81d 100644 --- a/contrib/bc/LICENSE.md +++ b/contrib/bc/LICENSE.md @@ -1,6 +1,6 @@ # License -Copyright (c) 2018-2020 Gavin D. Howard +Copyright (c) 2018-2021 Gavin D. Howard Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -31,7 +31,7 @@ copyrights and license: Copyright (c) 2010-2014, Salvatore Sanfilippo
Copyright (c) 2010-2013, Pieter Noordhuis
Copyright (c) 2018 rain-1
-Copyright (c) 2018-2020, Gavin D. Howard +Copyright (c) 2018-2021, Gavin D. Howard Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -53,3 +53,51 @@ 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. + +## Rand + +The files `src/rand.c` and `include/rand.h` are under the following copyrights +and license: + +Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors +Copyright (c) 2018-2021 Gavin D. Howard + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +## `safe-install.sh` + +The file `safe-install.sh` is under the following copyright and license: + +Copyright (c) 2021 Rich Felker + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/contrib/bc/Makefile.in b/contrib/bc/Makefile.in index 968494e4a8a0..aab7f9b569e5 100644 --- a/contrib/bc/Makefile.in +++ b/contrib/bc/Makefile.in @@ -1,7 +1,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2020 Gavin D. Howard and contributors. +# Copyright (c) 2018-2021 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -29,7 +29,7 @@ # .POSIX: -VERSION = 3.2.3 +VERSION = 3.3.4 SRC = %%SRC%% OBJ = %%OBJ%% @@ -41,6 +41,13 @@ BC_ENABLED = %%BC_ENABLED%% DC_ENABLED_NAME = DC_ENABLED DC_ENABLED = %%DC_ENABLED%% +HEADERS = include/args.h include/file.h include/lang.h include/lex.h include/num.h include/opt.h include/parse.h include/program.h include/read.h include/status.h include/vector.h include/vm.h +BC_HEADERS = include/bc.h +DC_HEADERS = include/dc.h +HISTORY_HEADERS = include/history.h +EXTRA_MATH_HEADERS = include/rand.h +LIBRARY_HEADERS = include/bcl.h include/library.h + GEN_DIR = gen GEN = %%GEN%% GEN_EXEC = $(GEN_DIR)/$(GEN) @@ -82,6 +89,11 @@ DC = dc BC_EXEC = $(BIN)/$(EXEC_PREFIX)$(BC) DC_EXEC = $(BIN)/$(EXEC_PREFIX)$(DC) +BC_TEST_OUTPUTS = tests/bc_outputs +BC_FUZZ_OUTPUTS = tests/fuzzing/bc_outputs1 tests/fuzzing/bc_outputs2 tests/fuzzing/bc_outputs3 +DC_TEST_OUTPUTS = tests/dc_outputs +DC_FUZZ_OUTPUTS = tests/fuzzing/dc_outputs + LIB = libbcl LIB_NAME = $(LIB).a LIBBC = $(BIN)/$(LIB_NAME) @@ -125,6 +137,9 @@ BC_ENABLE_NLS = %%NLS%% BC_ENABLE_PROMPT = %%PROMPT%% BC_LONG_BIT = %%LONG_BIT%% +BC_ENABLE_AFL = %%FUZZ%% +BC_ENABLE_MEMCHECK = %%MEMCHECK%% + RM = rm MKDIR = mkdir @@ -138,6 +153,8 @@ LOCALE_UNINSTALL = ./locale_uninstall.sh VALGRIND_ARGS = --error-exitcode=100 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all +TEST_STARS = "***********************************************************************" + BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%% CPPFLAGS1 = -D$(BC_ENABLED_NAME)=$(BC_ENABLED) -D$(DC_ENABLED_NAME)=$(DC_ENABLED) @@ -147,7 +164,8 @@ CPPFLAGS4 = $(CPPFLAGS3) -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700 CPPFLAGS5 = $(CPPFLAGS4) -DBC_NUM_KARATSUBA_LEN=$(BC_NUM_KARATSUBA_LEN) CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS) -DBC_ENABLE_PROMPT=$(BC_ENABLE_PROMPT) CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH) -CPPFLAGS = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY) +CPPFLAGS8 = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY) +CPPFLAGS = $(CPPFLAGS8) -DBC_ENABLE_MEMCHECK=$(BC_ENABLE_MEMCHECK) -DBC_ENABLE_AFL=$(BC_ENABLE_AFL) CFLAGS = $(CPPFLAGS) %%CPPFLAGS%% %%CFLAGS%% LDFLAGS = %%LDFLAGS%% @@ -159,20 +177,15 @@ HOSTCC = %%HOSTCC%% BC_LIB_C_ARGS = bc_lib bc_lib_name $(BC_ENABLED_NAME) 1 BC_LIB2_C_ARGS = bc_lib2 bc_lib2_name "$(BC_ENABLED_NAME) && $(BC_ENABLE_EXTRA_MATH_NAME)" 1 -OBJS = $(BC_HELP_O) $(DC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) -OBJ_TARGETS = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) +OBJS = $(DC_HELP_O) $(BC_HELP_O) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) -.c.o: - $(CC) $(CFLAGS) -o $@ -c $< - -all: %%ALL_PREREQ%% +all: %%DEFAULT_TARGET%% -execs: make_bin $(OBJ_TARGETS) - $(CC) $(CFLAGS) $(OBJS) $(LDFLAGS) -o $(EXEC) - %%LINK%% +%%DEFAULT_TARGET%%: %%DEFAULT_TARGET_PREREQS%% + %%DEFAULT_TARGET_CMD%% -library: make_bin $(OBJ) $(BC_LIB_O) $(BC_LIB2_O) - ar -r -cu $(LIBBC) $(BC_LIB_O) $(BC_LIB2_O) $(OBJ) +%%SECOND_TARGET%%: %%SECOND_TARGET_PREREQS%% + %%SECOND_TARGET_CMD%% $(GEN_EXEC): %%GEN_EXEC_TARGET%% @@ -180,18 +193,32 @@ $(GEN_EXEC): $(BC_LIB_C): $(GEN_EXEC) $(BC_LIB) $(GEN_EMU) $(GEN_EXEC) $(BC_LIB) $(BC_LIB_C) $(BC_LIB_C_ARGS) +$(BC_LIB_O): $(BC_LIB_C) + $(CC) $(CFLAGS) -o $@ -c $< + $(BC_LIB2_C): $(GEN_EXEC) $(BC_LIB2) $(GEN_EMU) $(GEN_EXEC) $(BC_LIB2) $(BC_LIB2_C) $(BC_LIB2_C_ARGS) +$(BC_LIB2_O): $(BC_LIB2_C) + $(CC) $(CFLAGS) -o $@ -c $< + $(BC_HELP_C): $(GEN_EXEC) $(BC_HELP) $(GEN_EMU) $(GEN_EXEC) $(BC_HELP) $(BC_HELP_C) bc_help "" $(BC_ENABLED_NAME) +$(BC_HELP_O): $(BC_HELP_C) + $(CC) $(CFLAGS) -o $@ -c $< + $(DC_HELP_C): $(GEN_EXEC) $(DC_HELP) $(GEN_EMU) $(GEN_EXEC) $(DC_HELP) $(DC_HELP_C) dc_help "" $(DC_ENABLED_NAME) -make_bin: +$(DC_HELP_O): $(DC_HELP_C) + $(CC) $(CFLAGS) -o $@ -c $< + +$(BIN): $(MKDIR) -p $(BIN) +headers: %%HEADERS%% + help: @printf 'available targets:\n' @printf '\n' @@ -222,41 +249,68 @@ help: @printf ' valgrind_dc runs the dc test suite, if dc has been built,\n' @printf ' through valgrind\n' +run_all_tests: + %%BC_ALL_TESTS%% + %%TIMECONST_ALL_TESTS%% + %%DC_ALL_TESTS%% + check: test test: %%TESTS%% -test_bc: - %%BC_TEST%% +test_bc: test_bc_header test_bc_tests test_bc_scripts test_bc_stdin test_bc_read test_bc_errors test_bc_other + @printf '\nAll bc tests passed.\n\n$(TEST_STARS)\n' + +test_bc_tests:%%BC_TESTS%% + +test_bc_scripts:%%BC_SCRIPT_TESTS%% + +test_bc_stdin: + @sh tests/stdin.sh bc %%BC_TEST_EXEC%% + +test_bc_read: + @sh tests/read.sh bc %%BC_TEST_EXEC%% + +test_bc_errors: + @sh tests/errors.sh bc %%BC_TEST_EXEC%% + +test_bc_other: + @sh tests/other.sh bc %%BC_TEST_EXEC%% + +test_bc_header: + @printf '$(TEST_STARS)\n\nRunning bc tests...\n\n' -test_dc: - %%DC_TEST%% +test_dc: test_dc_header test_dc_tests test_dc_scripts test_dc_stdin test_dc_read test_dc_errors test_dc_other + @printf '\nAll dc tests passed.\n\n$(TEST_STARS)\n' -time_test: time_test_bc timeconst time_test_dc +test_dc_tests:%%DC_TESTS%% -time_test_bc: - %%BC_TIME_TEST%% +test_dc_scripts:%%DC_SCRIPT_TESTS%% -time_test_dc: - %%DC_TIME_TEST%% +test_dc_stdin: + @sh tests/stdin.sh dc %%DC_TEST_EXEC%% + +test_dc_read: + @sh tests/read.sh dc %%DC_TEST_EXEC%% + +test_dc_errors: + @sh tests/errors.sh dc %%DC_TEST_EXEC%% + +test_dc_other: + @sh tests/other.sh dc %%DC_TEST_EXEC%% + +test_dc_header: + @printf '$(TEST_STARS)\n\nRunning dc tests...\n\n' timeconst: %%TIMECONST%% -library_test: library +library_test: $(LIBBC) $(CC) $(CFLAGS) $(BCL_TEST_C) $(LIBBC) -o $(BCL_TEST) test_library: library_test $(BCL_TEST) -valgrind: valgrind_bc valgrind_dc - -valgrind_bc: - %%VG_BC_TEST%% - -valgrind_dc: - %%VG_DC_TEST%% - karatsuba: %%KARATSUBA%% @@ -296,6 +350,8 @@ clean:%%CLEAN_PREREQS%% @$(RM) -f $(BC_LIB2_C) $(BC_LIB2_O) @$(RM) -f $(BC_HELP_C) $(BC_HELP_O) @$(RM) -f $(DC_HELP_C) $(DC_HELP_O) + @$(RM) -fr $(BC_TEST_OUTPUTS) $(DC_TEST_OUTPUTS) + @$(RM) -fr $(BC_FUZZ_OUTPUTS) $(DC_FUZZ_OUTPUTS) clean_config: clean @printf 'Cleaning config...\n' diff --git a/contrib/bc/NEWS.md b/contrib/bc/NEWS.md index db8448d48a86..3374ab57bc41 100644 --- a/contrib/bc/NEWS.md +++ b/contrib/bc/NEWS.md @@ -1,5 +1,102 @@ # News +## 3.3.4 + +This is a production release that fixes a small bug. + +The bug was that output was not flushed before a `read()` call, so prompts +without a newline on the end were not flushed before the `read()` call. + +This is such a tiny bug that users only need to upgrade if they are affected. + +## 3.3.3 + +This is a production release with one tweak and fixes for manuals. + +The tweak is that `length(0)` returns `1` instead of `0`. In `3.3.1`, I changed +it so `length(0.x)`, where `x` could be any number of digits, returned the +`scale`, but `length(0)` still returned `0` because I believe that `0` has `0` +significant digits. + +After request of FreeBSD and considering the arguments of a mathematician, +compatibility with other `bc`'s, and the expectations of users, I decided to +make the change. + +The fixes for manuals fixed a bug where `--` was rendered as `-`. + +## 3.3.2 + +This is a production release that fixes a divide-by-zero bug in `root()` in the +[extended math library][16]. All previous versions with `root()` have the bug. + +## 3.3.1 + +This is a production release that fixes a bug. + +The bug was in the reporting of number length when the value was 0. + +## 3.3.0 + +This is a production release that changes one behavior and fixes documentation +bugs. + +The changed behavior is the treatment of `-e` and `-f` when given through +`BC_ENV_ARGS` or `DC_ENV_ARGS`. Now `bc` and `dc` do not exit when those options +(or their equivalents) are given through those environment variables. However, +`bc` and `dc` still exit when they or their equivalents are given on the +command-line. + +## 3.2.7 + +This is a production release that removes a small non-portable shell operation +in `configure.sh`. This problem was only noticed on OpenBSD, not FreeBSD or +Linux. + +Non-OpenBSD users do ***NOT*** need to upgrade, although NetBSD users may also +need to upgrade. + +## 3.2.6 + +This is a production release that fixes the build on FreeBSD. + +There was a syntax error in `configure.sh` that the Linux shell did not catch, +and FreeBSD depends on the existence of `tests/all.sh`. + +All users that already upgraded to `3.2.5` should update to this release, with +my apologies for the poor release of `3.2.5`. Other users should skip `3.2.5` in +favor of this version. + +## 3.2.5 + +This is a production release that fixes several bugs and adds a couple small +things. + +The two most important bugs were bugs that causes `dc` to access memory +out-of-bounds (crash in debug builds). This was found by upgrading to `afl++` +from `afl`. Both were caused by a failure to distinguish between the same two +cases. + +Another bug was the failure to put all of the licenses in the `LICENSE.md` file. + +Third, some warnings by `scan-build` were found and eliminated. This needed one +big change: `bc` and `dc` now bail out as fast as possible on fatal errors +instead of unwinding the stack. + +Fourth, the pseudo-random number now attempts to seed itself with `/dev/random` +if `/dev/urandom` fails. + +Finally, this release has a few quality-of-life changes to the build system. The +usage should not change at all; the only thing that changed was making sure the +`Makefile.in` was written to rebuild properly when headers changed and to not +rebuild when not necessary. + +## 3.2.4 + +This is a production release that fixes a warning on `gcc` 6 or older, which +does not have an attribute that is used. + +Users do ***NOT*** need to upgrade if they don't use `gcc` 6 or older. + ## 3.2.3 This is a production release that fixes a bug in `gen/strgen.sh`. I recently diff --git a/contrib/bc/NOTICE.md b/contrib/bc/NOTICE.md index 92117daa9a6c..56d2935ab4b3 100644 --- a/contrib/bc/NOTICE.md +++ b/contrib/bc/NOTICE.md @@ -1,6 +1,6 @@ # Notice -Copyright 2018-2020 Gavin D. Howard and contributors. +Copyright 2018-2021 Gavin D. Howard and contributors. ## Contributors diff --git a/contrib/bc/README.md b/contrib/bc/README.md index cea5d877b95c..6a37a8bfb8da 100644 --- a/contrib/bc/README.md +++ b/contrib/bc/README.md @@ -1,7 +1,5 @@ # `bc` -[![Build Status][13]][14] -[![codecov][15]][16] [![Coverity Scan Build Status][17]][18] ***WARNING: This project has moved to [https://git.yzena.com/][20] for [these @@ -41,10 +39,10 @@ Systems that are known to work: * Mac OSX * Solaris* (as long as the Solaris version supports POSIX 2008) * AIX +* HP-UX* (except for history) Please submit bug reports if this `bc` does not build out of the box on any -system besides Windows. If Windows binaries are needed, they can be found at -[xstatic][6]. +system besides Windows. ## Build @@ -53,12 +51,6 @@ This `bc` should build unmodified on any POSIX-compliant system. For more complex build requirements than the ones below, see the [build manual][5]. -### Pre-built Binaries - -It is possible to download pre-compiled binaries for a wide list of platforms, -including Linux- and Windows-based systems, from [xstatic][6]. This link always -points to the latest release of `bc`. - ### Default For the default build with optimization, use the following commands in the root @@ -302,8 +294,6 @@ tarballs. Files: .gitignore The git ignore file (maintainer use only). - .travis.yml The Travis CI file (maintainer use only). - codecov.yml The Codecov file (maintainer use only). 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. @@ -332,24 +322,19 @@ Folders: [1]: https://www.gnu.org/software/bc/ [4]: ./LICENSE.md [5]: ./manuals/build.md -[6]: https://pkg.musl.cc/bc/ [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 -[13]: https://travis-ci.com/gavinhoward/bc.svg?branch=master -[14]: https://travis-ci.com/gavinhoward/bc -[15]: https://codecov.io/gh/gavinhoward/bc/branch/master/graph/badge.svg -[16]: https://codecov.io/gh/gavinhoward/bc [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://svnweb.freebsd.org/base/head/contrib/bc/ +[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 --git a/contrib/bc/codecov.yml b/contrib/bc/codecov.yml deleted file mode 100644 index 396c77d9c20a..000000000000 --- a/contrib/bc/codecov.yml +++ /dev/null @@ -1,3 +0,0 @@ -ignore: - - "src/history/history.c" - - "gen/strgen.c" diff --git a/contrib/bc/configure.sh b/contrib/bc/configure.sh index b6caf3debba3..310c26882906 100755 --- a/contrib/bc/configure.sh +++ b/contrib/bc/configure.sh @@ -2,7 +2,7 @@ # # SPDX-License-Identifier: BSD-2-Clause # -# Copyright (c) 2018-2020 Gavin D. Howard and contributors. +# Copyright (c) 2018-2021 Gavin D. Howard and contributors. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -33,6 +33,8 @@ script=$(basename "$script") . "$scriptdir/functions.sh" +cd "$scriptdir" + usage() { if [ $# -gt 0 ]; then @@ -48,7 +50,7 @@ usage() { printf 'usage:\n' printf ' %s -h\n' "$script" printf ' %s --help\n' "$script" - printf ' %s [-a|-bD|-dB|-c] [-EfgGHlMNPT] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\n' "$script" + printf ' %s [-a|-bD|-dB|-c] [-CEfgGHlmMNPtTvz] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\n' "$script" printf ' %s \\\n' "$script" printf ' [--library|--bc-only --disable-dc|--dc-only --disable-bc|--coverage]\\\n' printf ' [--force --debug --disable-extra-math --disable-generated-tests] \\\n' @@ -73,6 +75,8 @@ usage() { printf ' Generate test coverage code. Requires gcov and regcovr.\n' printf ' It is an error if either "-b" ("-D") or "-d" ("-B") is specified.\n' printf ' Requires a compiler that use gcc-compatible coverage options\n' + printf ' -C, --disable-clean\n' + printf ' Disable the clean that configure.sh does before configure.\n' printf ' -d, --dc-only\n' *** 24088 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Mar 21 17:14:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE1E057CAC4; Sun, 21 Mar 2021 17:14: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 4F3PPS5Klkz3QBs; Sun, 21 Mar 2021 17:14: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 AA4E51E893; Sun, 21 Mar 2021 17:14: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 12LHEKka075873; Sun, 21 Mar 2021 17:14:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LHEKkC075872; Sun, 21 Mar 2021 17:14:20 GMT (envelope-from git) Date: Sun, 21 Mar 2021 17:14:20 GMT Message-Id: <202103211714.12LHEKkC075872@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 6234a0bfc863 - main - usr.sbin/uefisign: prevent specifying certificate, key or output multiple times. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6234a0bfc8630fc556295812c15d72bde0f6427a Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 17:14:20 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=6234a0bfc8630fc556295812c15d72bde0f6427a commit 6234a0bfc8630fc556295812c15d72bde0f6427a Author: Xin LI AuthorDate: 2021-03-21 17:12:34 +0000 Commit: Xin LI CommitDate: 2021-03-21 17:12:34 +0000 usr.sbin/uefisign: prevent specifying certificate, key or output multiple times. MFC after: 1 month --- usr.sbin/uefisign/uefisign.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/usr.sbin/uefisign/uefisign.c b/usr.sbin/uefisign/uefisign.c index aa2a7621998d..149e90ba0e67 100644 --- a/usr.sbin/uefisign/uefisign.c +++ b/usr.sbin/uefisign/uefisign.c @@ -350,13 +350,22 @@ main(int argc, char **argv) Vflag = true; break; case 'c': - certpath = checked_strdup(optarg); + if (certpath == NULL) + certpath = checked_strdup(optarg); + else + err(1, "-c can only be specified once"); break; case 'k': - keypath = checked_strdup(optarg); + if (keypath == NULL) + keypath = checked_strdup(optarg); + else + err(1, "-k can only be specified once"); break; case 'o': - outpath = checked_strdup(optarg); + if (outpath == NULL) + outpath = checked_strdup(optarg); + else + err(1, "-o can only be specified once"); break; case 'v': vflag = true; @@ -402,7 +411,7 @@ main(int argc, char **argv) err(1, "fork"); if (pid == 0) - return (child(inpath, outpath, pipefds[1], Vflag, vflag)); + exit(child(inpath, outpath, pipefds[1], Vflag, vflag)); if (!Vflag) { certfp = checked_fopen(certpath, "r"); @@ -422,5 +431,5 @@ main(int argc, char **argv) sign(cert, key, pipefds[0]); } - return (wait_for_child(pid)); + exit(wait_for_child(pid)); } From owner-dev-commits-src-all@freebsd.org Sun Mar 21 17:28:45 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EFBA57CFE8; Sun, 21 Mar 2021 17:28: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 4F3Pk472bbz3RGb; Sun, 21 Mar 2021 17:28: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 E47031EB80; Sun, 21 Mar 2021 17:28: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 12LHSiI7090356; Sun, 21 Mar 2021 17:28:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LHSigh090355; Sun, 21 Mar 2021 17:28:44 GMT (envelope-from git) Date: Sun, 21 Mar 2021 17:28:44 GMT Message-Id: <202103211728.12LHSigh090355@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Xin LI Subject: git: 57b9a062d147 - main - usr.sbin/services_mkdb: diff reduction against NetBSD. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: delphij X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 57b9a062d147563ecda72227f0bb051f60eff608 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 17:28:45 -0000 The branch main has been updated by delphij: URL: https://cgit.FreeBSD.org/src/commit/?id=57b9a062d147563ecda72227f0bb051f60eff608 commit 57b9a062d147563ecda72227f0bb051f60eff608 Author: Xin LI AuthorDate: 2021-03-21 17:22:50 +0000 Commit: Xin LI CommitDate: 2021-03-21 17:22:50 +0000 usr.sbin/services_mkdb: diff reduction against NetBSD. MFC after: 1 month --- usr.sbin/services_mkdb/uniq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/usr.sbin/services_mkdb/uniq.c b/usr.sbin/services_mkdb/uniq.c index 74984468cbb5..330a09fc10e1 100644 --- a/usr.sbin/services_mkdb/uniq.c +++ b/usr.sbin/services_mkdb/uniq.c @@ -90,6 +90,7 @@ uniq(const char *fname) break; case -1: err(1, "put"); + /* NOTREACHED */ default: abort(); break; From owner-dev-commits-src-all@freebsd.org Sun Mar 21 17:55:12 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7208C57DC45; Sun, 21 Mar 2021 17:55: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 4F3QJc2qLkz3jC2; Sun, 21 Mar 2021 17:55: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 538FD1F10F; Sun, 21 Mar 2021 17:55: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 12LHtCRe031624; Sun, 21 Mar 2021 17:55:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LHtCjI031623; Sun, 21 Mar 2021 17:55:12 GMT (envelope-from git) Date: Sun, 21 Mar 2021 17:55:12 GMT Message-Id: <202103211755.12LHtCjI031623@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2e21e1d5fe8e - stable/12 - open(2): Remove O_BENEATH and AT_BENEATH MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2e21e1d5fe8e9f0b0817f831412ada6500f7bcbd Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 17:55:12 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2e21e1d5fe8e9f0b0817f831412ada6500f7bcbd commit 2e21e1d5fe8e9f0b0817f831412ada6500f7bcbd Author: Konstantin Belousov AuthorDate: 2021-02-16 03:31:40 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-21 17:53:56 +0000 open(2): Remove O_BENEATH and AT_BENEATH Discussed with: emaste, re Tested by: pho (cherry picked from commit 20e91ca36a56b8db1e6677f577ad011b66dd6eb3) --- lib/libc/sys/access.2 | 24 +++------------ lib/libc/sys/chflags.2 | 29 +++++------------- lib/libc/sys/chmod.2 | 29 +++++------------- lib/libc/sys/chown.2 | 29 +++++------------- lib/libc/sys/getfh.2 | 37 +++++------------------ lib/libc/sys/link.2 | 28 +++++------------ lib/libc/sys/open.2 | 76 ++++++++-------------------------------------- lib/libc/sys/stat.2 | 50 +++++-------------------------- lib/libc/sys/unlink.2 | 29 +++++------------- lib/libc/sys/utimensat.2 | 29 +++++------------- sys/kern/vfs_lookup.c | 78 +++++++----------------------------------------- sys/kern/vfs_syscalls.c | 53 ++++++++++++++------------------ sys/kern/vfs_vnops.c | 2 -- sys/sys/fcntl.h | 14 ++++----- sys/sys/namei.h | 5 ---- 15 files changed, 113 insertions(+), 399 deletions(-) diff --git a/lib/libc/sys/access.2 b/lib/libc/sys/access.2 index 1cd7eed1301b..13bfd7e5a88a 100644 --- a/lib/libc/sys/access.2 +++ b/lib/libc/sys/access.2 @@ -28,7 +28,7 @@ .\" @(#)access.2 8.2 (Berkeley) 4/1/94 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt ACCESS 2 .Os .Sh NAME @@ -120,15 +120,10 @@ list, defined in The checks for accessibility are performed using the effective user and group IDs instead of the real user and group ID as required in a call to .Fn access . -.It Dv AT_BENEATH -Only operate on files and directories below the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -218,17 +213,6 @@ or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn faccessat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. .El .Sh SEE ALSO .Xr chmod 2 , diff --git a/lib/libc/sys/chflags.2 b/lib/libc/sys/chflags.2 index b6b0b43249c7..a44713904599 100644 --- a/lib/libc/sys/chflags.2 +++ b/lib/libc/sys/chflags.2 @@ -28,7 +28,7 @@ .\" @(#)chflags.2 8.3 (Berkeley) 5/2/95 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt CHFLAGS 2 .Os .Sh NAME @@ -94,16 +94,10 @@ defined in If .Fa path names a symbolic link, then the flags of the symbolic link are changed. -.It Dv AT_BENEATH -Only allow to change flags for a file which is beneath of -the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -327,18 +321,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn chflagsat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chflags 1 , diff --git a/lib/libc/sys/chmod.2 b/lib/libc/sys/chmod.2 index 1d66408e3891..0127a5b629e4 100644 --- a/lib/libc/sys/chmod.2 +++ b/lib/libc/sys/chmod.2 @@ -28,7 +28,7 @@ .\" @(#)chmod.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt CHMOD 2 .Os .Sh NAME @@ -101,16 +101,10 @@ in If .Fa path names a symbolic link, then the mode of the symbolic link is changed. -.It Dv AT_BENEATH -Only allow to change permissions of a file which is beneath of -the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -310,18 +304,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn fchmodat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chmod 1 , diff --git a/lib/libc/sys/chown.2 b/lib/libc/sys/chown.2 index 64bfdeaa961c..4c45ce9174bb 100644 --- a/lib/libc/sys/chown.2 +++ b/lib/libc/sys/chown.2 @@ -28,7 +28,7 @@ .\" @(#)chown.2 8.4 (Berkeley) 4/19/94 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt CHOWN 2 .Os .Sh NAME @@ -118,16 +118,10 @@ list, defined in If .Fa path names a symbolic link, ownership of the symbolic link is changed. -.It Dv AT_BENEATH -Only allow to change ownership of a file which is beneath of -the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -252,18 +246,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn fchownat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chgrp 1 , diff --git a/lib/libc/sys/getfh.2 b/lib/libc/sys/getfh.2 index 5dc5896af6d8..cd3d54f54d7f 100644 --- a/lib/libc/sys/getfh.2 +++ b/lib/libc/sys/getfh.2 @@ -29,7 +29,7 @@ .\" @(#)getfh.2 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt GETFH 2 .Os .Sh NAME @@ -76,9 +76,7 @@ and .Fn lgetfh except when the .Fa path -specifies a relative path, or the -.Dv AT_BENEATH -flag is provided. +specifies a relative path. For .Fn getfhat and relative @@ -87,13 +85,6 @@ the status is retrieved from a file relative to the directory associated with the file descriptor .Fa fd instead of the current working directory. -For -.Dv AT_BENEATH -and absolute -.Fa path , -the status is retrieved from a file specified by the -.Fa path , -but additional permission checks are performed, see below. .Pp The values for the .Fa flag @@ -105,15 +96,10 @@ defined in If .Fa path names a symbolic link, the status of the symbolic link is returned. -.It Dv AT_BENEATH -Only stat files and directories below the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -140,19 +126,10 @@ bit is set in When .Fn getfhat is called with an absolute -.Fa path -without the -.Dv AT_BENEATH -flag, it ignores the -.Fa fd -argument. -When -.Dv AT_BENEATH -is specified with an absolute .Fa path , -a directory passed by the +it ignores the .Fa fd -argument is used as the topping point for the resolution. +argument. These system calls are restricted to the superuser. .Sh RETURN VALUES .Rv -std diff --git a/lib/libc/sys/link.2 b/lib/libc/sys/link.2 index c3451da10884..de0efd5e510f 100644 --- a/lib/libc/sys/link.2 +++ b/lib/libc/sys/link.2 @@ -28,7 +28,7 @@ .\" @(#)link.2 8.3 (Berkeley) 1/12/94 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt LINK 2 .Os .Sh NAME @@ -115,15 +115,10 @@ If .Fa name1 names a symbolic link, a new link for the target of the symbolic link is created. -.It Dv AT_BENEATH -Only allow to link to a file which is beneath of the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -281,18 +276,9 @@ For example, is absolute or includes a ".." component that escapes the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fa linkat -and the absolute path -.Fa name1 -does not have its tail fully contained under the topping directory, -or the relative path -.Fa name1 -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chflags 2 , diff --git a/lib/libc/sys/open.2 b/lib/libc/sys/open.2 index 73d104c5f1e2..a626b4c972e4 100644 --- a/lib/libc/sys/open.2 +++ b/lib/libc/sys/open.2 @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt OPEN 2 .Os .Sh NAME @@ -75,9 +75,7 @@ function is equivalent to the .Fn open function except in the case where the .Fa path -specifies a relative path, or the -.Dv O_BENEATH -flag is provided. +specifies a relative path. For .Fn openat and relative @@ -104,28 +102,10 @@ and the behavior is identical to a call to When .Fn openat is called with an absolute -.Fa path -without the -.Dv O_BENEATH -flag, it ignores the -.Fa fd -argument. -When -.Dv O_BENEATH -is specified with an absolute .Fa path , -a directory passed by the +it ignores the .Fa fd -argument is used as the topping point for the resolution. -When -.Dv O_BENEATH -is specified with a relative path, the -.Fa fd -argument is used both as the starting point, and as the topping point -for the resolution. -See the definition of the -.Dv O_BENEATH -flag below. +argument. .Pp In .Xr capsicum 4 @@ -137,9 +117,7 @@ The argument to .Fn openat must be strictly relative to a file descriptor -.Fa fd , -as defined in -.Pa sys/kern/vfs_lookup.c . +.Fa fd . .Fa path must not be an absolute path and must not contain ".." components which cause the path resolution to escape the directory hierarchy @@ -156,9 +134,8 @@ If the .Dv vfs.lookup_cap_dotdot .Xr sysctl 3 MIB is set to zero, ".." components in the paths, -used in capability mode, or with the -.Dv O_BENEATH -flag, are completely disabled. +used in capability mode, +are completely disabled. If the .Dv vfs.lookup_cap_dotdot_nonlocal MIB is set to zero, ".." is not allowed if found on non-local filesystem. @@ -189,8 +166,7 @@ O_TTY_INIT ignored O_DIRECTORY error if file is not a directory O_CLOEXEC set FD_CLOEXEC upon open O_VERIFY verify the contents of the file -O_BENEATH require resolved path to be strictly relative to topping directory -O_RESOLVE_BENEATH require walked path to be strictly relative to topping directory +O_RESOLVE_BENEATH path resolution must not cross the fd directory .Ed .Pp Opening a file with @@ -314,32 +290,13 @@ The details of what means is implementation specific. The run-time linker (rtld) uses this flag to ensure shared objects have been verified before operating on them. -.Dv O_BENEATH -returns -.Er ENOTCAPABLE -if the specified path, after resolving all symlinks and ".." -references, does not end up with tail residing in the directory hierarchy of -children beneath the topping directory. -Topping directory is the process current directory if relative -.Fa path -is used for -.Fn open , -and the directory referenced by the -.Fa fd -argument when using -.Fn openat . -.Dv O_BENEATH -allows arbitrary prefix that ends up at the topping directory, -after which all further resolved components must be under it. .Pp .Dv O_RESOLVE_BENEATH returns .Er ENOTCAPABLE if any intermediate component of the specified relative path does not -reside in the directory hierarchy beneath the topping directory. -Comparing to -.Dv O_BENEATH, -absolute paths or even the temporal escape from beneath of the topping +reside in the directory hierarchy beneath the starting directory. +Absolute paths or even the temporal escape from beneath of the starting directory is not allowed. .Pp When @@ -597,19 +554,12 @@ directory outside of the directory hierarchy specified by and the process is in capability mode. .It Bq Er ENOTCAPABLE The -.Dv O_BENEATH -flag was provided, and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. -.It Bq Er ENOTCAPABLE -The .Dv O_RESOLVE_BENEATH flag was provided, and the relative .Fa path -escapes topping directory. +escapes the +.Ar fd +directory. .El .Sh SEE ALSO .Xr chmod 2 , diff --git a/lib/libc/sys/stat.2 b/lib/libc/sys/stat.2 index 4759d297e8da..0ed70620af63 100644 --- a/lib/libc/sys/stat.2 +++ b/lib/libc/sys/stat.2 @@ -28,7 +28,7 @@ .\" @(#)stat.2 8.4 (Berkeley) 5/1/95 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt STAT 2 .Os .Sh NAME @@ -84,9 +84,7 @@ and .Fn lstat except when the .Fa path -specifies a relative path, or the -.Dv AT_BENEATH -flag is provided. +specifies a relative path. For .Fn fstatat and relative @@ -95,13 +93,6 @@ the status is retrieved from a file relative to the directory associated with the file descriptor .Fa fd instead of the current working directory. -For -.Dv AT_BENEATH -and absolute -.Fa path , -the status is retrieved from a file specified by the -.Fa path , -but additional permission checks are performed, see below. .Pp The values for the .Fa flag @@ -113,15 +104,8 @@ defined in If .Fa path names a symbolic link, the status of the symbolic link is returned. -.It Dv AT_BENEATH -Only stat files and directories below the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the starting directory. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -148,19 +132,10 @@ bit is set in When .Fn fstatat is called with an absolute -.Fa path -without the -.Dv AT_BENEATH -flag, it ignores the -.Fa fd -argument. -When -.Dv AT_BENEATH -is specified with an absolute .Fa path , -a directory passed by the +it ignores the .Fa fd -argument is used as the topping point for the resolution. +argument. .Pp The .Fa sb @@ -459,18 +434,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn fstatat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr access 2 , diff --git a/lib/libc/sys/unlink.2 b/lib/libc/sys/unlink.2 index 1f30c53496f8..abff0fdda0bd 100644 --- a/lib/libc/sys/unlink.2 +++ b/lib/libc/sys/unlink.2 @@ -28,7 +28,7 @@ .\" @(#)unlink.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt UNLINK 2 .Os .Sh NAME @@ -89,16 +89,10 @@ Remove the directory entry specified by and .Fa path as a directory, not a normal file. -.It Dv AT_BENEATH -Only unlink files and directories which are beneath of the topping -directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -223,18 +217,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn unlinkat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chflags 2 , diff --git a/lib/libc/sys/utimensat.2 b/lib/libc/sys/utimensat.2 index 3016d1af72aa..d31ee1f1515a 100644 --- a/lib/libc/sys/utimensat.2 +++ b/lib/libc/sys/utimensat.2 @@ -31,7 +31,7 @@ .\" @(#)utimes.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd September 23, 2020 +.Dd February 23, 2021 .Dt UTIMENSAT 2 .Os .Sh NAME @@ -146,16 +146,10 @@ names a symbolic link, the symbolic link's times are changed. By default, .Fn utimensat changes the times of the file referenced by the symbolic link. -.It Dv AT_BENEATH -Only allow to change the times of a file which is beneath of -the topping directory. -See the description of the -.Dv O_BENEATH -flag in the -.Xr open 2 -manual page. .It Dv AT_RESOLVE_BENEATH -Only walks paths below the topping directory. +Only walk paths below the directory specified by the +.Ar fd +descriptor. See the description of the .Dv O_RESOLVE_BENEATH flag in the @@ -290,18 +284,9 @@ is an absolute path, or contained a ".." component leading to a directory outside of the directory hierarchy specified by .Fa fd , -and the process is in capability mode. -.It Bq Er ENOTCAPABLE -The -.Dv AT_BENEATH -flag was provided to -.Fn utimensat , -and the absolute -.Fa path -does not have its tail fully contained under the topping directory, -or the relative -.Fa path -escapes it. +and the process is in capability mode or the +.Dv AT_RESOLVE_BENEATH +flag was specified. .El .Sh SEE ALSO .Xr chflags 2 , diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index f91eecfd26c6..23e8ac95669c 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -179,13 +179,6 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0 || dp->v_type != VDIR) return; cnp = &ndp->ni_cnd; - if ((cnp->cn_flags & BENEATH) != 0 && - (ndp->ni_lcf & NI_LCF_BENEATH_LATCHED) == 0) { - MPASS((ndp->ni_lcf & NI_LCF_LATCH) != 0); - if (dp != ndp->ni_beneath_latch) - return; - ndp->ni_lcf |= NI_LCF_BENEATH_LATCHED; - } nt = uma_zalloc(nt_zone, M_WAITOK); vhold(dp); nt->dp = dp; @@ -193,7 +186,7 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) } static void -nameicap_cleanup(struct nameidata *ndp, bool clean_latch) +nameicap_cleanup(struct nameidata *ndp) { struct nameicap_tracker *nt, *nt1; @@ -204,10 +197,6 @@ nameicap_cleanup(struct nameidata *ndp, bool clean_latch) vdrop(nt->dp); uma_zfree(nt_zone, nt); } - if (clean_latch && (ndp->ni_lcf & NI_LCF_LATCH) != 0) { - ndp->ni_lcf &= ~NI_LCF_LATCH; - vrele(ndp->ni_beneath_latch); - } } /* @@ -227,21 +216,17 @@ nameicap_check_dotdot(struct nameidata *ndp, struct vnode *dp) struct nameicap_tracker *nt; struct mount *mp; - if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0 || dp == NULL || - dp->v_type != VDIR) + if (dp == NULL || dp->v_type != VDIR || (ndp->ni_lcf & + NI_LCF_STRICTRELATIVE) == 0) return (0); + if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0) + return (ENOTCAPABLE); mp = dp->v_mount; if (lookup_cap_dotdot_nonlocal == 0 && mp != NULL && (mp->mnt_flag & MNT_LOCAL) == 0) return (ENOTCAPABLE); TAILQ_FOREACH_REVERSE(nt, &ndp->ni_cap_tracker, nameicap_tracker_head, nm_link) { - if ((ndp->ni_lcf & NI_LCF_LATCH) != 0 && - ndp->ni_beneath_latch == nt->dp) { - ndp->ni_lcf &= ~NI_LCF_BENEATH_LATCHED; - nameicap_cleanup(ndp, false); - return (0); - } if (dp == nt->dp) return (0); } @@ -272,11 +257,6 @@ namei_handle_root(struct nameidata *ndp, struct vnode **dpp) #endif return (ENOTCAPABLE); } - if ((cnp->cn_flags & BENEATH) != 0) { - ndp->ni_lcf |= NI_LCF_BENEATH_ABS; - ndp->ni_lcf &= ~NI_LCF_BENEATH_LATCHED; - nameicap_cleanup(ndp, false); - } while (*(cnp->cn_nameptr) == '/') { cnp->cn_nameptr++; ndp->ni_pathlen--; @@ -318,7 +298,6 @@ namei(struct nameidata *ndp) struct thread *td; struct proc *p; cap_rights_t rights; - struct filecaps dirfd_caps; struct uio auio; int error, linklen, startdir_used; @@ -478,28 +457,10 @@ namei(struct nameidata *ndp) if (error == 0 && dp->v_type != VDIR) error = ENOTDIR; } - if (error == 0 && (cnp->cn_flags & BENEATH) != 0) { - if (ndp->ni_dirfd == AT_FDCWD) { - ndp->ni_beneath_latch = fdp->fd_cdir; - vrefact(ndp->ni_beneath_latch); - } else { - rights = ndp->ni_rightsneeded; - cap_rights_set(&rights, CAP_LOOKUP); - error = fgetvp_rights(td, ndp->ni_dirfd, &rights, - &dirfd_caps, &ndp->ni_beneath_latch); - if (error == 0 && dp->v_type != VDIR) { - vrele(ndp->ni_beneath_latch); - error = ENOTDIR; - } - } - if (error == 0) - ndp->ni_lcf |= NI_LCF_LATCH; - } FILEDESC_SUNLOCK(fdp); if (error == 0 && (cnp->cn_flags & RBENEATH) != 0) { - if (cnp->cn_pnbuf[0] == '/' || - (ndp->ni_lcf & NI_LCF_BENEATH_ABS) != 0) { + if (cnp->cn_pnbuf[0] == '/') { error = EINVAL; } else if ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) == 0) { ndp->ni_lcf |= NI_LCF_STRICTRELATIVE | @@ -514,28 +475,16 @@ namei(struct nameidata *ndp) vrele(dp); goto out; } - MPASS((ndp->ni_lcf & (NI_LCF_BENEATH_ABS | NI_LCF_LATCH)) != - NI_LCF_BENEATH_ABS); - if (((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) != 0 && - lookup_cap_dotdot != 0) || - ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) == 0 && - (cnp->cn_flags & BENEATH) != 0)) + if ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) != 0 && + lookup_cap_dotdot != 0) ndp->ni_lcf |= NI_LCF_CAP_DOTDOT; SDT_PROBE3(vfs, namei, lookup, entry, dp, cnp->cn_pnbuf, cnp->cn_flags); for (;;) { ndp->ni_startdir = dp; error = lookup(ndp); - if (error != 0) { - /* - * Override an error to not allow user to use - * BENEATH as an oracle. - */ - if ((ndp->ni_lcf & (NI_LCF_LATCH | - NI_LCF_BENEATH_LATCHED)) == NI_LCF_LATCH) - error = ENOTCAPABLE; + if (error != 0) goto out; - } /* * If not a symbolic link, we're done. @@ -546,12 +495,7 @@ namei(struct nameidata *ndp) namei_cleanup_cnp(cnp); } else cnp->cn_flags |= HASBUF; - if ((ndp->ni_lcf & (NI_LCF_LATCH | - NI_LCF_BENEATH_LATCHED)) == NI_LCF_LATCH) { - NDFREE(ndp, 0); - error = ENOTCAPABLE; - } - nameicap_cleanup(ndp, true); + nameicap_cleanup(ndp); SDT_PROBE2(vfs, namei, lookup, return, error, (error == 0 ? ndp->ni_vp : NULL)); return (error); @@ -627,7 +571,7 @@ out: vrele(ndp->ni_rootdir); MPASS(error != 0); namei_cleanup_cnp(cnp); - nameicap_cleanup(ndp, true); + nameicap_cleanup(ndp); SDT_PROBE2(vfs, namei, lookup, return, error, NULL); return (error); } diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index c143ff3765cc..64b2f5d4a18a 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -124,8 +124,6 @@ at2cnpflags(u_int at_flags, u_int mask) res = 0; at_flags &= mask; - if ((at_flags & AT_BENEATH) != 0) - res |= BENEATH; if ((at_flags & AT_RESOLVE_BENEATH) != 0) res |= RBENEATH; if ((at_flags & AT_SYMLINK_FOLLOW) != 0) @@ -1475,12 +1473,11 @@ sys_linkat(struct thread *td, struct linkat_args *uap) int flag; flag = uap->flag; - if ((flag & ~(AT_SYMLINK_FOLLOW | AT_BENEATH | - AT_RESOLVE_BENEATH)) != 0) + if ((flag & ~(AT_SYMLINK_FOLLOW | AT_RESOLVE_BENEATH)) != 0) return (EINVAL); return (kern_linkat(td, uap->fd1, uap->fd2, uap->path1, uap->path2, - UIO_USERSPACE, at2cnpflags(flag, AT_SYMLINK_FOLLOW | AT_BENEATH | + UIO_USERSPACE, at2cnpflags(flag, AT_SYMLINK_FOLLOW | AT_RESOLVE_BENEATH))); } @@ -1794,7 +1791,7 @@ sys_unlinkat(struct thread *td, struct unlinkat_args *uap) fd = uap->fd; path = uap->path; - if ((flag & ~(AT_REMOVEDIR | AT_BENEATH)) != 0) + if ((flag & ~(AT_REMOVEDIR | AT_RESOLVE_BENEATH)) != 0) return (EINVAL); if ((uap->flag & AT_REMOVEDIR) != 0) @@ -1816,7 +1813,7 @@ kern_unlinkat(struct thread *td, int fd, char *path, enum uio_seg pathseg, restart: bwillwrite(); NDINIT_ATRIGHTS(&nd, DELETE, LOCKPARENT | LOCKLEAF | AUDITVNODE1 | - at2cnpflags(flag, AT_BENEATH | AT_RESOLVE_BENEATH), + at2cnpflags(flag, AT_RESOLVE_BENEATH), pathseg, path, fd, &cap_unlinkat_rights, td); if ((error = namei(&nd)) != 0) return (error == EINVAL ? EPERM : error); @@ -2007,7 +2004,7 @@ kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg, struct nameidata nd; int error; - if ((flag & ~(AT_EACCESS | AT_BENEATH | AT_RESOLVE_BENEATH)) != 0) + if ((flag & ~(AT_EACCESS | AT_RESOLVE_BENEATH)) != 0) return (EINVAL); if (amode != F_OK && (amode & ~(R_OK | W_OK | X_OK)) != 0) return (EINVAL); @@ -2028,7 +2025,7 @@ kern_accessat(struct thread *td, int fd, char *path, enum uio_seg pathseg, usecred = cred; AUDIT_ARG_VALUE(amode); NDINIT_ATRIGHTS(&nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF | - AUDITVNODE1 | at2cnpflags(flag, AT_BENEATH | AT_RESOLVE_BENEATH), + AUDITVNODE1 | at2cnpflags(flag, AT_RESOLVE_BENEATH), pathseg, path, fd, &cap_fstat_rights, td); if ((error = namei(&nd)) != 0) goto out; @@ -2320,13 +2317,12 @@ kern_statat(struct thread *td, int flag, int fd, char *path, struct stat sb; int error; - if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_BENEATH | - AT_RESOLVE_BENEATH)) != 0) + if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_RESOLVE_BENEATH)) != 0) return (EINVAL); - NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_BENEATH | - AT_RESOLVE_BENEATH | AT_SYMLINK_NOFOLLOW) | LOCKSHARED | LOCKLEAF | - AUDITVNODE1, pathseg, path, fd, &cap_fstat_rights, td); + NDINIT_ATRIGHTS(&nd, LOOKUP, at2cnpflags(flag, AT_RESOLVE_BENEATH | + AT_SYMLINK_NOFOLLOW) | LOCKSHARED | LOCKLEAF | AUDITVNODE1, + pathseg, path, fd, &cap_fstat_rights, td); if ((error = namei(&nd)) != 0) *** 180 LINES SKIPPED *** From owner-dev-commits-src-all@freebsd.org Sun Mar 21 17:55:13 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 89CFE57DE3D; Sun, 21 Mar 2021 17:55: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 4F3QJd3Wjzz3j6s; Sun, 21 Mar 2021 17:55: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 6BC431F0A3; Sun, 21 Mar 2021 17:55: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 12LHtDSJ031644; Sun, 21 Mar 2021 17:55:13 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LHtDMB031643; Sun, 21 Mar 2021 17:55:13 GMT (envelope-from git) Date: Sun, 21 Mar 2021 17:55:13 GMT Message-Id: <202103211755.12LHtDMB031643@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 7b7708867c44 - stable/12 - Do not call nameicap_tracker_add() for dotdot case. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7b7708867c4473f47a577427320459f57a70d458 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 17:55:13 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7b7708867c4473f47a577427320459f57a70d458 commit 7b7708867c4473f47a577427320459f57a70d458 Author: Konstantin Belousov AuthorDate: 2021-02-28 00:12:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-21 17:54:13 +0000 Do not call nameicap_tracker_add() for dotdot case. Tested by: pho (cherry picked from commit 59e749428111c029116a4302a544c7cc18b33772) --- sys/kern/vfs_lookup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 23e8ac95669c..cc0fe415365a 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -1143,8 +1143,10 @@ success: goto bad2; } } - if (ndp->ni_vp != NULL && ndp->ni_vp->v_type == VDIR) - nameicap_tracker_add(ndp, ndp->ni_vp); + if (ndp->ni_vp != NULL && ndp->ni_vp->v_type == VDIR) { + if ((cnp->cn_flags & ISDOTDOT) == 0) + nameicap_tracker_add(ndp, ndp->ni_vp); + } return (0); bad2: From owner-dev-commits-src-all@freebsd.org Sun Mar 21 17:55:15 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3290857DE8A; Sun, 21 Mar 2021 17:55: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 4F3QJg08X7z3j57; Sun, 21 Mar 2021 17:55: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 A98091F202; Sun, 21 Mar 2021 17:55: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 12LHtEG4031665; Sun, 21 Mar 2021 17:55:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LHtEss031664; Sun, 21 Mar 2021 17:55:14 GMT (envelope-from git) Date: Sun, 21 Mar 2021 17:55:14 GMT Message-Id: <202103211755.12LHtEss031664@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 512efd236cb1 - stable/12 - nameicap_tracker_add: avoid duplicates in the tracker list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 512efd236cb1aeeac591b1e5701fb1fe26d91a22 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 17:55:17 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=512efd236cb1aeeac591b1e5701fb1fe26d91a22 commit 512efd236cb1aeeac591b1e5701fb1fe26d91a22 Author: Konstantin Belousov AuthorDate: 2021-02-28 00:13:19 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-21 17:54:21 +0000 nameicap_tracker_add: avoid duplicates in the tracker list Tested by: pho (cherry picked from commit 2388ad7c293fbc89ee239a1adcb87fd158c4e8e9) --- sys/kern/vfs_lookup.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index cc0fe415365a..84a40d9e8fec 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -179,6 +179,9 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0 || dp->v_type != VDIR) return; cnp = &ndp->ni_cnd; + nt = TAILQ_LAST(&ndp->ni_cap_tracker, nameicap_tracker_head); + if (nt != NULL && nt->dp == dp) + return; nt = uma_zalloc(nt_zone, M_WAITOK); vhold(dp); nt->dp = dp; From owner-dev-commits-src-all@freebsd.org Sun Mar 21 17:55:18 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9516657DDC1; Sun, 21 Mar 2021 17:55: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 4F3QJk1bh9z3j99; Sun, 21 Mar 2021 17:55: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 E84FD1EC74; Sun, 21 Mar 2021 17:55: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 12LHtGmI031709; Sun, 21 Mar 2021 17:55:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LHtGZo031706; Sun, 21 Mar 2021 17:55:16 GMT (envelope-from git) Date: Sun, 21 Mar 2021 17:55:16 GMT Message-Id: <202103211755.12LHtGZo031706@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 45cc277b8522 - stable/12 - nameicap_check_dotdot: trim tracker on check MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 45cc277b8522723bc75912fb68665767dadc45ac Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 17:55:18 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=45cc277b8522723bc75912fb68665767dadc45ac commit 45cc277b8522723bc75912fb68665767dadc45ac Author: Konstantin Belousov AuthorDate: 2021-02-28 00:15:21 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-21 17:54:31 +0000 nameicap_check_dotdot: trim tracker on check Tested by: pho (cherry picked from commit 49c98a4bf3a87ace0df99056fa683805c1645e61) --- sys/kern/vfs_lookup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 74a5e9cdcfb9..442555700425 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -237,8 +237,12 @@ nameicap_check_dotdot(struct nameidata *ndp, struct vnode *dp) return (ENOTCAPABLE); TAILQ_FOREACH_REVERSE(nt, &ndp->ni_cap_tracker, nameicap_tracker_head, nm_link) { - if (dp == nt->dp) + if (dp == nt->dp) { + nt = TAILQ_NEXT(nt, nm_link); + if (nt != NULL) + nameicap_cleanup_from(ndp, nt); return (0); + } } return (ENOTCAPABLE); } From owner-dev-commits-src-all@freebsd.org Sun Mar 21 17:55:20 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AEE957DE8D; Sun, 21 Mar 2021 17:55: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 4F3QJl5R51z3jX2; Sun, 21 Mar 2021 17:55: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 038481F0A4; Sun, 21 Mar 2021 17:55: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 12LHtHgN031727; Sun, 21 Mar 2021 17:55:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LHtHmn031726; Sun, 21 Mar 2021 17:55:17 GMT (envelope-from git) Date: Sun, 21 Mar 2021 17:55:17 GMT Message-Id: <202103211755.12LHtHmn031726@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 7d82c78725cf - stable/12 - O_RELATIVE_BENEATH: return ENOTCAPABLE instead of EINVAL for abs path MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7d82c78725cf1769d68059b05f698737abcc8a1f Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 17:55:20 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7d82c78725cf1769d68059b05f698737abcc8a1f commit 7d82c78725cf1769d68059b05f698737abcc8a1f Author: Konstantin Belousov AuthorDate: 2021-02-28 23:59:12 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-21 17:54:36 +0000 O_RELATIVE_BENEATH: return ENOTCAPABLE instead of EINVAL for abs path Tested by: pho (cherry picked from commit 28cd3a673e0e32b009fd573764956b280d1affe1) --- sys/kern/vfs_lookup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 442555700425..5948978d238e 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -475,7 +475,7 @@ namei(struct nameidata *ndp) if (error == 0 && (cnp->cn_flags & RBENEATH) != 0) { if (cnp->cn_pnbuf[0] == '/') { - error = EINVAL; + error = ENOTCAPABLE; } else if ((ndp->ni_lcf & NI_LCF_STRICTRELATIVE) == 0) { ndp->ni_lcf |= NI_LCF_STRICTRELATIVE | NI_LCF_CAP_DOTDOT; From owner-dev-commits-src-all@freebsd.org Sun Mar 21 17:55:17 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 108DE57DDC0; Sun, 21 Mar 2021 17:55: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 4F3QJh1C9Gz3jMv; Sun, 21 Mar 2021 17:55: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 BFE7C1EC73; Sun, 21 Mar 2021 17:55: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 12LHtFrv031687; Sun, 21 Mar 2021 17:55:15 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LHtFtx031686; Sun, 21 Mar 2021 17:55:15 GMT (envelope-from git) Date: Sun, 21 Mar 2021 17:55:15 GMT Message-Id: <202103211755.12LHtFtx031686@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 2cb05fff6692 - stable/12 - Add nameicap_cleanup_from(), to clean tracker list starting from some element MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 2cb05fff66929296444ee0ff5c1fcbb8419c54d9 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 17:55:17 -0000 The branch stable/12 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=2cb05fff66929296444ee0ff5c1fcbb8419c54d9 commit 2cb05fff66929296444ee0ff5c1fcbb8419c54d9 Author: Konstantin Belousov AuthorDate: 2021-02-28 00:14:43 +0000 Commit: Konstantin Belousov CommitDate: 2021-03-21 17:54:26 +0000 Add nameicap_cleanup_from(), to clean tracker list starting from some element Tested by: pho (cherry picked from commit e8a2862aa0384c75603f801625e309a3dae0ed05) --- sys/kern/vfs_lookup.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 84a40d9e8fec..74a5e9cdcfb9 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -189,19 +189,26 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) } static void -nameicap_cleanup(struct nameidata *ndp) +nameicap_cleanup_from(struct nameidata *ndp, struct nameicap_tracker *first) { struct nameicap_tracker *nt, *nt1; - KASSERT(TAILQ_EMPTY(&ndp->ni_cap_tracker) || - (ndp->ni_lcf & NI_LCF_CAP_DOTDOT) != 0, ("not strictrelative")); - TAILQ_FOREACH_SAFE(nt, &ndp->ni_cap_tracker, nm_link, nt1) { + nt = first; + TAILQ_FOREACH_FROM_SAFE(nt, &ndp->ni_cap_tracker, nm_link, nt1) { TAILQ_REMOVE(&ndp->ni_cap_tracker, nt, nm_link); vdrop(nt->dp); uma_zfree(nt_zone, nt); } } +static void +nameicap_cleanup(struct nameidata *ndp) +{ + KASSERT(TAILQ_EMPTY(&ndp->ni_cap_tracker) || + (ndp->ni_lcf & NI_LCF_CAP_DOTDOT) != 0, ("not strictrelative")); + nameicap_cleanup_from(ndp, NULL); +} + /* * For dotdot lookups in capability mode, only allow the component * lookup to succeed if the resulting directory was already traversed From owner-dev-commits-src-all@freebsd.org Sun Mar 21 18:17:25 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4A3857EF9F; Sun, 21 Mar 2021 18:17: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 4F3QpF687nz3lGN; Sun, 21 Mar 2021 18:17: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 C591D1F0F7; Sun, 21 Mar 2021 18:17:25 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12LIHPqI060849; Sun, 21 Mar 2021 18:17:25 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LIHP6m060848; Sun, 21 Mar 2021 18:17:25 GMT (envelope-from git) Date: Sun, 21 Mar 2021 18:17:25 GMT Message-Id: <202103211817.12LIHP6m060848@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: 2476178e6b09 - main - Fix kassert panic when inserting multipath routes from multiple threads. 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: 2476178e6b09acc8d0fe6b1fb9c1b6f2981f766e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 18:17:26 -0000 The branch main has been updated by melifaro: URL: https://cgit.FreeBSD.org/src/commit/?id=2476178e6b09acc8d0fe6b1fb9c1b6f2981f766e commit 2476178e6b09acc8d0fe6b1fb9c1b6f2981f766e Author: Alexander V. Chernikov AuthorDate: 2021-03-21 18:15:29 +0000 Commit: Alexander V. Chernikov CommitDate: 2021-03-21 18:15:29 +0000 Fix kassert panic when inserting multipath routes from multiple threads. Reported by: Marco Zec MFC after: immediately --- sys/net/route/nhgrp_ctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/net/route/nhgrp_ctl.c b/sys/net/route/nhgrp_ctl.c index c2119506370f..b329b907144f 100644 --- a/sys/net/route/nhgrp_ctl.c +++ b/sys/net/route/nhgrp_ctl.c @@ -488,7 +488,9 @@ get_nhgrp(struct nh_control *ctl, struct weightened_nhop *wn, int num_nhops, if (link_nhgrp(ctl, key) == 0) { /* Unable to allocate index? */ *perror = EAGAIN; - destroy_nhgrp(key); + free_nhgrp_nhops(key); + destroy_nhgrp_int(key); + return (NULL); } *perror = 0; return (key); From owner-dev-commits-src-all@freebsd.org Sun Mar 21 18:19:54 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C7FD357ED79; Sun, 21 Mar 2021 18:19: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 4F3Qs65K1Qz3lQk; Sun, 21 Mar 2021 18:19:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A93441F0F8; Sun, 21 Mar 2021 18:19:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12LIJsB7061323; Sun, 21 Mar 2021 18:19:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LIJsW3061321; Sun, 21 Mar 2021 18:19:54 GMT (envelope-from git) Date: Sun, 21 Mar 2021 18:19:54 GMT Message-Id: <202103211819.12LIJsW3061321@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: 1af332a7d8f8 - main - rtsold: Fix validation of RDNSS options MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1af332a7d8f86b6fcc1f0f575fe5b06021b54f4c Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 18:19:54 -0000 The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=1af332a7d8f86b6fcc1f0f575fe5b06021b54f4c commit 1af332a7d8f86b6fcc1f0f575fe5b06021b54f4c Author: Mark Johnston AuthorDate: 2021-03-21 18:18:10 +0000 Commit: Mark Johnston CommitDate: 2021-03-21 18:19:42 +0000 rtsold: Fix validation of RDNSS options The header specifies the size of the option in multiples of eight bytes. The option consists of an eight-byte header followed by one or more IPv6 addresses, so the option is invalid if the size is not equal to 1+2n for some n>0. Check this. The bug can cause random stack data to be formatted as an IPv6 address and passed to resolvconf(8), but a host able to trigger the bug may also specify arbitrary addresses this way. Reported by: Q C Sponsored by: The FreeBSD Foundation MFC after: 3 days --- usr.sbin/rtsold/rtsol.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/usr.sbin/rtsold/rtsol.c b/usr.sbin/rtsold/rtsol.c index 30027fc65ac9..76756bfd8393 100644 --- a/usr.sbin/rtsold/rtsol.c +++ b/usr.sbin/rtsold/rtsol.c @@ -363,13 +363,19 @@ rtsol_input(int sock) case ND_OPT_RDNSS: rdnss = (struct nd_opt_rdnss *)raoptp; - /* Optlen sanity check (Section 5.3.1 in RFC 6106) */ - if (rdnss->nd_opt_rdnss_len < 3) { + /* + * The option header is 8 bytes long and each address + * occupies 16 bytes, so the option length must be + * greater than or equal to 24 bytes and an odd multiple + * of 8 bytes. See section 5.1 in RFC 6106. + */ + if (rdnss->nd_opt_rdnss_len < 3 || + rdnss->nd_opt_rdnss_len % 2 == 0) { warnmsg(LOG_INFO, __func__, - "too short RDNSS option" - "in RA from %s was ignored.", - inet_ntop(AF_INET6, &from.sin6_addr, - ntopbuf, sizeof(ntopbuf))); + "too short RDNSS option in RA from %s " + "was ignored.", + inet_ntop(AF_INET6, &from.sin6_addr, ntopbuf, + sizeof(ntopbuf))); break; } From owner-dev-commits-src-all@freebsd.org Sun Mar 21 18:48:32 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C8D357FDEB; Sun, 21 Mar 2021 18:48:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F3RV82dVyz3mw4; Sun, 21 Mar 2021 18:48:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4D6E81FC91; Sun, 21 Mar 2021 18:48: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 12LImWtG002283; Sun, 21 Mar 2021 18:48:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LImWaA002282; Sun, 21 Mar 2021 18:48:32 GMT (envelope-from git) Date: Sun, 21 Mar 2021 18:48:32 GMT Message-Id: <202103211848.12LImWaA002282@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mike Karels Subject: git: 35e7b6bff0b3 - stable/13 - genet: Fix problem with forwarding some TCP/IPv6 packets MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: karels X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 35e7b6bff0b39aa7c536dfbe3dd783abc983ea97 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 18:48:32 -0000 The branch stable/13 has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=35e7b6bff0b39aa7c536dfbe3dd783abc983ea97 commit 35e7b6bff0b39aa7c536dfbe3dd783abc983ea97 Author: Mike Karels AuthorDate: 2021-03-18 00:19:24 +0000 Commit: Mike Karels CommitDate: 2021-03-21 18:46:32 +0000 genet: Fix problem with forwarding some TCP/IPv6 packets TCP/IPv6 packets to be forwarded can be laid out with only the Ethernet header in the first mbuf, and these packets are lost. There was a previous hack to pullup ICMPv6 packets with such a layout for the same reason. Generalize, and pullup any IPv6 packets with only the Ethernet header in the first mbuf. Possibly this should also include IPv4, but that situation has not been observed to fail. PR: 254060 Reported by: denis at h3q.com MFC after: 3 days (cherry picked from commit 2bdcf6237744b2d9d9707d623660d33931daeb52) --- sys/arm64/broadcom/genet/if_genet.c | 46 +++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/sys/arm64/broadcom/genet/if_genet.c b/sys/arm64/broadcom/genet/if_genet.c index 5f2dfcc40395..0fe9f80f4c21 100644 --- a/sys/arm64/broadcom/genet/if_genet.c +++ b/sys/arm64/broadcom/genet/if_genet.c @@ -76,10 +76,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define ICMPV6_HACK /* workaround for chip issue */ -#ifdef ICMPV6_HACK -#include -#endif #include "syscon_if.h" #include "miibus_if.h" @@ -955,6 +951,8 @@ gen_start_locked(struct gen_softc *sc) if (err != 0) { if (err == ENOBUFS) if_setdrvflagbits(ifp, IFF_DRV_OACTIVE, 0); + else if (m == NULL) + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); if (m != NULL) if_sendq_prepend(ifp, m); break; @@ -995,36 +993,34 @@ gen_encap(struct gen_softc *sc, struct mbuf **mp) q = &sc->tx_queue[DEF_TXQUEUE]; m = *mp; -#ifdef ICMPV6_HACK + /* * Reflected ICMPv6 packets, e.g. echo replies, tend to get laid * out with only the Ethernet header in the first mbuf, and this - * doesn't seem to work. + * doesn't seem to work. Forwarded TCP packets over IPv6 also + * fail if laid out with only the Ethernet header in the first mbuf. + * For now, pull up any IPv6 packet with that layout. Maybe IPv4 + * needs it but we haven't run into it. Pulling up the sizes of + * ether_header + ip6_header + icmp6_hdr seems to work for both + * ICMPv6 and TCP over IPv6. */ -#define ICMP6_LEN (sizeof(struct ether_header) + sizeof(struct ip6_hdr) + \ - sizeof(struct icmp6_hdr)) +#define IP6_PULLUP_LEN (sizeof(struct ether_header) + \ + sizeof(struct ip6_hdr) + 8) if (m->m_len == sizeof(struct ether_header)) { int ether_type = mtod(m, struct ether_header *)->ether_type; - if (ntohs(ether_type) == ETHERTYPE_IPV6 && - m->m_next->m_len >= sizeof(struct ip6_hdr)) { - struct ip6_hdr *ip6; - - ip6 = mtod(m->m_next, struct ip6_hdr *); - if (ip6->ip6_nxt == IPPROTO_ICMPV6) { - m = m_pullup(m, - MIN(m->m_pkthdr.len, ICMP6_LEN)); - if (m == NULL) { - if (sc->ifp->if_flags & IFF_DEBUG) - device_printf(sc->dev, - "ICMPV6 pullup fail\n"); - *mp = NULL; - return (ENOMEM); - } + if (ntohs(ether_type) == ETHERTYPE_IPV6) { + m = m_pullup(m, MIN(m->m_pkthdr.len, IP6_PULLUP_LEN)); + if (m == NULL) { + if (sc->ifp->if_flags & IFF_DEBUG) + device_printf(sc->dev, + "IPV6 pullup fail\n"); + *mp = NULL; + return (ENOMEM); } } } -#undef ICMP6_LEN -#endif +#undef IP6_PULLUP_LEN + if ((if_getcapenable(sc->ifp) & (IFCAP_TXCSUM | IFCAP_TXCSUM_IPV6)) != 0) { csum_flags = m->m_pkthdr.csum_flags; From owner-dev-commits-src-all@freebsd.org Sun Mar 21 18:56:03 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 06EC05A83D0; Sun, 21 Mar 2021 18:56: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 4F3Rfp6Xb8z3nl0; Sun, 21 Mar 2021 18:56: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 D34171FCC4; Sun, 21 Mar 2021 18:56: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 12LIu28M016225; Sun, 21 Mar 2021 18:56:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12LIu2bP016224; Sun, 21 Mar 2021 18:56:02 GMT (envelope-from git) Date: Sun, 21 Mar 2021 18:56:02 GMT Message-Id: <202103211856.12LIu2bP016224@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 2595d78f3df2 - main - sys/ck.h: Add an include guard MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2595d78f3df2ca389aae259a291f93eb06ecad43 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Mar 2021 18:56:03 -0000 The branch main has been updated by kbowling (ports committer): URL: https://cgit.FreeBSD.org/src/commit/?id=2595d78f3df2ca389aae259a291f93eb06ecad43 commit 2595d78f3df2ca389aae259a291f93eb06ecad43 Author: Kevin Bowling AuthorDate: 2021-03-21 18:50:30 +0000 Commit: Kevin Bowling CommitDate: 2021-03-21 18:55:52 +0000 sys/ck.h: Add an include guard Approved by: cognet MFC after: 1 week Sponsored by: BBOX.io Differential Revision: https://reviews.freebsd.org/D29357 --- sys/sys/ck.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sys/sys/ck.h b/sys/sys/ck.h index 3bfce70c8d2c..b04fe67b476d 100644 --- a/sys/sys/ck.h +++ b/sys/sys/ck.h @@ -1,6 +1,9 @@ /* * $FreeBSD$ */ +#ifndef _SYS_CK_H_ +#define _SYS_CK_H_ + #ifdef _KERNEL #include #include @@ -11,3 +14,5 @@ #define CK_LIST_HEAD LIST_HEAD #define CK_LIST_ENTRY LIST_ENTRY #endif + +#endif /* !_SYS_CK_H_ */