From owner-dev-commits-src-all@freebsd.org Mon Mar 15 00:10:57 2021 Return-Path: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <otis@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <otis@FreeBSD.org> AuthorDate: 2021-02-28 22:07:14 +0000 Commit: Juraj Lutter <otis@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-02-18 21:22:01 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-02-19 03:07:32 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-02-19 20:42:57 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-02-21 21:45:14 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-02-21 22:21:14 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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 <stdbool.h> +#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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-02-22 17:23:35 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-02-27 15:14:05 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-03-02 21:07:22 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-03-03 20:21:26 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-03-01 23:35:45 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-03-02 04:31:34 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-03-03 16:58:04 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-03-02 23:39:44 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-02-19 03:07:32 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-02-18 21:22:01 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-02-21 21:45:14 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-02-19 20:42:57 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-02-22 17:23:35 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-02-27 15:14:05 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-03-01 23:35:45 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-02-21 22:21:14 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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 <stdbool.h> +#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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-03-02 04:31:34 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-03-02 21:07:22 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-03-02 23:39:44 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-01-28 20:53:49 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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 <dev/iscsi/iscsi_proto.h> #include <icl_conn_if.h> +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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-03-03 16:58:04 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-03-03 20:21:26 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kevans@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kevans@FreeBSD.org> AuthorDate: 2021-03-15 02:25:40 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> 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 <Jason@zx2c4.com> - Matt Dunwoodie <ncon@noconroy.net> - Kyle Evans <kevans@FreeBSD.org> 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 <netinet/in.h> #include <arpa/inet.h> +#include <dev/if_wg/if_wg.h> + #include <assert.h> #include <ctype.h> #include <err.h> @@ -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 <Jason@zx2c4.com>. 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 <sys/types.h> +#include <sys/endian.h> +#include <sys/systm.h> + +#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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <dev-commits-src-all@mailman.nyi.freebsd.org>; 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 <dev-commits-src-all@freebsd.org>; 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" <training@fdc-k.africa> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <whu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <whu@FreeBSD.org> AuthorDate: 2020-07-30 07:26:11 +0000 Commit: Wei Hu <whu@FreeBSD.org> 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 <sys/param.h> #include <sys/bus.h> #include <sys/kernel.h> +#include <sys/linker.h> #include <sys/lock.h> #include <sys/malloc.h> #include <sys/module.h> @@ -46,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include <machine/bus.h> #include <machine/intr_machdep.h> +#include <machine/metadata.h> #include <machine/md_var.h> #include <machine/resource.h> #include <x86/include/apicvar.h> @@ -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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <whu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <whu@FreeBSD.org> AuthorDate: 2019-07-09 07:24:18 +0000 Commit: Wei Hu <whu@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <whu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <whu@FreeBSD.org> AuthorDate: 2019-07-09 08:21:14 +0000 Commit: Wei Hu <whu@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <whu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <whu@FreeBSD.org> AuthorDate: 2020-08-31 09:05:45 +0000 Commit: Wei Hu <whu@FreeBSD.org> 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 <Alexander.Sideropoulos@netapp.com> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <whu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <whu@FreeBSD.org> AuthorDate: 2020-10-15 05:57:20 +0000 Commit: Wei Hu <whu@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <whu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <whu@FreeBSD.org> AuthorDate: 2020-10-15 11:44:28 +0000 Commit: Wei Hu <whu@FreeBSD.org> 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 <sys/module.h> #include <sys/queue.h> #include <sys/lock.h> +#include <sys/proc.h> #include <sys/rmlock.h> #include <sys/sbuf.h> +#include <sys/sched.h> #include <sys/smp.h> #include <sys/socket.h> #include <sys/sockio.h> @@ -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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <koobs.freebsd@gmail.com> 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 <kevans@FreeBSD.org> 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 <koobs@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kevans@FreeBSD.org> > AuthorDate: 2021-03-15 02:25:40 +0000 > Commit: Kyle Evans <kevans@FreeBSD.org> > 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 <snip> > - Many security issues have been addressed <snip> > 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kevans@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kevans@FreeBSD.org> AuthorDate: 2021-03-15 05:24:54 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kevans@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kevans@FreeBSD.org> AuthorDate: 2021-03-15 05:38:22 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kevans@freebsd.org> Date: Sun, 14 Mar 2021 22:46:51 -0700 X-Gmail-Original-Message-ID: <CACNAnaHePSi__bjnEn_djQ+RvusL6yCW3wojQJE3_M4+6Kmh=w@mail.gmail.com> Message-ID: <CACNAnaHePSi__bjnEn_djQ+RvusL6yCW3wojQJE3_M4+6Kmh=w@mail.gmail.com> Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Kubilay Kocak <koobs@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>, 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 15 Mar 2021 05:47:03 -0000 On Sun, Mar 14, 2021 at 10:40 PM Kubilay Kocak <koobs@freebsd.org> 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 <kevans@FreeBSD.org> > > AuthorDate: 2021-03-15 02:25:40 +0000 > > Commit: Kyle Evans <kevans@FreeBSD.org> > > 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 > > <snip> > > > - Many security issues have been addressed > > <snip> > > > 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kib@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kib@FreeBSD.org> AuthorDate: 2021-03-07 23:50:12 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kib@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kib@FreeBSD.org> AuthorDate: 2021-03-07 23:50:12 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kib@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kib@FreeBSD.org> AuthorDate: 2021-02-28 00:38:11 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kevans@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kevans@FreeBSD.org> AuthorDate: 2021-03-15 06:21:25 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kevans@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kevans@FreeBSD.org> AuthorDate: 2021-03-15 06:23:56 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <fernape@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <fernape@FreeBSD.org> AuthorDate: 2021-03-03 06:48:11 +0000 Commit: Fernando ApesteguÃa <fernape@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <whu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <whu@FreeBSD.org> AuthorDate: 2021-03-15 10:20:52 +0000 Commit: Wei Hu <whu@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <pho@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <pho@FreeBSD.org> AuthorDate: 2021-03-15 11:00:01 +0000 Commit: Peter Holm <pho@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <pho@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <pho@FreeBSD.org> AuthorDate: 2021-03-15 11:16:52 +0000 Commit: Peter Holm <pho@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kevans@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kevans@FreeBSD.org> AuthorDate: 2021-03-15 12:31:09 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> 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 <david@catwhisker.org> --- 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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é <royger@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <julien@xen.org> AuthorDate: 2021-03-15 11:15:47 +0000 Commit: Roger Pau Monné <royger@FreeBSD.org> 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 <ehem+freebsd@m5p.com> 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 <sys/sx.h> #include <sys/taskqueue.h> -#include <machine/xen/xen-os.h> #include <machine/stdarg.h> +#include <xen/xen-os.h> #include <xen/gnttab.h> #include <xen/xenstore/xenstorevar.h> #include <xen/xenbus/xenbusb.h> 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 <sys/sx.h> #include <sys/taskqueue.h> -#include <machine/xen/xen-os.h> #include <machine/stdarg.h> +#include <xen/xen-os.h> #include <xen/gnttab.h> #include <xen/xenbus/xenbusvar.h> #include <xen/xenbus/xenbusb.h> From owner-dev-commits-src-all@freebsd.org Mon Mar 15 13:20:30 2021 Return-Path: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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é <royger@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <julien@xen.org> AuthorDate: 2021-03-15 11:27:36 +0000 Commit: Roger Pau Monné <royger@FreeBSD.org> 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 <ehem+freebsd@m5p.com> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <trasz@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <trasz@FreeBSD.org> AuthorDate: 2021-03-12 15:31:37 +0000 Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> 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 <iwtcex@gmail.com> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <trasz@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <trasz@FreeBSD.org> AuthorDate: 2021-03-11 20:03:30 +0000 Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mhorne@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mhorne@FreeBSD.org> AuthorDate: 2021-03-10 14:57:12 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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: <xms:uXVPYDfgDJCtSHtkJ3qqnQfXwcYp6PDqiXpx5FGRRvIQ1aVv5bRjbw> <xme:uXVPYJP9lpP17wXGFO4MPB2Ri5-Jcz8BwyK5J_NCiN7imuw0jo6QUXEl4GvZpAKf9 zSCEuFz2Rr1f-tyNg> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddvledgjedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurheptggguffhjgffgffkfhfvofesthhqmhdthhdtjeenucfhrhhomhepufgtohht thcunfhonhhguceoshgtohhtthhlsehsrghmshgtohdrohhrgheqnecuggftrfgrthhtvg hrnhepudduveekheehiedukeekleelvedufeevfeetudfgtdffteffleehheffueffgfeh necuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecukfhppeekrdegiedrkeelrddvud efnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgt ohhtthhlsehsrghmshgtohdrohhrgh X-ME-Proxy: <xmx:uXVPYMhhALS2yVQ-QkWcguiS-RI8rF59uLEuHQZmc6D5ilOjaXIosA> <xmx:uXVPYE--RtVoZN9KvvUekZ70DNiZfipJZ1oAk-4vtYO-HfdiPeWBww> <xmx:uXVPYPvFMY0pSUtgtDEsBKerUiVlgAoIwBlkyrH_BnkjtfN3ZzjGrA> <xmx:uXVPYIWkExyaFkJvGDD56fwgbBFYkgOhFqQVFEU-2TI6TTDWLTwrkw> 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 <scottl@samsco.org> In-Reply-To: <202103150452.12F4qxjV047368@gitrepo.freebsd.org> Date: Mon, 15 Mar 2021 08:56:56 -0600 Cc: "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@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 <kevans@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kevans@FreeBSD.org> 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 <kevans@FreeBSD.org> > AuthorDate: 2021-03-15 02:25:40 +0000 > Commit: Kyle Evans <kevans@FreeBSD.org> > 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 <Jason@zx2c4.com> > - Matt Dunwoodie <ncon@noconroy.net> > - Kyle Evans <kevans@FreeBSD.org> >=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 <netinet/in.h> > #include <arpa/inet.h> >=20 > +#include <dev/if_wg/if_wg.h> > + > #include <assert.h> > #include <ctype.h> > #include <err.h> > @@ -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 <Jason@zx2c4.com>. 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 <sys/types.h> > +#include <sys/endian.h> > +#include <sys/systm.h> > + > +#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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kevans@freebsd.org> Date: Mon, 15 Mar 2021 10:27:42 -0500 X-Gmail-Original-Message-ID: <CACNAnaFi_wsZQzHz=wc5_s=8kAptpucyTP96gYYCVt_sxSj6hA@mail.gmail.com> Message-ID: <CACNAnaFi_wsZQzHz=wc5_s=8kAptpucyTP96gYYCVt_sxSj6hA@mail.gmail.com> Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Scott Long <scottl@samsco.org> Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 15 Mar 2021 15:27:56 -0000 On Mon, Mar 15, 2021 at 9:57 AM Scott Long <scottl@samsco.org> 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 <kevans@FreeBSD.org> wrote: > > > > The branch main has been updated by kevans: > > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D74ae3f3e33b810248da19004= c58b3581cd367843 > > > > commit 74ae3f3e33b810248da19004c58b3581cd367843 > > Author: Kyle Evans <kevans@FreeBSD.org> > > AuthorDate: 2021-03-15 02:25:40 +0000 > > Commit: Kyle Evans <kevans@FreeBSD.org> > > 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 <Jason@zx2c4.com> > > - Matt Dunwoodie <ncon@noconroy.net> > > - Kyle Evans <kevans@FreeBSD.org> > > > > 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <markj@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <markj@FreeBSD.org> AuthorDate: 2021-03-08 17:39:05 +0000 Commit: Mark Johnston <markj@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <markj@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <markj@FreeBSD.org> AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston <markj@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <markj@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <markj@FreeBSD.org> AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston <markj@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <markj@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <markj@FreeBSD.org> AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston <markj@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <markj@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <markj@FreeBSD.org> AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston <markj@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <markj@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <markj@FreeBSD.org> AuthorDate: 2021-03-08 17:39:05 +0000 Commit: Mark Johnston <markj@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <markj@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <markj@FreeBSD.org> AuthorDate: 2021-03-08 17:39:06 +0000 Commit: Mark Johnston <markj@FreeBSD.org> 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 <sys/_cscan_atomic.h> +#include <sys/atomic_san.h> #else #include <sys/atomic_common.h> 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 <sys/_cscan_atomic.h> +#include <sys/atomic_san.h> #else #include <sys/atomic_common.h> 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 <sys/_cscan_bus.h> +#include <sys/bus_san.h> #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 <machine/atomic.h> -#include <sys/_cscan_atomic.h> +#include <sys/atomic_san.h> #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 <sys/bus.h> #include <machine/bus.h> -#include <sys/_cscan_bus.h> +#include <sys/bus_san.h> 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 <sys/_cscan_bus.h> +#include <sys/bus_san.h> #else /* From owner-dev-commits-src-all@freebsd.org Mon Mar 15 15:46:54 2021 Return-Path: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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: <xms:bYFPYFl6aSvuDC4fPNVis7oFm7aWgWQLRGP2Pf3jKNKi6Ur--s8LUw> <xme:bYFPYA0q138a6SO9YBDKPgTreOzTDX0-7m0uiPds96LEwOi_BqgS9DVqdMnfwkWPd NOBCjTo-TrugUDAfA> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledruddvledgkedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurheptggguffhjgffgffkfhfvofesthhqmhdthhdtjeenucfhrhhomhepufgtohht thcunfhonhhguceoshgtohhtthhlsehsrghmshgtohdrohhrgheqnecuggftrfgrthhtvg hrnhepudduveekheehiedukeekleelvedufeevfeetudfgtdffteffleehheffueffgfeh necuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecukfhppeekrdegiedrkeelrddvud efnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshgt ohhtthhlsehsrghmshgtohdrohhrgh X-ME-Proxy: <xmx:bYFPYLrtwL-0Jupd4JAfdpj1722j1EYaZcP0OxsbLoBL_xkitNHlYw> <xmx:bYFPYFnAFbMJMdq3qnGm60v6640hmgERoeN3O1VUI-5BtKXaA6Bhsg> <xmx:bYFPYD2gYofe3KmXGUO4h3ZldwXpC-HXs6snNlZxVRkdnPGExgx9eg> <xmx:bYFPYM8decflMrVTbC9CfL1U3kxiuUow-vSaSPdUJqVW8VaQ2BPC0g> 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 <scottl@samsco.org> In-Reply-To: <CACNAnaFi_wsZQzHz=wc5_s=8kAptpucyTP96gYYCVt_sxSj6hA@mail.gmail.com> Date: Mon, 15 Mar 2021 09:46:52 -0600 Cc: "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@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> <CACNAnaFi_wsZQzHz=wc5_s=8kAptpucyTP96gYYCVt_sxSj6hA@mail.gmail.com> To: Kyle Evans <kevans@freebsd.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kevans@freebsd.org> wrote: >=20 > On Mon, Mar 15, 2021 at 9:57 AM Scott Long <scottl@samsco.org> 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 <kevans@FreeBSD.org> 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 <kevans@FreeBSD.org> >>> AuthorDate: 2021-03-15 02:25:40 +0000 >>> Commit: Kyle Evans <kevans@FreeBSD.org> >>> 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 <Jason@zx2c4.com> >>> - Matt Dunwoodie <ncon@noconroy.net> >>> - Kyle Evans <kevans@FreeBSD.org> >>>=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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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" <Jason@zx2c4.com> Date: Mon, 15 Mar 2021 09:52:00 -0600 X-Gmail-Original-Message-ID: <CAHmME9rcMXw4FKYqvkUqj1sWd6bizQhOg4CwfLD6SZKYoWRAFA@mail.gmail.com> Message-ID: <CAHmME9rcMXw4FKYqvkUqj1sWd6bizQhOg4CwfLD6SZKYoWRAFA@mail.gmail.com> Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Scott Long <scottl@samsco.org> Cc: Kyle Evans <kevans@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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> <CACNAnaFi_wsZQzHz=wc5_s=8kAptpucyTP96gYYCVt_sxSj6hA@mail.gmail.com> <1D0606F6-73C2-42B9-9CF5-E3EBE01CE4EE@samsco.org> In-Reply-To: <1D0606F6-73C2-42B9-9CF5-E3EBE01CE4EE@samsco.org> From: "Jason A. Donenfeld" <Jason@zx2c4.com> Date: Mon, 15 Mar 2021 10:00:50 -0600 X-Gmail-Original-Message-ID: <CAHmME9owBz04ux01H14Ttt4akEYC1JBCeA+DGc6k0J4KdObuGg@mail.gmail.com> Message-ID: <CAHmME9owBz04ux01H14Ttt4akEYC1JBCeA+DGc6k0J4KdObuGg@mail.gmail.com> Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Scott Long <scottl@samsco.org> Cc: Kyle Evans <kevans@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=subscribe> X-List-Received-Date: Mon, 15 Mar 2021 16:01:05 -0000 On Mon, Mar 15, 2021 at 9:46 AM Scott Long <scottl@samsco.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <bapt@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <bapt@FreeBSD.org> AuthorDate: 2021-03-12 17:36:30 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <vmaffione@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <vmaffione@FreeBSD.org> AuthorDate: 2021-03-15 17:39:18 +0000 Commit: Vincenzo Maffione <vmaffione@FreeBSD.org> 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 <sherllyyang00@gmail.com> Submitted by: Carl Smith <carl.smith@alliedtelesis.co.nz> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <dev-commits-src-all@mailman.nyi.freebsd.org>; 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 <dev-commits-src-all@freebsd.org>; 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 <dev-commits-src-all@freebsd.org>; 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 <kevin.bowling@kev009.com> Date: Mon, 15 Mar 2021 10:48:52 -0700 Message-ID: <CAK7dMtDOsmcjyLbA+2MhyDZ_4HOUuikf0jOVzh07HSi1OJZ3WQ@mail.gmail.com> Subject: Re: git: 74ae3f3e33b8 - main - if_wg: import latest fixup work from the wireguard-freebsd project To: Kyle Evans <kevans@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>, dev-commits-src-main@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kevans@freebsd.org> wrote: > > The branch main has been updated by kevans: > > URL: https://cgit.FreeBSD.org/src/commit/?id=74ae3f3e33b810248da19004c58b3581cd367843 > > commit 74ae3f3e33b810248da19004c58b3581cd367843 > Author: Kyle Evans <kevans@FreeBSD.org> > AuthorDate: 2021-03-15 02:25:40 +0000 > Commit: Kyle Evans <kevans@FreeBSD.org> > 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 <Jason@zx2c4.com> > - Matt Dunwoodie <ncon@noconroy.net> > - Kyle Evans <kevans@FreeBSD.org> > > 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 <netinet/in.h> > #include <arpa/inet.h> > > +#include <dev/if_wg/if_wg.h> > + > #include <assert.h> > #include <ctype.h> > #include <err.h> > @@ -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 <Jason@zx2c4.com>. 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 <sys/types.h> > +#include <sys/endian.h> > +#include <sys/systm.h> > + > +#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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-03-15 17:48:50 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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 <bsd.kmod.mk> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <rmacklem@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <rmacklem@FreeBSD.org> AuthorDate: 2021-02-28 22:15:32 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <rmacklem@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <rmacklem@FreeBSD.org> AuthorDate: 2021-02-28 22:53:54 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <rmacklem@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <rmacklem@FreeBSD.org> AuthorDate: 2021-03-01 20:49:32 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <rmacklem@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <rmacklem@FreeBSD.org> AuthorDate: 2021-03-02 22:18:23 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <rmacklem@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <rmacklem@FreeBSD.org> AuthorDate: 2021-02-28 01:54:05 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <rmacklem@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <rmacklem@FreeBSD.org> AuthorDate: 2021-02-28 22:15:32 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <rmacklem@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <rmacklem@FreeBSD.org> AuthorDate: 2021-02-28 22:53:54 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <rmacklem@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <rmacklem@FreeBSD.org> AuthorDate: 2021-03-01 20:49:32 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <rmacklem@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <rmacklem@FreeBSD.org> AuthorDate: 2021-03-02 22:18:23 +0000 Commit: Rick Macklem <rmacklem@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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" <melifaro@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <melifaro@FreeBSD.org> AuthorDate: 2021-03-15 21:09:07 +0000 Commit: Alexander V. Chernikov <melifaro@FreeBSD.org> CommitDate: 2021-03-15 21:09:07 +0000 Fix fib algo rebuild delay calculation. Submitted by: Marco Zec <zec at fer.hr> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <otis@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <otis@FreeBSD.org> AuthorDate: 2021-02-28 22:07:14 +0000 Commit: Juraj Lutter <otis@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <jhb@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <jhb@FreeBSD.org> AuthorDate: 2021-03-16 00:00:21 +0000 Commit: John Baldwin <jhb@FreeBSD.org> 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 <crypto/cryptodev.h>. 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mckusick@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mckusick@FreeBSD.org> AuthorDate: 2021-02-12 05:31:16 +0000 Commit: Kirk McKusick <mckusick@FreeBSD.org> 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 <sys/rwlock.h> #include <sys/vnode.h> +#include <vm/vm.h> +#include <vm/vm_extern.h> + #include <geom/geom.h> #include <ufs/ufs/extattr.h> @@ -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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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" <jah@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <jah@FreeBSD.org> AuthorDate: 2021-03-01 16:42:05 +0000 Commit: Jason A. Harmening <jah@FreeBSD.org> 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 <sys/bitstring.h> #include <sys/bus.h> #include <sys/systm.h> +#include <sys/counter.h> #include <sys/kernel.h> #include <sys/ktr.h> #include <sys/lock.h> @@ -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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <dev-commits-src-all@mailman.nyi.freebsd.org>; 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 <philip@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <philip@FreeBSD.org> AuthorDate: 2021-03-16 00:12:09 +0000 Commit: Philip Paeps <philip@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <danfe@freebsd.org> To: Scott Long <scottl@samsco.org> Cc: Kyle Evans <kevans@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>, "dev-commits-src-main@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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <manu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <manu@FreeBSD.org> AuthorDate: 2021-03-16 06:12:40 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <manu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <manu@FreeBSD.org> AuthorDate: 2021-03-16 06:12:46 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <manu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <manu@FreeBSD.org> AuthorDate: 2021-03-16 06:12:49 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <manu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <manu@FreeBSD.org> AuthorDate: 2021-03-16 06:12:56 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <manu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <manu@FreeBSD.org> AuthorDate: 2021-03-16 06:13:00 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <manu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <manu@FreeBSD.org> AuthorDate: 2021-03-16 06:12:53 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> 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 <bsd.prog.mk> -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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <manu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <manu@FreeBSD.org> AuthorDate: 2021-03-16 06:13:03 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <manu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <manu@FreeBSD.org> AuthorDate: 2021-03-16 06:13:07 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> 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 <bsd.lib.mk> 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 <bsd.lib.mk> From owner-dev-commits-src-all@freebsd.org Tue Mar 16 06:13:31 2021 Return-Path: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <manu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <manu@FreeBSD.org> AuthorDate: 2021-03-16 06:11:56 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> 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ć <me@igalic.co> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kostikbel@gmail.com> To: Emmanuel Vadot <manu@freebsd.org> 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: <YFBVlxZ1vXTdd3yu@kib.kiev.ua> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <manu@FreeBSD.org> > AuthorDate: 2021-03-16 06:12:53 +0000 > Commit: Emmanuel Vadot <manu@FreeBSD.org> > 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 <bsd.prog.mk> > > -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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <manu@bidouilliste.com> To: Konstantin Belousov <kostikbel@gmail.com> Cc: Emmanuel Vadot <manu@freebsd.org>, 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: <YFBVlxZ1vXTdd3yu@kib.kiev.ua> References: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> <YFBVlxZ1vXTdd3yu@kib.kiev.ua> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 16 Mar 2021 07:12:24 -0000 On Tue, 16 Mar 2021 08:52:07 +0200 Konstantin Belousov <kostikbel@gmail.com> 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 <manu@FreeBSD.org> > > AuthorDate: 2021-03-16 06:12:53 +0000 > > Commit: Emmanuel Vadot <manu@FreeBSD.org> > > 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 <bsd.prog.mk> > > > > -installincludes: ${SHARED} > > -${SHARED}: compat > > +installincludes: _installincludes > > > > .if ${MACHINE} == "host" && !defined(_SKIP_BUILD) > > # we're here because we are building a sysroot... -- Emmanuel Vadot <manu@bidouilliste.com> <manu@FreeBSD.org> From owner-dev-commits-src-all@freebsd.org Tue Mar 16 07:17:48 2021 Return-Path: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kostikbel@gmail.com> To: Emmanuel Vadot <manu@bidouilliste.com> Cc: Emmanuel Vadot <manu@freebsd.org>, 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: <YFBbkG1Utkxzr3JZ@kib.kiev.ua> References: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> <YFBVlxZ1vXTdd3yu@kib.kiev.ua> <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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kostikbel@gmail.com> 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 <manu@FreeBSD.org> > > > AuthorDate: 2021-03-16 06:12:53 +0000 > > > Commit: Emmanuel Vadot <manu@FreeBSD.org> > > > 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] <nested env sh>$ cd libexec/rtld-elf <nested env sh>$ make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all [Check built ld-elf.so.1, more edits] <nested env sh>$ 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <manu@bidouilliste.com> To: Konstantin Belousov <kostikbel@gmail.com> Cc: Emmanuel Vadot <manu@freebsd.org>, 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: <YFBbkG1Utkxzr3JZ@kib.kiev.ua> References: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> <YFBVlxZ1vXTdd3yu@kib.kiev.ua> <20210316081214.0ba83981a37b8b3b9e5589bd@bidouilliste.com> <YFBbkG1Utkxzr3JZ@kib.kiev.ua> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=subscribe> X-List-Received-Date: Tue, 16 Mar 2021 07:39:59 -0000 On Tue, 16 Mar 2021 09:17:36 +0200 Konstantin Belousov <kostikbel@gmail.com> 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 <kostikbel@gmail.com> 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 <manu@FreeBSD.org> > > > > AuthorDate: 2021-03-16 06:12:53 +0000 > > > > Commit: Emmanuel Vadot <manu@FreeBSD.org> > > > > 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] > <nested env sh>$ cd libexec/rtld-elf > <nested env sh>$ make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all > [Check built ld-elf.so.1, more edits] > <nested env sh>$ 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 <manu@bidouilliste.com> <manu@FreeBSD.org> From owner-dev-commits-src-all@freebsd.org Tue Mar 16 07:41:33 2021 Return-Path: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <manu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <manu@FreeBSD.org> AuthorDate: 2021-03-16 07:40:54 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <manu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <manu@FreeBSD.org> AuthorDate: 2021-03-16 07:40:59 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> 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 <bsd.prog.mk> -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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kostikbel@gmail.com> To: Emmanuel Vadot <manu@bidouilliste.com> Cc: Emmanuel Vadot <manu@freebsd.org>, 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: <YFBhp6Zd8jUDFjru@kib.kiev.ua> References: <202103160613.12G6DLYL061995@gitrepo.freebsd.org> <YFBVlxZ1vXTdd3yu@kib.kiev.ua> <20210316081214.0ba83981a37b8b3b9e5589bd@bidouilliste.com> <YFBbkG1Utkxzr3JZ@kib.kiev.ua> <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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kostikbel@gmail.com> 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 <kostikbel@gmail.com> 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 <manu@FreeBSD.org> > > > > > AuthorDate: 2021-03-16 06:12:53 +0000 > > > > > Commit: Emmanuel Vadot <manu@FreeBSD.org> > > > > > 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] > > <nested env sh>$ cd libexec/rtld-elf > > <nested env sh>$ make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all > > [Check built ld-elf.so.1, more edits] > > <nested env sh>$ 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kp@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kp@FreeBSD.org> AuthorDate: 2021-03-11 10:37:05 +0000 Commit: Kristof Provost <kp@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <khng@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <khng300@gmail.com> AuthorDate: 2021-03-16 11:27:38 +0000 Commit: Ka Ho Ng <khng@FreeBSD.org> 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 <dev/virtio/virtio_ids.h> #include <dev/virtio/virtio_config.h> +#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 <sys/endian.h> +#ifndef _KERNEL +#include <stdbool.h> +#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 <machine/atomic.h> #include <machine/vmm_snapshot.h> +#include <dev/virtio/pci/virtio_pci_legacy_var.h> + #include <stdio.h> #include <stdint.h> #include <pthread.h> @@ -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 <machine/atomic.h> +#include <dev/virtio/virtio.h> +#include <dev/virtio/virtio_ring.h> +#include <dev/virtio/pci/virtio_pci_var.h> + /* * 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 <dev/virtio/virtio.h> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <markj@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <markj@FreeBSD.org> AuthorDate: 2021-03-02 15:19:53 +0000 Commit: Mark Johnston <markj@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <bapt@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <bapt@FreeBSD.org> AuthorDate: 2021-03-16 15:18:48 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <gjb@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <gjb@FreeBSD.org> AuthorDate: 2021-03-16 16:01:48 +0000 Commit: Glen Barber <gjb@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mhorne@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mhorne@FreeBSD.org> AuthorDate: 2021-03-10 14:57:12 +0000 Commit: Mitchell Horne <mhorne@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <np@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <np@FreeBSD.org> AuthorDate: 2021-03-15 19:54:34 +0000 Commit: Navdeep Parhar <np@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <jkim@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <jkim@FreeBSD.org> AuthorDate: 2021-03-16 18:16:10 +0000 Commit: Jung-uk Kim <jkim@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <trasz@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <trasz@FreeBSD.org> AuthorDate: 2021-03-11 20:03:30 +0000 Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <trasz@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <trasz@FreeBSD.org> AuthorDate: 2021-03-12 15:31:37 +0000 Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> 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 <iwtcex@gmail.com> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <markj@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <markjdb@gmail.com> AuthorDate: 2021-03-16 19:01:41 +0000 Commit: Mark Johnston <markj@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <markj@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <markjdb@gmail.com> AuthorDate: 2021-03-16 19:01:41 +0000 Commit: Mark Johnston <markj@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <peterj@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <peterj@FreeBSD.org> AuthorDate: 2021-03-16 19:16:31 +0000 Commit: Peter Jeremy <peterj@FreeBSD.org> 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 <nfs/nfs_common.h> - -#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 <nfs/nfs_common.h> - -#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 <sys/queue.h> - -/* - * 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <truckman@FreeBSD.org> Subject: Re: git: 0af8a2db34cf - main - release: do not set __MAKE_CONF and SRCCONF for the chroot build To: Glen Barber <gjb@FreeBSD.org> 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: <tkrat.219bbc76270fd6fa@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <gjb@FreeBSD.org> > AuthorDate: 2021-03-16 16:01:48 +0000 > Commit: Glen Barber <gjb@FreeBSD.org> > 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <jhb@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <jhb@FreeBSD.org> AuthorDate: 2021-03-16 21:34:58 +0000 Commit: John Baldwin <jhb@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <dev-commits-src-all@mailman.nyi.freebsd.org>; 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 <cy@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <cy@FreeBSD.org> AuthorDate: 2021-03-17 00:06:17 +0000 Commit: Cy Schubert <cy@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kevans@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <andrew@tao146.riddles.org.uk> AuthorDate: 2021-03-03 18:25:11 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-15 22:06:41 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-15 22:09:33 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-09 19:11:40 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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 <sys/vnode.h> #include <machine/elf.h> +#ifdef VFP +#include <machine/vfp.h> +#endif #include <compat/freebsd32/freebsd32_util.h> @@ -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 <sys/param.h> #include <sys/systm.h> +#include <sys/limits.h> #include <sys/kernel.h> #include <sys/malloc.h> #include <sys/pcpu.h> @@ -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 <compat/linux/linux_util.h> #include <compat/linux/linux_vdso.h> +#ifdef VFP +#include <machine/vfp.h> +#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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-01 14:27:30 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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 <machine/vfp.h> #endif -uint32_t initial_fpcr = VFPCR_DN | VFPCR_FZ; +uint32_t initial_fpcr = VFPCR_DN; #include <dev/psci/psci.h> From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:32 2021 Return-Path: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-17 09:48:28 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-17 09:49:49 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-04 14:55:29 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-04 18:27:37 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-01-28 17:17:07 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-01-27 10:41:57 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-01-28 17:23:27 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-08 09:37:39 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-01-29 09:19:27 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-04 17:56:26 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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 <bad> 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 <bad> 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 <bad> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-18 10:12:29 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-03 15:26:19 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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 @@ <argument arg-num="1" value="0x1c" desc="domain" /> <argument arg-num="2" value="0x2" desc="type" /> <argument arg-num="3" value="0x0" desc="protocol" /> -<subject audit-uid="root" uid="root" gid="wheel" ruid="root" rgid="0" pid="7053" sid="4724" tid="37636 10.0.2.2" /> +<subject audit-uid="root" uid="root" gid="wheel" ruid="root" rgid="wheel" pid="7053" sid="4724" tid="37636 10.0.2.2" /> <return errval="success" retval="3" /> </record> <?xml version='1.0' ?> From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:50 2021 Return-Path: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-03 15:56:03 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-04 17:56:54 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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 <bsd.test.mk> From owner-dev-commits-src-all@freebsd.org Wed Mar 17 10:27:54 2021 Return-Path: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-13 13:52:59 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-10 11:05:02 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-03 15:24:28 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-13 13:53:50 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <Alexander.Richardson@cl.cam.ac.uk> AuthorDate: 2021-01-25 14:03:17 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-17 16:03:11 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-01-28 17:17:49 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-02 09:55:18 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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 <sys/param.h> #include <sys/extattr.h> -#include <sys/ucred.h> #include <sys/mount.h> #include <sys/stat.h> #include <sys/syscall.h> +#include <sys/ucred.h> #include <atf-c.h> +#include <errno.h> #include <fcntl.h> +#include <string.h> #include <unistd.h> #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 <sys/time.h> #include <atf-c.h> +#include <errno.h> #include <fcntl.h> #include <stdint.h> #include <unistd.h> @@ -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 <sys/types.h> +#include <sys/extattr.h> #include <sys/ioctl.h> #include <bsm/libbsm.h> @@ -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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <khng@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <khng@FreeBSD.org> AuthorDate: 2021-03-17 10:51:58 +0000 Commit: Ka Ho Ng <khng@FreeBSD.org> 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 <sys/types.h> +#include <err.h> +#include <fcntl.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/nv.h> +#include <sys/sndstat.h> +#include <sysexits.h> +#include <unistd.h> + +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 <ariff@FreeBSD.org> * Copyright (c) 2001 Cameron Grant <cg@FreeBSD.org> + * 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 <sys/param.h> +#include <sys/lock.h> +#include <sys/malloc.h> +#include <sys/nv.h> +#include <sys/dnv.h> +#include <sys/sx.h> +#ifdef COMPAT_FREEBSD32 +#include <sys/sysent.h> +#endif + #include <dev/sound/pcm/sound.h> #include <dev/sound/pcm/pcm.h> #include <dev/sound/version.h> -#include <sys/sx.h> + 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <hselasky@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <hselasky@FreeBSD.org> AuthorDate: 2021-03-16 15:06:42 +0000 Commit: Hans Petter Selasky <hselasky@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <cy@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <cy@FreeBSD.org> AuthorDate: 2021-03-17 00:06:17 +0000 Commit: Cy Schubert <cy@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <manu@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <daniel.engberg.lists@pyret.net> AuthorDate: 2021-03-17 14:00:57 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-04 14:48:10 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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 <atf-c++.hpp> +#include <atf-c++/detail/env.hpp> #include <atf-c++/detail/process.hpp> #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 <errno.h> #include <fcntl.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -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 <errno.h> #include <fcntl.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -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 <atf-c.h> +#include <atf-c/detail/env.h> #include <atf-c/error_fwd.h> #include <atf-c/tc.h> @@ -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 <fcntl.h> #include <stdarg.h> #include <stdbool.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -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 <limits.h> #include <signal.h> +#include <stdint.h> #include <unistd.h> } @@ -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:<path> inline:<val> match:regexp " "save:<path>")); + 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-04 17:48:29 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-18 10:07:51 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-03 09:32:16 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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 <src.opts.mk> .include <bsd.init.mk> -# 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 <bsd.lib.mk> 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 <bsd.test.mk> From owner-dev-commits-src-all@freebsd.org Wed Mar 17 14:05:27 2021 Return-Path: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-01 18:49:31 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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 <sched.h> #include <semaphore.h> #include <signal.h> +#include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> @@ -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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-01 18:51:02 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-15 22:11:30 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-23 12:51:35 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-03 11:21:04 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kevans@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kevans@FreeBSD.org> AuthorDate: 2021-03-16 02:38:23 +0000 Commit: Kyle Evans <kevans@FreeBSD.org> 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 <kevans@FreeBSD.org> 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 <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#ifndef RESCUE -#include <sys/param.h> -#include <sys/ioctl.h> -#include <sys/socket.h> -#include <sys/sysctl.h> -#include <sys/time.h> -#include <sys/nv.h> - -#include <net/ethernet.h> -#include <net/if.h> -#include <net/if_dl.h> -#include <net/if_types.h> -#include <net/if_media.h> -#include <net/route.h> - -#include <netinet/in.h> -#include <arpa/inet.h> - -#include <dev/if_wg/if_wg.h> - -#include <assert.h> -#include <ctype.h> -#include <err.h> -#include <errno.h> -#include <fcntl.h> -#include <inttypes.h> -#include <stdio.h> -#include <stdlib.h> -#include <netdb.h> -#include <string.h> -#include <unistd.h> -#include <stdarg.h> -#include <stddef.h> /* NB: for offsetof */ -#include <locale.h> -#include <langinfo.h> -#include <resolv.h> - -#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 <gbe@FreeBSD.org> -.\" -.\" 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <mav@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <mav@FreeBSD.org> AuthorDate: 2021-03-17 14:30:40 +0000 Commit: Alexander Motin <mav@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <gjb@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <gjb@FreeBSD.org> AuthorDate: 2021-03-17 14:57:32 +0000 Commit: Glen Barber <gjb@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <rscheff@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <rscheff@FreeBSD.org> AuthorDate: 2021-03-17 15:44:29 +0000 Commit: Richard Scheffenegger <rscheff@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kp@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <topical@gmx.net> AuthorDate: 2021-03-15 13:28:52 +0000 Commit: Kristof Provost <kp@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <kp@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <kp@FreeBSD.org> AuthorDate: 2021-03-15 13:10:55 +0000 Commit: Kristof Provost <kp@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <rscheff@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <rscheff@FreeBSD.org> AuthorDate: 2021-03-17 15:44:29 +0000 Commit: Richard Scheffenegger <rscheff@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <jhb@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <jhb@FreeBSD.org> AuthorDate: 2021-03-17 20:19:04 +0000 Commit: John Baldwin <jhb@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <emaste@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <emaste@FreeBSD.org> AuthorDate: 2021-03-17 14:10:41 +0000 Commit: Ed Maste <emaste@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-18 10:14:27 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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 <sys/ioctl.h> #include <bsm/libbsm.h> +#include <bsm/auditd_lib.h> #include <security/audit/audit_ioctl.h> #include <atf-c.h> @@ -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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-23 17:47:07 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-02 18:34:42 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-23 17:02:31 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-23 19:04:01 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-01 14:11:20 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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 <string.h> From owner-dev-commits-src-all@freebsd.org Wed Mar 17 22:23:15 2021 Return-Path: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-08 09:38:24 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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 <filesystem>' fails with bad <filesystem> 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 <volume>' fails with bad <volume> 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 <filesystem>' 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 <size> <volume>' 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-02 18:27:34 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-02 16:28:26 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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 <sys/param.h> +#include <sys/proc.h> +#include <sys/queue.h> +#include <sys/socket.h> +#include <sys/sysctl.h> +#include <sys/user.h> +#include <libprocstat.h> +#endif + #include <stdio.h> #include <string.h> #include <signal.h> @@ -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<int,bool> had_signal; +static volatile sig_atomic_t had_signal[NSIG]; +void clear_had_signals() { + memset(const_cast<sig_atomic_t *>(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<void *>(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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-02-16 14:35:12 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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 <uid> 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<std::string> TestList; -typedef std::map<std::string, TestList*> 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 <ios> #include <ostream> +#include <string> #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 <sys/types.h> -#include <sys/wait.h> #include <sys/stat.h> +#include <sys/wait.h> #include <errno.h> #include <fcntl.h> #include <limits.h> @@ -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 <linux/memfd.h> // 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 <uid> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-12 17:12:10 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-04 15:06:32 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-03 13:53:30 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <arichardson@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <arichardson@FreeBSD.org> AuthorDate: 2021-03-12 17:35:24 +0000 Commit: Alex Richardson <arichardson@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <freqlabs@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <freqlabs@FreeBSD.org> AuthorDate: 2021-02-28 10:30:09 +0000 Commit: Ryan Moeller <freqlabs@FreeBSD.org> 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 <string.h> #include <unistd.h> +#include <libifconfig.h> + #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 <libifconfig.h> + #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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <bdrewery@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <bdrewery@FreeBSD.org> AuthorDate: 2021-03-17 22:01:19 +0000 Commit: Bryan Drewery <bdrewery@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <karels@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <karels@FreeBSD.org> AuthorDate: 2021-03-18 00:19:24 +0000 Commit: Mike Karels <karels@FreeBSD.org> 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 <netinet/in.h> #include <netinet/ip.h> #include <netinet/ip6.h> -#define ICMPV6_HACK /* workaround for chip issue */ -#ifdef ICMPV6_HACK -#include <netinet/icmp6.h> -#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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <markj@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <markj@FreeBSD.org> AuthorDate: 2021-03-11 20:43:04 +0000 Commit: Mark Johnston <markj@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <markj@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <markj@FreeBSD.org> AuthorDate: 2021-03-04 15:02:47 +0000 Commit: Mark Johnston <markj@FreeBSD.org> 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 = "<<UNWIND>>"; #endif + else if (shdr[i].sh_type == SHT_INIT_ARRAY) + ef->progtab[pb].name = "<<INIT_ARRAY>>"; + else if (shdr[i].sh_type == SHT_FINI_ARRAY) + ef->progtab[pb].name = "<<FINI_ARRAY>>"; else ef->progtab[pb].name = "<<NOBITS>>"; 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 = "<<PROGBITS>>"; From owner-dev-commits-src-all@freebsd.org Thu Mar 18 01:25:08 2021 Return-Path: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <markj@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <markjdb@gmail.com> AuthorDate: 2021-03-16 19:01:41 +0000 Commit: Mark Johnston <markj@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <scottl@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <scottl@FreeBSD.org> AuthorDate: 2021-03-18 07:07:56 +0000 Commit: Scott Long <scottl@FreeBSD.org> 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 <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#ifndef RESCUE -#include <sys/param.h> -#include <sys/ioctl.h> -#include <sys/socket.h> -#include <sys/sysctl.h> -#include <sys/time.h> -#include <sys/nv.h> - -#include <net/ethernet.h> -#include <net/if.h> -#include <net/if_dl.h> -#include <net/if_types.h> -#include <net/if_media.h> -#include <net/route.h> - -#include <netinet/in.h> -#include <arpa/inet.h> - -#include <assert.h> -#include <ctype.h> -#include <err.h> -#include <errno.h> -#include <fcntl.h> -#include <inttypes.h> -#include <stdio.h> -#include <stdlib.h> -#include <netdb.h> -#include <string.h> -#include <unistd.h> -#include <stdarg.h> -#include <stddef.h> /* NB: for offsetof */ -#include <locale.h> -#include <langinfo.h> -#include <resolv.h> - -#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 <gbe@FreeBSD.org> -.\" -.\" 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <bapt@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <bapt@FreeBSD.org> AuthorDate: 2021-03-18 08:46:15 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <bapt@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <bapt@FreeBSD.org> AuthorDate: 2021-03-18 09:57:23 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> 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 <src.tools.mk> - -.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 <bsd.prog.mk> - From owner-dev-commits-src-all@freebsd.org Thu Mar 18 10:10:55 2021 Return-Path: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org 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 <bapt@FreeBSD.org> 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 <dev-commits-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/dev-commits-src-all/> List-Post: <mailto:dev-commits-src-all@freebsd.org> List-Help: <mailto:dev-commits-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all>, <mailto:dev-commits-src-all-request@freebsd.org?subject=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 <bapt@FreeBSD.org> AuthorDate: 2021-03-18 10:04:32 +0000 Commit: Baptiste Daroussin <bapt@FreeBSD.org> 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: <owner-dev-commits-src-all@freebsd.org> Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [I