From owner-svn-src-stable@freebsd.org Sun Sep 22 05:16:11 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1B47F4BAB; Sun, 22 Sep 2019 05:16:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46bbJq3tXdz4MJ0; Sun, 22 Sep 2019 05:16:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 688EA219A4; Sun, 22 Sep 2019 05:16:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8M5GBN3045857; Sun, 22 Sep 2019 05:16:11 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8M5GB7F045856; Sun, 22 Sep 2019 05:16:11 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201909220516.x8M5GB7F045856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 22 Sep 2019 05:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352589 - in stable: 11/usr.sbin/ntp/libntp 12/usr.sbin/ntp/libntp X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/usr.sbin/ntp/libntp 12/usr.sbin/ntp/libntp X-SVN-Commit-Revision: 352589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Sep 2019 05:16:11 -0000 Author: cy Date: Sun Sep 22 05:16:10 2019 New Revision: 352589 URL: https://svnweb.freebsd.org/changeset/base/352589 Log: MFC r352518: Reduce calls to close(2) at startup through the use of closefrom(2). Submitted by: pawel.biernacki@gmail.com Reviewed by: mjg, cy Differential Revision: https://reviews.freebsd.org/D21715 Modified: stable/12/usr.sbin/ntp/libntp/Makefile Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.sbin/ntp/libntp/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/12/usr.sbin/ntp/libntp/Makefile ============================================================================== --- stable/12/usr.sbin/ntp/libntp/Makefile Sun Sep 22 00:12:43 2019 (r352588) +++ stable/12/usr.sbin/ntp/libntp/Makefile Sun Sep 22 05:16:10 2019 (r352589) @@ -83,7 +83,7 @@ CFLAGS+= -I${SRCTOP}/contrib/ntp/include \ -I${.CURDIR:H} \ -I${.CURDIR}/ -CFLAGS+= -DHAVE_BSD_NICE -DHAVE_STDINT_H +CFLAGS+= -DHAVE_BSD_NICE -DHAVE_STDINT_H -DHAVE_CLOSEFROM CLEANFILES+= .version version.c From owner-svn-src-stable@freebsd.org Sun Sep 22 05:16:11 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F7F4F4BA7; Sun, 22 Sep 2019 05:16:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46bbJq1r2Gz4MHy; Sun, 22 Sep 2019 05:16:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1E146219A3; Sun, 22 Sep 2019 05:16:11 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8M5GAjk045851; Sun, 22 Sep 2019 05:16:10 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8M5GAjp045850; Sun, 22 Sep 2019 05:16:10 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201909220516.x8M5GAjp045850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 22 Sep 2019 05:16:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352589 - in stable: 11/usr.sbin/ntp/libntp 12/usr.sbin/ntp/libntp X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/usr.sbin/ntp/libntp 12/usr.sbin/ntp/libntp X-SVN-Commit-Revision: 352589 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Sep 2019 05:16:11 -0000 Author: cy Date: Sun Sep 22 05:16:10 2019 New Revision: 352589 URL: https://svnweb.freebsd.org/changeset/base/352589 Log: MFC r352518: Reduce calls to close(2) at startup through the use of closefrom(2). Submitted by: pawel.biernacki@gmail.com Reviewed by: mjg, cy Differential Revision: https://reviews.freebsd.org/D21715 Modified: stable/11/usr.sbin/ntp/libntp/Makefile Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/usr.sbin/ntp/libntp/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/11/usr.sbin/ntp/libntp/Makefile ============================================================================== --- stable/11/usr.sbin/ntp/libntp/Makefile Sun Sep 22 00:12:43 2019 (r352588) +++ stable/11/usr.sbin/ntp/libntp/Makefile Sun Sep 22 05:16:10 2019 (r352589) @@ -83,7 +83,7 @@ CFLAGS+= -I${SRCTOP}/contrib/ntp/include \ -I${.CURDIR:H} \ -I${.CURDIR}/ -CFLAGS+= -DHAVE_BSD_NICE -DHAVE_STDINT_H +CFLAGS+= -DHAVE_BSD_NICE -DHAVE_STDINT_H -DHAVE_CLOSEFROM CLEANFILES+= .version version.c From owner-svn-src-stable@freebsd.org Sun Sep 22 11:40:45 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01D2DFE7CF; Sun, 22 Sep 2019 11:40:45 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46blrX6J5vz3CNr; Sun, 22 Sep 2019 11:40:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC65425E06; Sun, 22 Sep 2019 11:40:44 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8MBeiJG072904; Sun, 22 Sep 2019 11:40:44 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8MBehbJ072899; Sun, 22 Sep 2019 11:40:43 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909221140.x8MBehbJ072899@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sun, 22 Sep 2019 11:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352595 - in stable/12: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common lib/libbe X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common lib/libbe X-SVN-Commit-Revision: 352595 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Sep 2019 11:40:45 -0000 Author: avg Date: Sun Sep 22 11:40:43 2019 New Revision: 352595 URL: https://svnweb.freebsd.org/changeset/base/352595 Log: MFC r352447,r352449,r352507: MFZoL: Add -vnP support to 'zfs send' for bookmarks Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/12/lib/libbe/be.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Sep 22 11:11:01 2019 (r352594) +++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Sep 22 11:40:43 2019 (r352595) @@ -190,8 +190,8 @@ .Ar snapshot .Nm .Cm send -.Op Fl Lce -.Op Fl i Ar snapshot Ns | Ns bookmark +.Op Fl LPcenv +.Op Fl i Ar snapshot Ns | Ns Ar bookmark .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Nm .Cm send @@ -2764,7 +2764,7 @@ on future versions of .It Xo .Nm .Cm send -.Op Fl Lce +.Op Fl LPcenv .Op Fl i Ar snapshot Ns | Ns Ar bookmark .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Xc @@ -2778,7 +2778,7 @@ stream generated from a filesystem or volume is receiv name will be .Pq --head-- . .Bl -tag -width indent -.It Fl i Ar snapshot Ns | Ns bookmark +.It Fl i Ar snapshot Ns | Ns Ar bookmark Generate an incremental send stream. The incremental source must be an earlier snapshot in the destination's history. @@ -2790,6 +2790,23 @@ specified as the last component of the name If the incremental target is a clone, the incremental source can be the origin snapshot, or an earlier snapshot in the origin's filesystem, or the origin's origin, etc. +.It Fl n, -dryrun +Do a dry-run +.Pq Qq No-op +send. +Do not generate any actual send data. +This is useful in conjunction with the +.Fl v +or +.Fl P +flags to determine what data will be sent. +In this case, the verbose output will be written to standard output +.Po contrast with a non-dry-run, where the stream is written to standard output +and the verbose output goes to standard error +.Pc . +.It Fl v, -verbose +Print verbose information about the stream package generated. +This information includes a per-second report of how much data has been sent. .It Fl L, -large-block Generate a stream which may contain blocks larger than 128KB. This flag @@ -2806,6 +2823,8 @@ See for details on ZFS feature flags and the .Sy large_blocks feature. +.It Fl P, -parsable +Print machine-parsable verbose information about the stream package generated. .It Fl c, -compressed Generate a more compact stream by using compressed WRITE records for blocks which are compressed on disk and in memory (see the Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Sep 22 11:11:01 2019 (r352594) +++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Sep 22 11:40:43 2019 (r352595) @@ -290,7 +290,7 @@ get_usage(zfs_help_t idx) case HELP_SEND: return (gettext("\tsend [-DnPpRvLec] [-[iI] snapshot] " "\n" - "\tsend [-Le] [-i snapshot|bookmark] " + "\tsend [-LPcenv] [-i snapshot|bookmark] " "\n" "\tsend [-nvPe] -t \n")); case HELP_SET: @@ -3928,13 +3928,11 @@ zfs_do_send(int argc, char **argv) if (strchr(argv[0], '@') == NULL || (fromname && strchr(fromname, '#') != NULL)) { char frombuf[ZFS_MAX_DATASET_NAME_LEN]; - enum lzc_send_flags lzc_flags = 0; if (flags.replicate || flags.doall || flags.props || - flags.dedup || flags.dryrun || flags.verbose || - flags.progress) { - (void) fprintf(stderr, - gettext("Error: " + flags.dedup || (strchr(argv[0], '@') == NULL && + (flags.dryrun || flags.verbose || flags.progress))) { + (void) fprintf(stderr, gettext("Error: " "Unsupported flag with filesystem or bookmark.\n")); return (1); } @@ -3943,13 +3941,6 @@ zfs_do_send(int argc, char **argv) if (zhp == NULL) return (1); - if (flags.largeblock) - lzc_flags |= LZC_SEND_FLAG_LARGE_BLOCK; - if (flags.embed_data) - lzc_flags |= LZC_SEND_FLAG_EMBED_DATA; - if (flags.compress) - lzc_flags |= LZC_SEND_FLAG_COMPRESS; - if (fromname != NULL && (fromname[0] == '#' || fromname[0] == '@')) { /* @@ -3963,7 +3954,7 @@ zfs_do_send(int argc, char **argv) (void) strlcat(frombuf, fromname, sizeof (frombuf)); fromname = frombuf; } - err = zfs_send_one(zhp, fromname, STDOUT_FILENO, lzc_flags); + err = zfs_send_one(zhp, fromname, STDOUT_FILENO, flags); zfs_close(zhp); return (err != 0); } Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sun Sep 22 11:11:01 2019 (r352594) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sun Sep 22 11:40:43 2019 (r352595) @@ -660,7 +660,7 @@ typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, vo extern int zfs_send(zfs_handle_t *, const char *, const char *, sendflags_t *, int, snapfilter_cb_t, void *, nvlist_t **); -extern int zfs_send_one(zfs_handle_t *, const char *, int, enum lzc_send_flags); +extern int zfs_send_one(zfs_handle_t *, const char *, int, sendflags_t flags); extern int zfs_send_resume(libzfs_handle_t *, sendflags_t *, int outfd, const char *); extern nvlist_t *zfs_send_resume_token_to_nvlist(libzfs_handle_t *hdl, Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sun Sep 22 11:11:01 2019 (r352594) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sun Sep 22 11:40:43 2019 (r352595) @@ -1190,16 +1190,14 @@ send_print_verbose(FILE *fout, const char *tosnap, con } } - if (size != 0) { - if (parsable) { - (void) fprintf(fout, "\t%llu", - (longlong_t)size); - } else { - char buf[16]; - zfs_nicenum(size, buf, sizeof (buf)); - (void) fprintf(fout, dgettext(TEXT_DOMAIN, - " estimated size is %s"), buf); - } + if (parsable) { + (void) fprintf(fout, "\t%llu", + (longlong_t)size); + } else if (size != 0) { + char buf[16]; + zfs_nicenum(size, buf, sizeof (buf)); + (void) fprintf(fout, dgettext(TEXT_DOMAIN, + " estimated size is %s"), buf); } (void) fprintf(fout, "\n"); } @@ -2037,17 +2035,40 @@ err_out: } int -zfs_send_one(zfs_handle_t *zhp, const char *from, int fd, - enum lzc_send_flags flags) +zfs_send_one(zfs_handle_t *zhp, const char *from, int fd, sendflags_t flags) { - int err; + int err = 0; libzfs_handle_t *hdl = zhp->zfs_hdl; - + enum lzc_send_flags lzc_flags = 0; + FILE *fout = (flags.verbose && flags.dryrun) ? stdout : stderr; char errbuf[1024]; + + if (flags.largeblock) + lzc_flags |= LZC_SEND_FLAG_LARGE_BLOCK; + if (flags.embed_data) + lzc_flags |= LZC_SEND_FLAG_EMBED_DATA; + if (flags.compress) + lzc_flags |= LZC_SEND_FLAG_COMPRESS; + + if (flags.verbose) { + uint64_t size = 0; + err = lzc_send_space(zhp->zfs_name, from, lzc_flags, &size); + if (err == 0) { + send_print_verbose(fout, zhp->zfs_name, from, size, + flags.parsable); + } else { + (void) fprintf(stderr, "Cannot estimate send size: " + "%s\n", strerror(errno)); + } + } + + if (flags.dryrun) + return (err); + (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "warning: cannot send '%s'"), zhp->zfs_name); - err = lzc_send(zhp->zfs_name, from, fd, flags); + err = lzc_send(zhp->zfs_name, from, fd, lzc_flags); if (err != 0) { switch (errno) { case EXDEV: Modified: stable/12/lib/libbe/be.c ============================================================================== --- stable/12/lib/libbe/be.c Sun Sep 22 11:11:01 2019 (r352594) +++ stable/12/lib/libbe/be.c Sun Sep 22 11:40:43 2019 (r352595) @@ -775,6 +775,7 @@ be_export(libbe_handle_t *lbh, const char *bootenv, in char snap_name[BE_MAXPATHLEN]; char buf[BE_MAXPATHLEN]; zfs_handle_t *zfs; + sendflags_t flags = { 0 }; int err; if ((err = be_snapshot(lbh, bootenv, NULL, true, snap_name)) != 0) @@ -786,7 +787,7 @@ be_export(libbe_handle_t *lbh, const char *bootenv, in if ((zfs = zfs_open(lbh->lzh, buf, ZFS_TYPE_DATASET)) == NULL) return (set_error(lbh, BE_ERR_ZFSOPEN)); - err = zfs_send_one(zfs, NULL, fd, 0); + err = zfs_send_one(zfs, NULL, fd, flags); zfs_close(zfs); return (err); From owner-svn-src-stable@freebsd.org Sun Sep 22 15:00:20 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A70AD12449B; Sun, 22 Sep 2019 15:00:20 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46brGr3vxQz3NCf; Sun, 22 Sep 2019 15:00:20 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6970A2BF; Sun, 22 Sep 2019 15:00:20 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8MF0KoU090812; Sun, 22 Sep 2019 15:00:20 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8MF0JtF090807; Sun, 22 Sep 2019 15:00:19 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909221500.x8MF0JtF090807@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Sun, 22 Sep 2019 15:00:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352598 - in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common lib/libbe X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/11: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common lib/libbe X-SVN-Commit-Revision: 352598 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Sep 2019 15:00:20 -0000 Author: avg Date: Sun Sep 22 15:00:19 2019 New Revision: 352598 URL: https://svnweb.freebsd.org/changeset/base/352598 Log: MFC r352447,r352449,r352507: MFZoL: Add -vnP support to 'zfs send' for bookmarks Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c stable/11/lib/libbe/be.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Sep 22 13:56:27 2019 (r352597) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Sun Sep 22 15:00:19 2019 (r352598) @@ -189,8 +189,8 @@ .Ar snapshot .Nm .Cm send -.Op Fl Lce -.Op Fl i Ar snapshot Ns | Ns bookmark +.Op Fl LPcenv +.Op Fl i Ar snapshot Ns | Ns Ar bookmark .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Nm .Cm send @@ -2758,7 +2758,7 @@ on future versions of .It Xo .Nm .Cm send -.Op Fl Lce +.Op Fl LPcenv .Op Fl i Ar snapshot Ns | Ns Ar bookmark .Ar filesystem Ns | Ns Ar volume Ns | Ns Ar snapshot .Xc @@ -2772,7 +2772,7 @@ stream generated from a filesystem or volume is receiv name will be .Pq --head-- . .Bl -tag -width indent -.It Fl i Ar snapshot Ns | Ns bookmark +.It Fl i Ar snapshot Ns | Ns Ar bookmark Generate an incremental send stream. The incremental source must be an earlier snapshot in the destination's history. @@ -2784,6 +2784,23 @@ specified as the last component of the name If the incremental target is a clone, the incremental source can be the origin snapshot, or an earlier snapshot in the origin's filesystem, or the origin's origin, etc. +.It Fl n, -dryrun +Do a dry-run +.Pq Qq No-op +send. +Do not generate any actual send data. +This is useful in conjunction with the +.Fl v +or +.Fl P +flags to determine what data will be sent. +In this case, the verbose output will be written to standard output +.Po contrast with a non-dry-run, where the stream is written to standard output +and the verbose output goes to standard error +.Pc . +.It Fl v, -verbose +Print verbose information about the stream package generated. +This information includes a per-second report of how much data has been sent. .It Fl L, -large-block Generate a stream which may contain blocks larger than 128KB. This flag @@ -2800,6 +2817,8 @@ See for details on ZFS feature flags and the .Sy large_blocks feature. +.It Fl P, -parsable +Print machine-parsable verbose information about the stream package generated. .It Fl c, -compressed Generate a more compact stream by using compressed WRITE records for blocks which are compressed on disk and in memory (see the Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Sep 22 13:56:27 2019 (r352597) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sun Sep 22 15:00:19 2019 (r352598) @@ -289,7 +289,7 @@ get_usage(zfs_help_t idx) case HELP_SEND: return (gettext("\tsend [-DnPpRvLec] [-[iI] snapshot] " "\n" - "\tsend [-Le] [-i snapshot|bookmark] " + "\tsend [-LPcenv] [-i snapshot|bookmark] " "\n" "\tsend [-nvPe] -t \n")); case HELP_SET: @@ -3927,13 +3927,11 @@ zfs_do_send(int argc, char **argv) if (strchr(argv[0], '@') == NULL || (fromname && strchr(fromname, '#') != NULL)) { char frombuf[ZFS_MAX_DATASET_NAME_LEN]; - enum lzc_send_flags lzc_flags = 0; if (flags.replicate || flags.doall || flags.props || - flags.dedup || flags.dryrun || flags.verbose || - flags.progress) { - (void) fprintf(stderr, - gettext("Error: " + flags.dedup || (strchr(argv[0], '@') == NULL && + (flags.dryrun || flags.verbose || flags.progress))) { + (void) fprintf(stderr, gettext("Error: " "Unsupported flag with filesystem or bookmark.\n")); return (1); } @@ -3942,13 +3940,6 @@ zfs_do_send(int argc, char **argv) if (zhp == NULL) return (1); - if (flags.largeblock) - lzc_flags |= LZC_SEND_FLAG_LARGE_BLOCK; - if (flags.embed_data) - lzc_flags |= LZC_SEND_FLAG_EMBED_DATA; - if (flags.compress) - lzc_flags |= LZC_SEND_FLAG_COMPRESS; - if (fromname != NULL && (fromname[0] == '#' || fromname[0] == '@')) { /* @@ -3962,7 +3953,7 @@ zfs_do_send(int argc, char **argv) (void) strlcat(frombuf, fromname, sizeof (frombuf)); fromname = frombuf; } - err = zfs_send_one(zhp, fromname, STDOUT_FILENO, lzc_flags); + err = zfs_send_one(zhp, fromname, STDOUT_FILENO, flags); zfs_close(zhp); return (err != 0); } Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sun Sep 22 13:56:27 2019 (r352597) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sun Sep 22 15:00:19 2019 (r352598) @@ -660,7 +660,7 @@ typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, vo extern int zfs_send(zfs_handle_t *, const char *, const char *, sendflags_t *, int, snapfilter_cb_t, void *, nvlist_t **); -extern int zfs_send_one(zfs_handle_t *, const char *, int, enum lzc_send_flags); +extern int zfs_send_one(zfs_handle_t *, const char *, int, sendflags_t flags); extern int zfs_send_resume(libzfs_handle_t *, sendflags_t *, int outfd, const char *); extern nvlist_t *zfs_send_resume_token_to_nvlist(libzfs_handle_t *hdl, Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sun Sep 22 13:56:27 2019 (r352597) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sun Sep 22 15:00:19 2019 (r352598) @@ -1190,16 +1190,14 @@ send_print_verbose(FILE *fout, const char *tosnap, con } } - if (size != 0) { - if (parsable) { - (void) fprintf(fout, "\t%llu", - (longlong_t)size); - } else { - char buf[16]; - zfs_nicenum(size, buf, sizeof (buf)); - (void) fprintf(fout, dgettext(TEXT_DOMAIN, - " estimated size is %s"), buf); - } + if (parsable) { + (void) fprintf(fout, "\t%llu", + (longlong_t)size); + } else if (size != 0) { + char buf[16]; + zfs_nicenum(size, buf, sizeof (buf)); + (void) fprintf(fout, dgettext(TEXT_DOMAIN, + " estimated size is %s"), buf); } (void) fprintf(fout, "\n"); } @@ -2037,17 +2035,40 @@ err_out: } int -zfs_send_one(zfs_handle_t *zhp, const char *from, int fd, - enum lzc_send_flags flags) +zfs_send_one(zfs_handle_t *zhp, const char *from, int fd, sendflags_t flags) { - int err; + int err = 0; libzfs_handle_t *hdl = zhp->zfs_hdl; - + enum lzc_send_flags lzc_flags = 0; + FILE *fout = (flags.verbose && flags.dryrun) ? stdout : stderr; char errbuf[1024]; + + if (flags.largeblock) + lzc_flags |= LZC_SEND_FLAG_LARGE_BLOCK; + if (flags.embed_data) + lzc_flags |= LZC_SEND_FLAG_EMBED_DATA; + if (flags.compress) + lzc_flags |= LZC_SEND_FLAG_COMPRESS; + + if (flags.verbose) { + uint64_t size = 0; + err = lzc_send_space(zhp->zfs_name, from, lzc_flags, &size); + if (err == 0) { + send_print_verbose(fout, zhp->zfs_name, from, size, + flags.parsable); + } else { + (void) fprintf(stderr, "Cannot estimate send size: " + "%s\n", strerror(errno)); + } + } + + if (flags.dryrun) + return (err); + (void) snprintf(errbuf, sizeof (errbuf), dgettext(TEXT_DOMAIN, "warning: cannot send '%s'"), zhp->zfs_name); - err = lzc_send(zhp->zfs_name, from, fd, flags); + err = lzc_send(zhp->zfs_name, from, fd, lzc_flags); if (err != 0) { switch (errno) { case EXDEV: Modified: stable/11/lib/libbe/be.c ============================================================================== --- stable/11/lib/libbe/be.c Sun Sep 22 13:56:27 2019 (r352597) +++ stable/11/lib/libbe/be.c Sun Sep 22 15:00:19 2019 (r352598) @@ -775,6 +775,7 @@ be_export(libbe_handle_t *lbh, const char *bootenv, in char snap_name[BE_MAXPATHLEN]; char buf[BE_MAXPATHLEN]; zfs_handle_t *zfs; + sendflags_t flags = { 0 }; int err; if ((err = be_snapshot(lbh, bootenv, NULL, true, snap_name)) != 0) @@ -786,7 +787,7 @@ be_export(libbe_handle_t *lbh, const char *bootenv, in if ((zfs = zfs_open(lbh->lzh, buf, ZFS_TYPE_DATASET)) == NULL) return (set_error(lbh, BE_ERR_ZFSOPEN)); - err = zfs_send_one(zfs, NULL, fd, 0); + err = zfs_send_one(zfs, NULL, fd, flags); zfs_close(zfs); return (err); From owner-svn-src-stable@freebsd.org Sun Sep 22 18:07:53 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B9E8712876A; Sun, 22 Sep 2019 18:07:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46bwRF40vrz43P5; Sun, 22 Sep 2019 18:07:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6CC252476; Sun, 22 Sep 2019 18:07:53 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8MI7rIl002533; Sun, 22 Sep 2019 18:07:53 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8MI7r17002532; Sun, 22 Sep 2019 18:07:53 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909221807.x8MI7r17002532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 22 Sep 2019 18:07:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352602 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 352602 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Sep 2019 18:07:53 -0000 Author: markj Date: Sun Sep 22 18:07:52 2019 New Revision: 352602 URL: https://svnweb.freebsd.org/changeset/base/352602 Log: MFC r352256: Remove a redundant NULL pointer check in cpuset_modify_domain(). Modified: stable/12/sys/kern/kern_cpuset.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_cpuset.c ============================================================================== --- stable/12/sys/kern/kern_cpuset.c Sun Sep 22 17:39:20 2019 (r352601) +++ stable/12/sys/kern/kern_cpuset.c Sun Sep 22 18:07:52 2019 (r352602) @@ -796,7 +796,7 @@ cpuset_modify_domain(struct cpuset *set, struct domain /* * Verify that we have access to this set of domains. */ - if (root && !domainset_valid(dset, domain)) { + if (!domainset_valid(dset, domain)) { error = EINVAL; goto out; } From owner-svn-src-stable@freebsd.org Sun Sep 22 19:53:30 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03B2312ABC8; Sun, 22 Sep 2019 19:53:30 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46byn56D6kz49FZ; Sun, 22 Sep 2019 19:53:29 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8B3239E7; Sun, 22 Sep 2019 19:53:29 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8MJrTgV066525; Sun, 22 Sep 2019 19:53:29 GMT (envelope-from grembo@FreeBSD.org) Received: (from grembo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8MJrTJe066524; Sun, 22 Sep 2019 19:53:29 GMT (envelope-from grembo@FreeBSD.org) Message-Id: <201909221953.x8MJrTJe066524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grembo set sender to grembo@FreeBSD.org using -f From: Michael Gmelin Date: Sun, 22 Sep 2019 19:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352608 - stable/12/usr.sbin/freebsd-update X-SVN-Group: stable-12 X-SVN-Commit-Author: grembo X-SVN-Commit-Paths: stable/12/usr.sbin/freebsd-update X-SVN-Commit-Revision: 352608 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Sep 2019 19:53:30 -0000 Author: grembo (ports committer) Date: Sun Sep 22 19:53:29 2019 New Revision: 352608 URL: https://svnweb.freebsd.org/changeset/base/352608 Log: MFC r352542: freebsd-update: Fix src component detection PR: 224048, 238558, 239997 Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D21579 Modified: stable/12/usr.sbin/freebsd-update/freebsd-update.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- stable/12/usr.sbin/freebsd-update/freebsd-update.sh Sun Sep 22 19:23:00 2019 (r352607) +++ stable/12/usr.sbin/freebsd-update/freebsd-update.sh Sun Sep 22 19:53:29 2019 (r352608) @@ -221,6 +221,14 @@ config_KeepModifiedMetadata () { # Add to the list of components which should be kept updated. config_Components () { for C in $@; do + COMPONENTS="${COMPONENTS} ${C}" + done +} + +# Remove src component from list if it isn't installed +finalize_components_config () { + COMPONENTS="" + for C in $@; do if [ "$C" = "src" ]; then if [ -e "${BASEDIR}/usr/src/COPYRIGHT" ]; then COMPONENTS="${COMPONENTS} ${C}" @@ -3284,6 +3292,7 @@ get_params () { parse_cmdline $@ parse_conffile default_params + finalize_components_config ${COMPONENTS} } # Fetch command. Make sure that we're being called From owner-svn-src-stable@freebsd.org Sun Sep 22 20:03:26 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47D2412AF9A; Sun, 22 Sep 2019 20:03:26 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46bz0Z15lHz49yV; Sun, 22 Sep 2019 20:03:26 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 090E23C29; Sun, 22 Sep 2019 20:03:26 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8MK3P5O072397; Sun, 22 Sep 2019 20:03:25 GMT (envelope-from grembo@FreeBSD.org) Received: (from grembo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8MK3PHf072396; Sun, 22 Sep 2019 20:03:25 GMT (envelope-from grembo@FreeBSD.org) Message-Id: <201909222003.x8MK3PHf072396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grembo set sender to grembo@FreeBSD.org using -f From: Michael Gmelin Date: Sun, 22 Sep 2019 20:03:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352610 - stable/11/usr.sbin/freebsd-update X-SVN-Group: stable-11 X-SVN-Commit-Author: grembo X-SVN-Commit-Paths: stable/11/usr.sbin/freebsd-update X-SVN-Commit-Revision: 352610 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Sep 2019 20:03:26 -0000 Author: grembo (ports committer) Date: Sun Sep 22 20:03:25 2019 New Revision: 352610 URL: https://svnweb.freebsd.org/changeset/base/352610 Log: MFC r352542: freebsd-update: Fix src component detection PR: 224048, 238558, 23999 Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D21579 Modified: stable/11/usr.sbin/freebsd-update/freebsd-update.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- stable/11/usr.sbin/freebsd-update/freebsd-update.sh Sun Sep 22 19:59:10 2019 (r352609) +++ stable/11/usr.sbin/freebsd-update/freebsd-update.sh Sun Sep 22 20:03:25 2019 (r352610) @@ -221,6 +221,14 @@ config_KeepModifiedMetadata () { # Add to the list of components which should be kept updated. config_Components () { for C in $@; do + COMPONENTS="${COMPONENTS} ${C}" + done +} + +# Remove src component from list if it isn't installed +finalize_components_config () { + COMPONENTS="" + for C in $@; do if [ "$C" = "src" ]; then if [ -e "${BASEDIR}/usr/src/COPYRIGHT" ]; then COMPONENTS="${COMPONENTS} ${C}" @@ -3284,6 +3292,7 @@ get_params () { parse_cmdline $@ parse_conffile default_params + finalize_components_config ${COMPONENTS} } # Fetch command. Make sure that we're being called From owner-svn-src-stable@freebsd.org Mon Sep 23 07:22:22 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BBECDE96ED; Mon, 23 Sep 2019 07:22:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46cG3y4cq3z4fPL; Mon, 23 Sep 2019 07:22:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 81FB4B64A; Mon, 23 Sep 2019 07:22:22 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8N7MMeD069199; Mon, 23 Sep 2019 07:22:22 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8N7MMPp069198; Mon, 23 Sep 2019 07:22:22 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909230722.x8N7MMPp069198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 23 Sep 2019 07:22:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352615 - stable/12/lib/libc/yp X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/lib/libc/yp X-SVN-Commit-Revision: 352615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Sep 2019 07:22:22 -0000 Author: kib Date: Mon Sep 23 07:22:22 2019 New Revision: 352615 URL: https://svnweb.freebsd.org/changeset/base/352615 Log: MFC r352384: Increase the size of the send and receive buffers for YP client rpc calls to max allowed UDP datagram size. Sponsored by: Mellanox Technologies Modified: stable/12/lib/libc/yp/yplib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/yp/yplib.c ============================================================================== --- stable/12/lib/libc/yp/yplib.c Mon Sep 23 04:28:07 2019 (r352614) +++ stable/12/lib/libc/yp/yplib.c Mon Sep 23 07:22:22 2019 (r352615) @@ -526,7 +526,7 @@ gotit: tv.tv_usec = 0; ysd->dom_socket = RPC_ANYSOCK; ysd->dom_client = clntudp_bufcreate(&ysd->dom_server_addr, - YPPROG, YPVERS, tv, &ysd->dom_socket, 1280, 2304); + YPPROG, YPVERS, tv, &ysd->dom_socket, 65507, 65507); if (ysd->dom_client == NULL) { clnt_pcreateerror("clntudp_create"); ysd->dom_vers = -1; From owner-svn-src-stable@freebsd.org Mon Sep 23 07:23:30 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4ABB3E9771; Mon, 23 Sep 2019 07:23:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46cG5G1Gvkz4fX3; Mon, 23 Sep 2019 07:23:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0ED39B65C; Mon, 23 Sep 2019 07:23:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8N7NTOP071762; Mon, 23 Sep 2019 07:23:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8N7NTTD071761; Mon, 23 Sep 2019 07:23:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909230723.x8N7NTTD071761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 23 Sep 2019 07:23:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352616 - stable/11/lib/libc/yp X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/lib/libc/yp X-SVN-Commit-Revision: 352616 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Sep 2019 07:23:30 -0000 Author: kib Date: Mon Sep 23 07:23:29 2019 New Revision: 352616 URL: https://svnweb.freebsd.org/changeset/base/352616 Log: MFC r352384: Increase the size of the send and receive buffers for YP client rpc calls to max allowed UDP datagram size. Sponsored by: Mellanox Technologies Modified: stable/11/lib/libc/yp/yplib.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/yp/yplib.c ============================================================================== --- stable/11/lib/libc/yp/yplib.c Mon Sep 23 07:22:22 2019 (r352615) +++ stable/11/lib/libc/yp/yplib.c Mon Sep 23 07:23:29 2019 (r352616) @@ -524,7 +524,7 @@ gotit: tv.tv_usec = 0; ysd->dom_socket = RPC_ANYSOCK; ysd->dom_client = clntudp_bufcreate(&ysd->dom_server_addr, - YPPROG, YPVERS, tv, &ysd->dom_socket, 1280, 2304); + YPPROG, YPVERS, tv, &ysd->dom_socket, 65507, 65507); if (ysd->dom_client == NULL) { clnt_pcreateerror("clntudp_create"); ysd->dom_vers = -1; From owner-svn-src-stable@freebsd.org Mon Sep 23 13:45:50 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA8BAF561D; Mon, 23 Sep 2019 13:45:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46cQZQ456Tz42kJ; Mon, 23 Sep 2019 13:45:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F7D8FB93; Mon, 23 Sep 2019 13:45:50 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8NDjo1d020270; Mon, 23 Sep 2019 13:45:50 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8NDjo0u020269; Mon, 23 Sep 2019 13:45:50 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909231345.x8NDjo0u020269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 23 Sep 2019 13:45:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352621 - stable/12/sys/fs/nfsclient X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/fs/nfsclient X-SVN-Commit-Revision: 352621 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Sep 2019 13:45:50 -0000 Author: kib Date: Mon Sep 23 13:45:50 2019 New Revision: 352621 URL: https://svnweb.freebsd.org/changeset/base/352621 Log: MFC r352393, r352457: nfscl_loadattrcache: fix rest of the cases to not call vnode_pager_setsize() under the node mutex. Modified: stable/12/sys/fs/nfsclient/nfs_clport.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/12/sys/fs/nfsclient/nfs_clport.c Mon Sep 23 13:24:31 2019 (r352620) +++ stable/12/sys/fs/nfsclient/nfs_clport.c Mon Sep 23 13:45:50 2019 (r352621) @@ -414,12 +414,12 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt struct nfsnode *np; struct nfsmount *nmp; struct timespec mtime_save; + vm_object_t object; u_quad_t nsize; - int setnsize, error, force_fid_err; + int error, force_fid_err; + bool setnsize; error = 0; - setnsize = 0; - nsize = 0; /* * If v_type == VNON it is a new node, so fill in the v_type, @@ -514,7 +514,6 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt vap->va_size = np->n_size; np->n_attrstamp = 0; KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(vp); - vnode_pager_setsize(vp, np->n_size); } else if (np->n_flag & NMODIFIED) { /* * We've modified the file: Use the larger @@ -526,21 +525,9 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt np->n_size = vap->va_size; np->n_flag |= NSIZECHANGED; } - vnode_pager_setsize(vp, np->n_size); - } else if (vap->va_size < np->n_size) { - /* - * When shrinking the size, the call to - * vnode_pager_setsize() cannot be done - * with the mutex held, so delay it until - * after the mtx_unlock call. - */ - nsize = np->n_size = vap->va_size; - np->n_flag |= NSIZECHANGED; - setnsize = 1; } else { np->n_size = vap->va_size; np->n_flag |= NSIZECHANGED; - vnode_pager_setsize(vp, np->n_size); } } else { np->n_size = vap->va_size; @@ -578,6 +565,23 @@ out: if (np->n_attrstamp != 0) KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, error); #endif + nsize = vap->va_size; + object = vp->v_object; + setnsize = false; + if (object != NULL) { + if (OFF_TO_IDX(nsize + PAGE_MASK) < object->size) { + /* + * When shrinking the size, the call to + * vnode_pager_setsize() cannot be done with + * the mutex held, because we might need to + * wait for a busy page. Delay it until after + * the node is unlocked. + */ + setnsize = true; + } else { + vnode_pager_setsize(vp, nsize); + } + } NFSUNLOCKNODE(np); if (setnsize) vnode_pager_setsize(vp, nsize); From owner-svn-src-stable@freebsd.org Tue Sep 24 02:28:18 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74D50F277F; Tue, 24 Sep 2019 02:28:18 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46clVB2XFLz3MTR; Tue, 24 Sep 2019 02:28:18 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A1E72062E; Tue, 24 Sep 2019 02:28:18 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8O2SIHN078792; Tue, 24 Sep 2019 02:28:18 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8O2SIDf078791; Tue, 24 Sep 2019 02:28:18 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201909240228.x8O2SIDf078791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Tue, 24 Sep 2019 02:28:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352637 - stable/12/share/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: stable/12/share/mk X-SVN-Commit-Revision: 352637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2019 02:28:18 -0000 Author: mhorne Date: Tue Sep 24 02:28:17 2019 New Revision: 352637 URL: https://svnweb.freebsd.org/changeset/base/352637 Log: MFC r352033: Allow for compiler versions >= 10 Modified: stable/12/share/mk/bsd.compiler.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/share/mk/bsd.compiler.mk ============================================================================== --- stable/12/share/mk/bsd.compiler.mk Tue Sep 24 01:58:54 2019 (r352636) +++ stable/12/share/mk/bsd.compiler.mk Tue Sep 24 02:28:17 2019 (r352637) @@ -168,7 +168,7 @@ ${X_}COMPILER_TYPE:= clang . endif .endif .if !defined(${X_}COMPILER_VERSION) -${X_}COMPILER_VERSION!=echo "${_v:M[1-9].[0-9]*}" | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' +${X_}COMPILER_VERSION!=echo "${_v:M[1-9]*.[0-9]*}" | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' .endif .undef _v .endif From owner-svn-src-stable@freebsd.org Tue Sep 24 02:30:32 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD8BCF2B00; Tue, 24 Sep 2019 02:30:32 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46clXm4CwJz3MlP; Tue, 24 Sep 2019 02:30:32 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74CEF20644; Tue, 24 Sep 2019 02:30:32 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8O2UWAB078983; Tue, 24 Sep 2019 02:30:32 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8O2UWb8078982; Tue, 24 Sep 2019 02:30:32 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201909240230.x8O2UWb8078982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Tue, 24 Sep 2019 02:30:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352638 - stable/11/share/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: stable/11/share/mk X-SVN-Commit-Revision: 352638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2019 02:30:32 -0000 Author: mhorne Date: Tue Sep 24 02:30:32 2019 New Revision: 352638 URL: https://svnweb.freebsd.org/changeset/base/352638 Log: MFC r352033: Allow for compiler versions >= 10 Modified: stable/11/share/mk/bsd.compiler.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/share/mk/bsd.compiler.mk ============================================================================== --- stable/11/share/mk/bsd.compiler.mk Tue Sep 24 02:28:17 2019 (r352637) +++ stable/11/share/mk/bsd.compiler.mk Tue Sep 24 02:30:32 2019 (r352638) @@ -156,7 +156,7 @@ ${X_}COMPILER_TYPE:= clang . endif .endif .if !defined(${X_}COMPILER_VERSION) -${X_}COMPILER_VERSION!=echo "${_v:M[1-9].[0-9]*}" | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' +${X_}COMPILER_VERSION!=echo "${_v:M[1-9]*.[0-9]*}" | awk -F. '{print $$1 * 10000 + $$2 * 100 + $$3;}' .endif .undef _v .endif From owner-svn-src-stable@freebsd.org Tue Sep 24 02:33:03 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C40FDF2FC9; Tue, 24 Sep 2019 02:33:03 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46clbg4lBsz3NBx; Tue, 24 Sep 2019 02:33:03 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83E6820808; Tue, 24 Sep 2019 02:33:03 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8O2X31Q084452; Tue, 24 Sep 2019 02:33:03 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8O2X3DE084451; Tue, 24 Sep 2019 02:33:03 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201909240233.x8O2X3DE084451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Tue, 24 Sep 2019 02:33:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352639 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 352639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2019 02:33:03 -0000 Author: mhorne Date: Tue Sep 24 02:33:03 2019 New Revision: 352639 URL: https://svnweb.freebsd.org/changeset/base/352639 Log: MFC r352034: RISC-V: fix kernel CFLAGS with clang Modified: stable/12/sys/conf/kern.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/kern.mk ============================================================================== --- stable/12/sys/conf/kern.mk Tue Sep 24 02:30:32 2019 (r352638) +++ stable/12/sys/conf/kern.mk Tue Sep 24 02:33:03 2019 (r352639) @@ -131,8 +131,18 @@ CFLAGS += -ffixed-x18 INLINE_LIMIT?= 8000 .endif +# +# For RISC-V we specify the soft-float ABI (lp64) to avoid the use of floating +# point registers within the kernel. We also specify the "medium" code model, +# which generates code suitable for a 2GiB addressing range located at any +# offset, allowing modules to be located anywhere in the 64-bit address space. +# Note that clang and GCC refer to this code model as "medium" and "medany" +# respectively. +# .if ${MACHINE_CPUARCH} == "riscv" -CFLAGS.gcc+= -mcmodel=medany -march=rv64imafdc -mabi=lp64 +CFLAGS+= -march=rv64imafdc -mabi=lp64 +CFLAGS.clang+= -mcmodel=medium +CFLAGS.gcc+= -mcmodel=medany INLINE_LIMIT?= 8000 .endif From owner-svn-src-stable@freebsd.org Tue Sep 24 02:36:10 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93246F3519; Tue, 24 Sep 2019 02:36:10 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46clgG0z47z3NdT; Tue, 24 Sep 2019 02:36:10 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05CE62082B; Tue, 24 Sep 2019 02:36:10 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8O2a9TT084904; Tue, 24 Sep 2019 02:36:09 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8O2a9np084903; Tue, 24 Sep 2019 02:36:09 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201909240236.x8O2a9np084903@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Tue, 24 Sep 2019 02:36:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352640 - stable/12/sys/riscv/riscv X-SVN-Group: stable-12 X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: stable/12/sys/riscv/riscv X-SVN-Commit-Revision: 352640 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2019 02:36:10 -0000 Author: mhorne Date: Tue Sep 24 02:36:09 2019 New Revision: 352640 URL: https://svnweb.freebsd.org/changeset/base/352640 Log: MFC r352035: Remove a duplicate KTR entry Modified: stable/12/sys/riscv/riscv/intr_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/riscv/riscv/intr_machdep.c ============================================================================== --- stable/12/sys/riscv/riscv/intr_machdep.c Tue Sep 24 02:33:03 2019 (r352639) +++ stable/12/sys/riscv/riscv/intr_machdep.c Tue Sep 24 02:36:09 2019 (r352640) @@ -204,7 +204,7 @@ ipi_send(struct pcpu *pc, int ipi) { u_long mask; - CTR3(KTR_SMP, "%s: cpu=%d, ipi=%x", __func__, pc->pc_cpuid, ipi); + CTR3(KTR_SMP, "%s: cpu: %d, ipi: %x", __func__, pc->pc_cpuid, ipi); atomic_set_32(&pc->pc_pending_ipis, ipi); mask = (1 << pc->pc_hart); @@ -234,7 +234,6 @@ ipi_cpu(int cpu, u_int ipi) CPU_ZERO(&cpus); CPU_SET(cpu, &cpus); - CTR3(KTR_SMP, "%s: cpu: %d, ipi: %x\n", __func__, cpu, ipi); ipi_send(cpuid_to_pcpu[cpu], ipi); } From owner-svn-src-stable@freebsd.org Tue Sep 24 02:38:09 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 932E2F37DF; Tue, 24 Sep 2019 02:38:09 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46cljY3Ps3z3Nr0; Tue, 24 Sep 2019 02:38:09 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 597152083C; Tue, 24 Sep 2019 02:38:09 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8O2c9G5085049; Tue, 24 Sep 2019 02:38:09 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8O2c9dU085048; Tue, 24 Sep 2019 02:38:09 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201909240238.x8O2c9dU085048@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Tue, 24 Sep 2019 02:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352641 - stable/12/sys/riscv/riscv X-SVN-Group: stable-12 X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: stable/12/sys/riscv/riscv X-SVN-Commit-Revision: 352641 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2019 02:38:09 -0000 Author: mhorne Date: Tue Sep 24 02:38:08 2019 New Revision: 352641 URL: https://svnweb.freebsd.org/changeset/base/352641 Log: MFC r352036: Fix compilation of locore.S with clang Modified: stable/12/sys/riscv/riscv/locore.S Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/riscv/riscv/locore.S ============================================================================== --- stable/12/sys/riscv/riscv/locore.S Tue Sep 24 02:36:09 2019 (r352640) +++ stable/12/sys/riscv/riscv/locore.S Tue Sep 24 02:38:08 2019 (r352641) @@ -69,12 +69,18 @@ _start: la t0, hart_lottery li t1, 1 amoadd.w t0, t1, 0(t0) - bnez t0, mpentry /* - * Page tables + * We must jump to mpentry in the non-BSP case because the offset is + * too large to fit in a 12-bit branch immediate. */ + beqz t0, 1f + j mpentry + /* + * Page tables + */ +1: /* Add L1 entry for kernel */ la s1, pagetable_l1 la s2, pagetable_l2 /* Link to next level PN */ From owner-svn-src-stable@freebsd.org Tue Sep 24 02:41:40 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4818F3CEB; Tue, 24 Sep 2019 02:41:40 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46clnc4XF7z3PJh; Tue, 24 Sep 2019 02:41:40 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 80034208BF; Tue, 24 Sep 2019 02:41:40 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8O2feDU086637; Tue, 24 Sep 2019 02:41:40 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8O2fdoN086634; Tue, 24 Sep 2019 02:41:39 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201909240241.x8O2fdoN086634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Tue, 24 Sep 2019 02:41:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352642 - in stable/12/sys/riscv: conf riscv X-SVN-Group: stable-12 X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: in stable/12/sys/riscv: conf riscv X-SVN-Commit-Revision: 352642 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2019 02:41:40 -0000 Author: mhorne Date: Tue Sep 24 02:41:39 2019 New Revision: 352642 URL: https://svnweb.freebsd.org/changeset/base/352642 Log: MFC r352430: RISC-V: Support EARLY_AP_STARTUP Modified: stable/12/sys/riscv/conf/GENERIC stable/12/sys/riscv/riscv/clock.c stable/12/sys/riscv/riscv/mp_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/riscv/conf/GENERIC ============================================================================== --- stable/12/sys/riscv/conf/GENERIC Tue Sep 24 02:38:08 2019 (r352641) +++ stable/12/sys/riscv/conf/GENERIC Tue Sep 24 02:41:39 2019 (r352642) @@ -72,6 +72,7 @@ options RACCT # Resource accounting framework options RACCT_DEFAULT_TO_DISABLED # Set kern.racct.enable=0 by default options RCTL # Resource limits options SMP +options EARLY_AP_STARTUP options INTRNG # RISC-V SBI console Modified: stable/12/sys/riscv/riscv/clock.c ============================================================================== --- stable/12/sys/riscv/riscv/clock.c Tue Sep 24 02:38:08 2019 (r352641) +++ stable/12/sys/riscv/riscv/clock.c Tue Sep 24 02:41:39 2019 (r352642) @@ -37,10 +37,34 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include +#include void cpu_initclocks(void) { +#ifdef EARLY_AP_STARTUP + struct thread *td; + int i; + td = curthread; cpu_initclocks_bsp(); + CPU_FOREACH(i) { + if (i == 0) + continue; + thread_lock(td); + sched_bind(td, i); + thread_unlock(td); + cpu_initclocks_ap(); + } + thread_lock(td); + if (sched_is_bound(td)) + sched_unbind(td); + thread_unlock(td); +#else + cpu_initclocks_bsp(); +#endif } Modified: stable/12/sys/riscv/riscv/mp_machdep.c ============================================================================== --- stable/12/sys/riscv/riscv/mp_machdep.c Tue Sep 24 02:38:08 2019 (r352641) +++ stable/12/sys/riscv/riscv/mp_machdep.c Tue Sep 24 02:41:39 2019 (r352642) @@ -258,8 +258,10 @@ init_secondary(uint64_t hart) /* Enable software interrupts */ riscv_unmask_ipi(); +#ifndef EARLY_AP_STARTUP /* Start per-CPU event timers. */ cpu_initclocks_ap(); +#endif /* Enable external (PLIC) interrupts */ csr_set(sie, SIE_SEIE); From owner-svn-src-stable@freebsd.org Tue Sep 24 06:18:49 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B61D9FA00A; Tue, 24 Sep 2019 06:18:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46crc94D94z44P2; Tue, 24 Sep 2019 06:18:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 74A59230F7; Tue, 24 Sep 2019 06:18:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8O6InEt014983; Tue, 24 Sep 2019 06:18:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8O6InD4014981; Tue, 24 Sep 2019 06:18:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909240618.x8O6InD4014981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 Sep 2019 06:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352643 - in stable/12: lib/libc/sys sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12: lib/libc/sys sys/kern X-SVN-Commit-Revision: 352643 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2019 06:18:49 -0000 Author: kib Date: Tue Sep 24 06:18:48 2019 New Revision: 352643 URL: https://svnweb.freebsd.org/changeset/base/352643 Log: MFC r352455: Return EISDIR when directory is opened with O_CREAT without O_DIRECTORY. PR: 240452 Modified: stable/12/lib/libc/sys/open.2 stable/12/sys/kern/vfs_vnops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/sys/open.2 ============================================================================== --- stable/12/lib/libc/sys/open.2 Tue Sep 24 02:41:39 2019 (r352642) +++ stable/12/lib/libc/sys/open.2 Tue Sep 24 06:18:48 2019 (r352643) @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd June 14, 2019 +.Dd September 17, 2019 .Dt OPEN 2 .Os .Sh NAME @@ -359,6 +359,11 @@ Too many symbolic links were encountered in translatin .It Bq Er EISDIR The named file is a directory, and the arguments specify it is to be modified. +.It Bq Er EISDIR +The named file is a directory, and the flags specified +.Dv O_CREAT +without +.Dv O_DIRECTORY . .It Bq Er EROFS The named file resides on a read-only file system, and the file is to be modified. Modified: stable/12/sys/kern/vfs_vnops.c ============================================================================== --- stable/12/sys/kern/vfs_vnops.c Tue Sep 24 02:41:39 2019 (r352642) +++ stable/12/sys/kern/vfs_vnops.c Tue Sep 24 06:18:48 2019 (r352643) @@ -261,6 +261,10 @@ restart: error = EEXIST; goto bad; } + if (vp->v_type == VDIR) { + error = EISDIR; + goto bad; + } fmode &= ~O_CREAT; } } else { From owner-svn-src-stable@freebsd.org Tue Sep 24 06:19:41 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F0311FA0EE; Tue, 24 Sep 2019 06:19:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46crd966dSz44Xb; Tue, 24 Sep 2019 06:19:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B633823101; Tue, 24 Sep 2019 06:19:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8O6Jf3M015091; Tue, 24 Sep 2019 06:19:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8O6JfI5015090; Tue, 24 Sep 2019 06:19:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909240619.x8O6JfI5015090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 Sep 2019 06:19:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352644 - stable/12/contrib/jemalloc/src X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/contrib/jemalloc/src X-SVN-Commit-Revision: 352644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2019 06:19:42 -0000 Author: kib Date: Tue Sep 24 06:19:41 2019 New Revision: 352644 URL: https://svnweb.freebsd.org/changeset/base/352644 Log: MFC r352456: realloc(x, 0) should not return NULL. PR: 240456 Modified: stable/12/contrib/jemalloc/src/jemalloc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/jemalloc/src/jemalloc.c ============================================================================== --- stable/12/contrib/jemalloc/src/jemalloc.c Tue Sep 24 06:18:48 2019 (r352643) +++ stable/12/contrib/jemalloc/src/jemalloc.c Tue Sep 24 06:19:41 2019 (r352644) @@ -2299,21 +2299,6 @@ je_realloc(void *ptr, size_t size) { LOG("core.realloc.entry", "ptr: %p, size: %zu\n", ptr, size); if (unlikely(size == 0)) { - if (ptr != NULL) { - /* realloc(ptr, 0) is equivalent to free(ptr). */ - UTRACE(ptr, 0, 0); - tcache_t *tcache; - tsd_t *tsd = tsd_fetch(); - if (tsd_reentrancy_level_get(tsd) == 0) { - tcache = tcache_get(tsd); - } else { - tcache = NULL; - } - ifree(tsd, ptr, tcache, true); - - LOG("core.realloc.exit", "result: %p", NULL); - return NULL; - } size = 1; } From owner-svn-src-stable@freebsd.org Tue Sep 24 06:21:49 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A338FA21E; Tue, 24 Sep 2019 06:21:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46crgd291yz44sd; Tue, 24 Sep 2019 06:21:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D88323291; Tue, 24 Sep 2019 06:21:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8O6Ln1m016779; Tue, 24 Sep 2019 06:21:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8O6LmLC016777; Tue, 24 Sep 2019 06:21:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909240621.x8O6LmLC016777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 Sep 2019 06:21:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352645 - in stable/11: lib/libc/sys sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11: lib/libc/sys sys/kern X-SVN-Commit-Revision: 352645 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2019 06:21:49 -0000 Author: kib Date: Tue Sep 24 06:21:48 2019 New Revision: 352645 URL: https://svnweb.freebsd.org/changeset/base/352645 Log: MFC r352455: Return EISDIR when directory is opened with O_CREAT without O_DIRECTORY. PR: 240452 Modified: stable/11/lib/libc/sys/open.2 stable/11/sys/kern/vfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/sys/open.2 ============================================================================== --- stable/11/lib/libc/sys/open.2 Tue Sep 24 06:19:41 2019 (r352644) +++ stable/11/lib/libc/sys/open.2 Tue Sep 24 06:21:48 2019 (r352645) @@ -28,7 +28,7 @@ .\" @(#)open.2 8.2 (Berkeley) 11/16/93 .\" $FreeBSD$ .\" -.Dd June 14, 2019 +.Dd September 17, 2019 .Dt OPEN 2 .Os .Sh NAME @@ -359,6 +359,11 @@ Too many symbolic links were encountered in translatin .It Bq Er EISDIR The named file is a directory, and the arguments specify it is to be modified. +.It Bq Er EISDIR +The named file is a directory, and the flags specified +.Dv O_CREAT +without +.Dv O_DIRECTORY . .It Bq Er EROFS The named file resides on a read-only file system, and the file is to be modified. Modified: stable/11/sys/kern/vfs_vnops.c ============================================================================== --- stable/11/sys/kern/vfs_vnops.c Tue Sep 24 06:19:41 2019 (r352644) +++ stable/11/sys/kern/vfs_vnops.c Tue Sep 24 06:21:48 2019 (r352645) @@ -262,6 +262,10 @@ restart: error = EEXIST; goto bad; } + if (vp->v_type == VDIR) { + error = EISDIR; + goto bad; + } fmode &= ~O_CREAT; } } else { From owner-svn-src-stable@freebsd.org Tue Sep 24 06:23:39 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A3C7FA45F; Tue, 24 Sep 2019 06:23:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46crjl2Zscz454N; Tue, 24 Sep 2019 06:23:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C09D232DB; Tue, 24 Sep 2019 06:23:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8O6NdWD020742; Tue, 24 Sep 2019 06:23:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8O6NdDt020741; Tue, 24 Sep 2019 06:23:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909240623.x8O6NdDt020741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 Sep 2019 06:23:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352646 - stable/11/contrib/jemalloc/src X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/contrib/jemalloc/src X-SVN-Commit-Revision: 352646 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2019 06:23:39 -0000 Author: kib Date: Tue Sep 24 06:23:38 2019 New Revision: 352646 URL: https://svnweb.freebsd.org/changeset/base/352646 Log: MFC r352456: realloc(x, 0) should not return NULL. PR: 240456 Modified: stable/11/contrib/jemalloc/src/jemalloc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/jemalloc/src/jemalloc.c ============================================================================== --- stable/11/contrib/jemalloc/src/jemalloc.c Tue Sep 24 06:21:48 2019 (r352645) +++ stable/11/contrib/jemalloc/src/jemalloc.c Tue Sep 24 06:23:38 2019 (r352646) @@ -1853,15 +1853,6 @@ je_realloc(void *ptr, size_t size) UNUSED size_t old_rzsize JEMALLOC_CC_SILENCE_INIT(0); if (unlikely(size == 0)) { - if (ptr != NULL) { - tsd_t *tsd; - - /* realloc(ptr, 0) is equivalent to free(ptr). */ - UTRACE(ptr, 0, 0); - tsd = tsd_fetch(); - ifree(tsd, ptr, tcache_get(tsd, false), true); - return (NULL); - } size = 1; } From owner-svn-src-stable@freebsd.org Tue Sep 24 06:30:36 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 330EBFA729; Tue, 24 Sep 2019 06:30:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46crsl408Dz45M9; Tue, 24 Sep 2019 06:30:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4E1C0232EF; Tue, 24 Sep 2019 06:30:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8O6UZMH021858; Tue, 24 Sep 2019 06:30:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8O6UYkS021855; Tue, 24 Sep 2019 06:30:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909240630.x8O6UYkS021855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 Sep 2019 06:30:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352647 - in stable/12/sys: net sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys: net sys X-SVN-Commit-Revision: 352647 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2019 06:30:36 -0000 Author: kib Date: Tue Sep 24 06:30:34 2019 New Revision: 352647 URL: https://svnweb.freebsd.org/changeset/base/352647 Log: MFC r352458: Add SIOCGIFDOWNREASON. Sponsored by: Mellanox Technologies Modified: stable/12/sys/net/if.c stable/12/sys/net/if.h stable/12/sys/sys/sockio.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/if.c ============================================================================== --- stable/12/sys/net/if.c Tue Sep 24 06:23:38 2019 (r352646) +++ stable/12/sys/net/if.c Tue Sep 24 06:30:34 2019 (r352647) @@ -2924,6 +2924,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, case SIOCGIFGENERIC: case SIOCGIFRSSKEY: case SIOCGIFRSSHASH: + case SIOCGIFDOWNREASON: if (ifp->if_ioctl == NULL) return (EOPNOTSUPP); error = (*ifp->if_ioctl)(ifp, cmd, data); Modified: stable/12/sys/net/if.h ============================================================================== --- stable/12/sys/net/if.h Tue Sep 24 06:23:38 2019 (r352646) +++ stable/12/sys/net/if.h Tue Sep 24 06:30:34 2019 (r352647) @@ -581,6 +581,16 @@ struct ifrsshash { #define IFNET_PCP_NONE 0xff /* PCP disabled */ +#define IFDR_MSG_SIZE 64 +#define IFDR_REASON_MSG 1 +#define IFDR_REASON_VENDOR 2 +struct ifdownreason { + char ifdr_name[IFNAMSIZ]; + uint32_t ifdr_reason; + uint32_t ifdr_vendor; + char ifdr_msg[IFDR_MSG_SIZE]; +}; + #endif /* __BSD_VISIBLE */ #ifdef _KERNEL Modified: stable/12/sys/sys/sockio.h ============================================================================== --- stable/12/sys/sys/sockio.h Tue Sep 24 06:23:38 2019 (r352646) +++ stable/12/sys/sys/sockio.h Tue Sep 24 06:30:34 2019 (r352647) @@ -143,4 +143,6 @@ #define SIOCGLANPCP _IOWR('i', 152, struct ifreq) /* Get (V)LAN PCP */ #define SIOCSLANPCP _IOW('i', 153, struct ifreq) /* Set (V)LAN PCP */ +#define SIOCGIFDOWNREASON _IOWR('i', 154, struct ifdownreason) + #endif /* !_SYS_SOCKIO_H_ */ From owner-svn-src-stable@freebsd.org Tue Sep 24 06:31:57 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0B8F2FA959; Tue, 24 Sep 2019 06:31:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46crvJ6bZQz45Yc; Tue, 24 Sep 2019 06:31:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C70AF23466; Tue, 24 Sep 2019 06:31:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8O6Vu5D026316; Tue, 24 Sep 2019 06:31:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8O6VuOk026315; Tue, 24 Sep 2019 06:31:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909240631.x8O6VuOk026315@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 Sep 2019 06:31:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352648 - stable/12/sbin/ifconfig X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sbin/ifconfig X-SVN-Commit-Revision: 352648 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2019 06:31:57 -0000 Author: kib Date: Tue Sep 24 06:31:56 2019 New Revision: 352648 URL: https://svnweb.freebsd.org/changeset/base/352648 Log: MFC r352459: ifconfig: add report of the string from SIOCGIFDOWNREASON. Sponsored by: Mellanox Technologies Modified: stable/12/sbin/ifconfig/ifmedia.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ifconfig/ifmedia.c ============================================================================== --- stable/12/sbin/ifconfig/ifmedia.c Tue Sep 24 06:30:34 2019 (r352647) +++ stable/12/sbin/ifconfig/ifmedia.c Tue Sep 24 06:31:56 2019 (r352648) @@ -80,6 +80,7 @@ #include #include #include +#include #include #include #include @@ -110,18 +111,20 @@ static void media_status(int s) { struct ifmediareq ifmr; + struct ifdownreason ifdr; int *media_list, i; - int xmedia = 1; + bool no_carrier, xmedia; (void) memset(&ifmr, 0, sizeof(ifmr)); (void) strlcpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name)); + xmedia = true; /* * Check if interface supports extended media types. */ if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)&ifmr) < 0) - xmedia = 0; - if (xmedia == 0 && ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { + xmedia = false; + if (!xmedia && ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { /* * Interface doesn't support SIOC{G,S}IFMEDIA. */ @@ -158,6 +161,7 @@ media_status(int s) putchar('\n'); if (ifmr.ifm_status & IFM_AVALID) { + no_carrier = false; printf("\tstatus: "); switch (IFM_TYPE(ifmr.ifm_active)) { case IFM_ETHER: @@ -165,7 +169,7 @@ media_status(int s) if (ifmr.ifm_status & IFM_ACTIVE) printf("active"); else - printf("no carrier"); + no_carrier = true; break; case IFM_IEEE80211: @@ -176,8 +180,26 @@ media_status(int s) else printf("running"); } else - printf("no carrier"); + no_carrier = true; break; + } + if (no_carrier) { + printf("no carrier"); + memset(&ifdr, 0, sizeof(ifdr)); + strlcpy(ifdr.ifdr_name, name, sizeof(ifdr.ifdr_name)); + if (ioctl(s, SIOCGIFDOWNREASON, (caddr_t)&ifdr) == 0) { + switch (ifdr.ifdr_reason) { + case IFDR_REASON_MSG: + printf(" (%s)", ifdr.ifdr_msg); + break; + case IFDR_REASON_VENDOR: + printf(" (vendor code %d)", + ifdr.ifdr_vendor); + break; + default: + break; + } + } } putchar('\n'); } From owner-svn-src-stable@freebsd.org Tue Sep 24 06:36:26 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FC68FAC55; Tue, 24 Sep 2019 06:36:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46cs0V3Hxnz45vt; Tue, 24 Sep 2019 06:36:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F9F82349D; Tue, 24 Sep 2019 06:36:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8O6aQjl026609; Tue, 24 Sep 2019 06:36:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8O6aPET026606; Tue, 24 Sep 2019 06:36:25 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909240636.x8O6aPET026606@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 Sep 2019 06:36:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352649 - in stable/11/sys: net sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11/sys: net sys X-SVN-Commit-Revision: 352649 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2019 06:36:26 -0000 Author: kib Date: Tue Sep 24 06:36:25 2019 New Revision: 352649 URL: https://svnweb.freebsd.org/changeset/base/352649 Log: MFC r352458: Add SIOCGIFDOWNREASON. Sponsored by: Mellanox Technologies Modified: stable/11/sys/net/if.c stable/11/sys/net/if.h stable/11/sys/sys/sockio.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if.c ============================================================================== --- stable/11/sys/net/if.c Tue Sep 24 06:31:56 2019 (r352648) +++ stable/11/sys/net/if.c Tue Sep 24 06:36:25 2019 (r352649) @@ -2844,6 +2844,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, case SIOCGIFGENERIC: case SIOCGIFRSSKEY: case SIOCGIFRSSHASH: + case SIOCGIFDOWNREASON: if (ifp->if_ioctl == NULL) return (EOPNOTSUPP); error = (*ifp->if_ioctl)(ifp, cmd, data); Modified: stable/11/sys/net/if.h ============================================================================== --- stable/11/sys/net/if.h Tue Sep 24 06:31:56 2019 (r352648) +++ stable/11/sys/net/if.h Tue Sep 24 06:36:25 2019 (r352649) @@ -574,6 +574,16 @@ struct ifrsshash { #define IFNET_PCP_NONE 0xff /* PCP disabled */ +#define IFDR_MSG_SIZE 64 +#define IFDR_REASON_MSG 1 +#define IFDR_REASON_VENDOR 2 +struct ifdownreason { + char ifdr_name[IFNAMSIZ]; + uint32_t ifdr_reason; + uint32_t ifdr_vendor; + char ifdr_msg[IFDR_MSG_SIZE]; +}; + #endif /* __BSD_VISIBLE */ #ifdef _KERNEL Modified: stable/11/sys/sys/sockio.h ============================================================================== --- stable/11/sys/sys/sockio.h Tue Sep 24 06:31:56 2019 (r352648) +++ stable/11/sys/sys/sockio.h Tue Sep 24 06:36:25 2019 (r352649) @@ -141,4 +141,6 @@ #define SIOCGLANPCP _IOWR('i', 152, struct ifreq) /* Get (V)LAN PCP */ #define SIOCSLANPCP _IOW('i', 153, struct ifreq) /* Set (V)LAN PCP */ +#define SIOCGIFDOWNREASON _IOWR('i', 154, struct ifdownreason) + #endif /* !_SYS_SOCKIO_H_ */ From owner-svn-src-stable@freebsd.org Tue Sep 24 06:37:02 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9EE03FACC5; Tue, 24 Sep 2019 06:37:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46cs1B3lMdz46Hc; Tue, 24 Sep 2019 06:37:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 619F02349E; Tue, 24 Sep 2019 06:37:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8O6b2wi026692; Tue, 24 Sep 2019 06:37:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8O6b2hV026691; Tue, 24 Sep 2019 06:37:02 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909240637.x8O6b2hV026691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 24 Sep 2019 06:37:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352650 - stable/11/sbin/ifconfig X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/11/sbin/ifconfig X-SVN-Commit-Revision: 352650 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Sep 2019 06:37:02 -0000 Author: kib Date: Tue Sep 24 06:37:01 2019 New Revision: 352650 URL: https://svnweb.freebsd.org/changeset/base/352650 Log: MFC r352459: ifconfig: add report of the string from SIOCGIFDOWNREASON. Sponsored by: Mellanox Technologies Modified: stable/11/sbin/ifconfig/ifmedia.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ifconfig/ifmedia.c ============================================================================== --- stable/11/sbin/ifconfig/ifmedia.c Tue Sep 24 06:36:25 2019 (r352649) +++ stable/11/sbin/ifconfig/ifmedia.c Tue Sep 24 06:37:01 2019 (r352650) @@ -78,6 +78,7 @@ #include #include #include +#include #include #include #include @@ -108,18 +109,20 @@ static void media_status(int s) { struct ifmediareq ifmr; + struct ifdownreason ifdr; int *media_list, i; - int xmedia = 1; + bool no_carrier, xmedia; (void) memset(&ifmr, 0, sizeof(ifmr)); (void) strlcpy(ifmr.ifm_name, name, sizeof(ifmr.ifm_name)); + xmedia = true; /* * Check if interface supports extended media types. */ if (ioctl(s, SIOCGIFXMEDIA, (caddr_t)&ifmr) < 0) - xmedia = 0; - if (xmedia == 0 && ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { + xmedia = false; + if (!xmedia && ioctl(s, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) { /* * Interface doesn't support SIOC{G,S}IFMEDIA. */ @@ -156,6 +159,7 @@ media_status(int s) putchar('\n'); if (ifmr.ifm_status & IFM_AVALID) { + no_carrier = false; printf("\tstatus: "); switch (IFM_TYPE(ifmr.ifm_active)) { case IFM_ETHER: @@ -163,7 +167,7 @@ media_status(int s) if (ifmr.ifm_status & IFM_ACTIVE) printf("active"); else - printf("no carrier"); + no_carrier = true; break; case IFM_FDDI: @@ -182,8 +186,26 @@ media_status(int s) else printf("running"); } else - printf("no carrier"); + no_carrier = true; break; + } + if (no_carrier) { + printf("no carrier"); + memset(&ifdr, 0, sizeof(ifdr)); + strlcpy(ifdr.ifdr_name, name, sizeof(ifdr.ifdr_name)); + if (ioctl(s, SIOCGIFDOWNREASON, (caddr_t)&ifdr) == 0) { + switch (ifdr.ifdr_reason) { + case IFDR_REASON_MSG: + printf(" (%s)", ifdr.ifdr_msg); + break; + case IFDR_REASON_VENDOR: + printf(" (vendor code %d)", + ifdr.ifdr_vendor); + break; + default: + break; + } + } } putchar('\n'); } From owner-svn-src-stable@freebsd.org Wed Sep 25 10:38:45 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 84EFF1229C8; Wed, 25 Sep 2019 10:38:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dZKd30Zjz3Cwl; Wed, 25 Sep 2019 10:38:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A708E6D2; Wed, 25 Sep 2019 10:38:45 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PAcjC2016796; Wed, 25 Sep 2019 10:38:45 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PAcjY4016795; Wed, 25 Sep 2019 10:38:45 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909251038.x8PAcjY4016795@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 25 Sep 2019 10:38:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352672 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 352672 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 10:38:45 -0000 Author: tuexen Date: Wed Sep 25 10:38:44 2019 New Revision: 352672 URL: https://svnweb.freebsd.org/changeset/base/352672 Log: MFC r352511: When processing an incoming IPv6 packet over the loopback interface which contains Hop-by-Hop options, the mbuf chain is potentially changed in ip6_hopopts_input(), called by ip6_input_hbh(). This can happen, because of the the use of IP6_EXTHDR_CHECK, which might call m_pullup(). So provide the updated pointer back to the called of ip6_input_hbh() to avoid using a freed mbuf chain in`ip6_input()`. Reviewed by: markj@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D21664 Modified: stable/12/sys/netinet6/ip6_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/ip6_input.c ============================================================================== --- stable/12/sys/netinet6/ip6_input.c Wed Sep 25 07:51:30 2019 (r352671) +++ stable/12/sys/netinet6/ip6_input.c Wed Sep 25 10:38:44 2019 (r352672) @@ -404,20 +404,22 @@ VNET_SYSUNINIT(inet6, SI_SUB_PROTO_DOMAIN, SI_ORDER_TH #endif static int -ip6_input_hbh(struct mbuf *m, uint32_t *plen, uint32_t *rtalert, int *off, +ip6_input_hbh(struct mbuf **mp, uint32_t *plen, uint32_t *rtalert, int *off, int *nxt, int *ours) { + struct mbuf *m; struct ip6_hdr *ip6; struct ip6_hbh *hbh; - if (ip6_hopopts_input(plen, rtalert, &m, off)) { + if (ip6_hopopts_input(plen, rtalert, mp, off)) { #if 0 /*touches NULL pointer*/ - in6_ifstat_inc(m->m_pkthdr.rcvif, ifs6_in_discard); + in6_ifstat_inc((*mp)->m_pkthdr.rcvif, ifs6_in_discard); #endif goto out; /* m have already been freed */ } /* adjust pointer */ + m = *mp; ip6 = mtod(m, struct ip6_hdr *); /* @@ -857,7 +859,7 @@ passin: */ plen = (u_int32_t)ntohs(ip6->ip6_plen); if (ip6->ip6_nxt == IPPROTO_HOPOPTS) { - if (ip6_input_hbh(m, &plen, &rtalert, &off, &nxt, &ours) != 0) + if (ip6_input_hbh(&m, &plen, &rtalert, &off, &nxt, &ours) != 0) return; } else nxt = ip6->ip6_nxt; From owner-svn-src-stable@freebsd.org Wed Sep 25 10:40:50 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 045DC122A75; Wed, 25 Sep 2019 10:40:50 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dZN16N0Zz3D5N; Wed, 25 Sep 2019 10:40:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5365E6F0; Wed, 25 Sep 2019 10:40:49 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PAenIH016977; Wed, 25 Sep 2019 10:40:49 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PAenLv016976; Wed, 25 Sep 2019 10:40:49 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909251040.x8PAenLv016976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 25 Sep 2019 10:40:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352673 - stable/12/sys/netinet/tcp_stacks X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 352673 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 10:40:50 -0000 Author: tuexen Date: Wed Sep 25 10:40:49 2019 New Revision: 352673 URL: https://svnweb.freebsd.org/changeset/base/352673 Log: MFC r352512: When the RACK stack computes the space for user data in a TCP segment, it wasn't taking the IP level options into account. This patch fixes this. In addition, it also corrects a KASSERT and adds protection code to assure that the IP header chain and the TCP head fit in the first fragment as required by RFC 7112. Reviewed by: rrs@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D21666 Modified: stable/12/sys/netinet/tcp_stacks/rack.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_stacks/rack.c ============================================================================== --- stable/12/sys/netinet/tcp_stacks/rack.c Wed Sep 25 10:38:44 2019 (r352672) +++ stable/12/sys/netinet/tcp_stacks/rack.c Wed Sep 25 10:40:49 2019 (r352673) @@ -7872,7 +7872,16 @@ send: hdrlen += sizeof(struct udphdr); } #endif - ipoptlen = 0; +#ifdef INET6 + if (isipv6) + ipoptlen = ip6_optlen(tp->t_inpcb); + else +#endif + if (tp->t_inpcb->inp_options) + ipoptlen = tp->t_inpcb->inp_options->m_len - + offsetof(struct ipoption, ipopt_list); + else + ipoptlen = 0; #if defined(IPSEC) || defined(IPSEC_SUPPORT) ipoptlen += ipsec_optlen; #endif @@ -7945,6 +7954,18 @@ send: sendalot = 1; } else { + if (optlen + ipoptlen > tp->t_maxseg) { + /* + * Since we don't have enough space to put + * the IP header chain and the TCP header in + * one packet as required by RFC 7112, don't + * send it. + */ + SOCKBUF_UNLOCK(&so->so_snd); + error = EMSGSIZE; + sack_rxmit = 0; + goto out; + } len = tp->t_maxseg - optlen - ipoptlen; sendalot = 1; } @@ -8438,15 +8459,9 @@ send: m->m_pkthdr.csum_flags |= CSUM_TSO; m->m_pkthdr.tso_segsz = tp->t_maxseg - optlen; } -#if defined(IPSEC) || defined(IPSEC_SUPPORT) - KASSERT(len + hdrlen + ipoptlen - ipsec_optlen == m_length(m, NULL), - ("%s: mbuf chain shorter than expected: %d + %u + %u - %u != %u", - __func__, len, hdrlen, ipoptlen, ipsec_optlen, m_length(m, NULL))); -#else - KASSERT(len + hdrlen + ipoptlen == m_length(m, NULL), - ("%s: mbuf chain shorter than expected: %d + %u + %u != %u", - __func__, len, hdrlen, ipoptlen, m_length(m, NULL))); -#endif + KASSERT(len + hdrlen == m_length(m, NULL), + ("%s: mbuf chain different than expected: %d + %u != %u", + __func__, len, hdrlen, m_length(m, NULL))); #ifdef TCP_HHOOK /* Run HHOOK_TCP_ESTABLISHED_OUT helper hooks. */ From owner-svn-src-stable@freebsd.org Wed Sep 25 10:42:34 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6233122C3D; Wed, 25 Sep 2019 10:42:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dZQ25N8Wz3DQm; Wed, 25 Sep 2019 10:42:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D1A8E887; Wed, 25 Sep 2019 10:42:34 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PAgYjX022273; Wed, 25 Sep 2019 10:42:34 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PAgYfc022272; Wed, 25 Sep 2019 10:42:34 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909251042.x8PAgYfc022272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 25 Sep 2019 10:42:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352674 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 352674 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 10:42:34 -0000 Author: tuexen Date: Wed Sep 25 10:42:34 2019 New Revision: 352674 URL: https://svnweb.freebsd.org/changeset/base/352674 Log: MFC r352550: Fix the handling of invalid parameters in ASCONF chunks. Thanks to Mark Wodrich from Google for reproting the issue in https://github.com/sctplab/usrsctp/issues/376 for the userland stack. Modified: stable/12/sys/netinet/sctp_asconf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_asconf.c ============================================================================== --- stable/12/sys/netinet/sctp_asconf.c Wed Sep 25 10:40:49 2019 (r352673) +++ stable/12/sys/netinet/sctp_asconf.c Wed Sep 25 10:42:34 2019 (r352674) @@ -703,6 +703,7 @@ sctp_handle_asconf(struct mbuf *m, unsigned int offset if (param_length <= sizeof(struct sctp_paramhdr)) { SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf: param length (%u) too short\n", param_length); sctp_m_freem(m_ack); + return; } /* get the entire parameter */ aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, param_length, aparam_buf); From owner-svn-src-stable@freebsd.org Wed Sep 25 10:44:11 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2C17122D2B; Wed, 25 Sep 2019 10:44:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dZRv3r7sz3Dbj; Wed, 25 Sep 2019 10:44:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67AB6E889; Wed, 25 Sep 2019 10:44:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PAiB7K022432; Wed, 25 Sep 2019 10:44:11 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PAiAgW022428; Wed, 25 Sep 2019 10:44:10 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909251044.x8PAiAgW022428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 25 Sep 2019 10:44:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352675 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 352675 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 10:44:11 -0000 Author: tuexen Date: Wed Sep 25 10:44:10 2019 New Revision: 352675 URL: https://svnweb.freebsd.org/changeset/base/352675 Log: MFC r352592: Cleanup the RTO calculation and perform some consistency checks before computing the RTO. This should fix an overflow issue reported by Felix Weinrank in https://github.com/sctplab/usrsctp/issues/375 for the userland stack and found by running a fuzz tester. Modified: stable/12/sys/netinet/sctp_indata.c stable/12/sys/netinet/sctp_input.c stable/12/sys/netinet/sctputil.c stable/12/sys/netinet/sctputil.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_indata.c ============================================================================== --- stable/12/sys/netinet/sctp_indata.c Wed Sep 25 10:42:34 2019 (r352674) +++ stable/12/sys/netinet/sctp_indata.c Wed Sep 25 10:44:10 2019 (r352675) @@ -3108,13 +3108,12 @@ sctp_process_segment_range(struct sctp_tcb *stcb, stru * update RTO too ? */ if (tp1->do_rtt) { - if (*rto_ok) { - tp1->whoTo->RTO = - sctp_calculate_rto(stcb, - &stcb->asoc, - tp1->whoTo, - &tp1->sent_rcv_time, - SCTP_RTT_FROM_DATA); + if (*rto_ok && + sctp_calculate_rto(stcb, + &stcb->asoc, + tp1->whoTo, + &tp1->sent_rcv_time, + SCTP_RTT_FROM_DATA)) { *rto_ok = 0; } if (tp1->whoTo->rto_needed == 0) { @@ -4086,16 +4085,12 @@ sctp_express_handle_sack(struct sctp_tcb *stcb, uint32 /* update RTO too? */ if (tp1->do_rtt) { - if (rto_ok) { - tp1->whoTo->RTO = - /* - * sa_ignore - * NO_NULL_CHK - */ - sctp_calculate_rto(stcb, - asoc, tp1->whoTo, - &tp1->sent_rcv_time, - SCTP_RTT_FROM_DATA); + if (rto_ok && + sctp_calculate_rto(stcb, + &stcb->asoc, + tp1->whoTo, + &tp1->sent_rcv_time, + SCTP_RTT_FROM_DATA)) { rto_ok = 0; } if (tp1->whoTo->rto_needed == 0) { @@ -4704,12 +4699,12 @@ hopeless_peer: /* update RTO too? */ if (tp1->do_rtt) { - if (rto_ok) { - tp1->whoTo->RTO = - sctp_calculate_rto(stcb, - asoc, tp1->whoTo, - &tp1->sent_rcv_time, - SCTP_RTT_FROM_DATA); + if (rto_ok && + sctp_calculate_rto(stcb, + &stcb->asoc, + tp1->whoTo, + &tp1->sent_rcv_time, + SCTP_RTT_FROM_DATA)) { rto_ok = 0; } if (tp1->whoTo->rto_needed == 0) { Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Wed Sep 25 10:42:34 2019 (r352674) +++ stable/12/sys/netinet/sctp_input.c Wed Sep 25 10:44:10 2019 (r352675) @@ -548,7 +548,7 @@ sctp_process_init_ack(struct mbuf *m, int iphlen, int asoc->primary_destination, SCTP_FROM_SCTP_INPUT + SCTP_LOC_3); /* calculate the RTO */ - net->RTO = sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, + sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, SCTP_RTT_FROM_NON_DATA); retval = sctp_send_cookie_echo(m, offset, initack_limit, stcb, net); return (retval); @@ -648,7 +648,7 @@ sctp_handle_heartbeat_ack(struct sctp_heartbeat_chunk tv.tv_sec = cp->heartbeat.hb_info.time_value_1; tv.tv_usec = cp->heartbeat.hb_info.time_value_2; /* Now lets do a RTO with this */ - r_net->RTO = sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv, + sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv, SCTP_RTT_FROM_NON_DATA); if (!(r_net->dest_state & SCTP_ADDR_REACHABLE)) { r_net->dest_state |= SCTP_ADDR_REACHABLE; @@ -1674,8 +1674,7 @@ sctp_process_cookie_existing(struct mbuf *m, int iphle old.tv_sec = cookie->time_entered.tv_sec; old.tv_usec = cookie->time_entered.tv_usec; net->hb_responded = 1; - net->RTO = sctp_calculate_rto(stcb, asoc, net, - &old, + sctp_calculate_rto(stcb, asoc, net, &old, SCTP_RTT_FROM_NON_DATA); if (stcb->asoc.sctp_autoclose_ticks && @@ -2399,8 +2398,7 @@ sctp_process_cookie_new(struct mbuf *m, int iphlen, in /* calculate the RTT and set the encaps port */ old.tv_sec = cookie->time_entered.tv_sec; old.tv_usec = cookie->time_entered.tv_usec; - (*netp)->RTO = sctp_calculate_rto(stcb, asoc, *netp, - &old, SCTP_RTT_FROM_NON_DATA); + sctp_calculate_rto(stcb, asoc, *netp, &old, SCTP_RTT_FROM_NON_DATA); } /* respond with a COOKIE-ACK */ sctp_send_cookie_ack(stcb); @@ -2976,8 +2974,7 @@ sctp_handle_cookie_ack(struct sctp_cookie_ack_chunk *c SCTP_STAT_INCR_COUNTER32(sctps_activeestab); SCTP_STAT_INCR_GAUGE32(sctps_currestab); if (asoc->overall_error_count == 0) { - net->RTO = sctp_calculate_rto(stcb, asoc, net, - &asoc->time_entered, + sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, SCTP_RTT_FROM_NON_DATA); } (void)SCTP_GETTIME_TIMEVAL(&asoc->time_entered); Modified: stable/12/sys/netinet/sctputil.c ============================================================================== --- stable/12/sys/netinet/sctputil.c Wed Sep 25 10:42:34 2019 (r352674) +++ stable/12/sys/netinet/sctputil.c Wed Sep 25 10:44:10 2019 (r352675) @@ -2469,25 +2469,24 @@ sctp_mtu_size_reset(struct sctp_inpcb *inp, /* - * given an association and starting time of the current RTT period return - * RTO in number of msecs net should point to the current network + * Given an association and starting time of the current RTT period, update + * RTO in number of msecs. net should point to the current network. + * Return 1, if an RTO update was performed, return 0 if no update was + * performed due to invalid starting point. */ -uint32_t +int sctp_calculate_rto(struct sctp_tcb *stcb, struct sctp_association *asoc, struct sctp_nets *net, struct timeval *old, int rtt_from_sack) { - /*- - * given an association and the starting time of the current RTT - * period (in value1/value2) return RTO in number of msecs. - */ + struct timeval now; + uint64_t rtt_us; /* RTT in us */ int32_t rtt; /* RTT in ms */ uint32_t new_rto; int first_measure = 0; - struct timeval now; /************************/ /* 1. calculate new RTT */ @@ -2498,10 +2497,19 @@ sctp_calculate_rto(struct sctp_tcb *stcb, } else { (void)SCTP_GETTIME_TIMEVAL(&now); } + if ((old->tv_sec > now.tv_sec) || + ((old->tv_sec == now.tv_sec) && (old->tv_sec > now.tv_sec))) { + /* The starting point is in the future. */ + return (0); + } timevalsub(&now, old); + rtt_us = (uint64_t)1000000 * (uint64_t)now.tv_sec + (uint64_t)now.tv_usec; + if (rtt_us > SCTP_RTO_UPPER_BOUND * 1000) { + /* The RTT is larger than a sane value. */ + return (0); + } /* store the current RTT in us */ - net->rtt = (uint64_t)1000000 * (uint64_t)now.tv_sec + - (uint64_t)now.tv_usec; + net->rtt = rtt_us; /* compute rtt in ms */ rtt = (int32_t)(net->rtt / 1000); if ((asoc->cc_functions.sctp_rtt_calculated) && (rtt_from_sack == SCTP_RTT_FROM_DATA)) { @@ -2533,7 +2541,7 @@ sctp_calculate_rto(struct sctp_tcb *stcb, * Paper "Congestion Avoidance and Control", Annex A. * * (net->lastsa >> SCTP_RTT_SHIFT) is the srtt - * (net->lastsa >> SCTP_RTT_VAR_SHIFT) is the rttvar + * (net->lastsv >> SCTP_RTT_VAR_SHIFT) is the rttvar */ if (net->RTO_measured) { rtt -= (net->lastsa >> SCTP_RTT_SHIFT); @@ -2574,8 +2582,8 @@ sctp_calculate_rto(struct sctp_tcb *stcb, if (new_rto > stcb->asoc.maxrto) { new_rto = stcb->asoc.maxrto; } - /* we are now returning the RTO */ - return (new_rto); + net->RTO = new_rto; + return (1); } /* Modified: stable/12/sys/netinet/sctputil.h ============================================================================== --- stable/12/sys/netinet/sctputil.h Wed Sep 25 10:42:34 2019 (r352674) +++ stable/12/sys/netinet/sctputil.h Wed Sep 25 10:44:10 2019 (r352675) @@ -133,7 +133,7 @@ uint32_t sctp_get_next_mtu(uint32_t); void sctp_timeout_handler(void *); -uint32_t +int sctp_calculate_rto(struct sctp_tcb *, struct sctp_association *, struct sctp_nets *, struct timeval *, int); From owner-svn-src-stable@freebsd.org Wed Sep 25 10:46:06 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08427122E67; Wed, 25 Sep 2019 10:46:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dZV56Tm7z3DrC; Wed, 25 Sep 2019 10:46:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3691E88D; Wed, 25 Sep 2019 10:46:05 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PAk5IP022744; Wed, 25 Sep 2019 10:46:05 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PAk5HZ022743; Wed, 25 Sep 2019 10:46:05 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201909251046.x8PAk5HZ022743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Wed, 25 Sep 2019 10:46:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352676 - stable/12/sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/12/sys/netinet X-SVN-Commit-Revision: 352676 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 10:46:06 -0000 Author: tuexen Date: Wed Sep 25 10:46:05 2019 New Revision: 352676 URL: https://svnweb.freebsd.org/changeset/base/352676 Log: MFC r352594: Don't hold the info lock when calling sctp_select_a_tag(). This avoids a double lock bug in the NAT colliding state processing of SCTP. Thanks to Felix Weinrank for finding and reporting this issue in https://github.com/sctplab/usrsctp/issues/374 He found this bug using fuzz testing. Modified: stable/12/sys/netinet/sctp_input.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/sctp_input.c ============================================================================== --- stable/12/sys/netinet/sctp_input.c Wed Sep 25 10:44:10 2019 (r352675) +++ stable/12/sys/netinet/sctp_input.c Wed Sep 25 10:46:05 2019 (r352676) @@ -703,34 +703,37 @@ static int sctp_handle_nat_colliding_state(struct sctp_tcb *stcb) { /* - * return 0 means we want you to proceed with the abort non-zero - * means no abort processing + * Return 0 means we want you to proceed with the abort non-zero + * means no abort processing. */ + uint32_t new_vtag; struct sctpasochead *head; if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { + new_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); atomic_add_int(&stcb->asoc.refcnt, 1); SCTP_TCB_UNLOCK(stcb); SCTP_INP_INFO_WLOCK(); SCTP_TCB_LOCK(stcb); atomic_subtract_int(&stcb->asoc.refcnt, 1); + } else { + return (0); } if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) { /* generate a new vtag and send init */ LIST_REMOVE(stcb, sctp_asocs); - stcb->asoc.my_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); + stcb->asoc.my_vtag = new_vtag; head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))]; /* * put it in the bucket in the vtag hash of assoc's for the * system */ LIST_INSERT_HEAD(head, stcb, sctp_asocs); - sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); SCTP_INP_INFO_WUNLOCK(); + sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); return (1); - } - if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED) { + } else { /* * treat like a case where the cookie expired i.e.: - dump * current cookie. - generate a new vtag. - resend init. @@ -740,15 +743,15 @@ sctp_handle_nat_colliding_state(struct sctp_tcb *stcb) SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_WAIT); sctp_stop_all_cookie_timers(stcb); sctp_toss_old_cookies(stcb, &stcb->asoc); - stcb->asoc.my_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); + stcb->asoc.my_vtag = new_vtag; head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))]; /* * put it in the bucket in the vtag hash of assoc's for the * system */ LIST_INSERT_HEAD(head, stcb, sctp_asocs); - sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); SCTP_INP_INFO_WUNLOCK(); + sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); return (1); } return (0); From owner-svn-src-stable@freebsd.org Wed Sep 25 12:58:50 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A082E1264CF; Wed, 25 Sep 2019 12:58:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ddRG3m21z3MMb; Wed, 25 Sep 2019 12:58:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6432F18022; Wed, 25 Sep 2019 12:58:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PCwoRw098945; Wed, 25 Sep 2019 12:58:50 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PCwoFU098944; Wed, 25 Sep 2019 12:58:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909251258.x8PCwoFU098944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 25 Sep 2019 12:58:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352678 - in stable: 11/sys/fs/msdosfs 12/sys/fs/msdosfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/fs/msdosfs 12/sys/fs/msdosfs X-SVN-Commit-Revision: 352678 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 12:58:50 -0000 Author: kevans Date: Wed Sep 25 12:58:49 2019 New Revision: 352678 URL: https://svnweb.freebsd.org/changeset/base/352678 Log: MFC r352564: msdosfs: do not deget unlinked denodes When a file is unlinked, the denode is not reclaimed until the last reference is dropped, but the directory entry is immediately up for reuse. This is a problem later when createde goes to grab a denode for the newly created entry -- we search the hash and find a dead denode, then return that without even bumping the reference count and the data later gets truncated when the the last reference to the unlinked file is dropped. This manifested itself as a broken in-place strip(1) on msdosfs. The comment indicating that we want to skip these denodes has been updated to reflect where this is actually done. Modified: stable/12/sys/fs/msdosfs/msdosfs_denode.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/fs/msdosfs/msdosfs_denode.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/fs/msdosfs/msdosfs_denode.c ============================================================================== --- stable/12/sys/fs/msdosfs/msdosfs_denode.c Wed Sep 25 11:58:54 2019 (r352677) +++ stable/12/sys/fs/msdosfs/msdosfs_denode.c Wed Sep 25 12:58:49 2019 (r352678) @@ -79,7 +79,7 @@ de_vncmpf(struct vnode *vp, void *arg) a = arg; de = VTODE(vp); - return (de->de_inode != *a); + return (de->de_inode != *a) || (de->de_refcnt <= 0); } /* @@ -124,8 +124,9 @@ deget(struct msdosfsmount *pmp, u_long dirclust, u_lon * address of "." entry. For root dir (if not FAT32) use cluster * MSDOSFSROOT, offset MSDOSFSROOT_OFS * - * NOTE: The check for de_refcnt > 0 below insures the denode being - * examined does not represent an unlinked but still open file. + * NOTE: de_vncmpf will explicitly skip any denodes that do not have + * a de_refcnt > 0. This insures that that we do not attempt to use + * a denode that represents an unlinked but still open file. * These files are not to be accessible even when the directory * entry that represented the file happens to be reused while the * deleted file is still open. From owner-svn-src-stable@freebsd.org Wed Sep 25 12:58:50 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B3761264CA; Wed, 25 Sep 2019 12:58:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ddRG1p0Mz3MMZ; Wed, 25 Sep 2019 12:58:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D82F18021; Wed, 25 Sep 2019 12:58:50 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PCwnul098939; Wed, 25 Sep 2019 12:58:49 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PCwnR6098938; Wed, 25 Sep 2019 12:58:49 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201909251258.x8PCwnR6098938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 25 Sep 2019 12:58:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352678 - in stable: 11/sys/fs/msdosfs 12/sys/fs/msdosfs X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/fs/msdosfs 12/sys/fs/msdosfs X-SVN-Commit-Revision: 352678 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 12:58:50 -0000 Author: kevans Date: Wed Sep 25 12:58:49 2019 New Revision: 352678 URL: https://svnweb.freebsd.org/changeset/base/352678 Log: MFC r352564: msdosfs: do not deget unlinked denodes When a file is unlinked, the denode is not reclaimed until the last reference is dropped, but the directory entry is immediately up for reuse. This is a problem later when createde goes to grab a denode for the newly created entry -- we search the hash and find a dead denode, then return that without even bumping the reference count and the data later gets truncated when the the last reference to the unlinked file is dropped. This manifested itself as a broken in-place strip(1) on msdosfs. The comment indicating that we want to skip these denodes has been updated to reflect where this is actually done. Modified: stable/11/sys/fs/msdosfs/msdosfs_denode.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/fs/msdosfs/msdosfs_denode.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/fs/msdosfs/msdosfs_denode.c ============================================================================== --- stable/11/sys/fs/msdosfs/msdosfs_denode.c Wed Sep 25 11:58:54 2019 (r352677) +++ stable/11/sys/fs/msdosfs/msdosfs_denode.c Wed Sep 25 12:58:49 2019 (r352678) @@ -77,7 +77,7 @@ de_vncmpf(struct vnode *vp, void *arg) a = arg; de = VTODE(vp); - return (de->de_inode != *a); + return (de->de_inode != *a) || (de->de_refcnt <= 0); } /* @@ -122,8 +122,9 @@ deget(struct msdosfsmount *pmp, u_long dirclust, u_lon * address of "." entry. For root dir (if not FAT32) use cluster * MSDOSFSROOT, offset MSDOSFSROOT_OFS * - * NOTE: The check for de_refcnt > 0 below insures the denode being - * examined does not represent an unlinked but still open file. + * NOTE: de_vncmpf will explicitly skip any denodes that do not have + * a de_refcnt > 0. This insures that that we do not attempt to use + * a denode that represents an unlinked but still open file. * These files are not to be accessible even when the directory * entry that represented the file happens to be reused while the * deleted file is still open. From owner-svn-src-stable@freebsd.org Wed Sep 25 13:28:07 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCB8B127163; Wed, 25 Sep 2019 13:28:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46df534zBHz3P9S; Wed, 25 Sep 2019 13:28:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E16518581; Wed, 25 Sep 2019 13:28:07 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PDS7L1016509; Wed, 25 Sep 2019 13:28:07 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PDS764016506; Wed, 25 Sep 2019 13:28:07 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909251328.x8PDS764016506@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 25 Sep 2019 13:28:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352682 - in stable/12: lib/libc/gen sys/kern sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12: lib/libc/gen sys/kern sys/sys X-SVN-Commit-Revision: 352682 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 13:28:07 -0000 Author: kib Date: Wed Sep 25 13:28:06 2019 New Revision: 352682 URL: https://svnweb.freebsd.org/changeset/base/352682 Log: MFC r352486: sysctl: use names instead of magic numbers. Modified: stable/12/lib/libc/gen/sysctlnametomib.c stable/12/sys/kern/kern_sysctl.c stable/12/sys/sys/sysctl.h Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/gen/sysctlnametomib.c ============================================================================== --- stable/12/lib/libc/gen/sysctlnametomib.c Wed Sep 25 13:24:31 2019 (r352681) +++ stable/12/lib/libc/gen/sysctlnametomib.c Wed Sep 25 13:28:06 2019 (r352682) @@ -47,8 +47,8 @@ sysctlnametomib(const char *name, int *mibp, size_t *s int oid[2]; int error; - oid[0] = 0; - oid[1] = 3; + oid[0] = CTL_SYSCTL; + oid[1] = CTL_SYSCTL_NAME2OID; *sizep *= sizeof(int); error = sysctl(oid, 2, mibp, sizep, name, strlen(name)); Modified: stable/12/sys/kern/kern_sysctl.c ============================================================================== --- stable/12/sys/kern/kern_sysctl.c Wed Sep 25 13:24:31 2019 (r352681) +++ stable/12/sys/kern/kern_sysctl.c Wed Sep 25 13:28:06 2019 (r352682) @@ -934,13 +934,18 @@ SYSINIT(sysctl, SI_SUB_KMEM, SI_ORDER_FIRST, sysctl_re * (be aware though, that the proper interface isn't as obvious as it * may seem, there are various conflicting requirements. * - * {0,0} printf the entire MIB-tree. - * {0,1,...} return the name of the "..." OID. - * {0,2,...} return the next OID. - * {0,3} return the OID of the name in "new" - * {0,4,...} return the kind & format info for the "..." OID. - * {0,5,...} return the description of the "..." OID. - * {0,6,...} return the aggregation label of the "..." OID. + * {CTL_SYSCTL, CTL_SYSCTL_DEBUG} printf the entire MIB-tree. + * {CTL_SYSCTL, CTL_SYSCTL_NAME, ...} return the name of the "..." + * OID. + * {CTL_SYSCTL, CTL_SYSCTL_NEXT, ...} return the next OID. + * {CTL_SYSCTL, CTL_SYSCTL_NAME2OID} return the OID of the name in + * "new" + * {CTL_SYSCTL, CTL_SYSCTL_OIDFMT, ...} return the kind & format info + * for the "..." OID. + * {CTL_SYSCTL, CTL_SYSCTL_OIDDESCR, ...} return the description of the + * "..." OID. + * {CTL_SYSCTL, CTL_SYSCTL_OIDLABEL, ...} return the aggregation label of + * the "..." OID. */ #ifdef SYSCTL_DEBUG @@ -1008,8 +1013,8 @@ sysctl_sysctl_debug(SYSCTL_HANDLER_ARGS) return (ENOENT); } -SYSCTL_PROC(_sysctl, 0, debug, CTLTYPE_STRING|CTLFLAG_RD|CTLFLAG_MPSAFE, - 0, 0, sysctl_sysctl_debug, "-", ""); +SYSCTL_PROC(_sysctl, CTL_SYSCTL_DEBUG, debug, CTLTYPE_STRING | CTLFLAG_RD | + CTLFLAG_MPSAFE, 0, 0, sysctl_sysctl_debug, "-", ""); #endif static int @@ -1074,8 +1079,8 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) * XXXRW/JA: Shouldn't return name data for nodes that we don't permit in * capability mode. */ -static SYSCTL_NODE(_sysctl, 1, name, CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, - sysctl_sysctl_name, ""); +static SYSCTL_NODE(_sysctl, CTL_SYSCTL_NAME, name, CTLFLAG_RD | + CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_name, ""); static int sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int *name, u_int namelen, @@ -1161,8 +1166,8 @@ sysctl_sysctl_next(SYSCTL_HANDLER_ARGS) * XXXRW/JA: Shouldn't return next data for nodes that we don't permit in * capability mode. */ -static SYSCTL_NODE(_sysctl, 2, next, CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, - sysctl_sysctl_next, ""); +static SYSCTL_NODE(_sysctl, CTL_SYSCTL_NEXT, next, CTLFLAG_RD | + CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_next, ""); static int name2oid(char *name, int *oid, int *len, struct sysctl_oid **oidpp) @@ -1248,9 +1253,9 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_ARGS) * XXXRW/JA: Shouldn't return name2oid data for nodes that we don't permit in * capability mode. */ -SYSCTL_PROC(_sysctl, 3, name2oid, - CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY | CTLFLAG_MPSAFE - | CTLFLAG_CAPRW, 0, 0, sysctl_sysctl_name2oid, "I", ""); +SYSCTL_PROC(_sysctl, CTL_SYSCTL_NAME2OID, name2oid, CTLTYPE_INT | CTLFLAG_RW | + CTLFLAG_ANYBODY | CTLFLAG_MPSAFE | CTLFLAG_CAPRW, 0, 0, + sysctl_sysctl_name2oid, "I", ""); static int sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS) @@ -1278,8 +1283,8 @@ sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS) } -static SYSCTL_NODE(_sysctl, 4, oidfmt, CTLFLAG_RD|CTLFLAG_MPSAFE|CTLFLAG_CAPRD, - sysctl_sysctl_oidfmt, ""); +static SYSCTL_NODE(_sysctl, CTL_SYSCTL_OIDFMT, oidfmt, CTLFLAG_RD | + CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_oidfmt, ""); static int sysctl_sysctl_oiddescr(SYSCTL_HANDLER_ARGS) @@ -1303,8 +1308,8 @@ sysctl_sysctl_oiddescr(SYSCTL_HANDLER_ARGS) return (error); } -static SYSCTL_NODE(_sysctl, 5, oiddescr, CTLFLAG_RD|CTLFLAG_MPSAFE|CTLFLAG_CAPRD, - sysctl_sysctl_oiddescr, ""); +static SYSCTL_NODE(_sysctl, CTL_SYSCTL_OIDDESCR, oiddescr, CTLFLAG_RD | + CTLFLAG_MPSAFE|CTLFLAG_CAPRD, sysctl_sysctl_oiddescr, ""); static int sysctl_sysctl_oidlabel(SYSCTL_HANDLER_ARGS) @@ -1328,8 +1333,8 @@ sysctl_sysctl_oidlabel(SYSCTL_HANDLER_ARGS) return (error); } -static SYSCTL_NODE(_sysctl, 6, oidlabel, - CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_oidlabel, ""); +static SYSCTL_NODE(_sysctl, CTL_SYSCTL_OIDLABEL, oidlabel, CTLFLAG_RD | + CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_oidlabel, ""); /* * Default "handler" functions. @@ -1809,8 +1814,8 @@ kernel_sysctlbyname(struct thread *td, char *name, voi size_t oidlen, plen; int error; - oid[0] = 0; /* sysctl internal magic */ - oid[1] = 3; /* name2oid */ + oid[0] = CTL_SYSCTL; + oid[1] = CTL_SYSCTL_NAME2OID; oidlen = sizeof(oid); error = kernel_sysctl(td, oid, 2, oid, &oidlen, Modified: stable/12/sys/sys/sysctl.h ============================================================================== --- stable/12/sys/sys/sysctl.h Wed Sep 25 13:24:31 2019 (r352681) +++ stable/12/sys/sys/sysctl.h Wed Sep 25 13:28:06 2019 (r352682) @@ -851,7 +851,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); /* * Top-level identifiers */ -#define CTL_UNSPEC 0 /* unused */ +#define CTL_SYSCTL 0 /* "magic" numbers */ #define CTL_KERN 1 /* "high kernel": proc, limits */ #define CTL_VM 2 /* virtual memory */ #define CTL_VFS 3 /* filesystem, mount type is next */ @@ -861,6 +861,17 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); #define CTL_MACHDEP 7 /* machine dependent */ #define CTL_USER 8 /* user-level */ #define CTL_P1003_1B 9 /* POSIX 1003.1B */ + +/* + * CTL_SYSCTL identifiers + */ +#define CTL_SYSCTL_DEBUG 0 /* printf all nodes */ +#define CTL_SYSCTL_NAME 1 /* string name of OID */ +#define CTL_SYSCTL_NEXT 2 /* next OID */ +#define CTL_SYSCTL_NAME2OID 3 /* int array of name */ +#define CTL_SYSCTL_OIDFMT 4 /* OID's kind and format */ +#define CTL_SYSCTL_OIDDESCR 5 /* OID's description */ +#define CTL_SYSCTL_OIDLABEL 6 /* aggregation label */ /* * CTL_KERN identifiers From owner-svn-src-stable@freebsd.org Wed Sep 25 13:29:57 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 09A70127296; Wed, 25 Sep 2019 13:29:57 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46df786Vlvz3PMj; Wed, 25 Sep 2019 13:29:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C26FC18589; Wed, 25 Sep 2019 13:29:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PDTuED016635; Wed, 25 Sep 2019 13:29:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PDTu6h016634; Wed, 25 Sep 2019 13:29:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909251329.x8PDTu6h016634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 25 Sep 2019 13:29:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352683 - stable/12/usr.bin/truss X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/usr.bin/truss X-SVN-Commit-Revision: 352683 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 13:29:57 -0000 Author: kib Date: Wed Sep 25 13:29:56 2019 New Revision: 352683 URL: https://svnweb.freebsd.org/changeset/base/352683 Log: MFC r352488: truss: decode sysctl names. Modified: stable/12/usr.bin/truss/syscall.h stable/12/usr.bin/truss/syscalls.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/truss/syscall.h ============================================================================== --- stable/12/usr.bin/truss/syscall.h Wed Sep 25 13:28:06 2019 (r352682) +++ stable/12/usr.bin/truss/syscall.h Wed Sep 25 13:29:56 2019 (r352683) @@ -131,6 +131,7 @@ enum Argtype { Sockprotocol, Socktype, Sysarch, + Sysctl, Umtxop, Waitoptions, Whence, Modified: stable/12/usr.bin/truss/syscalls.c ============================================================================== --- stable/12/usr.bin/truss/syscalls.c Wed Sep 25 13:28:06 2019 (r352682) +++ stable/12/usr.bin/truss/syscalls.c Wed Sep 25 13:29:56 2019 (r352683) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #define _WANT_FREEBSD11_STAT #include +#include #include #include #include @@ -499,6 +500,12 @@ static struct syscall decoded_syscalls[] = { .args = { { Name, 0 }, { Atfd, 1 }, { Name, 2 } } }, { .name = "sysarch", .ret_type = 1, .nargs = 2, .args = { { Sysarch, 0 }, { Ptr, 1 } } }, + { .name = "__sysctl", .ret_type = 1, .nargs = 6, + .args = { { Sysctl, 0 }, { Sizet, 1 }, { Ptr, 2 }, { Ptr, 3 }, + { Ptr, 4 }, { Sizet, 5 } } }, + { .name = "__sysctlbyname", .ret_type = 1, .nargs = 6, + .args = { { Name, 0 }, { Sizet, 1 }, { Ptr, 2 }, { Ptr, 3 }, + { Ptr, 4}, { Sizet, 5 } } }, { .name = "thr_kill", .ret_type = 1, .nargs = 2, .args = { { Long, 0 }, { Signal, 1 } } }, { .name = "thr_self", .ret_type = 1, .nargs = 1, @@ -1544,6 +1551,15 @@ print_cmsgs(FILE *fp, pid_t pid, bool receive, struct free(cmsgbuf); } +static void +print_sysctl_oid(FILE *fp, int *oid, int len) +{ + int i; + + for (i = 0; i < len; i++) + fprintf(fp, ".%d", oid[i]); +} + /* * Converts a syscall argument into a string. Said string is * allocated via malloc(), so needs to be free()'d. sc is @@ -2253,6 +2269,62 @@ print_arg(struct syscall_args *sc, unsigned long *args print_integer_arg(sysdecode_sysarch_number, fp, args[sc->offset]); break; + case Sysctl: { + char name[BUFSIZ]; + int oid[CTL_MAXNAME + 2], qoid[CTL_MAXNAME + 2]; + size_t i; + int len; + + memset(name, 0, sizeof(name)); + len = args[sc->offset + 1]; + if (get_struct(pid, (void *)args[sc->offset], oid, + len * sizeof(oid[0])) != -1) { + fprintf(fp, "\""); + if (oid[0] == CTL_SYSCTL) { + fprintf(fp, "sysctl."); + switch (oid[1]) { + case CTL_SYSCTL_DEBUG: + fprintf(fp, "debug"); + break; + case CTL_SYSCTL_NAME: + fprintf(fp, "name"); + print_sysctl_oid(fp, oid + 2, len - 2); + break; + case CTL_SYSCTL_NEXT: + fprintf(fp, "next"); + break; + case CTL_SYSCTL_NAME2OID: + fprintf(fp, "name2oid"); + break; + case CTL_SYSCTL_OIDFMT: + fprintf(fp, "oidfmt"); + print_sysctl_oid(fp, oid + 2, len - 2); + break; + case CTL_SYSCTL_OIDDESCR: + fprintf(fp, "oiddescr"); + print_sysctl_oid(fp, oid + 2, len - 2); + break; + case CTL_SYSCTL_OIDLABEL: + fprintf(fp, "oidlabel"); + print_sysctl_oid(fp, oid + 2, len - 2); + break; + default: + print_sysctl_oid(fp, oid + 1, len - 1); + } + } else { + qoid[0] = CTL_SYSCTL; + qoid[1] = CTL_SYSCTL_NAME; + memcpy(qoid + 2, oid, len * sizeof(int)); + i = sizeof(name); + if (sysctl(qoid, len + 2, name, &i, 0, 0) == -1) + print_sysctl_oid(fp, qoid + 2, len); + else + fprintf(fp, "%s", name); + } + fprintf(fp, "\""); + } + break; + } case PipeFds: /* * The pipe() system call in the kernel returns its From owner-svn-src-stable@freebsd.org Wed Sep 25 14:33:10 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1034F128EF5; Wed, 25 Sep 2019 14:33:10 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dgX56j0Cz3yb4; Wed, 25 Sep 2019 14:33:09 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9964191D5; Wed, 25 Sep 2019 14:33:09 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PEX96e057617; Wed, 25 Sep 2019 14:33:09 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PEX9D4057615; Wed, 25 Sep 2019 14:33:09 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201909251433.x8PEX9D4057615@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 25 Sep 2019 14:33:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352685 - stable/12/lib/msun/src X-SVN-Group: stable-12 X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: stable/12/lib/msun/src X-SVN-Commit-Revision: 352685 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 14:33:10 -0000 Author: jhibbits Date: Wed Sep 25 14:33:08 2019 New Revision: 352685 URL: https://svnweb.freebsd.org/changeset/base/352685 Log: MFC r342563: libm: Include float.h to get LDBL_MANT_DIG The long double aliases of double functions are only exposed as aliases if LDBL_MANT_DIG is 53 (same as DBL_MANT_DIG). Without float.h included these files were not exposing weak aliases as expected, leading to link failures if programs use the *l functions. This should fix editors/calligra on targets with 64-bit long double, which uses erfl and erfcl. Found on powerpc64. Modified: stable/12/lib/msun/src/s_cbrt.c stable/12/lib/msun/src/s_cproj.c stable/12/lib/msun/src/s_erf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/msun/src/s_cbrt.c ============================================================================== --- stable/12/lib/msun/src/s_cbrt.c Wed Sep 25 13:36:56 2019 (r352684) +++ stable/12/lib/msun/src/s_cbrt.c Wed Sep 25 14:33:08 2019 (r352685) @@ -15,6 +15,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include "math.h" #include "math_private.h" Modified: stable/12/lib/msun/src/s_cproj.c ============================================================================== --- stable/12/lib/msun/src/s_cproj.c Wed Sep 25 13:36:56 2019 (r352684) +++ stable/12/lib/msun/src/s_cproj.c Wed Sep 25 14:33:08 2019 (r352685) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include "math_private.h" Modified: stable/12/lib/msun/src/s_erf.c ============================================================================== --- stable/12/lib/msun/src/s_erf.c Wed Sep 25 13:36:56 2019 (r352684) +++ stable/12/lib/msun/src/s_erf.c Wed Sep 25 14:33:08 2019 (r352685) @@ -107,7 +107,7 @@ __FBSDID("$FreeBSD$"); * erfc/erf(NaN) is NaN */ - +#include #include "math.h" #include "math_private.h" From owner-svn-src-stable@freebsd.org Wed Sep 25 15:50:37 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B813812B109; Wed, 25 Sep 2019 15:50:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46djFT3Lmgz44V1; Wed, 25 Sep 2019 15:50:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 576C519E7F; Wed, 25 Sep 2019 15:50:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PFobZk000285; Wed, 25 Sep 2019 15:50:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PFobFB000270; Wed, 25 Sep 2019 15:50:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909251550.x8PFobFB000270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 25 Sep 2019 15:50:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352686 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 352686 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 15:50:37 -0000 Author: mav Date: Wed Sep 25 15:50:36 2019 New Revision: 352686 URL: https://svnweb.freebsd.org/changeset/base/352686 Log: MFC r352493: Fix typo, setting hidden flag instead of reparse. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Sep 25 14:33:08 2019 (r352685) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Sep 25 15:50:36 2019 (r352686) @@ -5249,7 +5249,7 @@ zfs_freebsd_setattr(ap) FLAG_CHANGE(UF_HIDDEN, ZFS_HIDDEN, XAT_HIDDEN, xvap.xva_xoptattrs.xoa_hidden); FLAG_CHANGE(UF_REPARSE, ZFS_REPARSE, XAT_REPARSE, - xvap.xva_xoptattrs.xoa_hidden); + xvap.xva_xoptattrs.xoa_reparse); FLAG_CHANGE(UF_OFFLINE, ZFS_OFFLINE, XAT_OFFLINE, xvap.xva_xoptattrs.xoa_offline); FLAG_CHANGE(UF_SPARSE, ZFS_SPARSE, XAT_SPARSE, From owner-svn-src-stable@freebsd.org Wed Sep 25 15:51:08 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8126312B295; Wed, 25 Sep 2019 15:51:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46djG42vwzz44dN; Wed, 25 Sep 2019 15:51:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4804419EA7; Wed, 25 Sep 2019 15:51:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PFp81j003671; Wed, 25 Sep 2019 15:51:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PFp8jk003670; Wed, 25 Sep 2019 15:51:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909251551.x8PFp8jk003670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 25 Sep 2019 15:51:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352687 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 352687 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 15:51:08 -0000 Author: mav Date: Wed Sep 25 15:51:07 2019 New Revision: 352687 URL: https://svnweb.freebsd.org/changeset/base/352687 Log: MFC r352493: Fix typo, setting hidden flag instead of reparse. Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Sep 25 15:50:36 2019 (r352686) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Wed Sep 25 15:51:07 2019 (r352687) @@ -5253,7 +5253,7 @@ zfs_freebsd_setattr(ap) FLAG_CHANGE(UF_HIDDEN, ZFS_HIDDEN, XAT_HIDDEN, xvap.xva_xoptattrs.xoa_hidden); FLAG_CHANGE(UF_REPARSE, ZFS_REPARSE, XAT_REPARSE, - xvap.xva_xoptattrs.xoa_hidden); + xvap.xva_xoptattrs.xoa_reparse); FLAG_CHANGE(UF_OFFLINE, ZFS_OFFLINE, XAT_OFFLINE, xvap.xva_xoptattrs.xoa_offline); FLAG_CHANGE(UF_SPARSE, ZFS_SPARSE, XAT_SPARSE, From owner-svn-src-stable@freebsd.org Wed Sep 25 19:46:18 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7927130930; Wed, 25 Sep 2019 19:46:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dpTQ56kqz4NF6; Wed, 25 Sep 2019 19:46:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E7651CA9D; Wed, 25 Sep 2019 19:46:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PJkIUx043029; Wed, 25 Sep 2019 19:46:18 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PJkICo043027; Wed, 25 Sep 2019 19:46:18 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909251946.x8PJkICo043027@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 25 Sep 2019 19:46:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352714 - stable/12/sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/cam/scsi X-SVN-Commit-Revision: 352714 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 19:46:18 -0000 Author: avg Date: Wed Sep 25 19:46:17 2019 New Revision: 352714 URL: https://svnweb.freebsd.org/changeset/base/352714 Log: MFC r351599,r351600: scsi_cd: make the media check asynchronous PR: 219857 Modified: stable/12/sys/cam/scsi/scsi_cd.c stable/12/sys/cam/scsi/scsi_cd.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_cd.c Wed Sep 25 19:29:09 2019 (r352713) +++ stable/12/sys/cam/scsi/scsi_cd.c Wed Sep 25 19:46:17 2019 (r352714) @@ -114,13 +114,21 @@ typedef enum { CD_FLAG_RETRY_UA = 0x0200, CD_FLAG_VALID_MEDIA = 0x0400, CD_FLAG_VALID_TOC = 0x0800, - CD_FLAG_SCTX_INIT = 0x1000 + CD_FLAG_SCTX_INIT = 0x1000, + CD_FLAG_MEDIA_WAIT = 0x2000, + CD_FLAG_MEDIA_SCAN_ACT = 0x4000 } cd_flags; typedef enum { CD_CCB_PROBE = 0x01, CD_CCB_BUFFER_IO = 0x02, - CD_CCB_TUR = 0x04, + CD_CCB_TUR = 0x03, + CD_CCB_MEDIA_PREVENT = 0x04, + CD_CCB_MEDIA_ALLOW = 0x05, + CD_CCB_MEDIA_SIZE = 0x06, + CD_CCB_MEDIA_TOC_HDR = 0x07, + CD_CCB_MEDIA_TOC_FULL = 0x08, + CD_CCB_MEDIA_TOC_LEAD = 0x09, CD_CCB_TYPE_MASK = 0x0F, CD_CCB_RETRY_UA = 0x10 } cd_ccb_state; @@ -140,7 +148,13 @@ struct cd_toc_single { typedef enum { CD_STATE_PROBE, - CD_STATE_NORMAL + CD_STATE_NORMAL, + CD_STATE_MEDIA_PREVENT, + CD_STATE_MEDIA_ALLOW, + CD_STATE_MEDIA_SIZE, + CD_STATE_MEDIA_TOC_HDR, + CD_STATE_MEDIA_TOC_FULL, + CD_STATE_MEDIA_TOC_LEAD } cd_state; struct cd_softc { @@ -161,6 +175,8 @@ struct cd_softc { struct sysctl_oid *sysctl_tree; STAILQ_HEAD(, cd_mode_params) mode_queue; struct cd_tocdata toc; + int toc_read_len; + struct cd_toc_single leadout; struct disk *disk; struct callout mediapoll_c; @@ -246,8 +262,11 @@ static void cddone(struct cam_periph *periph, static union cd_pages *cdgetpage(struct cd_mode_params *mode_params); static int cdgetpagesize(int page_num); static void cdprevent(struct cam_periph *periph, int action); -static int cdcheckmedia(struct cam_periph *periph); +static void cdmediaprobedone(struct cam_periph *periph); +static int cdcheckmedia(struct cam_periph *periph, int do_wait); +#if 0 static int cdsize(struct cam_periph *periph, u_int32_t *size); +#endif static int cd6byteworkaround(union ccb *ccb); static int cderror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags); @@ -755,7 +774,7 @@ cdopen(struct disk *dp) * if we don't have media, but then we don't allow anything but the * CDIOCEJECT/CDIOCCLOSE ioctls if there is no media. */ - cdcheckmedia(periph); + cdcheckmedia(periph, /*do_wait*/ 1); CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("leaving cdopen\n")); cam_periph_unhold(periph); @@ -851,27 +870,19 @@ cdstrategy(struct bio *bp) return; } - /* - * If we don't have valid media, look for it before trying to - * schedule the I/O. - */ - if ((softc->flags & CD_FLAG_VALID_MEDIA) == 0) { - int error; - - error = cdcheckmedia(periph); - if (error != 0) { - cam_periph_unlock(periph); - biofinish(bp, NULL, error); - return; - } - } - /* * Place it in the queue of disk activities for this disk */ bioq_disksort(&softc->bio_queue, bp); - xpt_schedule(periph, CAM_PRIORITY_NORMAL); + /* + * If we don't know that we have valid media, schedule the media + * check first. The I/O will get executed after the media check. + */ + if ((softc->flags & CD_FLAG_VALID_MEDIA) == 0) + cdcheckmedia(periph, /*do_wait*/ 0); + else + xpt_schedule(periph, CAM_PRIORITY_NORMAL); cam_periph_unlock(periph); return; @@ -883,7 +894,6 @@ cdstart(struct cam_periph *periph, union ccb *start_cc struct cd_softc *softc; struct bio *bp; struct ccb_scsiio *csio; - struct scsi_read_capacity_data *rcap; softc = (struct cd_softc *)periph->softc; @@ -964,16 +974,40 @@ cdstart(struct cam_periph *periph, union ccb *start_cc break; } case CD_STATE_PROBE: + case CD_STATE_MEDIA_SIZE: { + struct scsi_read_capacity_data *rcap; rcap = (struct scsi_read_capacity_data *)malloc(sizeof(*rcap), M_SCSICD, M_NOWAIT | M_ZERO); if (rcap == NULL) { xpt_print(periph->path, - "cdstart: Couldn't malloc read_capacity data\n"); - /* cd_free_periph??? */ + "%s: Couldn't malloc read_capacity data\n", + __func__); + xpt_release_ccb(start_ccb); + /* + * We can't probe because we can't allocate memory, + * so invalidate the peripheral. The system probably + * has larger problems at this stage. If we've + * already probed (and are re-probing capacity), we + * don't need to invalidate. + * + * XXX KDM need to reset probe state and kick out + * pending I/O. + */ + if (softc->state == CD_STATE_PROBE) + cam_periph_invalidate(periph); break; } + + /* + * Set the default capacity and sector size to something that + * GEOM can handle. This will get reset when a read capacity + * completes successfully. + */ + softc->disk->d_sectorsize = 2048; + softc->disk->d_mediasize = 0; + csio = &start_ccb->csio; scsi_read_capacity(csio, /*retries*/ cd_retry_count, @@ -983,11 +1017,112 @@ cdstart(struct cam_periph *periph, union ccb *start_cc SSD_FULL_SIZE, /*timeout*/20000); start_ccb->ccb_h.ccb_bp = NULL; - start_ccb->ccb_h.ccb_state = CD_CCB_PROBE; + if (softc->state == CD_STATE_PROBE) + start_ccb->ccb_h.ccb_state = CD_CCB_PROBE; + else + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_SIZE; xpt_action(start_ccb); break; } + case CD_STATE_MEDIA_ALLOW: + case CD_STATE_MEDIA_PREVENT: + { + /* + * If the CD is already locked, we don't need to do this. + * Move on to the capacity check. + */ + if ((softc->flags & CD_FLAG_DISC_LOCKED) != 0) { + softc->state = CD_STATE_MEDIA_SIZE; + xpt_release_ccb(start_ccb); + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + break; + } + + scsi_prevent(&start_ccb->csio, + /*retries*/ cd_retry_count, + /*cbfcnp*/ cddone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*action*/ (softc->state == CD_STATE_MEDIA_ALLOW) ? + PR_ALLOW : PR_PREVENT, + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 60000); + + start_ccb->ccb_h.ccb_bp = NULL; + if (softc->state == CD_STATE_MEDIA_ALLOW) + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_ALLOW; + else + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_PREVENT; + xpt_action(start_ccb); + break; } + case CD_STATE_MEDIA_TOC_HDR: { + struct ioc_toc_header *toch; + + bzero(&softc->toc, sizeof(softc->toc)); + + toch = &softc->toc.header; + + scsi_read_toc(&start_ccb->csio, + /*retries*/ cd_retry_count, + /*cbfcnp*/ cddone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*byte1_flags*/ 0, + /*format*/ SRTOC_FORMAT_TOC, + /*track*/ 0, + /*data_ptr*/ (uint8_t *)toch, + /*dxfer_len*/ sizeof(*toch), + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 50000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_TOC_HDR; + xpt_action(start_ccb); + break; + } + case CD_STATE_MEDIA_TOC_FULL: { + + bzero(&softc->toc, sizeof(softc->toc)); + + scsi_read_toc(&start_ccb->csio, + /*retries*/ cd_retry_count, + /*cbfcnp*/ cddone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*byte1_flags*/ 0, + /*format*/ SRTOC_FORMAT_TOC, + /*track*/ 0, + /*data_ptr*/ (uint8_t *)&softc->toc, + /*dxfer_len*/ softc->toc_read_len ? + softc->toc_read_len : + sizeof(softc->toc), + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 50000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_TOC_FULL; + xpt_action(start_ccb); + break; + } + case CD_STATE_MEDIA_TOC_LEAD: { + struct cd_toc_single *leadout; + + leadout = &softc->leadout; + bzero(leadout, sizeof(*leadout)); + + scsi_read_toc(&start_ccb->csio, + /*retries*/ cd_retry_count, + /*cbfcnp*/ cddone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*byte1_flags*/ CD_MSF, + /*format*/ SRTOC_FORMAT_TOC, + /*track*/ LEADOUT, + /*data_ptr*/ (uint8_t *)leadout, + /*dxfer_len*/ sizeof(*leadout), + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 50000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_TOC_LEAD; + xpt_action(start_ccb); + break; + } + } } static void @@ -1251,6 +1386,293 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) cam_periph_release_locked(periph); return; } + case CD_CCB_MEDIA_ALLOW: + case CD_CCB_MEDIA_PREVENT: + { + int error; + int is_prevent; + + error = 0; + + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + error = cderror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA | SF_NO_PRINT); + } + if (error == ERESTART) + return; + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + + /* + * Note that just like the original cdcheckmedia(), we do + * a prevent without failing the whole operation if the + * prevent fails. We try, but keep going if it doesn't + * work. + */ + + if ((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == + CD_CCB_MEDIA_PREVENT) + is_prevent = 1; + else + is_prevent = 0; + + xpt_release_ccb(done_ccb); + + if (is_prevent != 0) { + if (error == 0) + softc->flags |= CD_FLAG_DISC_LOCKED; + else + softc->flags &= ~CD_FLAG_DISC_LOCKED; + softc->state = CD_STATE_MEDIA_SIZE; + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + } else { + if (error == 0) + softc->flags &= ~CD_FLAG_DISC_LOCKED; + softc->state = CD_STATE_NORMAL; + if (bioq_first(&softc->bio_queue) != NULL) + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + } + return; + } + case CD_CCB_MEDIA_SIZE: + { + struct scsi_read_capacity_data *rdcap; + int error; + + error = 0; + if ((csio->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + error = cderror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA | SF_NO_PRINT); + } + if (error == ERESTART) + return; + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + rdcap = (struct scsi_read_capacity_data *)csio->data_ptr; + + if (error == 0) { + softc->params.disksize =scsi_4btoul(rdcap->addr) + 1; + softc->params.blksize = scsi_4btoul(rdcap->length); + + /* Make sure we got at least some block size. */ + if (softc->params.blksize == 0) + error = EIO; + /* + * SCSI-3 mandates that the reported blocksize shall be + * 2048. Older drives sometimes report funny values, + * trim it down to 2048, or other parts of the kernel + * will get confused. + * + * XXX we leave drives alone that might report 512 + * bytes, as well as drives reporting more weird + * sizes like perhaps 4K. + */ + if (softc->params.blksize > 2048 + && softc->params.blksize <= 2352) + softc->params.blksize = 2048; + } + free(rdcap, M_SCSICD); + + if (error == 0) { + softc->disk->d_sectorsize = softc->params.blksize; + softc->disk->d_mediasize = + (off_t)softc->params.blksize * + softc->params.disksize; + softc->flags |= CD_FLAG_SAW_MEDIA | CD_FLAG_VALID_MEDIA; + softc->state = CD_STATE_MEDIA_TOC_HDR; + } else { + softc->flags &= ~(CD_FLAG_VALID_MEDIA | + CD_FLAG_VALID_TOC); + bioq_flush(&softc->bio_queue, NULL, EINVAL); + softc->state = CD_STATE_MEDIA_ALLOW; + cdmediaprobedone(periph); + } + xpt_release_ccb(done_ccb); + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + return; + } + case CD_CCB_MEDIA_TOC_HDR: + case CD_CCB_MEDIA_TOC_FULL: + case CD_CCB_MEDIA_TOC_LEAD: + { + int error; + struct ioc_toc_header *toch; + int num_entries; + int cdindex; + + error = 0; + + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + error = cderror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA | SF_NO_PRINT); + } + if (error == ERESTART) + return; + + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + + /* + * We will get errors here for media that doesn't have a table + * of contents. According to the MMC-3 spec: "When a Read + * TOC/PMA/ATIP command is presented for a DDCD/CD-R/RW media, + * where the first TOC has not been recorded (no complete + * session) and the Format codes 0000b, 0001b, or 0010b are + * specified, this command shall be rejected with an INVALID + * FIELD IN CDB. Devices that are not capable of reading an + * incomplete session on DDC/CD-R/RW media shall report + * CANNOT READ MEDIUM - INCOMPATIBLE FORMAT." + * + * So this isn't fatal if we can't read the table of contents, + * it just means that the user won't be able to issue the + * play tracks ioctl, and likely lots of other stuff won't + * work either. They need to burn the CD before we can do + * a whole lot with it. So we don't print anything here if + * we get an error back. + * + * We also bail out if the drive doesn't at least give us + * the full TOC header. + */ + if ((error != 0) + || ((csio->dxfer_len - csio->resid) < + sizeof(struct ioc_toc_header))) { + softc->flags &= ~CD_FLAG_VALID_TOC; + bzero(&softc->toc, sizeof(softc->toc)); + /* + * Failing the TOC read is not an error. + */ + softc->state = CD_STATE_NORMAL; + xpt_release_ccb(done_ccb); + + cdmediaprobedone(periph); + + /* + * Go ahead and schedule I/O execution if there is + * anything in the queue. It'll probably get + * kicked out with an error. + */ + if (bioq_first(&softc->bio_queue) != NULL) + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + return; + } + + /* + * Note that this is NOT the storage location used for the + * leadout! + */ + toch = &softc->toc.header; + + if (softc->quirks & CD_Q_BCD_TRACKS) { + toch->starting_track = bcd2bin(toch->starting_track); + toch->ending_track = bcd2bin(toch->ending_track); + } + + /* Number of TOC entries, plus leadout */ + num_entries = (toch->ending_track - toch->starting_track) + 2; + cdindex = toch->starting_track + num_entries -1; + + if ((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == + CD_CCB_MEDIA_TOC_HDR) { + if (num_entries <= 0) { + softc->flags &= ~CD_FLAG_VALID_TOC; + bzero(&softc->toc, sizeof(softc->toc)); + /* + * Failing the TOC read is not an error. + */ + softc->state = CD_STATE_NORMAL; + xpt_release_ccb(done_ccb); + + cdmediaprobedone(periph); + + /* + * Go ahead and schedule I/O execution if + * there is anything in the queue. It'll + * probably get kicked out with an error. + */ + if (bioq_first(&softc->bio_queue) != NULL) + xpt_schedule(periph, + CAM_PRIORITY_NORMAL); + } else { + softc->toc_read_len = num_entries * + sizeof(struct cd_toc_entry); + softc->toc_read_len += sizeof(*toch); + + softc->state = CD_STATE_MEDIA_TOC_FULL; + xpt_release_ccb(done_ccb); + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + } + + return; + } else if ((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == + CD_CCB_MEDIA_TOC_LEAD) { + struct cd_toc_single *leadout; + + leadout = (struct cd_toc_single *)csio->data_ptr; + softc->toc.entries[cdindex - toch->starting_track] = + leadout->entry; + } else if (((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == + CD_CCB_MEDIA_TOC_FULL) + && (cdindex == toch->ending_track + 1)) { + /* + * XXX KDM is this necessary? Probably only if the + * drive doesn't return leadout information with the + * table of contents. + */ + softc->state = CD_STATE_MEDIA_TOC_LEAD; + xpt_release_ccb(done_ccb); + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + return; + } + + if (softc->quirks & CD_Q_BCD_TRACKS) { + for (cdindex = 0; cdindex < num_entries - 1; cdindex++){ + softc->toc.entries[cdindex].track = + bcd2bin(softc->toc.entries[cdindex].track); + } + } + + softc->flags |= CD_FLAG_VALID_TOC; + /* If the first track is audio, correct sector size. */ + if ((softc->toc.entries[0].control & 4) == 0) { + softc->disk->d_sectorsize =softc->params.blksize = 2352; + softc->disk->d_mediasize = + (off_t)softc->params.blksize * + softc->params.disksize; + } + softc->state = CD_STATE_NORMAL; + + /* + * We unconditionally (re)set the blocksize each time the + * CD device is opened. This is because the CD can change, + * and therefore the blocksize might change. + * XXX problems here if some slice or partition is still + * open with the old size? + */ + if ((softc->disk->d_devstat->flags & DEVSTAT_BS_UNAVAILABLE)!=0) + softc->disk->d_devstat->flags &= + ~DEVSTAT_BS_UNAVAILABLE; + softc->disk->d_devstat->block_size = softc->params.blksize; + + xpt_release_ccb(done_ccb); + + cdmediaprobedone(periph); + + if (bioq_first(&softc->bio_queue) != NULL) + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + return; + } default: break; } @@ -1343,7 +1765,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f && ((cmd != CDIOCCLOSE) && (cmd != CDIOCEJECT)) && (IOCGROUP(cmd) == 'c')) { - error = cdcheckmedia(periph); + error = cdcheckmedia(periph, /*do_wait*/ 1); if (error != 0) { cam_periph_unhold(periph); cam_periph_unlock(periph); @@ -2227,11 +2649,66 @@ cdprevent(struct cam_periph *periph, int action) } } +static void +cdmediaprobedone(struct cam_periph *periph) +{ + struct cd_softc *softc; + + softc = (struct cd_softc *)periph->softc; + + softc->flags &= ~CD_FLAG_MEDIA_SCAN_ACT; + + if ((softc->flags & CD_FLAG_MEDIA_WAIT) != 0) { + softc->flags &= ~CD_FLAG_MEDIA_WAIT; + wakeup(&softc->toc); + } +} + /* * XXX: the disk media and sector size is only really able to change * XXX: while the device is closed. */ + static int +cdcheckmedia(struct cam_periph *periph, int do_wait) +{ + struct cd_softc *softc; + int error; + + softc = (struct cd_softc *)periph->softc; + error = 0; + + if ((do_wait != 0) + && ((softc->flags & CD_FLAG_MEDIA_WAIT) == 0)) { + softc->flags |= CD_FLAG_MEDIA_WAIT; + } + if ((softc->flags & CD_FLAG_MEDIA_SCAN_ACT) == 0) { + softc->state = CD_STATE_MEDIA_PREVENT; + softc->flags |= CD_FLAG_MEDIA_SCAN_ACT; + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + } + + if (do_wait == 0) + goto bailout; + + error = msleep(&softc->toc, cam_periph_mtx(periph), PRIBIO,"cdmedia",0); + + if (error != 0) + goto bailout; + + /* + * Check to see whether we have a valid size from the media. We + * may or may not have a valid TOC. + */ + if ((softc->flags & CD_FLAG_VALID_MEDIA) == 0) + error = EINVAL; +bailout: + + return (error); +} + +#if 0 +static int cdcheckmedia(struct cam_periph *periph) { struct cd_softc *softc; @@ -2427,6 +2904,7 @@ cdsize(struct cam_periph *periph, u_int32_t *size) return (error); } +#endif static int cd6byteworkaround(union ccb *ccb) @@ -2650,7 +3128,6 @@ static int cdreadtoc(struct cam_periph *periph, u_int32_t mode, u_int32_t start, u_int8_t *data, u_int32_t len, u_int32_t sense_flags) { - struct scsi_read_toc *scsi_cmd; u_int32_t ntoc; struct ccb_scsiio *csio; union ccb *ccb; @@ -2663,29 +3140,18 @@ cdreadtoc(struct cam_periph *periph, u_int32_t mode, u csio = &ccb->csio; - cam_fill_csio(csio, + scsi_read_toc(csio, /* retries */ cd_retry_count, /* cbfcnp */ NULL, - /* flags */ CAM_DIR_IN, /* tag_action */ MSG_SIMPLE_Q_TAG, + /* byte1_flags */ (mode == CD_MSF_FORMAT) ? CD_MSF : 0, + /* format */ SRTOC_FORMAT_TOC, + /* track*/ start, /* data_ptr */ data, /* dxfer_len */ len, /* sense_len */ SSD_FULL_SIZE, - sizeof(struct scsi_read_toc), - /* timeout */ 50000); + /* timeout */ 50000); - scsi_cmd = (struct scsi_read_toc *)&csio->cdb_io.cdb_bytes; - bzero (scsi_cmd, sizeof(*scsi_cmd)); - - if (mode == CD_MSF_FORMAT) - scsi_cmd->byte2 |= CD_MSF; - scsi_cmd->from_track = start; - /* scsi_ulto2b(ntoc, (u_int8_t *)scsi_cmd->data_len); */ - scsi_cmd->data_len[0] = (ntoc) >> 8; - scsi_cmd->data_len[1] = (ntoc) & 0xff; - - scsi_cmd->op_code = READ_TOC; - error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO, /*sense_flags*/SF_RETRY_UA | sense_flags); @@ -3742,4 +4208,39 @@ scsi_read_dvd_structure(struct ccb_scsiio *csio, u_int sense_len, sizeof(*scsi_cmd), timeout); +} + +void +scsi_read_toc(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t byte1_flags, uint8_t format, + uint8_t track, uint8_t *data_ptr, uint32_t dxfer_len, + int sense_len, int timeout) +{ + struct scsi_read_toc *scsi_cmd; + + scsi_cmd = (struct scsi_read_toc *)&csio->cdb_io.cdb_bytes; + bzero(scsi_cmd, sizeof(*scsi_cmd)); + scsi_cmd->op_code = READ_TOC; + + /* + * The structure is counting from 1, the function counting from 0. + * The spec counts from 0. In MMC-6, there is only one flag, the + * MSF flag. But we put the whole byte in for a bit a future-proofing. + */ + scsi_cmd->byte2 = byte1_flags; + scsi_cmd->format = format; + scsi_cmd->from_track = track; + scsi_ulto2b(dxfer_len, scsi_cmd->data_len); + + cam_fill_csio(csio, + /* retries */ retries, + /* cbfcnp */ cbfcnp, + /* flags */ CAM_DIR_IN, + /* tag_action */ tag_action, + /* data_ptr */ data_ptr, + /* dxfer_len */ dxfer_len, + /* sense_len */ sense_len, + sizeof(*scsi_cmd), + /* timeout */ timeout); } Modified: stable/12/sys/cam/scsi/scsi_cd.h ============================================================================== --- stable/12/sys/cam/scsi/scsi_cd.h Wed Sep 25 19:29:09 2019 (r352713) +++ stable/12/sys/cam/scsi/scsi_cd.h Wed Sep 25 19:46:17 2019 (r352714) @@ -231,6 +231,12 @@ struct scsi_read_toc u_int8_t op_code; u_int8_t byte2; u_int8_t format; +#define SRTOC_FORMAT_TOC 0x00 +#define SRTOC_FORMAT_LAST_ADDR 0x01 +#define SRTOC_FORMAT_QSUB_TOC 0x02 +#define SRTOC_FORMAT_QSUB_PMA 0x03 +#define SRTOC_FORMAT_ATIP 0x04 +#define SRTOC_FORMAT_CD_TEXT 0x05 u_int8_t unused[3]; u_int8_t from_track; u_int8_t data_len[2]; @@ -870,6 +876,12 @@ void scsi_read_dvd_structure(struct ccb_scsiio *csio, u_int8_t agid, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout); + +void scsi_read_toc(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t byte1_flags, uint8_t format, + uint8_t track, uint8_t *data_ptr, uint32_t dxfer_len, + int sense_len, int timeout); __END_DECLS From owner-svn-src-stable@freebsd.org Wed Sep 25 19:46:53 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD691130990; Wed, 25 Sep 2019 19:46:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dpV55KSPz4NMB; Wed, 25 Sep 2019 19:46:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F9721CA9F; Wed, 25 Sep 2019 19:46:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PJkrpM043115; Wed, 25 Sep 2019 19:46:53 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PJkr8N043111; Wed, 25 Sep 2019 19:46:53 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909251946.x8PJkr8N043111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 25 Sep 2019 19:46:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352715 - stable/11/sys/cam/scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/cam/scsi X-SVN-Commit-Revision: 352715 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 19:46:53 -0000 Author: avg Date: Wed Sep 25 19:46:52 2019 New Revision: 352715 URL: https://svnweb.freebsd.org/changeset/base/352715 Log: MFC r351599,r351600: scsi_cd: make the media check asynchronous PR: 219857 Modified: stable/11/sys/cam/scsi/scsi_cd.c stable/11/sys/cam/scsi/scsi_cd.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_cd.c Wed Sep 25 19:46:17 2019 (r352714) +++ stable/11/sys/cam/scsi/scsi_cd.c Wed Sep 25 19:46:52 2019 (r352715) @@ -109,13 +109,21 @@ typedef enum { CD_FLAG_RETRY_UA = 0x0200, CD_FLAG_VALID_MEDIA = 0x0400, CD_FLAG_VALID_TOC = 0x0800, - CD_FLAG_SCTX_INIT = 0x1000 + CD_FLAG_SCTX_INIT = 0x1000, + CD_FLAG_MEDIA_WAIT = 0x2000, + CD_FLAG_MEDIA_SCAN_ACT = 0x4000 } cd_flags; typedef enum { CD_CCB_PROBE = 0x01, CD_CCB_BUFFER_IO = 0x02, - CD_CCB_TUR = 0x04, + CD_CCB_TUR = 0x03, + CD_CCB_MEDIA_PREVENT = 0x04, + CD_CCB_MEDIA_ALLOW = 0x05, + CD_CCB_MEDIA_SIZE = 0x06, + CD_CCB_MEDIA_TOC_HDR = 0x07, + CD_CCB_MEDIA_TOC_FULL = 0x08, + CD_CCB_MEDIA_TOC_LEAD = 0x09, CD_CCB_TYPE_MASK = 0x0F, CD_CCB_RETRY_UA = 0x10 } cd_ccb_state; @@ -135,7 +143,13 @@ struct cd_toc_single { typedef enum { CD_STATE_PROBE, - CD_STATE_NORMAL + CD_STATE_NORMAL, + CD_STATE_MEDIA_PREVENT, + CD_STATE_MEDIA_ALLOW, + CD_STATE_MEDIA_SIZE, + CD_STATE_MEDIA_TOC_HDR, + CD_STATE_MEDIA_TOC_FULL, + CD_STATE_MEDIA_TOC_LEAD } cd_state; struct cd_softc { @@ -156,6 +170,8 @@ struct cd_softc { struct sysctl_oid *sysctl_tree; STAILQ_HEAD(, cd_mode_params) mode_queue; struct cd_tocdata toc; + int toc_read_len; + struct cd_toc_single leadout; struct disk *disk; struct callout mediapoll_c; }; @@ -225,8 +241,11 @@ static void cddone(struct cam_periph *periph, static union cd_pages *cdgetpage(struct cd_mode_params *mode_params); static int cdgetpagesize(int page_num); static void cdprevent(struct cam_periph *periph, int action); -static int cdcheckmedia(struct cam_periph *periph); +static void cdmediaprobedone(struct cam_periph *periph); +static int cdcheckmedia(struct cam_periph *periph, int do_wait); +#if 0 static int cdsize(struct cam_periph *periph, u_int32_t *size); +#endif static int cd6byteworkaround(union ccb *ccb); static int cderror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags); @@ -734,7 +753,7 @@ cdopen(struct disk *dp) * if we don't have media, but then we don't allow anything but the * CDIOCEJECT/CDIOCCLOSE ioctls if there is no media. */ - cdcheckmedia(periph); + cdcheckmedia(periph, /*do_wait*/ 1); CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("leaving cdopen\n")); cam_periph_unhold(periph); @@ -830,27 +849,19 @@ cdstrategy(struct bio *bp) return; } - /* - * If we don't have valid media, look for it before trying to - * schedule the I/O. - */ - if ((softc->flags & CD_FLAG_VALID_MEDIA) == 0) { - int error; - - error = cdcheckmedia(periph); - if (error != 0) { - cam_periph_unlock(periph); - biofinish(bp, NULL, error); - return; - } - } - /* * Place it in the queue of disk activities for this disk */ bioq_disksort(&softc->bio_queue, bp); - xpt_schedule(periph, CAM_PRIORITY_NORMAL); + /* + * If we don't know that we have valid media, schedule the media + * check first. The I/O will get executed after the media check. + */ + if ((softc->flags & CD_FLAG_VALID_MEDIA) == 0) + cdcheckmedia(periph, /*do_wait*/ 0); + else + xpt_schedule(periph, CAM_PRIORITY_NORMAL); cam_periph_unlock(periph); return; @@ -862,7 +873,6 @@ cdstart(struct cam_periph *periph, union ccb *start_cc struct cd_softc *softc; struct bio *bp; struct ccb_scsiio *csio; - struct scsi_read_capacity_data *rcap; softc = (struct cd_softc *)periph->softc; @@ -943,16 +953,40 @@ cdstart(struct cam_periph *periph, union ccb *start_cc break; } case CD_STATE_PROBE: + case CD_STATE_MEDIA_SIZE: { + struct scsi_read_capacity_data *rcap; rcap = (struct scsi_read_capacity_data *)malloc(sizeof(*rcap), M_SCSICD, M_NOWAIT | M_ZERO); if (rcap == NULL) { xpt_print(periph->path, - "cdstart: Couldn't malloc read_capacity data\n"); - /* cd_free_periph??? */ + "%s: Couldn't malloc read_capacity data\n", + __func__); + xpt_release_ccb(start_ccb); + /* + * We can't probe because we can't allocate memory, + * so invalidate the peripheral. The system probably + * has larger problems at this stage. If we've + * already probed (and are re-probing capacity), we + * don't need to invalidate. + * + * XXX KDM need to reset probe state and kick out + * pending I/O. + */ + if (softc->state == CD_STATE_PROBE) + cam_periph_invalidate(periph); break; } + + /* + * Set the default capacity and sector size to something that + * GEOM can handle. This will get reset when a read capacity + * completes successfully. + */ + softc->disk->d_sectorsize = 2048; + softc->disk->d_mediasize = 0; + csio = &start_ccb->csio; scsi_read_capacity(csio, /*retries*/ cd_retry_count, @@ -962,11 +996,112 @@ cdstart(struct cam_periph *periph, union ccb *start_cc SSD_FULL_SIZE, /*timeout*/20000); start_ccb->ccb_h.ccb_bp = NULL; - start_ccb->ccb_h.ccb_state = CD_CCB_PROBE; + if (softc->state == CD_STATE_PROBE) + start_ccb->ccb_h.ccb_state = CD_CCB_PROBE; + else + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_SIZE; xpt_action(start_ccb); break; } + case CD_STATE_MEDIA_ALLOW: + case CD_STATE_MEDIA_PREVENT: + { + /* + * If the CD is already locked, we don't need to do this. + * Move on to the capacity check. + */ + if ((softc->flags & CD_FLAG_DISC_LOCKED) != 0) { + softc->state = CD_STATE_MEDIA_SIZE; + xpt_release_ccb(start_ccb); + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + break; + } + + scsi_prevent(&start_ccb->csio, + /*retries*/ cd_retry_count, + /*cbfcnp*/ cddone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*action*/ (softc->state == CD_STATE_MEDIA_ALLOW) ? + PR_ALLOW : PR_PREVENT, + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 60000); + + start_ccb->ccb_h.ccb_bp = NULL; + if (softc->state == CD_STATE_MEDIA_ALLOW) + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_ALLOW; + else + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_PREVENT; + xpt_action(start_ccb); + break; } + case CD_STATE_MEDIA_TOC_HDR: { + struct ioc_toc_header *toch; + + bzero(&softc->toc, sizeof(softc->toc)); + + toch = &softc->toc.header; + + scsi_read_toc(&start_ccb->csio, + /*retries*/ cd_retry_count, + /*cbfcnp*/ cddone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*byte1_flags*/ 0, + /*format*/ SRTOC_FORMAT_TOC, + /*track*/ 0, + /*data_ptr*/ (uint8_t *)toch, + /*dxfer_len*/ sizeof(*toch), + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 50000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_TOC_HDR; + xpt_action(start_ccb); + break; + } + case CD_STATE_MEDIA_TOC_FULL: { + + bzero(&softc->toc, sizeof(softc->toc)); + + scsi_read_toc(&start_ccb->csio, + /*retries*/ cd_retry_count, + /*cbfcnp*/ cddone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*byte1_flags*/ 0, + /*format*/ SRTOC_FORMAT_TOC, + /*track*/ 0, + /*data_ptr*/ (uint8_t *)&softc->toc, + /*dxfer_len*/ softc->toc_read_len ? + softc->toc_read_len : + sizeof(softc->toc), + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 50000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_TOC_FULL; + xpt_action(start_ccb); + break; + } + case CD_STATE_MEDIA_TOC_LEAD: { + struct cd_toc_single *leadout; + + leadout = &softc->leadout; + bzero(leadout, sizeof(*leadout)); + + scsi_read_toc(&start_ccb->csio, + /*retries*/ cd_retry_count, + /*cbfcnp*/ cddone, + /*tag_action*/ MSG_SIMPLE_Q_TAG, + /*byte1_flags*/ CD_MSF, + /*format*/ SRTOC_FORMAT_TOC, + /*track*/ LEADOUT, + /*data_ptr*/ (uint8_t *)leadout, + /*dxfer_len*/ sizeof(*leadout), + /*sense_len*/ SSD_FULL_SIZE, + /*timeout*/ 50000); + start_ccb->ccb_h.ccb_bp = NULL; + start_ccb->ccb_h.ccb_state = CD_CCB_MEDIA_TOC_LEAD; + xpt_action(start_ccb); + break; + } + } } static void @@ -1238,6 +1373,293 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) cam_periph_release_locked(periph); return; } + case CD_CCB_MEDIA_ALLOW: + case CD_CCB_MEDIA_PREVENT: + { + int error; + int is_prevent; + + error = 0; + + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + error = cderror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA | SF_NO_PRINT); + } + if (error == ERESTART) + return; + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + + /* + * Note that just like the original cdcheckmedia(), we do + * a prevent without failing the whole operation if the + * prevent fails. We try, but keep going if it doesn't + * work. + */ + + if ((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == + CD_CCB_MEDIA_PREVENT) + is_prevent = 1; + else + is_prevent = 0; + + xpt_release_ccb(done_ccb); + + if (is_prevent != 0) { + if (error == 0) + softc->flags |= CD_FLAG_DISC_LOCKED; + else + softc->flags &= ~CD_FLAG_DISC_LOCKED; + softc->state = CD_STATE_MEDIA_SIZE; + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + } else { + if (error == 0) + softc->flags &= ~CD_FLAG_DISC_LOCKED; + softc->state = CD_STATE_NORMAL; + if (bioq_first(&softc->bio_queue) != NULL) + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + } + return; + } + case CD_CCB_MEDIA_SIZE: + { + struct scsi_read_capacity_data *rdcap; + int error; + + error = 0; + if ((csio->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + error = cderror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA | SF_NO_PRINT); + } + if (error == ERESTART) + return; + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + rdcap = (struct scsi_read_capacity_data *)csio->data_ptr; + + if (error == 0) { + softc->params.disksize =scsi_4btoul(rdcap->addr) + 1; + softc->params.blksize = scsi_4btoul(rdcap->length); + + /* Make sure we got at least some block size. */ + if (softc->params.blksize == 0) + error = EIO; + /* + * SCSI-3 mandates that the reported blocksize shall be + * 2048. Older drives sometimes report funny values, + * trim it down to 2048, or other parts of the kernel + * will get confused. + * + * XXX we leave drives alone that might report 512 + * bytes, as well as drives reporting more weird + * sizes like perhaps 4K. + */ + if (softc->params.blksize > 2048 + && softc->params.blksize <= 2352) + softc->params.blksize = 2048; + } + free(rdcap, M_SCSICD); + + if (error == 0) { + softc->disk->d_sectorsize = softc->params.blksize; + softc->disk->d_mediasize = + (off_t)softc->params.blksize * + softc->params.disksize; + softc->flags |= CD_FLAG_SAW_MEDIA | CD_FLAG_VALID_MEDIA; + softc->state = CD_STATE_MEDIA_TOC_HDR; + } else { + softc->flags &= ~(CD_FLAG_VALID_MEDIA | + CD_FLAG_VALID_TOC); + bioq_flush(&softc->bio_queue, NULL, EINVAL); + softc->state = CD_STATE_MEDIA_ALLOW; + cdmediaprobedone(periph); + } + xpt_release_ccb(done_ccb); + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + return; + } + case CD_CCB_MEDIA_TOC_HDR: + case CD_CCB_MEDIA_TOC_FULL: + case CD_CCB_MEDIA_TOC_LEAD: + { + int error; + struct ioc_toc_header *toch; + int num_entries; + int cdindex; + + error = 0; + + if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + error = cderror(done_ccb, CAM_RETRY_SELTO, + SF_RETRY_UA | SF_NO_PRINT); + } + if (error == ERESTART) + return; + + if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) + cam_release_devq(done_ccb->ccb_h.path, + /*relsim_flags*/0, + /*reduction*/0, + /*timeout*/0, + /*getcount_only*/0); + + /* + * We will get errors here for media that doesn't have a table + * of contents. According to the MMC-3 spec: "When a Read + * TOC/PMA/ATIP command is presented for a DDCD/CD-R/RW media, + * where the first TOC has not been recorded (no complete + * session) and the Format codes 0000b, 0001b, or 0010b are + * specified, this command shall be rejected with an INVALID + * FIELD IN CDB. Devices that are not capable of reading an + * incomplete session on DDC/CD-R/RW media shall report + * CANNOT READ MEDIUM - INCOMPATIBLE FORMAT." + * + * So this isn't fatal if we can't read the table of contents, + * it just means that the user won't be able to issue the + * play tracks ioctl, and likely lots of other stuff won't + * work either. They need to burn the CD before we can do + * a whole lot with it. So we don't print anything here if + * we get an error back. + * + * We also bail out if the drive doesn't at least give us + * the full TOC header. + */ + if ((error != 0) + || ((csio->dxfer_len - csio->resid) < + sizeof(struct ioc_toc_header))) { + softc->flags &= ~CD_FLAG_VALID_TOC; + bzero(&softc->toc, sizeof(softc->toc)); + /* + * Failing the TOC read is not an error. + */ + softc->state = CD_STATE_NORMAL; + xpt_release_ccb(done_ccb); + + cdmediaprobedone(periph); + + /* + * Go ahead and schedule I/O execution if there is + * anything in the queue. It'll probably get + * kicked out with an error. + */ + if (bioq_first(&softc->bio_queue) != NULL) + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + return; + } + + /* + * Note that this is NOT the storage location used for the + * leadout! + */ + toch = &softc->toc.header; + + if (softc->quirks & CD_Q_BCD_TRACKS) { + toch->starting_track = bcd2bin(toch->starting_track); + toch->ending_track = bcd2bin(toch->ending_track); + } + + /* Number of TOC entries, plus leadout */ + num_entries = (toch->ending_track - toch->starting_track) + 2; + cdindex = toch->starting_track + num_entries -1; + + if ((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == + CD_CCB_MEDIA_TOC_HDR) { + if (num_entries <= 0) { + softc->flags &= ~CD_FLAG_VALID_TOC; + bzero(&softc->toc, sizeof(softc->toc)); + /* + * Failing the TOC read is not an error. + */ + softc->state = CD_STATE_NORMAL; + xpt_release_ccb(done_ccb); + + cdmediaprobedone(periph); + + /* + * Go ahead and schedule I/O execution if + * there is anything in the queue. It'll + * probably get kicked out with an error. + */ + if (bioq_first(&softc->bio_queue) != NULL) + xpt_schedule(periph, + CAM_PRIORITY_NORMAL); + } else { + softc->toc_read_len = num_entries * + sizeof(struct cd_toc_entry); + softc->toc_read_len += sizeof(*toch); + + softc->state = CD_STATE_MEDIA_TOC_FULL; + xpt_release_ccb(done_ccb); + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + } + + return; + } else if ((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == + CD_CCB_MEDIA_TOC_LEAD) { + struct cd_toc_single *leadout; + + leadout = (struct cd_toc_single *)csio->data_ptr; + softc->toc.entries[cdindex - toch->starting_track] = + leadout->entry; + } else if (((done_ccb->ccb_h.ccb_state & CD_CCB_TYPE_MASK) == + CD_CCB_MEDIA_TOC_FULL) + && (cdindex == toch->ending_track + 1)) { + /* + * XXX KDM is this necessary? Probably only if the + * drive doesn't return leadout information with the + * table of contents. + */ + softc->state = CD_STATE_MEDIA_TOC_LEAD; + xpt_release_ccb(done_ccb); + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + return; + } + + if (softc->quirks & CD_Q_BCD_TRACKS) { + for (cdindex = 0; cdindex < num_entries - 1; cdindex++){ + softc->toc.entries[cdindex].track = + bcd2bin(softc->toc.entries[cdindex].track); + } + } + + softc->flags |= CD_FLAG_VALID_TOC; + /* If the first track is audio, correct sector size. */ + if ((softc->toc.entries[0].control & 4) == 0) { + softc->disk->d_sectorsize =softc->params.blksize = 2352; + softc->disk->d_mediasize = + (off_t)softc->params.blksize * + softc->params.disksize; + } + softc->state = CD_STATE_NORMAL; + + /* + * We unconditionally (re)set the blocksize each time the + * CD device is opened. This is because the CD can change, + * and therefore the blocksize might change. + * XXX problems here if some slice or partition is still + * open with the old size? + */ + if ((softc->disk->d_devstat->flags & DEVSTAT_BS_UNAVAILABLE)!=0) + softc->disk->d_devstat->flags &= + ~DEVSTAT_BS_UNAVAILABLE; + softc->disk->d_devstat->block_size = softc->params.blksize; + + xpt_release_ccb(done_ccb); + + cdmediaprobedone(periph); + + if (bioq_first(&softc->bio_queue) != NULL) + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + return; + } default: break; } @@ -1307,7 +1729,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f && ((cmd != CDIOCCLOSE) && (cmd != CDIOCEJECT)) && (IOCGROUP(cmd) == 'c')) { - error = cdcheckmedia(periph); + error = cdcheckmedia(periph, /*do_wait*/ 1); if (error != 0) { cam_periph_unhold(periph); cam_periph_unlock(periph); @@ -2187,11 +2609,66 @@ cdprevent(struct cam_periph *periph, int action) } } +static void +cdmediaprobedone(struct cam_periph *periph) +{ + struct cd_softc *softc; + + softc = (struct cd_softc *)periph->softc; + + softc->flags &= ~CD_FLAG_MEDIA_SCAN_ACT; + + if ((softc->flags & CD_FLAG_MEDIA_WAIT) != 0) { + softc->flags &= ~CD_FLAG_MEDIA_WAIT; + wakeup(&softc->toc); + } +} + /* * XXX: the disk media and sector size is only really able to change * XXX: while the device is closed. */ + static int +cdcheckmedia(struct cam_periph *periph, int do_wait) +{ + struct cd_softc *softc; + int error; + + softc = (struct cd_softc *)periph->softc; + error = 0; + + if ((do_wait != 0) + && ((softc->flags & CD_FLAG_MEDIA_WAIT) == 0)) { + softc->flags |= CD_FLAG_MEDIA_WAIT; + } + if ((softc->flags & CD_FLAG_MEDIA_SCAN_ACT) == 0) { + softc->state = CD_STATE_MEDIA_PREVENT; + softc->flags |= CD_FLAG_MEDIA_SCAN_ACT; + xpt_schedule(periph, CAM_PRIORITY_NORMAL); + } + + if (do_wait == 0) + goto bailout; + + error = msleep(&softc->toc, cam_periph_mtx(periph), PRIBIO,"cdmedia",0); + + if (error != 0) + goto bailout; + + /* + * Check to see whether we have a valid size from the media. We + * may or may not have a valid TOC. + */ + if ((softc->flags & CD_FLAG_VALID_MEDIA) == 0) + error = EINVAL; +bailout: + + return (error); +} + +#if 0 +static int cdcheckmedia(struct cam_periph *periph) { struct cd_softc *softc; @@ -2387,6 +2864,7 @@ cdsize(struct cam_periph *periph, u_int32_t *size) return (error); } +#endif static int cd6byteworkaround(union ccb *ccb) @@ -2611,7 +3089,6 @@ static int cdreadtoc(struct cam_periph *periph, u_int32_t mode, u_int32_t start, u_int8_t *data, u_int32_t len, u_int32_t sense_flags) { - struct scsi_read_toc *scsi_cmd; u_int32_t ntoc; struct ccb_scsiio *csio; union ccb *ccb; @@ -2624,29 +3101,18 @@ cdreadtoc(struct cam_periph *periph, u_int32_t mode, u csio = &ccb->csio; - cam_fill_csio(csio, + scsi_read_toc(csio, /* retries */ cd_retry_count, /* cbfcnp */ cddone, - /* flags */ CAM_DIR_IN, /* tag_action */ MSG_SIMPLE_Q_TAG, + /* byte1_flags */ (mode == CD_MSF_FORMAT) ? CD_MSF : 0, + /* format */ SRTOC_FORMAT_TOC, + /* track*/ start, /* data_ptr */ data, /* dxfer_len */ len, /* sense_len */ SSD_FULL_SIZE, - sizeof(struct scsi_read_toc), - /* timeout */ 50000); + /* timeout */ 50000); - scsi_cmd = (struct scsi_read_toc *)&csio->cdb_io.cdb_bytes; - bzero (scsi_cmd, sizeof(*scsi_cmd)); - - if (mode == CD_MSF_FORMAT) - scsi_cmd->byte2 |= CD_MSF; - scsi_cmd->from_track = start; - /* scsi_ulto2b(ntoc, (u_int8_t *)scsi_cmd->data_len); */ - scsi_cmd->data_len[0] = (ntoc) >> 8; - scsi_cmd->data_len[1] = (ntoc) & 0xff; - - scsi_cmd->op_code = READ_TOC; - error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO, /*sense_flags*/SF_RETRY_UA | sense_flags); @@ -3703,4 +4169,39 @@ scsi_read_dvd_structure(struct ccb_scsiio *csio, u_int sense_len, sizeof(*scsi_cmd), timeout); +} + +void +scsi_read_toc(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t byte1_flags, uint8_t format, + uint8_t track, uint8_t *data_ptr, uint32_t dxfer_len, + int sense_len, int timeout) +{ + struct scsi_read_toc *scsi_cmd; + + scsi_cmd = (struct scsi_read_toc *)&csio->cdb_io.cdb_bytes; + bzero(scsi_cmd, sizeof(*scsi_cmd)); + scsi_cmd->op_code = READ_TOC; + + /* + * The structure is counting from 1, the function counting from 0. + * The spec counts from 0. In MMC-6, there is only one flag, the + * MSF flag. But we put the whole byte in for a bit a future-proofing. + */ + scsi_cmd->byte2 = byte1_flags; + scsi_cmd->format = format; + scsi_cmd->from_track = track; + scsi_ulto2b(dxfer_len, scsi_cmd->data_len); + + cam_fill_csio(csio, + /* retries */ retries, + /* cbfcnp */ cbfcnp, + /* flags */ CAM_DIR_IN, + /* tag_action */ tag_action, + /* data_ptr */ data_ptr, + /* dxfer_len */ dxfer_len, + /* sense_len */ sense_len, + sizeof(*scsi_cmd), + /* timeout */ timeout); } Modified: stable/11/sys/cam/scsi/scsi_cd.h ============================================================================== --- stable/11/sys/cam/scsi/scsi_cd.h Wed Sep 25 19:46:17 2019 (r352714) +++ stable/11/sys/cam/scsi/scsi_cd.h Wed Sep 25 19:46:52 2019 (r352715) @@ -229,6 +229,12 @@ struct scsi_read_toc u_int8_t op_code; u_int8_t byte2; u_int8_t format; +#define SRTOC_FORMAT_TOC 0x00 +#define SRTOC_FORMAT_LAST_ADDR 0x01 +#define SRTOC_FORMAT_QSUB_TOC 0x02 +#define SRTOC_FORMAT_QSUB_PMA 0x03 +#define SRTOC_FORMAT_ATIP 0x04 +#define SRTOC_FORMAT_CD_TEXT 0x05 u_int8_t unused[3]; u_int8_t from_track; u_int8_t data_len[2]; @@ -868,6 +874,12 @@ void scsi_read_dvd_structure(struct ccb_scsiio *csio, u_int8_t agid, u_int8_t *data_ptr, u_int32_t dxfer_len, u_int8_t sense_len, u_int32_t timeout); + +void scsi_read_toc(struct ccb_scsiio *csio, uint32_t retries, + void (*cbfcnp)(struct cam_periph *, union ccb *), + uint8_t tag_action, uint8_t byte1_flags, uint8_t format, + uint8_t track, uint8_t *data_ptr, uint32_t dxfer_len, + int sense_len, int timeout); __END_DECLS From owner-svn-src-stable@freebsd.org Wed Sep 25 19:48:07 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AF143130AC9; Wed, 25 Sep 2019 19:48:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dpWW4xZxz4NYr; Wed, 25 Sep 2019 19:48:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 735DA1CAB4; Wed, 25 Sep 2019 19:48:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PJm784043261; Wed, 25 Sep 2019 19:48:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PJm70E043260; Wed, 25 Sep 2019 19:48:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909251948.x8PJm70E043260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 25 Sep 2019 19:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352716 - stable/12/sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/cam/scsi X-SVN-Commit-Revision: 352716 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 19:48:07 -0000 Author: avg Date: Wed Sep 25 19:48:07 2019 New Revision: 352716 URL: https://svnweb.freebsd.org/changeset/base/352716 Log: MFC r351601: scsi_cd: whitespace cleanup Modified: stable/12/sys/cam/scsi/scsi_cd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_cd.c Wed Sep 25 19:46:52 2019 (r352715) +++ stable/12/sys/cam/scsi/scsi_cd.c Wed Sep 25 19:48:07 2019 (r352716) @@ -270,25 +270,25 @@ static int cdsize(struct cam_periph *periph, u_int32_ static int cd6byteworkaround(union ccb *ccb); static int cderror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags); -static int cdreadtoc(struct cam_periph *periph, u_int32_t mode, - u_int32_t start, u_int8_t *data, +static int cdreadtoc(struct cam_periph *periph, u_int32_t mode, + u_int32_t start, u_int8_t *data, u_int32_t len, u_int32_t sense_flags); -static int cdgetmode(struct cam_periph *periph, +static int cdgetmode(struct cam_periph *periph, struct cd_mode_params *data, u_int32_t page); static int cdsetmode(struct cam_periph *periph, struct cd_mode_params *data); -static int cdplay(struct cam_periph *periph, u_int32_t blk, +static int cdplay(struct cam_periph *periph, u_int32_t blk, u_int32_t len); -static int cdreadsubchannel(struct cam_periph *periph, - u_int32_t mode, u_int32_t format, - int track, - struct cd_sub_channel_info *data, +static int cdreadsubchannel(struct cam_periph *periph, + u_int32_t mode, u_int32_t format, + int track, + struct cd_sub_channel_info *data, u_int32_t len); -static int cdplaymsf(struct cam_periph *periph, u_int32_t startm, - u_int32_t starts, u_int32_t startf, - u_int32_t endm, u_int32_t ends, +static int cdplaymsf(struct cam_periph *periph, u_int32_t startm, + u_int32_t starts, u_int32_t startf, + u_int32_t endm, u_int32_t ends, u_int32_t endf); -static int cdplaytracks(struct cam_periph *periph, +static int cdplaytracks(struct cam_periph *periph, u_int32_t strack, u_int32_t sindex, u_int32_t etrack, u_int32_t eindex); static int cdpause(struct cam_periph *periph, u_int32_t go); @@ -599,7 +599,7 @@ cdregister(struct cam_periph *periph, void *arg) M_NOWAIT | M_ZERO); if (softc == NULL) { printf("cdregister: Unable to probe new device. " - "Unable to allocate softc\n"); + "Unable to allocate softc\n"); return(CAM_REQ_CMP_ERR); } @@ -876,7 +876,7 @@ cdstrategy(struct bio *bp) bioq_disksort(&softc->bio_queue, bp); /* - * If we don't know that we have valid media, schedule the media + * If we don't know that we have valid media, schedule the media * check first. The I/O will get executed after the media check. */ if ((softc->flags & CD_FLAG_VALID_MEDIA) == 0) @@ -951,7 +951,6 @@ cdstart(struct cam_periph *periph, union ccb *start_cc } start_ccb->ccb_h.ccb_state = CD_CCB_BUFFER_IO; - LIST_INSERT_HEAD(&softc->pending_ccbs, &start_ccb->ccb_h, periph_links.le); softc->outstanding_cmds++; @@ -1038,7 +1037,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc break; } - scsi_prevent(&start_ccb->csio, + scsi_prevent(&start_ccb->csio, /*retries*/ cd_retry_count, /*cbfcnp*/ cddone, /*tag_action*/ MSG_SIMPLE_Q_TAG, @@ -1057,7 +1056,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc } case CD_STATE_MEDIA_TOC_HDR: { struct ioc_toc_header *toch; - + bzero(&softc->toc, sizeof(softc->toc)); toch = &softc->toc.header; @@ -1069,7 +1068,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc /*byte1_flags*/ 0, /*format*/ SRTOC_FORMAT_TOC, /*track*/ 0, - /*data_ptr*/ (uint8_t *)toch, + /*data_ptr*/ (uint8_t *)toch, /*dxfer_len*/ sizeof(*toch), /*sense_len*/ SSD_FULL_SIZE, /*timeout*/ 50000); @@ -1113,7 +1112,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc /*byte1_flags*/ CD_MSF, /*format*/ SRTOC_FORMAT_TOC, /*track*/ LEADOUT, - /*data_ptr*/ (uint8_t *)leadout, + /*data_ptr*/ (uint8_t *)leadout, /*dxfer_len*/ sizeof(*leadout), /*sense_len*/ SSD_FULL_SIZE, /*timeout*/ 50000); @@ -1127,7 +1126,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc static void cddone(struct cam_periph *periph, union ccb *done_ccb) -{ +{ struct cd_softc *softc; struct ccb_scsiio *csio; @@ -1182,7 +1181,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) bp->bio_error = 0; if (bp->bio_resid != 0) { /* - * Short transfer ??? + * Short transfer ??? * XXX: not sure this is correct for partial * transfers at EOM */ @@ -1208,7 +1207,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) bzero(announce_buf, CD_ANNOUNCETMP_SZ); rdcap = (struct scsi_read_capacity_data *)csio->data_ptr; - + cdp->disksize = scsi_4btoul (rdcap->addr) + 1; cdp->blksize = scsi_4btoul (rdcap->length); @@ -1248,7 +1247,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) status = done_ccb->ccb_h.status; - xpt_setup_ccb(&cgd.ccb_h, + xpt_setup_ccb(&cgd.ccb_h, done_ccb->ccb_h.path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; @@ -1282,15 +1281,15 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) "size failed: %s, %s", sense_key_desc, asc_desc); - } else if ((have_sense == 0) - && ((status & CAM_STATUS_MASK) == - CAM_SCSI_STATUS_ERROR) - && (csio->scsi_status == - SCSI_STATUS_BUSY)) { - snprintf(announce_buf, + } else if ((have_sense == 0) + && ((status & CAM_STATUS_MASK) == + CAM_SCSI_STATUS_ERROR) + && (csio->scsi_status == + SCSI_STATUS_BUSY)) { + snprintf(announce_buf, CD_ANNOUNCETMP_SZ, - "Attempt to query device " - "size failed: SCSI Status: %s", + "Attempt to query device " + "size failed: SCSI Status: %s", scsi_status_string(csio)); } else if (SID_TYPE(&cgd.inq_data) == T_CDROM) { /* @@ -1301,7 +1300,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) * don't support CDROM commands. * If we have sense information, go * ahead and print it out. - * Otherwise, just say that we + * Otherwise, just say that we * couldn't attach. */ @@ -1354,7 +1353,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) */ taskqueue_enqueue(taskqueue_thread,&softc->sysctl_task); } - softc->state = CD_STATE_NORMAL; + softc->state = CD_STATE_NORMAL; /* * Since our peripheral may be invalidated by an error * above or an external event, we must release our CCB @@ -1386,7 +1385,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) cam_periph_release_locked(periph); return; } - case CD_CCB_MEDIA_ALLOW: + case CD_CCB_MEDIA_ALLOW: case CD_CCB_MEDIA_PREVENT: { int error; @@ -1526,12 +1525,12 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) /* * We will get errors here for media that doesn't have a table - * of contents. According to the MMC-3 spec: "When a Read + * of contents. According to the MMC-3 spec: "When a Read * TOC/PMA/ATIP command is presented for a DDCD/CD-R/RW media, * where the first TOC has not been recorded (no complete * session) and the Format codes 0000b, 0001b, or 0010b are - * specified, this command shall be rejected with an INVALID - * FIELD IN CDB. Devices that are not capable of reading an + * specified, this command shall be rejected with an INVALID + * FIELD IN CDB. Devices that are not capable of reading an * incomplete session on DDC/CD-R/RW media shall report * CANNOT READ MEDIUM - INCOMPATIBLE FORMAT." * @@ -1792,7 +1791,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCPLAYTRACKS\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -1838,7 +1837,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f softc->toc.header.starting_track; if ((st < 0) || (et < 0) - || (st > (softc->toc.header.ending_track - + || (st > (softc->toc.header.ending_track - softc->toc.header.starting_track))) { error = EINVAL; cam_periph_unlock(periph); @@ -1888,7 +1887,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCPLAYMSF\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -1929,7 +1928,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCPLAYBLOCKS\n")); @@ -1960,11 +1959,11 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f struct cd_sub_channel_info *data; u_int32_t len = args->data_len; - data = malloc(sizeof(struct cd_sub_channel_info), + data = malloc(sizeof(struct cd_sub_channel_info), M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCREADSUBCHANNEL\n")); if ((len > sizeof(struct cd_sub_channel_info)) || @@ -1988,7 +1987,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f if (error) { free(data, M_SCSICD); cam_periph_unlock(periph); - break; + break; } if (softc->quirks & CD_Q_BCD_TRACKS) data->what.track_info.track_number = @@ -2010,10 +2009,10 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOREADTOCHEADER\n")); - error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, + error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, sizeof (*th), /*sense_flags*/SF_NO_PRINT); if (error) { free(th, M_SCSICD); @@ -2024,7 +2023,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f /* we are going to have to convert the BCD * encoding on the cd to what is expected */ - th->starting_track = + th->starting_track = bcd2bin(th->starting_track); th->ending_track = bcd2bin(th->ending_track); } @@ -2051,7 +2050,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f lead = malloc(sizeof(*lead), M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOREADTOCENTRYS\n")); if (te->data_len < sizeof(struct cd_toc_entry) @@ -2068,7 +2067,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } th = &data->header; - error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, + error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, sizeof (*th), /*sense_flags*/0); if (error) { free(data, M_SCSICD); @@ -2152,7 +2151,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f cam_periph_unlock(periph); break; } - data->entries[idx - starting_track] = + data->entries[idx - starting_track] = lead->entry; } if (softc->quirks & CD_Q_BCD_TRACKS) { @@ -2180,7 +2179,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f data = malloc(sizeof(*data), M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOREADTOCENTRY\n")); if (te->address_format != CD_MSF_FORMAT @@ -2249,11 +2248,11 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f union cd_pages *page; params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_SCSICD, + params.mode_buf = malloc(params.alloc_len, M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETPATCH\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2264,9 +2263,9 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } page = cdgetpage(¶ms); - page->audio.port[LEFT_PORT].channels = + page->audio.port[LEFT_PORT].channels = arg->patch[0]; - page->audio.port[RIGHT_PORT].channels = + page->audio.port[RIGHT_PORT].channels = arg->patch[1]; page->audio.port[2].channels = arg->patch[2]; page->audio.port[3].channels = arg->patch[3]; @@ -2282,11 +2281,11 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f union cd_pages *page; params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_SCSICD, + params.mode_buf = malloc(params.alloc_len, M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCGETVOL\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2297,9 +2296,9 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } page = cdgetpage(¶ms); - arg->vol[LEFT_PORT] = + arg->vol[LEFT_PORT] = page->audio.port[LEFT_PORT].volume; - arg->vol[RIGHT_PORT] = + arg->vol[RIGHT_PORT] = page->audio.port[RIGHT_PORT].volume; arg->vol[2] = page->audio.port[2].volume; arg->vol[3] = page->audio.port[3].volume; @@ -2314,11 +2313,11 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f union cd_pages *page; params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_SCSICD, + params.mode_buf = malloc(params.alloc_len, M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETVOL\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2330,10 +2329,10 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f page = cdgetpage(¶ms); page->audio.port[LEFT_PORT].channels = CHANNEL_0; - page->audio.port[LEFT_PORT].volume = + page->audio.port[LEFT_PORT].volume = arg->vol[LEFT_PORT]; page->audio.port[RIGHT_PORT].channels = CHANNEL_1; - page->audio.port[RIGHT_PORT].volume = + page->audio.port[RIGHT_PORT].volume = arg->vol[RIGHT_PORT]; page->audio.port[2].volume = arg->vol[2]; page->audio.port[3].volume = arg->vol[3]; @@ -2352,7 +2351,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETMONO\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2363,9 +2362,9 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } page = cdgetpage(¶ms); - page->audio.port[LEFT_PORT].channels = + page->audio.port[LEFT_PORT].channels = LEFT_CHANNEL | RIGHT_CHANNEL; - page->audio.port[RIGHT_PORT].channels = + page->audio.port[RIGHT_PORT].channels = LEFT_CHANNEL | RIGHT_CHANNEL; page->audio.port[2].channels = 0; page->audio.port[3].channels = 0; @@ -2384,7 +2383,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETSTEREO\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2395,9 +2394,9 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } page = cdgetpage(¶ms); - page->audio.port[LEFT_PORT].channels = + page->audio.port[LEFT_PORT].channels = LEFT_CHANNEL; - page->audio.port[RIGHT_PORT].channels = + page->audio.port[RIGHT_PORT].channels = RIGHT_CHANNEL; page->audio.port[2].channels = 0; page->audio.port[3].channels = 0; @@ -2416,7 +2415,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETMUTE\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2446,7 +2445,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETLEFT\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2476,7 +2475,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETRIGHT\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2598,7 +2597,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f cam_periph_lock(periph); cam_periph_unhold(periph); - + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("leaving cdioctl\n")); if (error && bootverbose) { printf("scsi_cd.c::ioctl cmd=%08lx error=%d\n", cmd, error); @@ -2618,24 +2617,24 @@ cdprevent(struct cam_periph *periph, int action) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdprevent\n")); softc = (struct cd_softc *)periph->softc; - + if (((action == PR_ALLOW) && (softc->flags & CD_FLAG_DISC_LOCKED) == 0) || ((action == PR_PREVENT) && (softc->flags & CD_FLAG_DISC_LOCKED) != 0)) { return; } - + ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); - scsi_prevent(&ccb->csio, + scsi_prevent(&ccb->csio, /*retries*/ cd_retry_count, /*cbfcnp*/NULL, MSG_SIMPLE_Q_TAG, action, SSD_FULL_SIZE, /* timeout */60000); - + error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO, /*sense_flags*/SF_RETRY_UA|SF_NO_PRINT); @@ -2692,7 +2691,7 @@ cdcheckmedia(struct cam_periph *periph, int do_wait) goto bailout; error = msleep(&softc->toc, cam_periph_mtx(periph), PRIBIO,"cdmedia",0); - + if (error != 0) goto bailout; @@ -2807,7 +2806,7 @@ cdcheckmedia(struct cam_periph *periph) cdindex = toch->starting_track + num_entries -1; if (cdindex == toch->ending_track + 1) { - error = cdreadtoc(periph, CD_MSF_FORMAT, LEADOUT, + error = cdreadtoc(periph, CD_MSF_FORMAT, LEADOUT, (u_int8_t *)&leadout, sizeof(leadout), SF_NO_PRINT); if (error != 0) { @@ -2860,16 +2859,16 @@ cdsize(struct cam_periph *periph, u_int32_t *size) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdsize\n")); softc = (struct cd_softc *)periph->softc; - + ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); /* XXX Should be M_WAITOK */ - rcap_buf = malloc(sizeof(struct scsi_read_capacity_data), + rcap_buf = malloc(sizeof(struct scsi_read_capacity_data), M_SCSICD, M_NOWAIT | M_ZERO); if (rcap_buf == NULL) return (ENOMEM); - scsi_read_capacity(&ccb->csio, + scsi_read_capacity(&ccb->csio, /*retries*/ cd_retry_count, /*cbfcnp*/NULL, MSG_SIMPLE_Q_TAG, @@ -2969,9 +2968,9 @@ cd6byteworkaround(union ccb *ccb) ms6 = (struct scsi_mode_sense_6 *)cdb; bzero(&ms10, sizeof(ms10)); - ms10.opcode = MODE_SENSE_10; - ms10.byte2 = ms6->byte2; - ms10.page = ms6->page; + ms10.opcode = MODE_SENSE_10; + ms10.byte2 = ms6->byte2; + ms10.page = ms6->page; /* * 10 byte mode header, block descriptor, @@ -3124,8 +3123,8 @@ cdmediapoll(void *arg) /* * Read table of contents */ -static int -cdreadtoc(struct cam_periph *periph, u_int32_t mode, u_int32_t start, +static int +cdreadtoc(struct cam_periph *periph, u_int32_t mode, u_int32_t start, u_int8_t *data, u_int32_t len, u_int32_t sense_flags) { u_int32_t ntoc; @@ -3141,7 +3140,7 @@ cdreadtoc(struct cam_periph *periph, u_int32_t mode, u csio = &ccb->csio; scsi_read_toc(csio, - /* retries */ cd_retry_count, + /* retries */ cd_retry_count, /* cbfcnp */ NULL, /* tag_action */ MSG_SIMPLE_Q_TAG, /* byte1_flags */ (mode == CD_MSF_FORMAT) ? CD_MSF : 0, @@ -3161,9 +3160,9 @@ cdreadtoc(struct cam_periph *periph, u_int32_t mode, u } static int -cdreadsubchannel(struct cam_periph *periph, u_int32_t mode, - u_int32_t format, int track, - struct cd_sub_channel_info *data, u_int32_t len) +cdreadsubchannel(struct cam_periph *periph, u_int32_t mode, + u_int32_t format, int track, + struct cd_sub_channel_info *data, u_int32_t len) { struct scsi_read_subchannel *scsi_cmd; struct ccb_scsiio *csio; @@ -3176,8 +3175,8 @@ cdreadsubchannel(struct cam_periph *periph, u_int32_t csio = &ccb->csio; - cam_fill_csio(csio, - /* retries */ cd_retry_count, + cam_fill_csio(csio, + /* retries */ cd_retry_count, /* cbfcnp */ NULL, /* flags */ CAM_DIR_IN, /* tag_action */ MSG_SIMPLE_Q_TAG, @@ -3185,7 +3184,7 @@ cdreadsubchannel(struct cam_periph *periph, u_int32_t /* dxfer_len */ len, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_read_subchannel), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_read_subchannel *)&csio->cdb_io.cdb_bytes; bzero (scsi_cmd, sizeof(*scsi_cmd)); @@ -3406,7 +3405,7 @@ cdsetmode(struct cam_periph *periph, struct cd_mode_pa } -static int +static int cdplay(struct cam_periph *periph, u_int32_t blk, u_int32_t len) { struct ccb_scsiio *csio; @@ -3476,8 +3475,8 @@ cdplaymsf(struct cam_periph *periph, u_int32_t startm, csio = &ccb->csio; - cam_fill_csio(csio, - /* retries */ cd_retry_count, + cam_fill_csio(csio, + /* retries */ cd_retry_count, /* cbfcnp */ NULL, /* flags */ CAM_DIR_NONE, /* tag_action */ MSG_SIMPLE_Q_TAG, @@ -3485,7 +3484,7 @@ cdplaymsf(struct cam_periph *periph, u_int32_t startm, /* dxfer_len */ 0, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_play_msf), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_play_msf *)&csio->cdb_io.cdb_bytes; bzero (scsi_cmd, sizeof(*scsi_cmd)); @@ -3496,11 +3495,11 @@ cdplaymsf(struct cam_periph *periph, u_int32_t startm, scsi_cmd->start_f = startf; scsi_cmd->end_m = endm; scsi_cmd->end_s = ends; - scsi_cmd->end_f = endf; + scsi_cmd->end_f = endf; error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO, /*sense_flags*/SF_RETRY_UA); - + xpt_release_ccb(ccb); return(error); @@ -3522,8 +3521,8 @@ cdplaytracks(struct cam_periph *periph, u_int32_t stra csio = &ccb->csio; - cam_fill_csio(csio, - /* retries */ cd_retry_count, + cam_fill_csio(csio, + /* retries */ cd_retry_count, /* cbfcnp */ NULL, /* flags */ CAM_DIR_NONE, /* tag_action */ MSG_SIMPLE_Q_TAG, @@ -3531,7 +3530,7 @@ cdplaytracks(struct cam_periph *periph, u_int32_t stra /* dxfer_len */ 0, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_play_track), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_play_track *)&csio->cdb_io.cdb_bytes; bzero (scsi_cmd, sizeof(*scsi_cmd)); @@ -3564,8 +3563,8 @@ cdpause(struct cam_periph *periph, u_int32_t go) csio = &ccb->csio; - cam_fill_csio(csio, - /* retries */ cd_retry_count, + cam_fill_csio(csio, + /* retries */ cd_retry_count, /* cbfcnp */ NULL, /* flags */ CAM_DIR_NONE, /* tag_action */ MSG_SIMPLE_Q_TAG, @@ -3573,7 +3572,7 @@ cdpause(struct cam_periph *periph, u_int32_t go) /* dxfer_len */ 0, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_pause), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_pause *)&csio->cdb_io.cdb_bytes; bzero (scsi_cmd, sizeof(*scsi_cmd)); @@ -3672,7 +3671,7 @@ cdsetspeed(struct cam_periph *periph, u_int32_t rdspee /* dxfer_len */ 0, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_set_speed), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_set_speed *)&csio->cdb_io.cdb_bytes; bzero(scsi_cmd, sizeof(*scsi_cmd)); @@ -4095,7 +4094,7 @@ cdreaddvdstructure(struct cam_periph *periph, struct d * Tell the user what the overall length is, no matter * what we can actually fit in the data buffer. */ - dvdstruct->length = length - ccb->csio.resid - + dvdstruct->length = length - ccb->csio.resid - sizeof(struct scsi_read_dvd_struct_data_header); /* @@ -4233,8 +4232,8 @@ scsi_read_toc(struct ccb_scsiio *csio, uint32_t retrie scsi_cmd->from_track = track; scsi_ulto2b(dxfer_len, scsi_cmd->data_len); - cam_fill_csio(csio, - /* retries */ retries, + cam_fill_csio(csio, + /* retries */ retries, /* cbfcnp */ cbfcnp, /* flags */ CAM_DIR_IN, /* tag_action */ tag_action, @@ -4242,5 +4241,5 @@ scsi_read_toc(struct ccb_scsiio *csio, uint32_t retrie /* dxfer_len */ dxfer_len, /* sense_len */ sense_len, sizeof(*scsi_cmd), - /* timeout */ timeout); + /* timeout */ timeout); } From owner-svn-src-stable@freebsd.org Wed Sep 25 19:49:48 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87ADA130BE1; Wed, 25 Sep 2019 19:49:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dpYS3nywz4Np3; Wed, 25 Sep 2019 19:49:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6671B1CABA; Wed, 25 Sep 2019 19:49:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PJnmTj043516; Wed, 25 Sep 2019 19:49:48 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PJnmNU043515; Wed, 25 Sep 2019 19:49:48 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909251949.x8PJnmNU043515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 25 Sep 2019 19:49:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352717 - stable/11/sys/cam/scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/cam/scsi X-SVN-Commit-Revision: 352717 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 19:49:48 -0000 Author: avg Date: Wed Sep 25 19:49:48 2019 New Revision: 352717 URL: https://svnweb.freebsd.org/changeset/base/352717 Log: MFC r351601: scsi_cd: whitespace cleanup Modified: stable/11/sys/cam/scsi/scsi_cd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_cd.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_cd.c Wed Sep 25 19:48:07 2019 (r352716) +++ stable/11/sys/cam/scsi/scsi_cd.c Wed Sep 25 19:49:48 2019 (r352717) @@ -249,25 +249,25 @@ static int cdsize(struct cam_periph *periph, u_int32_ static int cd6byteworkaround(union ccb *ccb); static int cderror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags); -static int cdreadtoc(struct cam_periph *periph, u_int32_t mode, - u_int32_t start, u_int8_t *data, +static int cdreadtoc(struct cam_periph *periph, u_int32_t mode, + u_int32_t start, u_int8_t *data, u_int32_t len, u_int32_t sense_flags); -static int cdgetmode(struct cam_periph *periph, +static int cdgetmode(struct cam_periph *periph, struct cd_mode_params *data, u_int32_t page); static int cdsetmode(struct cam_periph *periph, struct cd_mode_params *data); -static int cdplay(struct cam_periph *periph, u_int32_t blk, +static int cdplay(struct cam_periph *periph, u_int32_t blk, u_int32_t len); -static int cdreadsubchannel(struct cam_periph *periph, - u_int32_t mode, u_int32_t format, - int track, - struct cd_sub_channel_info *data, +static int cdreadsubchannel(struct cam_periph *periph, + u_int32_t mode, u_int32_t format, + int track, + struct cd_sub_channel_info *data, u_int32_t len); -static int cdplaymsf(struct cam_periph *periph, u_int32_t startm, - u_int32_t starts, u_int32_t startf, - u_int32_t endm, u_int32_t ends, +static int cdplaymsf(struct cam_periph *periph, u_int32_t startm, + u_int32_t starts, u_int32_t startf, + u_int32_t endm, u_int32_t ends, u_int32_t endf); -static int cdplaytracks(struct cam_periph *periph, +static int cdplaytracks(struct cam_periph *periph, u_int32_t strack, u_int32_t sindex, u_int32_t etrack, u_int32_t eindex); static int cdpause(struct cam_periph *periph, u_int32_t go); @@ -578,7 +578,7 @@ cdregister(struct cam_periph *periph, void *arg) M_NOWAIT | M_ZERO); if (softc == NULL) { printf("cdregister: Unable to probe new device. " - "Unable to allocate softc\n"); + "Unable to allocate softc\n"); return(CAM_REQ_CMP_ERR); } @@ -855,7 +855,7 @@ cdstrategy(struct bio *bp) bioq_disksort(&softc->bio_queue, bp); /* - * If we don't know that we have valid media, schedule the media + * If we don't know that we have valid media, schedule the media * check first. The I/O will get executed after the media check. */ if ((softc->flags & CD_FLAG_VALID_MEDIA) == 0) @@ -930,7 +930,6 @@ cdstart(struct cam_periph *periph, union ccb *start_cc } start_ccb->ccb_h.ccb_state = CD_CCB_BUFFER_IO; - LIST_INSERT_HEAD(&softc->pending_ccbs, &start_ccb->ccb_h, periph_links.le); softc->outstanding_cmds++; @@ -1017,7 +1016,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc break; } - scsi_prevent(&start_ccb->csio, + scsi_prevent(&start_ccb->csio, /*retries*/ cd_retry_count, /*cbfcnp*/ cddone, /*tag_action*/ MSG_SIMPLE_Q_TAG, @@ -1036,7 +1035,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc } case CD_STATE_MEDIA_TOC_HDR: { struct ioc_toc_header *toch; - + bzero(&softc->toc, sizeof(softc->toc)); toch = &softc->toc.header; @@ -1048,7 +1047,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc /*byte1_flags*/ 0, /*format*/ SRTOC_FORMAT_TOC, /*track*/ 0, - /*data_ptr*/ (uint8_t *)toch, + /*data_ptr*/ (uint8_t *)toch, /*dxfer_len*/ sizeof(*toch), /*sense_len*/ SSD_FULL_SIZE, /*timeout*/ 50000); @@ -1092,7 +1091,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc /*byte1_flags*/ CD_MSF, /*format*/ SRTOC_FORMAT_TOC, /*track*/ LEADOUT, - /*data_ptr*/ (uint8_t *)leadout, + /*data_ptr*/ (uint8_t *)leadout, /*dxfer_len*/ sizeof(*leadout), /*sense_len*/ SSD_FULL_SIZE, /*timeout*/ 50000); @@ -1106,7 +1105,7 @@ cdstart(struct cam_periph *periph, union ccb *start_cc static void cddone(struct cam_periph *periph, union ccb *done_ccb) -{ +{ struct cd_softc *softc; struct ccb_scsiio *csio; @@ -1161,7 +1160,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) bp->bio_error = 0; if (bp->bio_resid != 0) { /* - * Short transfer ??? + * Short transfer ??? * XXX: not sure this is correct for partial * transfers at EOM */ @@ -1202,7 +1201,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) cdp = &softc->params; rdcap = (struct scsi_read_capacity_data *)csio->data_ptr; - + cdp->disksize = scsi_4btoul (rdcap->addr) + 1; cdp->blksize = scsi_4btoul (rdcap->length); @@ -1242,7 +1241,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) status = done_ccb->ccb_h.status; - xpt_setup_ccb(&cgd.ccb_h, + xpt_setup_ccb(&cgd.ccb_h, done_ccb->ccb_h.path, CAM_PRIORITY_NORMAL); cgd.ccb_h.func_code = XPT_GDEV_TYPE; @@ -1276,15 +1275,15 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) "size failed: %s, %s", sense_key_desc, asc_desc); - } else if ((have_sense == 0) - && ((status & CAM_STATUS_MASK) == - CAM_SCSI_STATUS_ERROR) - && (csio->scsi_status == - SCSI_STATUS_BUSY)) { - snprintf(announce_buf, + } else if ((have_sense == 0) + && ((status & CAM_STATUS_MASK) == + CAM_SCSI_STATUS_ERROR) + && (csio->scsi_status == + SCSI_STATUS_BUSY)) { + snprintf(announce_buf, sizeof(announce_buf), - "Attempt to query device " - "size failed: SCSI Status: %s", + "Attempt to query device " + "size failed: SCSI Status: %s", scsi_status_string(csio)); } else if (SID_TYPE(&cgd.inq_data) == T_CDROM) { /* @@ -1295,7 +1294,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) * don't support CDROM commands. * If we have sense information, go * ahead and print it out. - * Otherwise, just say that we + * Otherwise, just say that we * couldn't attach. */ @@ -1341,7 +1340,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) */ taskqueue_enqueue(taskqueue_thread,&softc->sysctl_task); } - softc->state = CD_STATE_NORMAL; + softc->state = CD_STATE_NORMAL; /* * Since our peripheral may be invalidated by an error * above or an external event, we must release our CCB @@ -1373,7 +1372,7 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) cam_periph_release_locked(periph); return; } - case CD_CCB_MEDIA_ALLOW: + case CD_CCB_MEDIA_ALLOW: case CD_CCB_MEDIA_PREVENT: { int error; @@ -1513,12 +1512,12 @@ cddone(struct cam_periph *periph, union ccb *done_ccb) /* * We will get errors here for media that doesn't have a table - * of contents. According to the MMC-3 spec: "When a Read + * of contents. According to the MMC-3 spec: "When a Read * TOC/PMA/ATIP command is presented for a DDCD/CD-R/RW media, * where the first TOC has not been recorded (no complete * session) and the Format codes 0000b, 0001b, or 0010b are - * specified, this command shall be rejected with an INVALID - * FIELD IN CDB. Devices that are not capable of reading an + * specified, this command shall be rejected with an INVALID + * FIELD IN CDB. Devices that are not capable of reading an * incomplete session on DDC/CD-R/RW media shall report * CANNOT READ MEDIUM - INCOMPATIBLE FORMAT." * @@ -1756,7 +1755,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCPLAYTRACKS\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -1802,7 +1801,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f softc->toc.header.starting_track; if ((st < 0) || (et < 0) - || (st > (softc->toc.header.ending_track - + || (st > (softc->toc.header.ending_track - softc->toc.header.starting_track))) { error = EINVAL; cam_periph_unlock(periph); @@ -1852,7 +1851,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCPLAYMSF\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -1893,7 +1892,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCPLAYBLOCKS\n")); @@ -1924,11 +1923,11 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f struct cd_sub_channel_info *data; u_int32_t len = args->data_len; - data = malloc(sizeof(struct cd_sub_channel_info), + data = malloc(sizeof(struct cd_sub_channel_info), M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCREADSUBCHANNEL\n")); if ((len > sizeof(struct cd_sub_channel_info)) || @@ -1952,7 +1951,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f if (error) { free(data, M_SCSICD); cam_periph_unlock(periph); - break; + break; } if (softc->quirks & CD_Q_BCD_TRACKS) data->what.track_info.track_number = @@ -1974,10 +1973,10 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOREADTOCHEADER\n")); - error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, + error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, sizeof (*th), /*sense_flags*/SF_NO_PRINT); if (error) { free(th, M_SCSICD); @@ -1988,7 +1987,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f /* we are going to have to convert the BCD * encoding on the cd to what is expected */ - th->starting_track = + th->starting_track = bcd2bin(th->starting_track); th->ending_track = bcd2bin(th->ending_track); } @@ -2012,7 +2011,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f lead = malloc(sizeof(*lead), M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOREADTOCENTRYS\n")); if (te->data_len < sizeof(struct cd_toc_entry) @@ -2029,7 +2028,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } th = &data->header; - error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, + error = cdreadtoc(periph, 0, 0, (u_int8_t *)th, sizeof (*th), /*sense_flags*/0); if (error) { free(data, M_SCSICD); @@ -2113,7 +2112,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f cam_periph_unlock(periph); break; } - data->entries[idx - starting_track] = + data->entries[idx - starting_track] = lead->entry; } if (softc->quirks & CD_Q_BCD_TRACKS) { @@ -2140,7 +2139,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f data = malloc(sizeof(*data), M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOREADTOCENTRY\n")); if (te->address_format != CD_MSF_FORMAT @@ -2209,11 +2208,11 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f union cd_pages *page; params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_SCSICD, + params.mode_buf = malloc(params.alloc_len, M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETPATCH\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2224,9 +2223,9 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } page = cdgetpage(¶ms); - page->audio.port[LEFT_PORT].channels = + page->audio.port[LEFT_PORT].channels = arg->patch[0]; - page->audio.port[RIGHT_PORT].channels = + page->audio.port[RIGHT_PORT].channels = arg->patch[1]; page->audio.port[2].channels = arg->patch[2]; page->audio.port[3].channels = arg->patch[3]; @@ -2242,11 +2241,11 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f union cd_pages *page; params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_SCSICD, + params.mode_buf = malloc(params.alloc_len, M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCGETVOL\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2257,9 +2256,9 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } page = cdgetpage(¶ms); - arg->vol[LEFT_PORT] = + arg->vol[LEFT_PORT] = page->audio.port[LEFT_PORT].volume; - arg->vol[RIGHT_PORT] = + arg->vol[RIGHT_PORT] = page->audio.port[RIGHT_PORT].volume; arg->vol[2] = page->audio.port[2].volume; arg->vol[3] = page->audio.port[3].volume; @@ -2274,11 +2273,11 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f union cd_pages *page; params.alloc_len = sizeof(union cd_mode_data_6_10); - params.mode_buf = malloc(params.alloc_len, M_SCSICD, + params.mode_buf = malloc(params.alloc_len, M_SCSICD, M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETVOL\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2290,10 +2289,10 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f page = cdgetpage(¶ms); page->audio.port[LEFT_PORT].channels = CHANNEL_0; - page->audio.port[LEFT_PORT].volume = + page->audio.port[LEFT_PORT].volume = arg->vol[LEFT_PORT]; page->audio.port[RIGHT_PORT].channels = CHANNEL_1; - page->audio.port[RIGHT_PORT].volume = + page->audio.port[RIGHT_PORT].volume = arg->vol[RIGHT_PORT]; page->audio.port[2].volume = arg->vol[2]; page->audio.port[3].volume = arg->vol[3]; @@ -2312,7 +2311,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETMONO\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2323,9 +2322,9 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } page = cdgetpage(¶ms); - page->audio.port[LEFT_PORT].channels = + page->audio.port[LEFT_PORT].channels = LEFT_CHANNEL | RIGHT_CHANNEL; - page->audio.port[RIGHT_PORT].channels = + page->audio.port[RIGHT_PORT].channels = LEFT_CHANNEL | RIGHT_CHANNEL; page->audio.port[2].channels = 0; page->audio.port[3].channels = 0; @@ -2344,7 +2343,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETSTEREO\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2355,9 +2354,9 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f } page = cdgetpage(¶ms); - page->audio.port[LEFT_PORT].channels = + page->audio.port[LEFT_PORT].channels = LEFT_CHANNEL; - page->audio.port[RIGHT_PORT].channels = + page->audio.port[RIGHT_PORT].channels = RIGHT_CHANNEL; page->audio.port[2].channels = 0; page->audio.port[3].channels = 0; @@ -2376,7 +2375,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETMUTE\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2406,7 +2405,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETLEFT\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2436,7 +2435,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f M_WAITOK | M_ZERO); cam_periph_lock(periph); - CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, + CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, ("trying to do CDIOCSETRIGHT\n")); error = cdgetmode(periph, ¶ms, AUDIO_PAGE); @@ -2558,7 +2557,7 @@ cdioctl(struct disk *dp, u_long cmd, void *addr, int f cam_periph_lock(periph); cam_periph_unhold(periph); - + CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("leaving cdioctl\n")); if (error && bootverbose) { printf("scsi_cd.c::ioctl cmd=%08lx error=%d\n", cmd, error); @@ -2578,24 +2577,24 @@ cdprevent(struct cam_periph *periph, int action) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdprevent\n")); softc = (struct cd_softc *)periph->softc; - + if (((action == PR_ALLOW) && (softc->flags & CD_FLAG_DISC_LOCKED) == 0) || ((action == PR_PREVENT) && (softc->flags & CD_FLAG_DISC_LOCKED) != 0)) { return; } - + ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); - scsi_prevent(&ccb->csio, + scsi_prevent(&ccb->csio, /*retries*/ cd_retry_count, cddone, MSG_SIMPLE_Q_TAG, action, SSD_FULL_SIZE, /* timeout */60000); - + error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO, /*sense_flags*/SF_RETRY_UA|SF_NO_PRINT); @@ -2652,7 +2651,7 @@ cdcheckmedia(struct cam_periph *periph, int do_wait) goto bailout; error = msleep(&softc->toc, cam_periph_mtx(periph), PRIBIO,"cdmedia",0); - + if (error != 0) goto bailout; @@ -2767,7 +2766,7 @@ cdcheckmedia(struct cam_periph *periph) cdindex = toch->starting_track + num_entries -1; if (cdindex == toch->ending_track + 1) { - error = cdreadtoc(periph, CD_MSF_FORMAT, LEADOUT, + error = cdreadtoc(periph, CD_MSF_FORMAT, LEADOUT, (u_int8_t *)&leadout, sizeof(leadout), SF_NO_PRINT); if (error != 0) { @@ -2820,16 +2819,16 @@ cdsize(struct cam_periph *periph, u_int32_t *size) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdsize\n")); softc = (struct cd_softc *)periph->softc; - + ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); /* XXX Should be M_WAITOK */ - rcap_buf = malloc(sizeof(struct scsi_read_capacity_data), + rcap_buf = malloc(sizeof(struct scsi_read_capacity_data), M_SCSICD, M_NOWAIT | M_ZERO); if (rcap_buf == NULL) return (ENOMEM); - scsi_read_capacity(&ccb->csio, + scsi_read_capacity(&ccb->csio, /*retries*/ cd_retry_count, cddone, MSG_SIMPLE_Q_TAG, @@ -2929,9 +2928,9 @@ cd6byteworkaround(union ccb *ccb) ms6 = (struct scsi_mode_sense_6 *)cdb; bzero(&ms10, sizeof(ms10)); - ms10.opcode = MODE_SENSE_10; - ms10.byte2 = ms6->byte2; - ms10.page = ms6->page; + ms10.opcode = MODE_SENSE_10; + ms10.byte2 = ms6->byte2; + ms10.page = ms6->page; /* * 10 byte mode header, block descriptor, @@ -3085,8 +3084,8 @@ cdmediapoll(void *arg) /* * Read table of contents */ -static int -cdreadtoc(struct cam_periph *periph, u_int32_t mode, u_int32_t start, +static int +cdreadtoc(struct cam_periph *periph, u_int32_t mode, u_int32_t start, u_int8_t *data, u_int32_t len, u_int32_t sense_flags) { u_int32_t ntoc; @@ -3102,7 +3101,7 @@ cdreadtoc(struct cam_periph *periph, u_int32_t mode, u csio = &ccb->csio; scsi_read_toc(csio, - /* retries */ cd_retry_count, + /* retries */ cd_retry_count, /* cbfcnp */ cddone, /* tag_action */ MSG_SIMPLE_Q_TAG, /* byte1_flags */ (mode == CD_MSF_FORMAT) ? CD_MSF : 0, @@ -3122,9 +3121,9 @@ cdreadtoc(struct cam_periph *periph, u_int32_t mode, u } static int -cdreadsubchannel(struct cam_periph *periph, u_int32_t mode, - u_int32_t format, int track, - struct cd_sub_channel_info *data, u_int32_t len) +cdreadsubchannel(struct cam_periph *periph, u_int32_t mode, + u_int32_t format, int track, + struct cd_sub_channel_info *data, u_int32_t len) { struct scsi_read_subchannel *scsi_cmd; struct ccb_scsiio *csio; @@ -3137,8 +3136,8 @@ cdreadsubchannel(struct cam_periph *periph, u_int32_t csio = &ccb->csio; - cam_fill_csio(csio, - /* retries */ cd_retry_count, + cam_fill_csio(csio, + /* retries */ cd_retry_count, /* cbfcnp */ cddone, /* flags */ CAM_DIR_IN, /* tag_action */ MSG_SIMPLE_Q_TAG, @@ -3146,7 +3145,7 @@ cdreadsubchannel(struct cam_periph *periph, u_int32_t /* dxfer_len */ len, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_read_subchannel), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_read_subchannel *)&csio->cdb_io.cdb_bytes; bzero (scsi_cmd, sizeof(*scsi_cmd)); @@ -3367,7 +3366,7 @@ cdsetmode(struct cam_periph *periph, struct cd_mode_pa } -static int +static int cdplay(struct cam_periph *periph, u_int32_t blk, u_int32_t len) { struct ccb_scsiio *csio; @@ -3437,8 +3436,8 @@ cdplaymsf(struct cam_periph *periph, u_int32_t startm, csio = &ccb->csio; - cam_fill_csio(csio, - /* retries */ cd_retry_count, + cam_fill_csio(csio, + /* retries */ cd_retry_count, /* cbfcnp */ cddone, /* flags */ CAM_DIR_NONE, /* tag_action */ MSG_SIMPLE_Q_TAG, @@ -3446,7 +3445,7 @@ cdplaymsf(struct cam_periph *periph, u_int32_t startm, /* dxfer_len */ 0, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_play_msf), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_play_msf *)&csio->cdb_io.cdb_bytes; bzero (scsi_cmd, sizeof(*scsi_cmd)); @@ -3457,11 +3456,11 @@ cdplaymsf(struct cam_periph *periph, u_int32_t startm, scsi_cmd->start_f = startf; scsi_cmd->end_m = endm; scsi_cmd->end_s = ends; - scsi_cmd->end_f = endf; + scsi_cmd->end_f = endf; error = cdrunccb(ccb, cderror, /*cam_flags*/CAM_RETRY_SELTO, /*sense_flags*/SF_RETRY_UA); - + xpt_release_ccb(ccb); return(error); @@ -3483,8 +3482,8 @@ cdplaytracks(struct cam_periph *periph, u_int32_t stra csio = &ccb->csio; - cam_fill_csio(csio, - /* retries */ cd_retry_count, + cam_fill_csio(csio, + /* retries */ cd_retry_count, /* cbfcnp */ cddone, /* flags */ CAM_DIR_NONE, /* tag_action */ MSG_SIMPLE_Q_TAG, @@ -3492,7 +3491,7 @@ cdplaytracks(struct cam_periph *periph, u_int32_t stra /* dxfer_len */ 0, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_play_track), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_play_track *)&csio->cdb_io.cdb_bytes; bzero (scsi_cmd, sizeof(*scsi_cmd)); @@ -3525,8 +3524,8 @@ cdpause(struct cam_periph *periph, u_int32_t go) csio = &ccb->csio; - cam_fill_csio(csio, - /* retries */ cd_retry_count, + cam_fill_csio(csio, + /* retries */ cd_retry_count, /* cbfcnp */ cddone, /* flags */ CAM_DIR_NONE, /* tag_action */ MSG_SIMPLE_Q_TAG, @@ -3534,7 +3533,7 @@ cdpause(struct cam_periph *periph, u_int32_t go) /* dxfer_len */ 0, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_pause), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_pause *)&csio->cdb_io.cdb_bytes; bzero (scsi_cmd, sizeof(*scsi_cmd)); @@ -3633,7 +3632,7 @@ cdsetspeed(struct cam_periph *periph, u_int32_t rdspee /* dxfer_len */ 0, /* sense_len */ SSD_FULL_SIZE, sizeof(struct scsi_set_speed), - /* timeout */ 50000); + /* timeout */ 50000); scsi_cmd = (struct scsi_set_speed *)&csio->cdb_io.cdb_bytes; bzero(scsi_cmd, sizeof(*scsi_cmd)); @@ -4056,7 +4055,7 @@ cdreaddvdstructure(struct cam_periph *periph, struct d * Tell the user what the overall length is, no matter * what we can actually fit in the data buffer. */ - dvdstruct->length = length - ccb->csio.resid - + dvdstruct->length = length - ccb->csio.resid - sizeof(struct scsi_read_dvd_struct_data_header); /* @@ -4194,8 +4193,8 @@ scsi_read_toc(struct ccb_scsiio *csio, uint32_t retrie scsi_cmd->from_track = track; scsi_ulto2b(dxfer_len, scsi_cmd->data_len); - cam_fill_csio(csio, - /* retries */ retries, + cam_fill_csio(csio, + /* retries */ retries, /* cbfcnp */ cbfcnp, /* flags */ CAM_DIR_IN, /* tag_action */ tag_action, @@ -4203,5 +4202,5 @@ scsi_read_toc(struct ccb_scsiio *csio, uint32_t retrie /* dxfer_len */ dxfer_len, /* sense_len */ sense_len, sizeof(*scsi_cmd), - /* timeout */ timeout); + /* timeout */ timeout); } From owner-svn-src-stable@freebsd.org Wed Sep 25 19:51:22 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCED7130D70; Wed, 25 Sep 2019 19:51:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dpbG57sdz4P4w; Wed, 25 Sep 2019 19:51:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93D7D1CC1B; Wed, 25 Sep 2019 19:51:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PJpMSX046627; Wed, 25 Sep 2019 19:51:22 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PJpMEq046612; Wed, 25 Sep 2019 19:51:22 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909251951.x8PJpMEq046612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 25 Sep 2019 19:51:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352718 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 352718 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 19:51:22 -0000 Author: avg Date: Wed Sep 25 19:51:22 2019 New Revision: 352718 URL: https://svnweb.freebsd.org/changeset/base/352718 Log: MFC r351810: shutdown_halt: make sure that watchdog timer is stopped Modified: stable/12/sys/kern/kern_shutdown.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_shutdown.c ============================================================================== --- stable/12/sys/kern/kern_shutdown.c Wed Sep 25 19:49:48 2019 (r352717) +++ stable/12/sys/kern/kern_shutdown.c Wed Sep 25 19:51:22 2019 (r352718) @@ -564,6 +564,9 @@ shutdown_halt(void *junk, int howto) printf("\n"); printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); + + wdog_kern_pat(WD_TO_NEVER); + switch (cngetc()) { case -1: /* No console, just die */ cpu_halt(); From owner-svn-src-stable@freebsd.org Wed Sep 25 19:51:59 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8F89130F17; Wed, 25 Sep 2019 19:51:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dpbz4521z4PF6; Wed, 25 Sep 2019 19:51:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7080C1CC66; Wed, 25 Sep 2019 19:51:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PJpxo1048345; Wed, 25 Sep 2019 19:51:59 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PJpxTN048344; Wed, 25 Sep 2019 19:51:59 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909251951.x8PJpxTN048344@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 25 Sep 2019 19:51:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352719 - stable/11/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/kern X-SVN-Commit-Revision: 352719 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 19:51:59 -0000 Author: avg Date: Wed Sep 25 19:51:58 2019 New Revision: 352719 URL: https://svnweb.freebsd.org/changeset/base/352719 Log: MFC r351810: shutdown_halt: make sure that watchdog timer is stopped Modified: stable/11/sys/kern/kern_shutdown.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_shutdown.c ============================================================================== --- stable/11/sys/kern/kern_shutdown.c Wed Sep 25 19:51:22 2019 (r352718) +++ stable/11/sys/kern/kern_shutdown.c Wed Sep 25 19:51:58 2019 (r352719) @@ -501,6 +501,9 @@ shutdown_halt(void *junk, int howto) printf("\n"); printf("The operating system has halted.\n"); printf("Please press any key to reboot.\n\n"); + + wdog_kern_pat(WD_TO_NEVER); + switch (cngetc()) { case -1: /* No console, just die */ cpu_halt(); From owner-svn-src-stable@freebsd.org Wed Sep 25 19:52:35 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56FA4130F88; Wed, 25 Sep 2019 19:52:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dpcg1G8nz4PVj; Wed, 25 Sep 2019 19:52:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9B231CC88; Wed, 25 Sep 2019 19:52:34 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PJqYvZ049149; Wed, 25 Sep 2019 19:52:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PJqYjS049148; Wed, 25 Sep 2019 19:52:34 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909251952.x8PJqYjS049148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 25 Sep 2019 19:52:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352720 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 352720 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 19:52:35 -0000 Author: markj Date: Wed Sep 25 19:52:34 2019 New Revision: 352720 URL: https://svnweb.freebsd.org/changeset/base/352720 Log: MFC r346550: Use separate descriptors in bhyve's stdio uart backend. Modified: stable/12/usr.sbin/bhyve/uart_emul.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/uart_emul.c ============================================================================== --- stable/12/usr.sbin/bhyve/uart_emul.c Wed Sep 25 19:51:58 2019 (r352719) +++ stable/12/usr.sbin/bhyve/uart_emul.c Wed Sep 25 19:52:34 2019 (r352720) @@ -100,8 +100,8 @@ struct fifo { struct ttyfd { bool opened; - int fd; /* tty device file descriptor */ - struct termios tio_orig, tio_new; /* I/O Terminals */ + int rfd; /* fd for reading */ + int wfd; /* fd for writing, may be == rfd */ }; struct uart_softc { @@ -141,16 +141,15 @@ ttyclose(void) static void ttyopen(struct ttyfd *tf) { + struct termios orig, new; - tcgetattr(tf->fd, &tf->tio_orig); - - tf->tio_new = tf->tio_orig; - cfmakeraw(&tf->tio_new); - tf->tio_new.c_cflag |= CLOCAL; - tcsetattr(tf->fd, TCSANOW, &tf->tio_new); - - if (tf->fd == STDIN_FILENO) { - tio_stdio_orig = tf->tio_orig; + tcgetattr(tf->rfd, &orig); + new = orig; + cfmakeraw(&new); + new.c_cflag |= CLOCAL; + tcsetattr(tf->rfd, TCSANOW, &new); + if (uart_stdio) { + tio_stdio_orig = orig; atexit(ttyclose); } } @@ -160,7 +159,7 @@ ttyread(struct ttyfd *tf) { unsigned char rb; - if (read(tf->fd, &rb, 1) == 1) + if (read(tf->rfd, &rb, 1) == 1) return (rb); else return (-1); @@ -170,7 +169,7 @@ static void ttywrite(struct ttyfd *tf, unsigned char wb) { - (void)write(tf->fd, &wb, 1); + (void)write(tf->wfd, &wb, 1); } static void @@ -190,7 +189,7 @@ rxfifo_reset(struct uart_softc *sc, int size) * Flush any unread input from the tty buffer. */ while (1) { - nread = read(sc->tty.fd, flushbuf, sizeof(flushbuf)); + nread = read(sc->tty.rfd, flushbuf, sizeof(flushbuf)); if (nread != sizeof(flushbuf)) break; } @@ -277,7 +276,7 @@ uart_opentty(struct uart_softc *sc) { ttyopen(&sc->tty); - sc->mev = mevent_add(sc->tty.fd, EVF_READ, uart_drain, sc); + sc->mev = mevent_add(sc->tty.rfd, EVF_READ, uart_drain, sc); assert(sc->mev != NULL); } @@ -374,7 +373,7 @@ uart_drain(int fd, enum ev_type ev, void *arg) sc = arg; - assert(fd == sc->tty.fd); + assert(fd == sc->tty.rfd); assert(ev == EVF_READ); /* @@ -634,68 +633,79 @@ uart_init(uart_intr_func_t intr_assert, uart_intr_func } static int -uart_tty_backend(struct uart_softc *sc, const char *opts) +uart_stdio_backend(struct uart_softc *sc) { - int fd; - int retval; +#ifndef WITHOUT_CAPSICUM + cap_rights_t rights; + cap_ioctl_t cmds[] = { TIOCGETA, TIOCSETA, TIOCGWINSZ }; +#endif - retval = -1; + if (uart_stdio) + return (-1); - fd = open(opts, O_RDWR | O_NONBLOCK); - if (fd > 0 && isatty(fd)) { - sc->tty.fd = fd; - sc->tty.opened = true; - retval = 0; - } + sc->tty.rfd = STDIN_FILENO; + sc->tty.wfd = STDOUT_FILENO; + sc->tty.opened = true; - return (retval); + if (fcntl(sc->tty.rfd, F_SETFL, O_NONBLOCK) != 0) + return (-1); + if (fcntl(sc->tty.wfd, F_SETFL, O_NONBLOCK) != 0) + return (-1); + +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_EVENT, CAP_IOCTL, CAP_READ); + if (caph_rights_limit(sc->tty.rfd, &rights) == -1) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + if (caph_ioctls_limit(sc->tty.rfd, cmds, nitems(cmds)) == -1) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif + + uart_stdio = true; + + return (0); } -int -uart_set_backend(struct uart_softc *sc, const char *opts) +static int +uart_tty_backend(struct uart_softc *sc, const char *opts) { - int retval; #ifndef WITHOUT_CAPSICUM cap_rights_t rights; cap_ioctl_t cmds[] = { TIOCGETA, TIOCSETA, TIOCGWINSZ }; #endif + int fd; - retval = -1; + fd = open(opts, O_RDWR | O_NONBLOCK); + if (fd < 0 || !isatty(fd)) + return (-1); + sc->tty.rfd = sc->tty.wfd = fd; + sc->tty.opened = true; + +#ifndef WITHOUT_CAPSICUM + cap_rights_init(&rights, CAP_EVENT, CAP_IOCTL, CAP_READ, CAP_WRITE); + if (caph_rights_limit(fd, &rights) == -1) + errx(EX_OSERR, "Unable to apply rights for sandbox"); + if (caph_ioctls_limit(fd, cmds, nitems(cmds)) == -1) + errx(EX_OSERR, "Unable to apply rights for sandbox"); +#endif + + return (0); +} + +int +uart_set_backend(struct uart_softc *sc, const char *opts) +{ + int retval; + if (opts == NULL) return (0); - if (strcmp("stdio", opts) == 0) { - if (!uart_stdio) { - sc->tty.fd = STDIN_FILENO; - sc->tty.opened = true; - uart_stdio = true; - retval = 0; - } - } else if (uart_tty_backend(sc, opts) == 0) { - retval = 0; - } - - /* Make the backend file descriptor non-blocking */ + if (strcmp("stdio", opts) == 0) + retval = uart_stdio_backend(sc); + else + retval = uart_tty_backend(sc, opts); if (retval == 0) - retval = fcntl(sc->tty.fd, F_SETFL, O_NONBLOCK); - - if (retval == 0) { -#ifndef WITHOUT_CAPSICUM - cap_rights_init(&rights, CAP_EVENT, CAP_IOCTL, CAP_READ, - CAP_WRITE); - if (caph_rights_limit(sc->tty.fd, &rights) == -1) - errx(EX_OSERR, "Unable to apply rights for sandbox"); - if (caph_ioctls_limit(sc->tty.fd, cmds, nitems(cmds)) == -1) - errx(EX_OSERR, "Unable to apply rights for sandbox"); - if (!uart_stdio) { - if (caph_limit_stdin() == -1) - errx(EX_OSERR, - "Unable to apply rights for sandbox"); - } -#endif uart_opentty(sc); - } return (retval); } From owner-svn-src-stable@freebsd.org Wed Sep 25 19:55:53 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44838131166; Wed, 25 Sep 2019 19:55:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dphT17Hcz4PnB; Wed, 25 Sep 2019 19:55:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AE021CC90; Wed, 25 Sep 2019 19:55:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PJtqr9049420; Wed, 25 Sep 2019 19:55:52 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PJtqFD049419; Wed, 25 Sep 2019 19:55:52 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909251955.x8PJtqFD049419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 25 Sep 2019 19:55:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352721 - stable/12/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 352721 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 19:55:53 -0000 Author: avg Date: Wed Sep 25 19:55:52 2019 New Revision: 352721 URL: https://svnweb.freebsd.org/changeset/base/352721 Log: MFC r352590: print summary line for space estimate of zfs send from bookmark Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Sep 25 19:52:34 2019 (r352720) +++ stable/12/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Sep 25 19:55:52 2019 (r352721) @@ -2056,6 +2056,15 @@ zfs_send_one(zfs_handle_t *zhp, const char *from, int if (err == 0) { send_print_verbose(fout, zhp->zfs_name, from, size, flags.parsable); + if (flags.parsable) { + (void) fprintf(fout, "size\t%llu\n", + (longlong_t)size); + } else { + char buf[16]; + zfs_nicenum(size, buf, sizeof (buf)); + (void) fprintf(fout, dgettext(TEXT_DOMAIN, + "total estimated size is %s\n"), buf); + } } else { (void) fprintf(stderr, "Cannot estimate send size: " "%s\n", strerror(errno)); From owner-svn-src-stable@freebsd.org Wed Sep 25 19:56:24 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 225F61311C1; Wed, 25 Sep 2019 19:56:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dpj4034kz4PvM; Wed, 25 Sep 2019 19:56:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D8EA71CC91; Wed, 25 Sep 2019 19:56:23 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PJuN93049500; Wed, 25 Sep 2019 19:56:23 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PJuNXs049499; Wed, 25 Sep 2019 19:56:23 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909251956.x8PJuNXs049499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 25 Sep 2019 19:56:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352722 - stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/lib/libzfs/common X-SVN-Commit-Revision: 352722 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 19:56:24 -0000 Author: avg Date: Wed Sep 25 19:56:23 2019 New Revision: 352722 URL: https://svnweb.freebsd.org/changeset/base/352722 Log: MFC r352590: print summary line for space estimate of zfs send from bookmark Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Sep 25 19:55:52 2019 (r352721) +++ stable/11/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Wed Sep 25 19:56:23 2019 (r352722) @@ -2056,6 +2056,15 @@ zfs_send_one(zfs_handle_t *zhp, const char *from, int if (err == 0) { send_print_verbose(fout, zhp->zfs_name, from, size, flags.parsable); + if (flags.parsable) { + (void) fprintf(fout, "size\t%llu\n", + (longlong_t)size); + } else { + char buf[16]; + zfs_nicenum(size, buf, sizeof (buf)); + (void) fprintf(fout, dgettext(TEXT_DOMAIN, + "total estimated size is %s\n"), buf); + } } else { (void) fprintf(stderr, "Cannot estimate send size: " "%s\n", strerror(errno)); From owner-svn-src-stable@freebsd.org Wed Sep 25 20:01:00 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A2A313142D; Wed, 25 Sep 2019 20:01:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dppN1jCZz4Q80; Wed, 25 Sep 2019 20:01:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DCF31CCCF; Wed, 25 Sep 2019 20:01:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PK10XD049877; Wed, 25 Sep 2019 20:01:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PK0xvJ049876; Wed, 25 Sep 2019 20:00:59 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909252000.x8PK0xvJ049876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 25 Sep 2019 20:00:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352723 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 352723 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 20:01:00 -0000 Author: avg Date: Wed Sep 25 20:00:59 2019 New Revision: 352723 URL: https://svnweb.freebsd.org/changeset/base/352723 Log: MFC r352506: fix dsl_scan_ds_clone_swapped logic PR: 239566 Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Sep 25 19:56:23 2019 (r352722) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Sep 25 20:00:59 2019 (r352723) @@ -2014,16 +2014,17 @@ ds_clone_swapped_bookmark(dsl_dataset_t *ds1, dsl_data } /* - * Called when a parent dataset and its clone are swapped. If we were + * Called when an origin dataset and its clone are swapped. If we were * currently traversing the dataset, we need to switch to traversing the - * newly promoted parent. + * newly promoted clone. */ void dsl_scan_ds_clone_swapped(dsl_dataset_t *ds1, dsl_dataset_t *ds2, dmu_tx_t *tx) { dsl_pool_t *dp = ds1->ds_dir->dd_pool; dsl_scan_t *scn = dp->dp_scan; - uint64_t mintxg; + uint64_t mintxg1, mintxg2; + boolean_t ds1_queued, ds2_queued; if (!dsl_scan_is_running(scn)) return; @@ -2031,44 +2032,81 @@ dsl_scan_ds_clone_swapped(dsl_dataset_t *ds1, dsl_data ds_clone_swapped_bookmark(ds1, ds2, &scn->scn_phys.scn_bookmark); ds_clone_swapped_bookmark(ds1, ds2, &scn->scn_phys_cached.scn_bookmark); - if (scan_ds_queue_contains(scn, ds1->ds_object, &mintxg)) { - scan_ds_queue_remove(scn, ds1->ds_object); - scan_ds_queue_insert(scn, ds2->ds_object, mintxg); + /* + * Handle the in-memory scan queue. + */ + ds1_queued = scan_ds_queue_contains(scn, ds1->ds_object, &mintxg1); + ds2_queued = scan_ds_queue_contains(scn, ds2->ds_object, &mintxg2); + + /* Sanity checking. */ + if (ds1_queued) { + ASSERT3U(mintxg1, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); + ASSERT3U(mintxg1, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); } - if (scan_ds_queue_contains(scn, ds2->ds_object, &mintxg)) { + if (ds2_queued) { + ASSERT3U(mintxg2, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); + ASSERT3U(mintxg2, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); + } + + if (ds1_queued && ds2_queued) { + /* + * If both are queued, we don't need to do anything. + * The swapping code below would not handle this case correctly, + * since we can't insert ds2 if it is already there. That's + * because scan_ds_queue_insert() prohibits a duplicate insert + * and panics. + */ + } else if (ds1_queued) { + scan_ds_queue_remove(scn, ds1->ds_object); + scan_ds_queue_insert(scn, ds2->ds_object, mintxg1); + } else if (ds2_queued) { scan_ds_queue_remove(scn, ds2->ds_object); - scan_ds_queue_insert(scn, ds1->ds_object, mintxg); + scan_ds_queue_insert(scn, ds1->ds_object, mintxg2); } - if (zap_lookup_int_key(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, - ds1->ds_object, &mintxg) == 0) { - int err; - ASSERT3U(mintxg, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); - ASSERT3U(mintxg, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); - VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset, + /* + * Handle the on-disk scan queue. + * The on-disk state is an out-of-date version of the in-memory state, + * so the in-memory and on-disk values for ds1_queued and ds2_queued may + * be different. Therefore we need to apply the swap logic to the + * on-disk state independently of the in-memory state. + */ + ds1_queued = zap_lookup_int_key(dp->dp_meta_objset, + scn->scn_phys.scn_queue_obj, ds1->ds_object, &mintxg1) == 0; + ds2_queued = zap_lookup_int_key(dp->dp_meta_objset, + scn->scn_phys.scn_queue_obj, ds2->ds_object, &mintxg2) == 0; + + /* Sanity checking. */ + if (ds1_queued) { + ASSERT3U(mintxg1, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); + ASSERT3U(mintxg1, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); + } + if (ds2_queued) { + ASSERT3U(mintxg2, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); + ASSERT3U(mintxg2, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); + } + + if (ds1_queued && ds2_queued) { + /* + * If both are queued, we don't need to do anything. + * Alternatively, we could check for EEXIST from + * zap_add_int_key() and back out to the original state, but + * that would be more work than checking for this case upfront. + */ + } else if (ds1_queued) { + VERIFY3S(0, ==, zap_remove_int(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, ds1->ds_object, tx)); - err = zap_add_int_key(dp->dp_meta_objset, - scn->scn_phys.scn_queue_obj, ds2->ds_object, mintxg, tx); - VERIFY(err == 0 || err == EEXIST); - if (err == EEXIST) { - /* Both were there to begin with */ - VERIFY(0 == zap_add_int_key(dp->dp_meta_objset, - scn->scn_phys.scn_queue_obj, - ds1->ds_object, mintxg, tx)); - } + VERIFY3S(0, ==, zap_add_int_key(dp->dp_meta_objset, + scn->scn_phys.scn_queue_obj, ds2->ds_object, mintxg1, tx)); zfs_dbgmsg("clone_swap ds %llu; in queue; " "replacing with %llu", (u_longlong_t)ds1->ds_object, (u_longlong_t)ds2->ds_object); - } - if (zap_lookup_int_key(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, - ds2->ds_object, &mintxg) == 0) { - ASSERT3U(mintxg, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); - ASSERT3U(mintxg, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); - VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset, + } else if (ds2_queued) { + VERIFY3S(0, ==, zap_remove_int(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, ds2->ds_object, tx)); - VERIFY(0 == zap_add_int_key(dp->dp_meta_objset, - scn->scn_phys.scn_queue_obj, ds1->ds_object, mintxg, tx)); + VERIFY3S(0, ==, zap_add_int_key(dp->dp_meta_objset, + scn->scn_phys.scn_queue_obj, ds1->ds_object, mintxg2, tx)); zfs_dbgmsg("clone_swap ds %llu; in queue; " "replacing with %llu", (u_longlong_t)ds2->ds_object, From owner-svn-src-stable@freebsd.org Wed Sep 25 20:01:50 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BEEE131529; Wed, 25 Sep 2019 20:01:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dpqL0t5vz4QSw; Wed, 25 Sep 2019 20:01:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0181C1CE1B; Wed, 25 Sep 2019 20:01:50 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8PK1nXx051743; Wed, 25 Sep 2019 20:01:49 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8PK1nbL051742; Wed, 25 Sep 2019 20:01:49 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201909252001.x8PK1nbL051742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Wed, 25 Sep 2019 20:01:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352724 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 352724 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Sep 2019 20:01:50 -0000 Author: avg Date: Wed Sep 25 20:01:49 2019 New Revision: 352724 URL: https://svnweb.freebsd.org/changeset/base/352724 Log: MFC r352506: fix dsl_scan_ds_clone_swapped logic PR: 239566 Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Sep 25 20:00:59 2019 (r352723) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Wed Sep 25 20:01:49 2019 (r352724) @@ -2010,16 +2010,17 @@ ds_clone_swapped_bookmark(dsl_dataset_t *ds1, dsl_data } /* - * Called when a parent dataset and its clone are swapped. If we were + * Called when an origin dataset and its clone are swapped. If we were * currently traversing the dataset, we need to switch to traversing the - * newly promoted parent. + * newly promoted clone. */ void dsl_scan_ds_clone_swapped(dsl_dataset_t *ds1, dsl_dataset_t *ds2, dmu_tx_t *tx) { dsl_pool_t *dp = ds1->ds_dir->dd_pool; dsl_scan_t *scn = dp->dp_scan; - uint64_t mintxg; + uint64_t mintxg1, mintxg2; + boolean_t ds1_queued, ds2_queued; if (!dsl_scan_is_running(scn)) return; @@ -2027,44 +2028,81 @@ dsl_scan_ds_clone_swapped(dsl_dataset_t *ds1, dsl_data ds_clone_swapped_bookmark(ds1, ds2, &scn->scn_phys.scn_bookmark); ds_clone_swapped_bookmark(ds1, ds2, &scn->scn_phys_cached.scn_bookmark); - if (scan_ds_queue_contains(scn, ds1->ds_object, &mintxg)) { - scan_ds_queue_remove(scn, ds1->ds_object); - scan_ds_queue_insert(scn, ds2->ds_object, mintxg); + /* + * Handle the in-memory scan queue. + */ + ds1_queued = scan_ds_queue_contains(scn, ds1->ds_object, &mintxg1); + ds2_queued = scan_ds_queue_contains(scn, ds2->ds_object, &mintxg2); + + /* Sanity checking. */ + if (ds1_queued) { + ASSERT3U(mintxg1, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); + ASSERT3U(mintxg1, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); } - if (scan_ds_queue_contains(scn, ds2->ds_object, &mintxg)) { + if (ds2_queued) { + ASSERT3U(mintxg2, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); + ASSERT3U(mintxg2, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); + } + + if (ds1_queued && ds2_queued) { + /* + * If both are queued, we don't need to do anything. + * The swapping code below would not handle this case correctly, + * since we can't insert ds2 if it is already there. That's + * because scan_ds_queue_insert() prohibits a duplicate insert + * and panics. + */ + } else if (ds1_queued) { + scan_ds_queue_remove(scn, ds1->ds_object); + scan_ds_queue_insert(scn, ds2->ds_object, mintxg1); + } else if (ds2_queued) { scan_ds_queue_remove(scn, ds2->ds_object); - scan_ds_queue_insert(scn, ds1->ds_object, mintxg); + scan_ds_queue_insert(scn, ds1->ds_object, mintxg2); } - if (zap_lookup_int_key(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, - ds1->ds_object, &mintxg) == 0) { - int err; - ASSERT3U(mintxg, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); - ASSERT3U(mintxg, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); - VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset, + /* + * Handle the on-disk scan queue. + * The on-disk state is an out-of-date version of the in-memory state, + * so the in-memory and on-disk values for ds1_queued and ds2_queued may + * be different. Therefore we need to apply the swap logic to the + * on-disk state independently of the in-memory state. + */ + ds1_queued = zap_lookup_int_key(dp->dp_meta_objset, + scn->scn_phys.scn_queue_obj, ds1->ds_object, &mintxg1) == 0; + ds2_queued = zap_lookup_int_key(dp->dp_meta_objset, + scn->scn_phys.scn_queue_obj, ds2->ds_object, &mintxg2) == 0; + + /* Sanity checking. */ + if (ds1_queued) { + ASSERT3U(mintxg1, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); + ASSERT3U(mintxg1, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); + } + if (ds2_queued) { + ASSERT3U(mintxg2, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); + ASSERT3U(mintxg2, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); + } + + if (ds1_queued && ds2_queued) { + /* + * If both are queued, we don't need to do anything. + * Alternatively, we could check for EEXIST from + * zap_add_int_key() and back out to the original state, but + * that would be more work than checking for this case upfront. + */ + } else if (ds1_queued) { + VERIFY3S(0, ==, zap_remove_int(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, ds1->ds_object, tx)); - err = zap_add_int_key(dp->dp_meta_objset, - scn->scn_phys.scn_queue_obj, ds2->ds_object, mintxg, tx); - VERIFY(err == 0 || err == EEXIST); - if (err == EEXIST) { - /* Both were there to begin with */ - VERIFY(0 == zap_add_int_key(dp->dp_meta_objset, - scn->scn_phys.scn_queue_obj, - ds1->ds_object, mintxg, tx)); - } + VERIFY3S(0, ==, zap_add_int_key(dp->dp_meta_objset, + scn->scn_phys.scn_queue_obj, ds2->ds_object, mintxg1, tx)); zfs_dbgmsg("clone_swap ds %llu; in queue; " "replacing with %llu", (u_longlong_t)ds1->ds_object, (u_longlong_t)ds2->ds_object); - } - if (zap_lookup_int_key(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, - ds2->ds_object, &mintxg) == 0) { - ASSERT3U(mintxg, ==, dsl_dataset_phys(ds1)->ds_prev_snap_txg); - ASSERT3U(mintxg, ==, dsl_dataset_phys(ds2)->ds_prev_snap_txg); - VERIFY3U(0, ==, zap_remove_int(dp->dp_meta_objset, + } else if (ds2_queued) { + VERIFY3S(0, ==, zap_remove_int(dp->dp_meta_objset, scn->scn_phys.scn_queue_obj, ds2->ds_object, tx)); - VERIFY(0 == zap_add_int_key(dp->dp_meta_objset, - scn->scn_phys.scn_queue_obj, ds1->ds_object, mintxg, tx)); + VERIFY3S(0, ==, zap_add_int_key(dp->dp_meta_objset, + scn->scn_phys.scn_queue_obj, ds1->ds_object, mintxg2, tx)); zfs_dbgmsg("clone_swap ds %llu; in queue; " "replacing with %llu", (u_longlong_t)ds2->ds_object, From owner-svn-src-stable@freebsd.org Thu Sep 26 01:54:26 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED261F1C44; Thu, 26 Sep 2019 01:54:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46dyfB6kvVz4r1w; Thu, 26 Sep 2019 01:54:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB34E20E3A; Thu, 26 Sep 2019 01:54:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8Q1sQYC069652; Thu, 26 Sep 2019 01:54:26 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8Q1sPGv069643; Thu, 26 Sep 2019 01:54:25 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201909260154.x8Q1sPGv069643@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 26 Sep 2019 01:54:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352735 - in stable/12/sys/dev: mpr mpr/mpi mps X-SVN-Group: stable-12 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in stable/12/sys/dev: mpr mpr/mpi mps X-SVN-Commit-Revision: 352735 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 01:54:27 -0000 Author: imp Date: Thu Sep 26 01:54:24 2019 New Revision: 352735 URL: https://svnweb.freebsd.org/changeset/base/352735 Log: Catch up with stability fixes to mpr/mps in -current since 12 was branched. MFC r341755,r342354,r342355,r342386,r342387,r342388,r342526,r342528, r342530,r342531,r342533,r342534,r342535,r342536,r342659,r345479, r345485,r345573,r347237,r349849,r349909: r341755: Copy and clear the reply descriptor atomically. This prevents concurrency in the interrupt handlers (usually due to timeout/error recovery) from seeing and processing the same descriptor twice. r342354: mps(4), mpr(4): Fix lifetime of command buffer for mp?sas_get_sata_identify r342355: mps(4), mpr(4): remove SATA ID command cancellation hack r342386: First step in refactoring and fixing the error recovery and task management code in the mpr and mps drivers. Eliminate duplicated code and fix some comments. r342387: Commands for user-initated device resets should come from the high-priority allocator. Prior to this change, they would leak from the normal allocator. r342388: Further refactoring for task management commands. Also fix a related typo from the previous commit. r342526: Update MPI header files version to 2.00.52 from 2.00.48 r342528: Copy back the Sense data at proper location expected by the application r342530: Added support for NVMe Task Management r342531: Add Sea,Aero adapter support r342533: Enable atomic type descriptor support only for Sea & Aero cards r342534: On Aero/Sea A0 cards retry MPT Fusion registers reads for max three times r342535: Update copyright information r342536: Update mpr driver version to v23.00.00.00-fbsd r342659: Fix whitespace from r342528 r345479: r329522 created problemss with commands that enter the TIMEDOUT state but are successfully returned by the card (usually due to an abort being issued as part of timeout recovery). Remove what amounts to an insufficient KASSERT, and don't overwrite the state value. State should probably be re-designed, and that will be done with a future commit. r345485: Add event table decoding for SAS Broadcast Primitive events. r345573: Add missing break statements. Coverity CID 1400446. r347237: Add missing newline to debug printf. r349849: Fix bugs in recovery path and improve cm tracking r349909: More fully implement the state machine. Sponsored by: Netflix, Inc Modified: stable/12/sys/dev/mpr/mpi/mpi2.h stable/12/sys/dev/mpr/mpi/mpi2_cnfg.h stable/12/sys/dev/mpr/mpi/mpi2_hbd.h stable/12/sys/dev/mpr/mpi/mpi2_history.txt stable/12/sys/dev/mpr/mpi/mpi2_init.h stable/12/sys/dev/mpr/mpi/mpi2_ioc.h stable/12/sys/dev/mpr/mpi/mpi2_pci.h stable/12/sys/dev/mpr/mpi/mpi2_ra.h stable/12/sys/dev/mpr/mpi/mpi2_raid.h stable/12/sys/dev/mpr/mpi/mpi2_sas.h stable/12/sys/dev/mpr/mpi/mpi2_targ.h stable/12/sys/dev/mpr/mpi/mpi2_tool.h stable/12/sys/dev/mpr/mpi/mpi2_type.h stable/12/sys/dev/mpr/mpr.c stable/12/sys/dev/mpr/mpr_config.c stable/12/sys/dev/mpr/mpr_ioctl.h stable/12/sys/dev/mpr/mpr_mapping.c stable/12/sys/dev/mpr/mpr_mapping.h stable/12/sys/dev/mpr/mpr_pci.c stable/12/sys/dev/mpr/mpr_sas.c stable/12/sys/dev/mpr/mpr_sas.h stable/12/sys/dev/mpr/mpr_sas_lsi.c stable/12/sys/dev/mpr/mpr_table.c stable/12/sys/dev/mpr/mpr_user.c stable/12/sys/dev/mpr/mprvar.h stable/12/sys/dev/mps/mps.c stable/12/sys/dev/mps/mps_sas.c stable/12/sys/dev/mps/mps_sas_lsi.c stable/12/sys/dev/mps/mps_table.c stable/12/sys/dev/mps/mps_user.c stable/12/sys/dev/mps/mpsvar.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/mpr/mpi/mpi2.h ============================================================================== --- stable/12/sys/dev/mpr/mpi/mpi2.h Thu Sep 26 01:51:55 2019 (r352734) +++ stable/12/sys/dev/mpr/mpi/mpi2.h Thu Sep 26 01:54:24 2019 (r352735) @@ -1,7 +1,5 @@ /*- - * Copyright (c) 2012-2015 LSI Corp. - * Copyright (c) 2013-2016 Avago Technologies - * All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,15 +25,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * Avago Technologies (LSI) MPT-Fusion Host Adapter FreeBSD + * Broadcom Inc. (LSI) MPT-Fusion Host Adapter FreeBSD * * $FreeBSD$ */ /* - * Copyright (c) 2000-2015 LSI Corporation. - * Copyright (c) 2013-2016 Avago Technologies - * All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * * Name: mpi2.h @@ -44,7 +40,7 @@ * scatter/gather formats. * Creation Date: June 21, 2006 * - * mpi2.h Version: 02.00.48 + * mpi2.h Version: 02.00.52 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -153,6 +149,11 @@ * 09-02-16 02.00.46 Bumped MPI2_HEADER_VERSION_UNIT. * 11-23-16 02.00.47 Bumped MPI2_HEADER_VERSION_UNIT. * 02-03-17 02.00.48 Bumped MPI2_HEADER_VERSION_UNIT. + * 06-13-17 02.00.49 Bumped MPI2_HEADER_VERSION_UNIT. + * 09-29-17 02.00.50 Bumped MPI2_HEADER_VERSION_UNIT. + * 07-22-18 02.00.51 Added SECURE_BOOT define. + * Bumped MPI2_HEADER_VERSION_UNIT + * 08-15-18 02.00.52 Bumped MPI2_HEADER_VERSION_UNIT. * -------------------------------------------------------------------------- */ @@ -196,7 +197,7 @@ /* Unit and Dev versioning for this MPI header set */ -#define MPI2_HEADER_VERSION_UNIT (0x30) +#define MPI2_HEADER_VERSION_UNIT (0x34) #define MPI2_HEADER_VERSION_DEV (0x00) #define MPI2_HEADER_VERSION_UNIT_MASK (0xFF00) #define MPI2_HEADER_VERSION_UNIT_SHIFT (8) @@ -297,6 +298,8 @@ typedef volatile struct _MPI2_SYSTEM_INTERFACE_REGS * Defines for the HostDiagnostic register */ #define MPI2_HOST_DIAGNOSTIC_OFFSET (0x00000008) + +#define MPI26_DIAG_SECURE_BOOT (0x80000000) #define MPI2_DIAG_SBR_RELOAD (0x00002000) Modified: stable/12/sys/dev/mpr/mpi/mpi2_cnfg.h ============================================================================== --- stable/12/sys/dev/mpr/mpi/mpi2_cnfg.h Thu Sep 26 01:51:55 2019 (r352734) +++ stable/12/sys/dev/mpr/mpi/mpi2_cnfg.h Thu Sep 26 01:54:24 2019 (r352735) @@ -1,7 +1,5 @@ /*- - * Copyright (c) 2012-2015 LSI Corp. - * Copyright (c) 2013-2016 Avago Technologies - * All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,22 +25,20 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * Avago Technologies (LSI) MPT-Fusion Host Adapter FreeBSD + * Broadcom Inc. (LSI) MPT-Fusion Host Adapter FreeBSD * * $FreeBSD$ */ /* - * Copyright (c) 2000-2015 LSI Corporation. - * Copyright (c) 2013-2016 Avago Technologies - * All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * * Name: mpi2_cnfg.h * Title: MPI Configuration messages and pages * Creation Date: November 10, 2006 * - * mpi2_cnfg.h Version: 02.00.40 + * mpi2_cnfg.h Version: 02.00.45 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -259,6 +255,27 @@ * Added ChassisSlot field to SAS Enclosure Page 0. * Added ChassisSlot Valid bit (bit 5) to the Flags field * in SAS Enclosure Page 0. + * 06-13-17 02.00.41 Added MPI26_MFGPAGE_DEVID_SAS3816 and + * MPI26_MFGPAGE_DEVID_SAS3916 defines. + * Removed MPI26_MFGPAGE_DEVID_SAS4008 define. + * Added MPI26_PCIEIOUNIT1_LINKFLAGS_SRNS_EN define. + * Renamed PI26_PCIEIOUNIT1_LINKFLAGS_EN_SRIS to + * PI26_PCIEIOUNIT1_LINKFLAGS_SRIS_EN. + * Renamed MPI26_PCIEIOUNIT1_LINKFLAGS_DIS_SRIS to + * MPI26_PCIEIOUNIT1_LINKFLAGS_DIS_SEPARATE_REFCLK. + * 09-29-17 02.00.42 Added ControllerResetTO field to PCIe Device Page 2. + * Added NOIOB field to PCIe Device Page 2. + * Added MPI26_PCIEDEV2_CAP_DATA_BLK_ALIGN_AND_GRAN to + * the Capabilities field of PCIe Device Page 2. + * 07-22-18 02.00.43 Added defines for SAS3916 and SAS3816. + * Added WRiteCache defines to IO Unit Page 1. + * Added MaxEnclosureLevel to BIOS Page 1. + * Added OEMRD to SAS Enclosure Page 1. + * Added DMDReportPCIe to PCIe IO Unit Page 1. + * Added Flags field and flags for Retimers to + * PCIe Switch Page 1. + * 08-02-18 02.00.44 Added Slotx2, Slotx4 to ManPage 7. + * 08-15-18 02.00.45 Added ProductSpecific field at end of IOC Page 1 * -------------------------------------------------------------------------- */ @@ -601,9 +618,19 @@ typedef struct _MPI2_CONFIG_REPLY #define MPI26_MFGPAGE_DEVID_SAS3616 (0x00D1) #define MPI26_MFGPAGE_DEVID_SAS3708 (0x00D2) -#define MPI26_MFGPAGE_DEVID_SAS4008 (0x00A1) +#define MPI26_MFGPAGE_DEVID_SEC_MASK_SAS3916 (0x0003) +#define MPI26_MFGPAGE_DEVID_INVALID0_SAS3916 (0x00E0) +#define MPI26_MFGPAGE_DEVID_CFG_SEC_SAS3916 (0x00E1) +#define MPI26_MFGPAGE_DEVID_HARD_SEC_SAS3916 (0x00E2) +#define MPI26_MFGPAGE_DEVID_INVALID1_SAS3916 (0x00E3) +#define MPI26_MFGPAGE_DEVID_SEC_MASK_SAS3816 (0x0003) +#define MPI26_MFGPAGE_DEVID_INVALID0_SAS3816 (0x00E4) +#define MPI26_MFGPAGE_DEVID_CFG_SEC_SAS3816 (0x00E5) +#define MPI26_MFGPAGE_DEVID_HARD_SEC_SAS3816 (0x00E6) +#define MPI26_MFGPAGE_DEVID_INVALID1_SAS3816 (0x00E7) + /* Manufacturing Page 0 */ typedef struct _MPI2_CONFIG_PAGE_MAN_0 @@ -818,7 +845,8 @@ typedef struct _MPI2_MANPAGE7_CONNECTOR_INFO U8 Location; /* 0x14 */ U8 ReceptacleID; /* 0x15 */ U16 Slot; /* 0x16 */ - U32 Reserved2; /* 0x18 */ + U16 Slotx4; /* 0x18 */ + U16 Slotx2; /* 0x1A */ } MPI2_MANPAGE7_CONNECTOR_INFO, MPI2_POINTER PTR_MPI2_MANPAGE7_CONNECTOR_INFO, Mpi2ManPage7ConnectorInfo_t, MPI2_POINTER pMpi2ManPage7ConnectorInfo_t; @@ -960,6 +988,10 @@ typedef struct _MPI2_CONFIG_PAGE_IO_UNIT_1 #define MPI2_IOUNITPAGE1_PAGEVERSION (0x04) /* IO Unit Page 1 Flags defines */ +#define MPI26_IOUNITPAGE1_NVME_WRITE_CACHE_MASK (0x00030000) +#define MPI26_IOUNITPAGE1_NVME_WRITE_CACHE_ENABLE (0x00000000) +#define MPI26_IOUNITPAGE1_NVME_WRITE_CACHE_DISABLE (0x00010000) +#define MPI26_IOUNITPAGE1_NVME_WRITE_CACHE_NO_CHANGE (0x00020000) #define MPI2_IOUNITPAGE1_ATA_SECURITY_FREEZE_LOCK (0x00004000) #define MPI25_IOUNITPAGE1_NEW_DEVICE_FAST_PATH_DISABLE (0x00002000) #define MPI25_IOUNITPAGE1_DISABLE_FAST_PATH (0x00001000) @@ -1384,7 +1416,7 @@ typedef struct _MPI2_CONFIG_PAGE_IOC_1 U8 PCIBusNum; /* 0x0E */ U8 PCIDomainSegment; /* 0x0F */ U32 Reserved1; /* 0x10 */ - U32 Reserved2; /* 0x14 */ + U32 ProductSpecific; /* 0x14 */ } MPI2_CONFIG_PAGE_IOC_1, MPI2_POINTER PTR_MPI2_CONFIG_PAGE_IOC_1, Mpi2IOCPage1_t, MPI2_POINTER pMpi2IOCPage1_t; @@ -1510,7 +1542,7 @@ typedef struct _MPI2_CONFIG_PAGE_BIOS_1 U32 BiosOptions; /* 0x04 */ U32 IOCSettings; /* 0x08 */ U8 SSUTimeout; /* 0x0C */ - U8 Reserved1; /* 0x0D */ + U8 MaxEnclosureLevel; /* 0x0D */ U16 Reserved2; /* 0x0E */ U32 DeviceSettings; /* 0x10 */ U16 NumberOfDevices; /* 0x14 */ @@ -3102,7 +3134,9 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0 U8 ChassisSlot; /* 0x1C */ U8 EnclosureLevel; /* 0x1D */ U16 SEPDevHandle; /* 0x1E */ - U32 Reserved2; /* 0x20 */ + U8 OEMRD; /* 0x20 */ + U8 Reserved1a; /* 0x21 */ + U16 Reserved2; /* 0x22 */ U32 Reserved3; /* 0x24 */ } MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0, MPI2_POINTER PTR_MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0, @@ -3114,6 +3148,8 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0 #define MPI2_SASENCLOSURE0_PAGEVERSION (0x04) /* values for SAS Enclosure Page 0 Flags field */ +#define MPI26_SAS_ENCLS0_FLAGS_OEMRD_VALID (0x0080) +#define MPI26_SAS_ENCLS0_FLAGS_OEMRD_COLLECTING (0x0040) #define MPI2_SAS_ENCLS0_FLAGS_CHASSIS_SLOT_VALID (0x0020) #define MPI2_SAS_ENCLS0_FLAGS_ENCL_LEVEL_VALID (0x0010) #define MPI2_SAS_ENCLS0_FLAGS_MNG_MASK (0x000F) @@ -3127,6 +3163,8 @@ typedef struct _MPI2_CONFIG_PAGE_SAS_ENCLOSURE_0 #define MPI26_ENCLOSURE0_PAGEVERSION (0x04) /* Values for Enclosure Page 0 Flags field */ +#define MPI26_ENCLS0_FLAGS_OEMRD_VALID (0x0080) +#define MPI26_ENCLS0_FLAGS_OEMRD_COLLECTING (0x0040) #define MPI26_ENCLS0_FLAGS_CHASSIS_SLOT_VALID (0x0020) #define MPI26_ENCLS0_FLAGS_ENCL_LEVEL_VALID (0x0010) #define MPI26_ENCLS0_FLAGS_MNG_MASK (0x000F) @@ -3502,8 +3540,9 @@ typedef struct _MPI26_PCIE_IO_UNIT1_PHY_DATA Mpi26PCIeIOUnit1PhyData_t, MPI2_POINTER pMpi26PCIeIOUnit1PhyData_t; /* values for LinkFlags */ -#define MPI26_PCIEIOUNIT1_LINKFLAGS_DIS_SRIS (0x00) -#define MPI26_PCIEIOUNIT1_LINKFLAGS_EN_SRIS (0x01) +#define MPI26_PCIEIOUNIT1_LINKFLAGS_DIS_SEPARATE_REFCLK (0x00) +#define MPI26_PCIEIOUNIT1_LINKFLAGS_SRIS_EN (0x01) +#define MPI26_PCIEIOUNIT1_LINKFLAGS_SRNS_EN (0x02) /* * Host code (drivers, BIOS, utilities, etc.) should leave this define set to @@ -3521,7 +3560,7 @@ typedef struct _MPI26_CONFIG_PAGE_PIOUNIT_1 U16 AdditionalControlFlags; /* 0x0C */ U16 NVMeMaxQueueDepth; /* 0x0E */ U8 NumPhys; /* 0x10 */ - U8 Reserved1; /* 0x11 */ + U8 DMDReportPCIe; /* 0x11 */ U16 Reserved2; /* 0x12 */ MPI26_PCIE_IO_UNIT1_PHY_DATA PhyData[MPI26_PCIE_IOUNIT1_PHY_MAX];/* 0x14 */ } MPI26_CONFIG_PAGE_PIOUNIT_1, @@ -3542,6 +3581,13 @@ typedef struct _MPI26_CONFIG_PAGE_PIOUNIT_1 #define MPI26_PCIEIOUNIT1_MAX_RATE_8_0 (0x40) #define MPI26_PCIEIOUNIT1_MAX_RATE_16_0 (0x50) +/* values for PCIe IO Unit Page 1 DMDReportPCIe */ +#define MPI26_PCIEIOUNIT1_DMD_REPORT_UNITS_MASK (0x80) +#define MPI26_PCIEIOUNIT1_DMD_REPORT_UNITS_1_SEC (0x00) +#define MPI26_PCIEIOUNIT1_DMD_REPORT_UNITS_16_SEC (0x80) +#define MPI26_PCIEIOUNIT1_DMD_REPORT_DELAY_TIME_MASK (0x7F) + + /* see mpi2_pci.h for values for PCIe IO Unit Page 0 ControllerPhyDeviceInfo values */ @@ -3585,16 +3631,22 @@ typedef struct _MPI26_CONFIG_PAGE_PSWITCH_1 U16 SwitchDevHandle; /* 0x10 */ U8 NegotiatedPortWidth; /* 0x12 */ U8 NegotiatedLinkRate; /* 0x13 */ - U32 Reserved4; /* 0x14 */ + U16 Flags; /* 0x14 */ + U16 Reserved4; /* 0x16 */ U32 Reserved5; /* 0x18 */ } MPI26_CONFIG_PAGE_PSWITCH_1, MPI2_POINTER PTR_MPI26_CONFIG_PAGE_PSWITCH_1, Mpi26PCIeSwitchPage1_t, MPI2_POINTER pMpi26PCIeSwitchPage1_t; -#define MPI26_PCIESWITCH1_PAGEVERSION (0x00) +#define MPI26_PCIESWITCH1_PAGEVERSION (0x00) /* use MPI26_PCIE_NEG_LINK_RATE_ defines for the NegotiatedLinkRate field */ +/* defines for the Flags field */ +#define MPI26_PCIESWITCH1_2_RETIMER_PRESENCE (0x0002) +#define MPI26_PCIESWITCH1_RETIMER_PRESENCE (0x0001) + + /**************************************************************************** * PCIe Device Config Pages (MPI v2.6 and later) ****************************************************************************/ @@ -3655,18 +3707,20 @@ typedef struct _MPI26_CONFIG_PAGE_PCIEDEV_0 /* see mpi2_pci.h for the MPI26_PCIE_DEVINFO_ defines used for the DeviceInfo field */ /* values for PCIe Device Page 0 Flags field */ -#define MPI26_PCIEDEV0_FLAGS_UNAUTHORIZED_DEVICE (0x8000) -#define MPI26_PCIEDEV0_FLAGS_ENABLED_FAST_PATH (0x4000) -#define MPI26_PCIEDEV0_FLAGS_FAST_PATH_CAPABLE (0x2000) -#define MPI26_PCIEDEV0_FLAGS_ASYNCHRONOUS_NOTIFICATION (0x0400) -#define MPI26_PCIEDEV0_FLAGS_ATA_SW_PRESERVATION (0x0200) -#define MPI26_PCIEDEV0_FLAGS_UNSUPPORTED_DEVICE (0x0100) -#define MPI26_PCIEDEV0_FLAGS_ATA_48BIT_LBA_SUPPORTED (0x0080) -#define MPI26_PCIEDEV0_FLAGS_ATA_SMART_SUPPORTED (0x0040) -#define MPI26_PCIEDEV0_FLAGS_ATA_NCQ_SUPPORTED (0x0020) -#define MPI26_PCIEDEV0_FLAGS_ATA_FUA_SUPPORTED (0x0010) -#define MPI26_PCIEDEV0_FLAGS_ENCL_LEVEL_VALID (0x0002) -#define MPI26_PCIEDEV0_FLAGS_DEVICE_PRESENT (0x0001) +#define MPI26_PCIEDEV0_FLAGS_2_RETIMER_PRESENCE (0x00020000) +#define MPI26_PCIEDEV0_FLAGS_RETIMER_PRESENCE (0x00010000) +#define MPI26_PCIEDEV0_FLAGS_UNAUTHORIZED_DEVICE (0x00008000) +#define MPI26_PCIEDEV0_FLAGS_ENABLED_FAST_PATH (0x00004000) +#define MPI26_PCIEDEV0_FLAGS_FAST_PATH_CAPABLE (0x00002000) +#define MPI26_PCIEDEV0_FLAGS_ASYNCHRONOUS_NOTIFICATION (0x00000400) +#define MPI26_PCIEDEV0_FLAGS_ATA_SW_PRESERVATION (0x00000200) +#define MPI26_PCIEDEV0_FLAGS_UNSUPPORTED_DEVICE (0x00000100) +#define MPI26_PCIEDEV0_FLAGS_ATA_48BIT_LBA_SUPPORTED (0x00000080) +#define MPI26_PCIEDEV0_FLAGS_ATA_SMART_SUPPORTED (0x00000040) +#define MPI26_PCIEDEV0_FLAGS_ATA_NCQ_SUPPORTED (0x00000020) +#define MPI26_PCIEDEV0_FLAGS_ATA_FUA_SUPPORTED (0x00000010) +#define MPI26_PCIEDEV0_FLAGS_ENCL_LEVEL_VALID (0x00000002) +#define MPI26_PCIEDEV0_FLAGS_DEVICE_PRESENT (0x00000001) /* values for PCIe Device Page 0 SupportedLinkRates field */ #define MPI26_PCIEDEV0_LINK_RATE_16_0_SUPPORTED (0x08) @@ -3683,19 +3737,25 @@ typedef struct _MPI26_CONFIG_PAGE_PCIEDEV_2 { MPI2_CONFIG_EXTENDED_PAGE_HEADER Header; /* 0x00 */ U16 DevHandle; /* 0x08 */ - U16 Reserved1; /* 0x0A */ + U8 ControllerResetTO; /* 0x0A */ + U8 Reserved1; /* 0x0B */ U32 MaximumDataTransferSize;/* 0x0C */ U32 Capabilities; /* 0x10 */ - U32 Reserved2; /* 0x14 */ + U16 NOIOB; /* 0x14 */ + U16 Reserved2; /* 0x16 */ } MPI26_CONFIG_PAGE_PCIEDEV_2, MPI2_POINTER PTR_MPI26_CONFIG_PAGE_PCIEDEV_2, Mpi26PCIeDevicePage2_t, MPI2_POINTER pMpi26PCIeDevicePage2_t; -#define MPI26_PCIEDEVICE2_PAGEVERSION (0x00) +#define MPI26_PCIEDEVICE2_PAGEVERSION (0x01) /* defines for PCIe Device Page 2 Capabilities field */ -#define MPI26_PCIEDEV2_CAP_SGL_FORMAT (0x00000004) -#define MPI26_PCIEDEV2_CAP_BIT_BUCKET_SUPPORT (0x00000002) -#define MPI26_PCIEDEV2_CAP_SGL_SUPPORT (0x00000001) +#define MPI26_PCIEDEV2_CAP_DATA_BLK_ALIGN_AND_GRAN (0x00000008) +#define MPI26_PCIEDEV2_CAP_SGL_FORMAT (0x00000004) +#define MPI26_PCIEDEV2_CAP_BIT_BUCKET_SUPPORT (0x00000002) +#define MPI26_PCIEDEV2_CAP_SGL_SUPPORT (0x00000001) + +/* Defines for the NOIOB field */ +#define MPI26_PCIEDEV2_NOIOB_UNSUPPORTED (0x0000) /**************************************************************************** Modified: stable/12/sys/dev/mpr/mpi/mpi2_hbd.h ============================================================================== --- stable/12/sys/dev/mpr/mpi/mpi2_hbd.h Thu Sep 26 01:51:55 2019 (r352734) +++ stable/12/sys/dev/mpr/mpi/mpi2_hbd.h Thu Sep 26 01:54:24 2019 (r352735) @@ -1,7 +1,5 @@ /*- - * Copyright (c) 2012-2015 LSI Corp. - * Copyright (c) 2013-2016 Avago Technologies - * All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,15 +25,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * Avago Technologies (LSI) MPT-Fusion Host Adapter FreeBSD + * Broadcom Inc. (LSI) MPT-Fusion Host Adapter FreeBSD * * $FreeBSD$ */ /* - * Copyright (c) 2009-2015 LSI Corporation. - * Copyright (c) 2013-2016 Avago Technologies - * All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * * Name: mpi2_hbd.h Modified: stable/12/sys/dev/mpr/mpi/mpi2_history.txt ============================================================================== --- stable/12/sys/dev/mpr/mpi/mpi2_history.txt Thu Sep 26 01:51:55 2019 (r352734) +++ stable/12/sys/dev/mpr/mpi/mpi2_history.txt Thu Sep 26 01:54:24 2019 (r352735) @@ -1,7 +1,5 @@ /*- - * Copyright (c) 2012-2015 LSI Corp. - * Copyright (c) 2013-2016 Avago Technologies - * All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * Avago Technologies (LSI) MPT-Fusion Host Adapter FreeBSD + * Broadcom Inc. (LSI) MPT-Fusion Host Adapter FreeBSD * * $FreeBSD$ */ @@ -36,21 +34,19 @@ Fusion-MPT MPI 2.0 / 2.5 Header File Change History ============================== - Copyright (c) 2000-2015 LSI Corporation. - Copyright (c) 2013-2016 Avago Technologies - All rights reserved. + Copyright 2000-2020 Broadcom Inc. All rights reserved. --------------------------------------- - Header Set Release Version: 02.00.48 - Header Set Release Date: 02-03-17 + Header Set Release Version: 02.00.50 + Header Set Release Date: 09-29-17 --------------------------------------- Filename Current version Prior version ---------- --------------- ------------- - mpi2.h 02.00.48 02.00.47 - mpi2_cnfg.h 02.00.40 02.00.39 + mpi2.h 02.00.50 02.00.49 + mpi2_cnfg.h 02.00.42 02.00.41 mpi2_init.h 02.00.21 02.00.21 - mpi2_ioc.h 02.00.32 02.00.31 + mpi2_ioc.h 02.00.34 02.00.33 mpi2_raid.h 02.00.11 02.00.11 mpi2_sas.h 02.00.10 02.00.10 mpi2_targ.h 02.00.09 02.00.09 @@ -59,7 +55,7 @@ mpi2_ra.h 02.00.01 02.00.01 mpi2_hbd.h 02.00.04 02.00.04 mpi2_pci.h 02.00.02 02.00.02 - mpi2_history.txt 02.00.45 02.00.44 + mpi2_history.txt 02.00.46 02.00.45 * Date Version Description @@ -163,6 +159,8 @@ mpi2.h * 09-02-16 02.00.46 Bumped MPI2_HEADER_VERSION_UNIT. * 11-23-16 02.00.47 Bumped MPI2_HEADER_VERSION_UNIT. * 02-03-17 02.00.48 Bumped MPI2_HEADER_VERSION_UNIT. + * 06-13-17 02.00.49 Bumped MPI2_HEADER_VERSION_UNIT. + * 09-29-17 02.00.50 Bumped MPI2_HEADER_VERSION_UNIT. * -------------------------------------------------------------------------- mpi2_cnfg.h @@ -371,6 +369,18 @@ mpi2_cnfg.h * Added ChassisSlot field to SAS Enclosure Page 0. * Added ChassisSlot Valid bit (bit 5) to the Flags field * in SAS Enclosure Page 0. + * 06-13-17 02.00.41 Added MPI26_MFGPAGE_DEVID_SAS3816 and + * MPI26_MFGPAGE_DEVID_SAS3916 defines. + * Removed MPI26_MFGPAGE_DEVID_SAS4008 define. + * Added MPI26_PCIEIOUNIT1_LINKFLAGS_SRNS_EN define. + * Renamed MPI26_PCIEIOUNIT1_LINKFLAGS_EN_SRIS to + * MPI26_PCIEIOUNIT1_LINKFLAGS_SRIS_EN. + * Renamed MPI26_PCIEIOUNIT1_LINKFLAGS_DIS_SRIS to + * MPI26_PCIEIOUNIT1_LINKFLAGS_DIS_SEPARATE_REFCLK. + * 09-29-17 02.00.42 Added ControllerResetTO field to PCIe Device Page 2. + * Added NOIOB field to PCIe Device Page 2. + * Added MPI26_PCIEDEV2_CAP_DATA_BLK_ALIGN_AND_GRAN to + * the Capabilities field of PCIe Device Page 2. * -------------------------------------------------------------------------- mpi2_init.h @@ -566,6 +576,10 @@ mpi2_ioc.h * 02-02-17 02.00.32 Added MPI2_FW_DOWNLOAD_ITYPE_CBB_BACKUP. * Added MPI25_EVENT_DATA_ACTIVE_CABLE_EXCEPT and related * defines for the ReasonCode field. + * 06-13-17 02.00.33 Added MPI2_FW_DOWNLOAD_ITYPE_CPLD. + * 09-29-17 02.00.34 Added MPI26_EVENT_PCIDEV_STAT_RC_PCIE_HOT_RESET_FAILED + * to the ReasonCode field in PCIe Device Status Change + * Event Data. * -------------------------------------------------------------------------- mpi2_raid.h @@ -687,20 +701,20 @@ mpi2_pci.h mpi2_history.txt Parts list history -Filename 02.00.48 ----------- -------- -mpi2.h 02.00.48 -mpi2_cnfg.h 02.00.40 -mpi2_init.h 02.00.21 -mpi2_ioc.h 02.00.32 -mpi2_raid.h 02.00.11 -mpi2_sas.h 02.00.10 -mpi2_targ.h 02.00.09 -mpi2_tool.h 02.00.14 -mpi2_type.h 02.00.01 -mpi2_ra.h 02.00.01 -mpi2_hbd.h 02.00.04 -mpi2_pci.h 02.00.02 +Filename 02.00.50 02.00.49 02.00.48 +---------- -------- -------- -------- +mpi2.h 02.00.50 02.00.49 02.00.48 +mpi2_cnfg.h 02.00.42 02.00.41 02.00.40 +mpi2_init.h 02.00.21 02.00.21 02.00.21 +mpi2_ioc.h 02.00.34 02.00.33 02.00.32 +mpi2_raid.h 02.00.11 02.00.11 02.00.11 +mpi2_sas.h 02.00.10 02.00.10 02.00.10 +mpi2_targ.h 02.00.09 02.00.09 02.00.09 +mpi2_tool.h 02.00.14 02.00.14 02.00.14 +mpi2_type.h 02.00.01 02.00.01 02.00.01 +mpi2_ra.h 02.00.01 02.00.01 02.00.01 +mpi2_hbd.h 02.00.04 02.00.04 02.00.04 +mpi2_pci.h 02.00.02 02.00.02 02.00.02 Filename 02.00.47 02.00.46 02.00.45 02.00.44 02.00.43 02.00.42 ---------- -------- -------- -------- -------- -------- -------- Modified: stable/12/sys/dev/mpr/mpi/mpi2_init.h ============================================================================== --- stable/12/sys/dev/mpr/mpi/mpi2_init.h Thu Sep 26 01:51:55 2019 (r352734) +++ stable/12/sys/dev/mpr/mpi/mpi2_init.h Thu Sep 26 01:54:24 2019 (r352735) @@ -1,7 +1,5 @@ /*- - * Copyright (c) 2012-2015 LSI Corp. - * Copyright (c) 2013-2016 Avago Technologies - * All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,15 +25,13 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * Avago Technologies (LSI) MPT-Fusion Host Adapter FreeBSD + * Broadcom Inc. (LSI) MPT-Fusion Host Adapter FreeBSD * * $FreeBSD$ */ /* - * Copyright (c) 2000-2015 LSI Corporation. - * Copyright (c) 2013-2016 Avago Technologies - * All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * * Name: mpi2_init.h @@ -62,7 +58,7 @@ * 05-21-08 02.00.05 Fixed typo in name of Mpi2SepRequest_t. * 10-02-08 02.00.06 Removed Untagged and No Disconnect values from SCSI IO * Control field Task Attribute flags. - * Moved LUN field defines to mpi2.h because they are + * Moved LUN field defines to mpi2.h becasue they are * common to many structures. * 05-06-09 02.00.07 Changed task management type of Query Unit Attention to * Query Asynchronous Event. Modified: stable/12/sys/dev/mpr/mpi/mpi2_ioc.h ============================================================================== --- stable/12/sys/dev/mpr/mpi/mpi2_ioc.h Thu Sep 26 01:51:55 2019 (r352734) +++ stable/12/sys/dev/mpr/mpi/mpi2_ioc.h Thu Sep 26 01:54:24 2019 (r352735) @@ -1,7 +1,5 @@ /*- - * Copyright (c) 2012-2015 LSI Corp. - * Copyright (c) 2013-2016 Avago Technologies - * All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,22 +25,20 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * Avago Technologies (LSI) MPT-Fusion Host Adapter FreeBSD + * Broadcom Inc. (LSI) MPT-Fusion Host Adapter FreeBSD * * $FreeBSD$ */ /* - * Copyright (c) 2000-2015 LSI Corporation. - * Copyright (c) 2013-2016 Avago Technologies - * All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * * Name: mpi2_ioc.h * Title: MPI IOC, Port, Event, FW Download, and FW Upload messages * Creation Date: October 11, 2006 * - * mpi2_ioc.h Version: 02.00.32 + * mpi2_ioc.h Version: 02.00.36 * * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25 * prefix are for use only on MPI v2.5 products, and must not be used @@ -205,6 +201,13 @@ * 02-02-17 02.00.32 Added MPI2_FW_DOWNLOAD_ITYPE_CBB_BACKUP. * Added MPI25_EVENT_DATA_ACTIVE_CABLE_EXCEPT and related * defines for the ReasonCode field. + * 06-13-17 02.00.33 Added MPI2_FW_DOWNLOAD_ITYPE_CPLD. + * 09-29-17 02.00.34 Added MPI26_EVENT_PCIDEV_STAT_RC_PCIE_HOT_RESET_FAILED + * to the ReasonCode field in PCIe Device Status Change + * Event Data. + * 07-22-18 02.00.35 Added FW_DOWNLOAD_ITYPE_CPLD and _PSOC. + * Moved FW image definitions ionto new mpi2_image,h + * 08-14-18 02.00.36 Fixed definition of MPI2_FW_DOWNLOAD_ITYPE_PSOC (0x16) * -------------------------------------------------------------------------- */ @@ -1270,6 +1273,7 @@ typedef struct _MPI26_EVENT_DATA_PCIE_DEVICE_STATUS_CH #define MPI26_EVENT_PCIDEV_STAT_RC_CMP_INTERNAL_DEV_RESET (0x0E) #define MPI26_EVENT_PCIDEV_STAT_RC_CMP_TASK_ABORT_INTERNAL (0x0F) #define MPI26_EVENT_PCIDEV_STAT_RC_DEV_INIT_FAILURE (0x10) +#define MPI26_EVENT_PCIDEV_STAT_RC_PCIE_HOT_RESET_FAILED (0x11) /* PCIe Enumeration Event data (MPI v2.6 and later) */ @@ -1534,8 +1538,12 @@ typedef struct _MPI2_FW_DOWNLOAD_REQUEST #define MPI2_FW_DOWNLOAD_ITYPE_CTLR (0x12) #define MPI2_FW_DOWNLOAD_ITYPE_IMR_FIRMWARE (0x13) #define MPI2_FW_DOWNLOAD_ITYPE_MR_NVDATA (0x14) +#define MPI2_FW_DOWNLOAD_ITYPE_CPLD (0x15) /* MPI v2.6 and newer */ +#define MPI2_FW_DOWNLOAD_ITYPE_PSOC (0x16) /* MPI v2.6 and newer */ #define MPI2_FW_DOWNLOAD_ITYPE_MIN_PRODUCT_SPECIFIC (0xF0) +#define MPI2_FW_DOWNLOAD_ITYPE_TERMINATE (0xFF) /* MPI v2.6 and newer */ + /* MPI v2.0 FWDownload TransactionContext Element */ typedef struct _MPI2_FW_DOWNLOAD_TCSGE { @@ -1692,367 +1700,6 @@ typedef struct _MPI2_FW_UPLOAD_REPLY } MPI2_FW_UPLOAD_REPLY, MPI2_POINTER PTR_MPI2_FW_UPLOAD_REPLY, Mpi2FWUploadReply_t, MPI2_POINTER pMPi2FWUploadReply_t; - -/* FW Image Header */ -typedef struct _MPI2_FW_IMAGE_HEADER -{ - U32 Signature; /* 0x00 */ - U32 Signature0; /* 0x04 */ - U32 Signature1; /* 0x08 */ - U32 Signature2; /* 0x0C */ - MPI2_VERSION_UNION MPIVersion; /* 0x10 */ - MPI2_VERSION_UNION FWVersion; /* 0x14 */ - MPI2_VERSION_UNION NVDATAVersion; /* 0x18 */ - MPI2_VERSION_UNION PackageVersion; /* 0x1C */ - U16 VendorID; /* 0x20 */ - U16 ProductID; /* 0x22 */ - U16 ProtocolFlags; /* 0x24 */ - U16 Reserved26; /* 0x26 */ - U32 IOCCapabilities; /* 0x28 */ - U32 ImageSize; /* 0x2C */ - U32 NextImageHeaderOffset; /* 0x30 */ - U32 Checksum; /* 0x34 */ - U32 Reserved38; /* 0x38 */ - U32 Reserved3C; /* 0x3C */ - U32 Reserved40; /* 0x40 */ - U32 Reserved44; /* 0x44 */ - U32 Reserved48; /* 0x48 */ - U32 Reserved4C; /* 0x4C */ - U32 Reserved50; /* 0x50 */ - U32 Reserved54; /* 0x54 */ - U32 Reserved58; /* 0x58 */ - U32 Reserved5C; /* 0x5C */ - U32 BootFlags; /* 0x60 */ /* reserved in MPI v2.5 and earlier */ - U32 FirmwareVersionNameWhat; /* 0x64 */ - U8 FirmwareVersionName[32]; /* 0x68 */ - U32 VendorNameWhat; /* 0x88 */ - U8 VendorName[32]; /* 0x8C */ - U32 PackageNameWhat; /* 0x88 */ - U8 PackageName[32]; /* 0x8C */ - U32 ReservedD0; /* 0xD0 */ - U32 ReservedD4; /* 0xD4 */ - U32 ReservedD8; /* 0xD8 */ - U32 ReservedDC; /* 0xDC */ - U32 ReservedE0; /* 0xE0 */ - U32 ReservedE4; /* 0xE4 */ - U32 ReservedE8; /* 0xE8 */ - U32 ReservedEC; /* 0xEC */ - U32 ReservedF0; /* 0xF0 */ - U32 ReservedF4; /* 0xF4 */ - U32 ReservedF8; /* 0xF8 */ - U32 ReservedFC; /* 0xFC */ -} MPI2_FW_IMAGE_HEADER, MPI2_POINTER PTR_MPI2_FW_IMAGE_HEADER, - Mpi2FWImageHeader_t, MPI2_POINTER pMpi2FWImageHeader_t; - -/* Signature field */ -#define MPI2_FW_HEADER_SIGNATURE_OFFSET (0x00) -#define MPI2_FW_HEADER_SIGNATURE_MASK (0xFF000000) -#define MPI2_FW_HEADER_SIGNATURE (0xEA000000) -#define MPI26_FW_HEADER_SIGNATURE (0xEB000000) - -/* Signature0 field */ -#define MPI2_FW_HEADER_SIGNATURE0_OFFSET (0x04) -#define MPI2_FW_HEADER_SIGNATURE0 (0x5AFAA55A) -#define MPI26_FW_HEADER_SIGNATURE0_BASE (0x5AEAA500) /* Last byte is defined by architecture */ -#define MPI26_FW_HEADER_SIGNATURE0_ARC_0 (0x5A) -#define MPI26_FW_HEADER_SIGNATURE0_ARC_1 (0x00) -#define MPI26_FW_HEADER_SIGNATURE0_ARC_2 (0x01) -#define MPI26_FW_HEADER_SIGNATURE0_ARC_3 (0x02) -#define MPI26_FW_HEADER_SIGNATURE0 (MPI26_FW_HEADER_SIGNATURE0_BASE+MPI26_FW_HEADER_SIGNATURE0_ARC_0) // legacy (0x5AEAA55A) -#define MPI26_FW_HEADER_SIGNATURE0_3516 (MPI26_FW_HEADER_SIGNATURE0_BASE+MPI26_FW_HEADER_SIGNATURE0_ARC_1) -#define MPI26_FW_HEADER_SIGNATURE0_4008 (MPI26_FW_HEADER_SIGNATURE0_BASE+MPI26_FW_HEADER_SIGNATURE0_ARC_3) - -/* Signature1 field */ -#define MPI2_FW_HEADER_SIGNATURE1_OFFSET (0x08) -#define MPI2_FW_HEADER_SIGNATURE1 (0xA55AFAA5) -#define MPI26_FW_HEADER_SIGNATURE1 (0xA55AEAA5) - -/* Signature2 field */ -#define MPI2_FW_HEADER_SIGNATURE2_OFFSET (0x0C) -#define MPI2_FW_HEADER_SIGNATURE2 (0x5AA55AFA) -#define MPI26_FW_HEADER_SIGNATURE2 (0x5AA55AEA) - - -/* defines for using the ProductID field */ -#define MPI2_FW_HEADER_PID_TYPE_MASK (0xF000) -#define MPI2_FW_HEADER_PID_TYPE_SAS (0x2000) - -#define MPI2_FW_HEADER_PID_PROD_MASK (0x0F00) -#define MPI2_FW_HEADER_PID_PROD_A (0x0000) -#define MPI2_FW_HEADER_PID_PROD_TARGET_INITIATOR_SCSI (0x0200) -#define MPI2_FW_HEADER_PID_PROD_IR_SCSI (0x0700) - - -#define MPI2_FW_HEADER_PID_FAMILY_MASK (0x00FF) -/* SAS ProductID Family bits */ -#define MPI2_FW_HEADER_PID_FAMILY_2108_SAS (0x0013) -#define MPI2_FW_HEADER_PID_FAMILY_2208_SAS (0x0014) -#define MPI25_FW_HEADER_PID_FAMILY_3108_SAS (0x0021) -#define MPI26_FW_HEADER_PID_FAMILY_3324_SAS (0x0028) -#define MPI26_FW_HEADER_PID_FAMILY_3516_SAS (0x0031) - -/* use MPI2_IOCFACTS_PROTOCOL_ defines for ProtocolFlags field */ - -/* use MPI2_IOCFACTS_CAPABILITY_ defines for IOCCapabilities field */ - - -#define MPI2_FW_HEADER_IMAGESIZE_OFFSET (0x2C) -#define MPI2_FW_HEADER_NEXTIMAGE_OFFSET (0x30) -#define MPI26_FW_HEADER_BOOTFLAGS_OFFSET (0x60) -#define MPI2_FW_HEADER_VERNMHWAT_OFFSET (0x64) - -#define MPI2_FW_HEADER_WHAT_SIGNATURE (0x29232840) - -#define MPI2_FW_HEADER_SIZE (0x100) - - -/* Extended Image Header */ -typedef struct _MPI2_EXT_IMAGE_HEADER - -{ - U8 ImageType; /* 0x00 */ - U8 Reserved1; /* 0x01 */ - U16 Reserved2; /* 0x02 */ - U32 Checksum; /* 0x04 */ - U32 ImageSize; /* 0x08 */ - U32 NextImageHeaderOffset; /* 0x0C */ - U32 PackageVersion; /* 0x10 */ - U32 Reserved3; /* 0x14 */ - U32 Reserved4; /* 0x18 */ - U32 Reserved5; /* 0x1C */ - U8 IdentifyString[32]; /* 0x20 */ -} MPI2_EXT_IMAGE_HEADER, MPI2_POINTER PTR_MPI2_EXT_IMAGE_HEADER, - Mpi2ExtImageHeader_t, MPI2_POINTER pMpi2ExtImageHeader_t; - -/* useful offsets */ -#define MPI2_EXT_IMAGE_IMAGETYPE_OFFSET (0x00) -#define MPI2_EXT_IMAGE_IMAGESIZE_OFFSET (0x08) -#define MPI2_EXT_IMAGE_NEXTIMAGE_OFFSET (0x0C) - -#define MPI2_EXT_IMAGE_HEADER_SIZE (0x40) - -/* defines for the ImageType field */ -#define MPI2_EXT_IMAGE_TYPE_UNSPECIFIED (0x00) -#define MPI2_EXT_IMAGE_TYPE_FW (0x01) -#define MPI2_EXT_IMAGE_TYPE_NVDATA (0x03) -#define MPI2_EXT_IMAGE_TYPE_BOOTLOADER (0x04) -#define MPI2_EXT_IMAGE_TYPE_INITIALIZATION (0x05) -#define MPI2_EXT_IMAGE_TYPE_FLASH_LAYOUT (0x06) -#define MPI2_EXT_IMAGE_TYPE_SUPPORTED_DEVICES (0x07) -#define MPI2_EXT_IMAGE_TYPE_MEGARAID (0x08) -#define MPI2_EXT_IMAGE_TYPE_ENCRYPTED_HASH (0x09) /* MPI v2.5 and newer */ -#define MPI2_EXT_IMAGE_TYPE_MIN_PRODUCT_SPECIFIC (0x80) -#define MPI2_EXT_IMAGE_TYPE_MAX_PRODUCT_SPECIFIC (0xFF) - -#define MPI2_EXT_IMAGE_TYPE_MAX (MPI2_EXT_IMAGE_TYPE_MAX_PRODUCT_SPECIFIC) /* deprecated */ - - - -/* FLASH Layout Extended Image Data */ - -/* - * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check RegionsPerLayout at runtime. - */ -#ifndef MPI2_FLASH_NUMBER_OF_REGIONS -#define MPI2_FLASH_NUMBER_OF_REGIONS (1) -#endif - -/* - * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check NumberOfLayouts at runtime. - */ -#ifndef MPI2_FLASH_NUMBER_OF_LAYOUTS -#define MPI2_FLASH_NUMBER_OF_LAYOUTS (1) -#endif - -typedef struct _MPI2_FLASH_REGION -{ - U8 RegionType; /* 0x00 */ - U8 Reserved1; /* 0x01 */ - U16 Reserved2; /* 0x02 */ - U32 RegionOffset; /* 0x04 */ - U32 RegionSize; /* 0x08 */ - U32 Reserved3; /* 0x0C */ -} MPI2_FLASH_REGION, MPI2_POINTER PTR_MPI2_FLASH_REGION, - Mpi2FlashRegion_t, MPI2_POINTER pMpi2FlashRegion_t; - -typedef struct _MPI2_FLASH_LAYOUT -{ - U32 FlashSize; /* 0x00 */ - U32 Reserved1; /* 0x04 */ - U32 Reserved2; /* 0x08 */ - U32 Reserved3; /* 0x0C */ - MPI2_FLASH_REGION Region[MPI2_FLASH_NUMBER_OF_REGIONS];/* 0x10 */ -} MPI2_FLASH_LAYOUT, MPI2_POINTER PTR_MPI2_FLASH_LAYOUT, - Mpi2FlashLayout_t, MPI2_POINTER pMpi2FlashLayout_t; - -typedef struct _MPI2_FLASH_LAYOUT_DATA -{ - U8 ImageRevision; /* 0x00 */ - U8 Reserved1; /* 0x01 */ - U8 SizeOfRegion; /* 0x02 */ - U8 Reserved2; /* 0x03 */ - U16 NumberOfLayouts; /* 0x04 */ - U16 RegionsPerLayout; /* 0x06 */ - U16 MinimumSectorAlignment; /* 0x08 */ - U16 Reserved3; /* 0x0A */ - U32 Reserved4; /* 0x0C */ - MPI2_FLASH_LAYOUT Layout[MPI2_FLASH_NUMBER_OF_LAYOUTS];/* 0x10 */ -} MPI2_FLASH_LAYOUT_DATA, MPI2_POINTER PTR_MPI2_FLASH_LAYOUT_DATA, - Mpi2FlashLayoutData_t, MPI2_POINTER pMpi2FlashLayoutData_t; - -/* defines for the RegionType field */ -#define MPI2_FLASH_REGION_UNUSED (0x00) -#define MPI2_FLASH_REGION_FIRMWARE (0x01) -#define MPI2_FLASH_REGION_BIOS (0x02) -#define MPI2_FLASH_REGION_NVDATA (0x03) -#define MPI2_FLASH_REGION_FIRMWARE_BACKUP (0x05) -#define MPI2_FLASH_REGION_MFG_INFORMATION (0x06) -#define MPI2_FLASH_REGION_CONFIG_1 (0x07) -#define MPI2_FLASH_REGION_CONFIG_2 (0x08) -#define MPI2_FLASH_REGION_MEGARAID (0x09) -#define MPI2_FLASH_REGION_COMMON_BOOT_BLOCK (0x0A) -#define MPI2_FLASH_REGION_INIT (MPI2_FLASH_REGION_COMMON_BOOT_BLOCK) /* older name */ -#define MPI2_FLASH_REGION_CBB_BACKUP (0x0D) -#define MPI2_FLASH_REGION_SBR (0x0E) -#define MPI2_FLASH_REGION_SBR_BACKUP (0x0F) -#define MPI2_FLASH_REGION_HIIM (0x10) -#define MPI2_FLASH_REGION_HIIA (0x11) -#define MPI2_FLASH_REGION_CTLR (0x12) -#define MPI2_FLASH_REGION_IMR_FIRMWARE (0x13) -#define MPI2_FLASH_REGION_MR_NVDATA (0x14) - -/* ImageRevision */ -#define MPI2_FLASH_LAYOUT_IMAGE_REVISION (0x00) - - - -/* Supported Devices Extended Image Data */ - -/* - * Host code (drivers, BIOS, utilities, etc.) should leave this define set to - * one and check NumberOfDevices at runtime. - */ -#ifndef MPI2_SUPPORTED_DEVICES_IMAGE_NUM_DEVICES -#define MPI2_SUPPORTED_DEVICES_IMAGE_NUM_DEVICES (1) -#endif - -typedef struct _MPI2_SUPPORTED_DEVICE -{ - U16 DeviceID; /* 0x00 */ - U16 VendorID; /* 0x02 */ - U16 DeviceIDMask; /* 0x04 */ - U16 Reserved1; /* 0x06 */ - U8 LowPCIRev; /* 0x08 */ - U8 HighPCIRev; /* 0x09 */ - U16 Reserved2; /* 0x0A */ - U32 Reserved3; /* 0x0C */ -} MPI2_SUPPORTED_DEVICE, MPI2_POINTER PTR_MPI2_SUPPORTED_DEVICE, - Mpi2SupportedDevice_t, MPI2_POINTER pMpi2SupportedDevice_t; - -typedef struct _MPI2_SUPPORTED_DEVICES_DATA -{ - U8 ImageRevision; /* 0x00 */ - U8 Reserved1; /* 0x01 */ - U8 NumberOfDevices; /* 0x02 */ - U8 Reserved2; /* 0x03 */ - U32 Reserved3; /* 0x04 */ - MPI2_SUPPORTED_DEVICE SupportedDevice[MPI2_SUPPORTED_DEVICES_IMAGE_NUM_DEVICES]; /* 0x08 */ -} MPI2_SUPPORTED_DEVICES_DATA, MPI2_POINTER PTR_MPI2_SUPPORTED_DEVICES_DATA, - Mpi2SupportedDevicesData_t, MPI2_POINTER pMpi2SupportedDevicesData_t; - -/* ImageRevision */ -#define MPI2_SUPPORTED_DEVICES_IMAGE_REVISION (0x00) - - -/* Init Extended Image Data */ - -typedef struct _MPI2_INIT_IMAGE_FOOTER - -{ - U32 BootFlags; /* 0x00 */ - U32 ImageSize; /* 0x04 */ - U32 Signature0; /* 0x08 */ - U32 Signature1; /* 0x0C */ - U32 Signature2; /* 0x10 */ - U32 ResetVector; /* 0x14 */ -} MPI2_INIT_IMAGE_FOOTER, MPI2_POINTER PTR_MPI2_INIT_IMAGE_FOOTER, - Mpi2InitImageFooter_t, MPI2_POINTER pMpi2InitImageFooter_t; - -/* defines for the BootFlags field */ -#define MPI2_INIT_IMAGE_BOOTFLAGS_OFFSET (0x00) - -/* defines for the ImageSize field */ -#define MPI2_INIT_IMAGE_IMAGESIZE_OFFSET (0x04) - -/* defines for the Signature0 field */ -#define MPI2_INIT_IMAGE_SIGNATURE0_OFFSET (0x08) -#define MPI2_INIT_IMAGE_SIGNATURE0 (0x5AA55AEA) - -/* defines for the Signature1 field */ -#define MPI2_INIT_IMAGE_SIGNATURE1_OFFSET (0x0C) -#define MPI2_INIT_IMAGE_SIGNATURE1 (0xA55AEAA5) - -/* defines for the Signature2 field */ -#define MPI2_INIT_IMAGE_SIGNATURE2_OFFSET (0x10) -#define MPI2_INIT_IMAGE_SIGNATURE2 (0x5AEAA55A) - -/* Signature fields as individual bytes */ -#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_0 (0xEA) -#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_1 (0x5A) -#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_2 (0xA5) -#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_3 (0x5A) - -#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_4 (0xA5) -#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_5 (0xEA) -#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_6 (0x5A) -#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_7 (0xA5) - -#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_8 (0x5A) -#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_9 (0xA5) -#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_A (0xEA) -#define MPI2_INIT_IMAGE_SIGNATURE_BYTE_B (0x5A) - -/* defines for the ResetVector field */ -#define MPI2_INIT_IMAGE_RESETVECTOR_OFFSET (0x14) - - -/* Encrypted Hash Extended Image Data */ - -typedef struct _MPI25_ENCRYPTED_HASH_ENTRY -{ - U8 HashImageType; /* 0x00 */ - U8 HashAlgorithm; /* 0x01 */ - U8 EncryptionAlgorithm; /* 0x02 */ - U8 Reserved1; /* 0x03 */ - U32 Reserved2; /* 0x04 */ - U32 EncryptedHash[1]; /* 0x08 */ /* variable length */ -} MPI25_ENCRYPTED_HASH_ENTRY, MPI2_POINTER PTR_MPI25_ENCRYPTED_HASH_ENTRY, - Mpi25EncryptedHashEntry_t, MPI2_POINTER pMpi25EncryptedHashEntry_t; - -/* values for HashImageType */ -#define MPI25_HASH_IMAGE_TYPE_UNUSED (0x00) -#define MPI25_HASH_IMAGE_TYPE_FIRMWARE (0x01) -#define MPI25_HASH_IMAGE_TYPE_BIOS (0x02) - -/* values for HashAlgorithm */ -#define MPI25_HASH_ALGORITHM_UNUSED (0x00) -#define MPI25_HASH_ALGORITHM_SHA256 (0x01) - -/* values for EncryptionAlgorithm */ -#define MPI25_ENCRYPTION_ALG_UNUSED (0x00) -#define MPI25_ENCRYPTION_ALG_RSA256 (0x01) - -typedef struct _MPI25_ENCRYPTED_HASH_DATA -{ - U8 ImageVersion; /* 0x00 */ - U8 NumHash; /* 0x01 */ - U16 Reserved1; /* 0x02 */ - U32 Reserved2; /* 0x04 */ - MPI25_ENCRYPTED_HASH_ENTRY EncryptedHashEntry[1]; /* 0x08 */ /* variable number of entries */ -} MPI25_ENCRYPTED_HASH_DATA, MPI2_POINTER PTR_MPI25_ENCRYPTED_HASH_DATA, - Mpi25EncryptedHashData_t, MPI2_POINTER pMpi25EncryptedHashData_t; /**************************************************************************** * PowerManagementControl message Modified: stable/12/sys/dev/mpr/mpi/mpi2_pci.h ============================================================================== --- stable/12/sys/dev/mpr/mpi/mpi2_pci.h Thu Sep 26 01:51:55 2019 (r352734) +++ stable/12/sys/dev/mpr/mpi/mpi2_pci.h Thu Sep 26 01:54:24 2019 (r352735) @@ -1,7 +1,5 @@ /*- - * Copyright (c) 2012-2015 LSI Corp. - * Copyright (c) 2013-2016 Avago Technologies - * All rights reserved. + * Copyright 2000-2020 Broadcom Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,22 +25,20 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Thu Sep 26 12:54:54 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0614E1260F8; Thu, 26 Sep 2019 12:54:54 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fFJF6KXNz4Cxh; Thu, 26 Sep 2019 12:54:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC588717; Thu, 26 Sep 2019 12:54:53 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QCsrAn056614; Thu, 26 Sep 2019 12:54:53 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QCsr0J056612; Thu, 26 Sep 2019 12:54:53 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201909261254.x8QCsr0J056612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 26 Sep 2019 12:54:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352741 - in stable/12/sys: modules powerpc/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in stable/12/sys: modules powerpc/conf X-SVN-Commit-Revision: 352741 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 12:54:54 -0000 Author: imp Date: Thu Sep 26 12:54:52 2019 New Revision: 352741 URL: https://svnweb.freebsd.org/changeset/base/352741 Log: mpr/mps crash badly. Part of the stability added use of atomic64 functions not present on 32-bit powerpc. Merge the part that removes mps from the build on this tier 2 platform. Working mpr/mps in 12 and 12.1 on our tier 1 platforms is more important. MFC r341754: Remove the mps driver from powerpc 32bit GENERIC, and don't build it and mpr as a module for powerpc or mips. An upcoming commit will cause these drivers to rely on the presence of 64bit atomic operations. Discussed with jhibbits. Relnotes: YES Modified: stable/12/sys/modules/Makefile stable/12/sys/powerpc/conf/GENERIC Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/modules/Makefile ============================================================================== --- stable/12/sys/modules/Makefile Thu Sep 26 07:19:26 2019 (r352740) +++ stable/12/sys/modules/Makefile Thu Sep 26 12:54:52 2019 (r352741) @@ -256,8 +256,8 @@ SUBDIR= \ ${_mly} \ mmc \ mmcsd \ - mpr \ - mps \ + ${_mpr} \ + ${_mps} \ mpt \ mqueue \ mrsas \ @@ -557,6 +557,12 @@ _rtwnfw= rtwnfw ${MACHINE_ARCH} != "powerpc" && ${MACHINE_ARCH} != "powerpcspe" && \ ${MACHINE_CPUARCH} != "riscv" _cxgbe= cxgbe +.endif + +# These rely on 64bit atomics +.if ${MACHINE_ARCH} != "powerpc" && ${MACHINE_CPUARCH} != "mips" +_mps= mps +_mpr= mpr .endif .if ${MK_TESTS} != "no" || defined(ALL_MODULES) Modified: stable/12/sys/powerpc/conf/GENERIC ============================================================================== --- stable/12/sys/powerpc/conf/GENERIC Thu Sep 26 07:19:26 2019 (r352740) +++ stable/12/sys/powerpc/conf/GENERIC Thu Sep 26 12:54:52 2019 (r352741) @@ -120,7 +120,6 @@ options AHC_ALLOW_MEMIO # Attempt to use memory mappe device isp # Qlogic family device ispfw # Firmware module for Qlogic host adapters device mpt # LSI-Logic MPT-Fusion -device mps # LSI-Logic MPT-Fusion 2 device sym # NCR/Symbios/LSI Logic 53C8XX/53C1010/53C1510D # ATA/SCSI peripherals From owner-svn-src-stable@freebsd.org Thu Sep 26 15:37:40 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CB77C12A40B; Thu, 26 Sep 2019 15:37:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fJw44jy2z4PBC; Thu, 26 Sep 2019 15:37:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 85D4E2468; Thu, 26 Sep 2019 15:37:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QFbeOP050051; Thu, 26 Sep 2019 15:37:40 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QFbeAA050050; Thu, 26 Sep 2019 15:37:40 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909261537.x8QFbeAA050050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 26 Sep 2019 15:37:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352749 - stable/12/sys/dev/jme X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/dev/jme X-SVN-Commit-Revision: 352749 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 15:37:40 -0000 Author: markj Date: Thu Sep 26 15:37:40 2019 New Revision: 352749 URL: https://svnweb.freebsd.org/changeset/base/352749 Log: MFC r352625: Revert r316820. PR: 233952 Modified: stable/12/sys/dev/jme/if_jme.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/jme/if_jme.c ============================================================================== --- stable/12/sys/dev/jme/if_jme.c Thu Sep 26 15:35:35 2019 (r352748) +++ stable/12/sys/dev/jme/if_jme.c Thu Sep 26 15:37:40 2019 (r352749) @@ -559,7 +559,7 @@ jme_map_intr_vector(struct jme_softc *sc) bzero(map, sizeof(map)); /* Map Tx interrupts source to MSI/MSIX vector 2. */ - map[MSINUM_REG_INDEX(N_INTR_TXQ0_COMP)] |= + map[MSINUM_REG_INDEX(N_INTR_TXQ0_COMP)] = MSINUM_INTR_SOURCE(2, N_INTR_TXQ0_COMP); map[MSINUM_REG_INDEX(N_INTR_TXQ1_COMP)] |= MSINUM_INTR_SOURCE(2, N_INTR_TXQ1_COMP); @@ -581,37 +581,37 @@ jme_map_intr_vector(struct jme_softc *sc) MSINUM_INTR_SOURCE(2, N_INTR_TXQ_COAL_TO); /* Map Rx interrupts source to MSI/MSIX vector 1. */ - map[MSINUM_REG_INDEX(N_INTR_RXQ0_COMP)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ0_COMP)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ0_COMP); - map[MSINUM_REG_INDEX(N_INTR_RXQ1_COMP)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ1_COMP)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ1_COMP); - map[MSINUM_REG_INDEX(N_INTR_RXQ2_COMP)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ2_COMP)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ2_COMP); - map[MSINUM_REG_INDEX(N_INTR_RXQ3_COMP)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ3_COMP)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ3_COMP); - map[MSINUM_REG_INDEX(N_INTR_RXQ0_DESC_EMPTY)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ0_DESC_EMPTY)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ0_DESC_EMPTY); - map[MSINUM_REG_INDEX(N_INTR_RXQ1_DESC_EMPTY)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ1_DESC_EMPTY)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ1_DESC_EMPTY); - map[MSINUM_REG_INDEX(N_INTR_RXQ2_DESC_EMPTY)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ2_DESC_EMPTY)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ2_DESC_EMPTY); - map[MSINUM_REG_INDEX(N_INTR_RXQ3_DESC_EMPTY)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ3_DESC_EMPTY)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ3_DESC_EMPTY); - map[MSINUM_REG_INDEX(N_INTR_RXQ0_COAL)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ0_COAL)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ0_COAL); - map[MSINUM_REG_INDEX(N_INTR_RXQ1_COAL)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ1_COAL)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ1_COAL); - map[MSINUM_REG_INDEX(N_INTR_RXQ2_COAL)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ2_COAL)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ2_COAL); - map[MSINUM_REG_INDEX(N_INTR_RXQ3_COAL)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ3_COAL)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ3_COAL); - map[MSINUM_REG_INDEX(N_INTR_RXQ0_COAL_TO)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ0_COAL_TO)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ0_COAL_TO); - map[MSINUM_REG_INDEX(N_INTR_RXQ1_COAL_TO)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ1_COAL_TO)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ1_COAL_TO); - map[MSINUM_REG_INDEX(N_INTR_RXQ2_COAL_TO)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ2_COAL_TO)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ2_COAL_TO); - map[MSINUM_REG_INDEX(N_INTR_RXQ3_COAL_TO)] |= + map[MSINUM_REG_INDEX(N_INTR_RXQ3_COAL_TO)] = MSINUM_INTR_SOURCE(1, N_INTR_RXQ3_COAL_TO); /* Map all other interrupts source to MSI/MSIX vector 0. */ From owner-svn-src-stable@freebsd.org Thu Sep 26 15:38:07 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DCC312A483; Thu, 26 Sep 2019 15:38:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fJwb00qPz4PJb; Thu, 26 Sep 2019 15:38:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D777F246B; Thu, 26 Sep 2019 15:38:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QFc6Ho050145; Thu, 26 Sep 2019 15:38:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QFc64i050144; Thu, 26 Sep 2019 15:38:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201909261538.x8QFc64i050144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 26 Sep 2019 15:38:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352750 - stable/12/sbin/ping6 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sbin/ping6 X-SVN-Commit-Revision: 352750 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 15:38:07 -0000 Author: markj Date: Thu Sep 26 15:38:06 2019 New Revision: 352750 URL: https://svnweb.freebsd.org/changeset/base/352750 Log: MFC r352634: ping6: Use caph_rights_limit(3) for STDIN_FILENO Modified: stable/12/sbin/ping6/ping6.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ping6/ping6.c ============================================================================== --- stable/12/sbin/ping6/ping6.c Thu Sep 26 15:37:40 2019 (r352749) +++ stable/12/sbin/ping6/ping6.c Thu Sep 26 15:38:06 2019 (r352750) @@ -1028,8 +1028,8 @@ main(int argc, char *argv[]) err(1, "caph_enter_casper"); cap_rights_init(&rights_stdin); - if (cap_rights_limit(STDIN_FILENO, &rights_stdin) < 0) - err(1, "cap_rights_limit stdin"); + if (caph_rights_limit(STDIN_FILENO, &rights_stdin) < 0) + err(1, "caph_rights_limit stdin"); if (caph_limit_stdout() < 0) err(1, "caph_limit_stdout"); if (caph_limit_stderr() < 0) @@ -1037,10 +1037,10 @@ main(int argc, char *argv[]) cap_rights_init(&rights_srecv, CAP_RECV, CAP_EVENT, CAP_SETSOCKOPT); if (caph_rights_limit(srecv, &rights_srecv) < 0) - err(1, "cap_rights_limit srecv"); + err(1, "caph_rights_limit srecv"); cap_rights_init(&rights_ssend, CAP_SEND, CAP_SETSOCKOPT); if (caph_rights_limit(ssend, &rights_ssend) < 0) - err(1, "cap_rights_limit ssend"); + err(1, "caph_rights_limit ssend"); #if defined(SO_SNDBUF) && defined(SO_RCVBUF) if (sockbufsize) { @@ -1092,10 +1092,10 @@ main(int argc, char *argv[]) cap_rights_clear(&rights_srecv, CAP_SETSOCKOPT); if (caph_rights_limit(srecv, &rights_srecv) < 0) - err(1, "cap_rights_limit srecv setsockopt"); + err(1, "caph_rights_limit srecv setsockopt"); cap_rights_clear(&rights_ssend, CAP_SETSOCKOPT); if (caph_rights_limit(ssend, &rights_ssend) < 0) - err(1, "cap_rights_limit ssend setsockopt"); + err(1, "caph_rights_limit ssend setsockopt"); printf("PING6(%lu=40+8+%lu bytes) ", (unsigned long)(40 + pingerlen()), (unsigned long)(pingerlen() - 8)); From owner-svn-src-stable@freebsd.org Thu Sep 26 15:50:21 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F39C12AD85; Thu, 26 Sep 2019 15:50:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fKBh1vprz4QY1; Thu, 26 Sep 2019 15:50:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12DCD2640; Thu, 26 Sep 2019 15:50:20 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QFoJ5l056491; Thu, 26 Sep 2019 15:50:19 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QFoJXY056485; Thu, 26 Sep 2019 15:50:19 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909261550.x8QFoJXY056485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 26 Sep 2019 15:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352752 - in stable/12: share/mk tools/build/options X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/12: share/mk tools/build/options X-SVN-Commit-Revision: 352752 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 15:50:21 -0000 Author: emaste Date: Thu Sep 26 15:50:18 2019 New Revision: 352752 URL: https://svnweb.freebsd.org/changeset/base/352752 Log: Add a WITH_BIND_NOW build knob MFC r340186: Add a WITH_BIND_NOW build knob The linker's -z now flag sets the DF_BIND_NOW flag, which signals to the runtime loader that all relocation processing should be performed at process startup rather than on demand. In combination with lld's default of enabling relro this causes the GOT to be made read-only when the process starts, preventing straightforward GOT overwrite attacks. MFC r341429: disable BIND_NOW in libc, libthr, and rtld An issue remains with BIND_NOW and processes using threads. For now, restore libc's BIND_NOW disable, and also disable BIND_NOW in rtld and libthr. MFC r345625: revert r341429 "disable BIND_NOW in libc, libthr, and rtld" r345620 by kib@ fixed the rtld issue that caused a crash at startup during resolution of libc's ifuncs with BIND_NOW. MFC r345638: Revert change accidentally committed along with r345625 MFC r345640: Revert other accidentally committed part of r345625 Sponsored by: The FreeBSD Foundation Added: stable/12/tools/build/options/WITHOUT_BIND_NOW - copied unchanged from r340186, head/tools/build/options/WITHOUT_BIND_NOW stable/12/tools/build/options/WITH_BIND_NOW - copied unchanged from r340186, head/tools/build/options/WITH_BIND_NOW Modified: stable/12/share/mk/bsd.lib.mk stable/12/share/mk/bsd.opts.mk stable/12/share/mk/bsd.prog.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/share/mk/bsd.lib.mk ============================================================================== --- stable/12/share/mk/bsd.lib.mk Thu Sep 26 15:41:10 2019 (r352751) +++ stable/12/share/mk/bsd.lib.mk Thu Sep 26 15:50:18 2019 (r352752) @@ -69,6 +69,10 @@ TAGS+= package=${PACKAGE:Uruntime} TAG_ARGS= -T ${TAGS:[*]:S/ /,/g} .endif +# ELF hardening knobs +.if ${MK_BIND_NOW} != "no" +LDFLAGS+= -Wl,-znow +.endif .if ${MK_RETPOLINE} != "no" CFLAGS+= -mretpoline CXXFLAGS+= -mretpoline Modified: stable/12/share/mk/bsd.opts.mk ============================================================================== --- stable/12/share/mk/bsd.opts.mk Thu Sep 26 15:41:10 2019 (r352751) +++ stable/12/share/mk/bsd.opts.mk Thu Sep 26 15:50:18 2019 (r352752) @@ -69,6 +69,7 @@ __DEFAULT_YES_OPTIONS = \ WARNS __DEFAULT_NO_OPTIONS = \ + BIND_NOW \ CCACHE_BUILD \ CTF \ INSTALL_AS_USER \ Modified: stable/12/share/mk/bsd.prog.mk ============================================================================== --- stable/12/share/mk/bsd.prog.mk Thu Sep 26 15:41:10 2019 (r352751) +++ stable/12/share/mk/bsd.prog.mk Thu Sep 26 15:50:18 2019 (r352752) @@ -34,6 +34,10 @@ PROG= ${PROG_CXX} MK_DEBUG_FILES= no .endif +# ELF hardening knobs +.if ${MK_BIND_NOW} != "no" +LDFLAGS+= -Wl,-znow +.endif .if ${MK_RETPOLINE} != "no" CFLAGS+= -mretpoline CXXFLAGS+= -mretpoline Copied: stable/12/tools/build/options/WITHOUT_BIND_NOW (from r340186, head/tools/build/options/WITHOUT_BIND_NOW) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITHOUT_BIND_NOW Thu Sep 26 15:50:18 2019 (r352752, copy of r340186, head/tools/build/options/WITHOUT_BIND_NOW) @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Do not build all binaries with the +.Dv DF_BIND_NOW +flag set. +Run-time relocation processing will be performed on demand. Copied: stable/12/tools/build/options/WITH_BIND_NOW (from r340186, head/tools/build/options/WITH_BIND_NOW) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITH_BIND_NOW Thu Sep 26 15:50:18 2019 (r352752, copy of r340186, head/tools/build/options/WITH_BIND_NOW) @@ -0,0 +1,5 @@ +.\" $FreeBSD$ +Build all binaries with the +.Dv DF_BIND_NOW +flag set to indicate that the run-time loader should perform all relocation +processing at process startup rather than on demand. From owner-svn-src-stable@freebsd.org Thu Sep 26 15:52:42 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AFA0112B056; Thu, 26 Sep 2019 15:52:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fKFQ4KjKz4R1P; Thu, 26 Sep 2019 15:52:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7875D280A; Thu, 26 Sep 2019 15:52:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QFqgnV062151; Thu, 26 Sep 2019 15:52:42 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QFqgl9062150; Thu, 26 Sep 2019 15:52:42 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909261552.x8QFqgl9062150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 26 Sep 2019 15:52:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352753 - stable/12/share/man/man5 X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/share/man/man5 X-SVN-Commit-Revision: 352753 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 15:52:42 -0000 Author: emaste Date: Thu Sep 26 15:52:42 2019 New Revision: 352753 URL: https://svnweb.freebsd.org/changeset/base/352753 Log: src.conf.5: regen after r352752, WITH_BIND_NOW Sponsored by: The FreeBSD Foundation Modified: stable/12/share/man/man5/src.conf.5 Modified: stable/12/share/man/man5/src.conf.5 ============================================================================== --- stable/12/share/man/man5/src.conf.5 Thu Sep 26 15:50:18 2019 (r352752) +++ stable/12/share/man/man5/src.conf.5 Thu Sep 26 15:52:42 2019 (r352753) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd July 24, 2019 +.Dd September 26, 2019 .Dt SRC.CONF 5 .Os .Sh NAME @@ -170,6 +170,11 @@ Set to not build or install associated utilities, and examples. .Pp This option only affects amd64/amd64. +.It Va WITH_BIND_NOW +Build all binaries with the +.Dv DF_BIND_NOW +flag set to indicate that the run-time loader should perform all relocation +processing at process startup rather than on demand. .It Va WITHOUT_BINUTILS Set to not build or install GNU .Xr as 1 , @@ -234,8 +239,6 @@ Set to build some programs without support, like .Xr fingerd 8 , .Xr ftpd 8 , -.Xr rlogind 8 , -.Xr rshd 8 , and .Xr sshd 8 . .It Va WITHOUT_BLUETOOTH @@ -256,6 +259,11 @@ and related programs. .It Va WITHOUT_BSD_CPIO Set to not build the BSD licensed version of cpio based on .Xr libarchive 3 . +.It Va WITH_BSD_CRTBEGIN +Enable the BSD licensed +.Pa crtbegin.o +and +.Pa crtend.o . .It Va WITH_BSD_GREP Install BSD-licensed grep as '[ef]grep' instead of GNU grep. .It Va WITHOUT_BSNMP From owner-svn-src-stable@freebsd.org Thu Sep 26 16:06:02 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 552B512B997; Thu, 26 Sep 2019 16:06:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fKXp2HW4z4SBs; Thu, 26 Sep 2019 16:06:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 316EE29ED; Thu, 26 Sep 2019 16:06:02 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QG62Sw068634; Thu, 26 Sep 2019 16:06:02 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QG5wc8068607; Thu, 26 Sep 2019 16:05:58 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909261605.x8QG5wc8068607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 26 Sep 2019 16:05:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352754 - in stable/12: gnu/usr.bin/binutils/as gnu/usr.bin/binutils/ld gnu/usr.bin/binutils/objcopy gnu/usr.bin/binutils/objdump gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/kgdb kerberos5/tool... X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/12: gnu/usr.bin/binutils/as gnu/usr.bin/binutils/ld gnu/usr.bin/binutils/objcopy gnu/usr.bin/binutils/objdump gnu/usr.bin/gdb/gdb gnu/usr.bin/gdb/kgdb kerberos5/tools/asn1_compile kerberos5/... X-SVN-Commit-Revision: 352754 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 16:06:02 -0000 Author: emaste Date: Thu Sep 26 16:05:57 2019 New Revision: 352754 URL: https://svnweb.freebsd.org/changeset/base/352754 Log: Add WITH_PIE knob to build Position Independent Executables MFC r344179: Add WITH_PIE knob to build Position Independent Executables Building binaries as PIE allows the executable itself to be loaded at a random address when ASLR is enabled (not just its shared libraries). With this change PIE objects have a .pieo extension and INTERNALLIB libraries libXXX_pie.a. MK_PIE is disabled for some kerberos5 tools, Clang, and Subversion, as they explicitly reference .a libraries in their Makefiles. These can be addressed on an individual basis later. MK_PIE is also disabled for rtld-elf because it is already position-independent using bespoke Makefile rules. Currently only dynamically linked binaries will be built as PIE. MFC r344181: Fix Makefile conditional after r344179 MFC r344182: Use make's :tl instead of checking "no" and "NO" MFC r344189: Fixup bsd.prog.mk after r344182 MFC r344211: wlandebug: disable PIE to fix build failure libifconfig is built as a static-only PRIVATELIB (and there is no _pie.a version) so disable PIE in libifconfig's consumer. r345489: Fix GNU objdump build under WITH_PIE Explicitly specified bare .a libraries need ${PIE_SUFFIX}. r345490: Apply WITH_PIE changes to other binutils components Followon to r345489, explicitly specified bare .a libraries need ${PIE_SUFFIX} (although these still built). r345778: Fix gdb/kgdb build under WITH_PIE Explicitly specified bare .a libraries need ${PIE_SUFFIX}. Sponsored by: The FreeBSD Foundation Added: stable/12/tools/build/options/WITHOUT_PIE - copied unchanged from r344179, head/tools/build/options/WITHOUT_PIE stable/12/tools/build/options/WITH_PIE - copied unchanged from r344179, head/tools/build/options/WITH_PIE Modified: stable/12/gnu/usr.bin/binutils/as/Makefile stable/12/gnu/usr.bin/binutils/ld/Makefile stable/12/gnu/usr.bin/binutils/objcopy/Makefile stable/12/gnu/usr.bin/binutils/objdump/Makefile stable/12/gnu/usr.bin/gdb/gdb/Makefile stable/12/gnu/usr.bin/gdb/kgdb/Makefile stable/12/kerberos5/tools/asn1_compile/Makefile stable/12/kerberos5/tools/slc/Makefile stable/12/lib/clang/Makefile.inc stable/12/libexec/rtld-elf/Makefile stable/12/share/mk/bsd.lib.mk stable/12/share/mk/bsd.opts.mk stable/12/share/mk/bsd.prog.mk stable/12/share/mk/src.libnames.mk stable/12/stand/i386/Makefile.inc stable/12/usr.bin/clang/Makefile.inc stable/12/usr.bin/svn/Makefile.inc stable/12/usr.sbin/wlandebug/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/gnu/usr.bin/binutils/as/Makefile ============================================================================== --- stable/12/gnu/usr.bin/binutils/as/Makefile Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/gnu/usr.bin/binutils/as/Makefile Thu Sep 26 16:05:57 2019 (r352754) @@ -95,9 +95,9 @@ CFLAGS+= -I${.CURDIR} -I${.CURDIR}/${TARGET_CPUARCH}-f NO_SHARED?= yes .endif -DPADD= ${GNURELTOP}/libbfd/libbfd.a -DPADD+= ${GNURELTOP}/libiberty/libiberty.a -DPADD+= ${GNURELTOP}/libopcodes/libopcodes.a +DPADD= ${GNURELTOP}/libbfd/libbfd${PIE_SUFFIX}.a +DPADD+= ${GNURELTOP}/libiberty/libiberty${PIE_SUFFIX}.a +DPADD+= ${GNURELTOP}/libopcodes/libopcodes${PIE_SUFFIX}.a LDADD= ${DPADD} .include Modified: stable/12/gnu/usr.bin/binutils/ld/Makefile ============================================================================== --- stable/12/gnu/usr.bin/binutils/ld/Makefile Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/gnu/usr.bin/binutils/ld/Makefile Thu Sep 26 16:05:57 2019 (r352754) @@ -51,8 +51,8 @@ CFLAGS+= -I${SRCDIR}/ld -I${SRCDIR}/bfd .if ${MK_SHARED_TOOLCHAIN} == "no" NO_SHARED?= yes .endif -DPADD= ${GNURELTOP}/libbfd/libbfd.a -DPADD+= ${GNURELTOP}/libiberty/libiberty.a +DPADD= ${GNURELTOP}/libbfd/libbfd${PIE_SUFFIX}.a +DPADD+= ${GNURELTOP}/libiberty/libiberty${PIE_SUFFIX}.a LDADD= ${DPADD} CLEANDIRS+= ldscripts CLEANFILES+= ldemul-list.h stringify.sed Modified: stable/12/gnu/usr.bin/binutils/objcopy/Makefile ============================================================================== --- stable/12/gnu/usr.bin/binutils/objcopy/Makefile Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/gnu/usr.bin/binutils/objcopy/Makefile Thu Sep 26 16:05:57 2019 (r352754) @@ -9,9 +9,9 @@ SRCS= objcopy.c not-strip.c CFLAGS+= -D_GNU_SOURCE CFLAGS+= -I${.CURDIR}/${GNURELTOP}/libbinutils CFLAGS+= -I${SRCDIR}/binutils -I${SRCDIR}/bfd -DPADD= ${GNURELTOP}/libbinutils/libbinutils.a -DPADD+= ${GNURELTOP}/libbfd/libbfd.a -DPADD+= ${GNURELTOP}/libiberty/libiberty.a +DPADD= ${GNURELTOP}/libbinutils/libbinutils${PIE_SUFFIX}.a +DPADD+= ${GNURELTOP}/libbfd/libbfd${PIE_SUFFIX}.a +DPADD+= ${GNURELTOP}/libiberty/libiberty${PIE_SUFFIX}.a LDADD= ${DPADD} .include Modified: stable/12/gnu/usr.bin/binutils/objdump/Makefile ============================================================================== --- stable/12/gnu/usr.bin/binutils/objdump/Makefile Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/gnu/usr.bin/binutils/objdump/Makefile Thu Sep 26 16:05:57 2019 (r352754) @@ -10,10 +10,10 @@ CFLAGS+= -D_GNU_SOURCE CFLAGS+= -I${.CURDIR}/${GNURELTOP}/libbinutils CFLAGS+= -I${SRCDIR}/binutils CFLAGS+= -DBFD_VERSION_STRING=\"${VERSION}\" -DPADD= ${GNURELTOP}/libbinutils/libbinutils.a -DPADD+= ${GNURELTOP}/libopcodes/libopcodes.a -DPADD+= ${GNURELTOP}/libbfd/libbfd.a -DPADD+= ${GNURELTOP}/libiberty/libiberty.a +DPADD= ${GNURELTOP}/libbinutils/libbinutils${PIE_SUFFIX}.a +DPADD+= ${GNURELTOP}/libopcodes/libopcodes${PIE_SUFFIX}.a +DPADD+= ${GNURELTOP}/libbfd/libbfd${PIE_SUFFIX}.a +DPADD+= ${GNURELTOP}/libiberty/libiberty${PIE_SUFFIX}.a LDADD= ${DPADD} .include Modified: stable/12/gnu/usr.bin/gdb/gdb/Makefile ============================================================================== --- stable/12/gnu/usr.bin/gdb/gdb/Makefile Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/gnu/usr.bin/gdb/gdb/Makefile Thu Sep 26 16:05:57 2019 (r352754) @@ -3,9 +3,10 @@ PROG= gdb${GDB_SUFFIX} SRCS= gdb.c -BULIBS= ${OBJ_BU}/libbfd/libbfd.a ${OBJ_BU}/libopcodes/libopcodes.a \ - ${OBJ_BU}/libiberty/libiberty.a -GDBLIBS= ${OBJ_GDB}/libgdb/libgdb.a +BULIBS= ${OBJ_BU}/libbfd/libbfd${PIE_SUFFIX}.a \ + ${OBJ_BU}/libopcodes/libopcodes${PIE_SUFFIX}.a \ + ${OBJ_BU}/libiberty/libiberty${PIE_SUFFIX}.a +GDBLIBS= ${OBJ_GDB}/libgdb/libgdb${PIE_SUFFIX}.a # libthread_db.so calls back into gdb for the proc services. Make all the # global symbols visible. Modified: stable/12/gnu/usr.bin/gdb/kgdb/Makefile ============================================================================== --- stable/12/gnu/usr.bin/gdb/kgdb/Makefile Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/gnu/usr.bin/gdb/kgdb/Makefile Thu Sep 26 16:05:57 2019 (r352754) @@ -4,9 +4,10 @@ PROG= kgdb${GDB_SUFFIX} SRCS= main.c kld.c kthr.c trgt.c trgt_${TARGET_CPUARCH}.c WARNS?= 2 -BULIBS= ${OBJ_BU}/libbfd/libbfd.a ${OBJ_BU}/libopcodes/libopcodes.a \ - ${OBJ_BU}/libiberty/libiberty.a -GDBLIBS= ${OBJ_GDB}/libgdb/libgdb.a +BULIBS= ${OBJ_BU}/libbfd/libbfd${PIE_SUFFIX}.a \ + ${OBJ_BU}/libopcodes/libopcodes${PIE_SUFFIX}.a \ + ${OBJ_BU}/libiberty/libiberty${PIE_SUFFIX}.a +GDBLIBS= ${OBJ_GDB}/libgdb/libgdb${PIE_SUFFIX}.a DPADD= ${GDBLIBS} ${BULIBS} LDADD= ${GDBLIBS} ${BULIBS} Modified: stable/12/kerberos5/tools/asn1_compile/Makefile ============================================================================== --- stable/12/kerberos5/tools/asn1_compile/Makefile Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/kerberos5/tools/asn1_compile/Makefile Thu Sep 26 16:05:57 2019 (r352754) @@ -6,6 +6,7 @@ LIBROKEN_A= ${.OBJDIR:H:H}/lib/libroken/libroken.a LIBADD= vers LDADD= ${LIBROKEN_A} DPADD= ${LIBROKEN_A} +MK_PIE:= no SRCS= \ asn1parse.y \ Modified: stable/12/kerberos5/tools/slc/Makefile ============================================================================== --- stable/12/kerberos5/tools/slc/Makefile Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/kerberos5/tools/slc/Makefile Thu Sep 26 16:05:57 2019 (r352754) @@ -6,6 +6,7 @@ LIBADD= vers LDADD= ${LIBROKEN_A} DPADD= ${LIBROKEN_A} MAN= +MK_PIE:= no SRCS= roken.h \ slc-gram.y \ Modified: stable/12/lib/clang/Makefile.inc ============================================================================== --- stable/12/lib/clang/Makefile.inc Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/lib/clang/Makefile.inc Thu Sep 26 16:05:57 2019 (r352754) @@ -2,6 +2,8 @@ .include +MK_PIE:= no # Explicit libXXX.a references + .if ${COMPILER_TYPE} == "clang" DEBUG_FILES_CFLAGS= -gline-tables-only .else Modified: stable/12/libexec/rtld-elf/Makefile ============================================================================== --- stable/12/libexec/rtld-elf/Makefile Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/libexec/rtld-elf/Makefile Thu Sep 26 16:05:57 2019 (r352754) @@ -6,6 +6,7 @@ .include PACKAGE= clibs +MK_PIE= no # Always position independent using local rules MK_SSP= no CONFS= libmap.conf Modified: stable/12/share/mk/bsd.lib.mk ============================================================================== --- stable/12/share/mk/bsd.lib.mk Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/share/mk/bsd.lib.mk Thu Sep 26 16:05:57 2019 (r352754) @@ -91,13 +91,16 @@ CTFFLAGS+= -g # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries # .pico used for PIC object files # .nossppico used for NOSSP PIC object files -.SUFFIXES: .out .o .bc .ll .po .pico .nossppico .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln +# .pieo used for PIE object files +.SUFFIXES: .out .o .bc .ll .po .pico .nossppico .pieo .S .asm .s .c .cc .cpp .cxx .C .f .y .l .ln .if !defined(PICFLAG) .if ${MACHINE_CPUARCH} == "sparc64" PICFLAG=-fPIC +PIEFLAG=-fPIE .else PICFLAG=-fpic +PIEFLAG=-fpie .endif .endif @@ -115,6 +118,10 @@ PO_FLAG=-pg ${CC} ${PICFLAG} -DPIC ${SHARED_CFLAGS:C/^-fstack-protector.*$//} ${CFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} +.c.pieo: + ${CC} ${PIEFLAG} -DPIC ${SHARED_CFLAGS} ${CFLAGS} -c ${.IMPSRC} -o ${.TARGET} + ${CTFCONVERT_CMD} + .cc.po .C.po .cpp.po .cxx.po: ${CXX} ${PO_FLAG} ${STATIC_CXXFLAGS} ${PO_CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} @@ -124,6 +131,9 @@ PO_FLAG=-pg .cc.nossppico .C.nossppico .cpp.nossppico .cxx.nossppico: ${CXX} ${PICFLAG} -DPIC ${SHARED_CXXFLAGS:C/^-fstack-protector.*$//} ${CXXFLAGS:C/^-fstack-protector.*$//} -c ${.IMPSRC} -o ${.TARGET} +.cc.pieo .C.pieo .cpp.pieo .cxx.pieo: + ${CXX} ${PIEFLAG} ${SHARED_CXXFLAGS} ${CXXFLAGS} -c ${.IMPSRC} -o ${.TARGET} + .f.po: ${FC} -pg ${FFLAGS} -o ${.TARGET} -c ${.IMPSRC} ${CTFCONVERT_CMD} @@ -136,7 +146,7 @@ PO_FLAG=-pg ${FC} ${PICFLAG} -DPIC ${FFLAGS:C/^-fstack-protector.*$//} -o ${.TARGET} -c ${.IMPSRC} ${CTFCONVERT_CMD} -.s.po .s.pico .s.nossppico: +.s.po .s.pico .s.nossppico .s.pieo: ${AS} ${AFLAGS} -o ${.TARGET} ${.IMPSRC} ${CTFCONVERT_CMD} @@ -155,6 +165,11 @@ PO_FLAG=-pg ${CFLAGS:C/^-fstack-protector.*$//} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} +.asm.pieo: + ${CC:N${CCACHE_BIN}} -x assembler-with-cpp ${PIEFLAG} -DPIC \ + ${CFLAGS} ${ACFLAGS} -c ${.IMPSRC} -o ${.TARGET} + ${CTFCONVERT_CMD} + .S.po: ${CC:N${CCACHE_BIN}} -DPROF ${PO_CFLAGS} ${ACFLAGS} -c ${.IMPSRC} \ -o ${.TARGET} @@ -170,6 +185,11 @@ PO_FLAG=-pg -c ${.IMPSRC} -o ${.TARGET} ${CTFCONVERT_CMD} +.S.pieo: + ${CC:N${CCACHE_BIN}} ${PIEFLAG} -DPIC ${CFLAGS} ${ACFLAGS} \ + -c ${.IMPSRC} -o ${.TARGET} + ${CTFCONVERT_CMD} + _LIBDIR:=${LIBDIR} _SHLIBDIR:=${SHLIBDIR} @@ -333,6 +353,20 @@ lib${LIB_PRIVATE}${LIB}_nossp_pic.a: ${NOSSPSOBJS} .endif .endif # !defined(INTERNALLIB) + +.if defined(INTERNALLIB) && ${MK_PIE} != "no" +PIEOBJS+= ${OBJS:.o=.pieo} +DEPENDOBJS+= ${PIEOBJS} +CLEANFILES+= ${PIEOBJS} + +_LIBS+= lib${LIB_PRIVATE}${LIB}_pie.a + +lib${LIB_PRIVATE}${LIB}_pie.a: ${PIEOBJS} + @${ECHO} building pie ${LIB} library + @rm -f ${.TARGET} + ${AR} ${ARFLAGS} ${.TARGET} ${PIEOBJS} ${ARADD} + ${RANLIB} ${RANLIBFLAGS} ${.TARGET} +.endif .if defined(_SKIP_BUILD) all: Modified: stable/12/share/mk/bsd.opts.mk ============================================================================== --- stable/12/share/mk/bsd.opts.mk Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/share/mk/bsd.opts.mk Thu Sep 26 16:05:57 2019 (r352754) @@ -73,6 +73,7 @@ __DEFAULT_NO_OPTIONS = \ CCACHE_BUILD \ CTF \ INSTALL_AS_USER \ + PIE \ RETPOLINE \ STALE_STAGED Modified: stable/12/share/mk/bsd.prog.mk ============================================================================== --- stable/12/share/mk/bsd.prog.mk Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/share/mk/bsd.prog.mk Thu Sep 26 16:05:57 2019 (r352754) @@ -38,11 +38,16 @@ MK_DEBUG_FILES= no .if ${MK_BIND_NOW} != "no" LDFLAGS+= -Wl,-znow .endif +.if ${MK_PIE} != "no" && (!defined(NO_SHARED) || ${NO_SHARED:tl} == "no") +CFLAGS+= -fPIE +CXXFLAGS+= -fPIE +LDFLAGS+= -pie +.endif .if ${MK_RETPOLINE} != "no" CFLAGS+= -mretpoline CXXFLAGS+= -mretpoline # retpolineplt is broken with static linking (PR 233336) -.if !defined(NO_SHARED) || ${NO_SHARED} == "no" || ${NO_SHARED} == "NO" +.if !defined(NO_SHARED) || ${NO_SHARED:tl} == "no" LDFLAGS+= -Wl,-zretpolineplt .endif .endif @@ -68,7 +73,7 @@ TAGS+= package=${PACKAGE:Uruntime} TAG_ARGS= -T ${TAGS:[*]:S/ /,/g} .endif -.if defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO") +.if defined(NO_SHARED) && ${NO_SHARED:tl} != "no" LDFLAGS+= -static .endif Modified: stable/12/share/mk/src.libnames.mk ============================================================================== --- stable/12/share/mk/src.libnames.mk Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/share/mk/src.libnames.mk Thu Sep 26 16:05:57 2019 (r352754) @@ -398,6 +398,10 @@ LDADD_gtest_main= -lprivategtest_main LIB${_l:tu}?= ${LIBDESTDIR}${LIBDIR_BASE}/libprivate${_l}.a .endfor +.if ${MK_PIE} != "no" +PIE_SUFFIX= _pie +.endif + .for _l in ${_LIBRARIES} .if ${_INTERNALLIBS:M${_l}} || !defined(SYSROOT) LDADD_${_l}_L+= -L${LIB${_l:tu}DIR} @@ -405,12 +409,14 @@ LDADD_${_l}_L+= -L${LIB${_l:tu}DIR} DPADD_${_l}?= ${LIB${_l:tu}} .if ${_PRIVATELIBS:M${_l}} LDADD_${_l}?= -lprivate${_l} +.elif ${_INTERNALLIBS:M${_l}} +LDADD_${_l}?= ${LDADD_${_l}_L} -l${_l:S/${PIE_SUFFIX}//}${PIE_SUFFIX} .else LDADD_${_l}?= ${LDADD_${_l}_L} -l${_l} .endif # Add in all dependencies for static linkage. .if defined(_DP_${_l}) && (${_INTERNALLIBS:M${_l}} || \ - (defined(NO_SHARED) && (${NO_SHARED} != "no" && ${NO_SHARED} != "NO"))) + (defined(NO_SHARED) && ${NO_SHARED:tl} != "no")) .for _d in ${_DP_${_l}} DPADD_${_l}+= ${DPADD_${_d}} LDADD_${_l}+= ${LDADD_${_d}} @@ -457,69 +463,69 @@ LDADD+= ${LDADD_${_l}} # INTERNALLIB definitions. LIBELFTCDIR= ${OBJTOP}/lib/libelftc -LIBELFTC?= ${LIBELFTCDIR}/libelftc.a +LIBELFTC?= ${LIBELFTCDIR}/libelftc${PIE_SUFFIX}.a LIBPEDIR= ${OBJTOP}/lib/libpe -LIBPE?= ${LIBPEDIR}/libpe.a +LIBPE?= ${LIBPEDIR}/libpe${PIE_SUFFIX}.a LIBOPENBSDDIR= ${OBJTOP}/lib/libopenbsd -LIBOPENBSD?= ${LIBOPENBSDDIR}/libopenbsd.a +LIBOPENBSD?= ${LIBOPENBSDDIR}/libopenbsd${PIE_SUFFIX}.a LIBSMDIR= ${OBJTOP}/lib/libsm -LIBSM?= ${LIBSMDIR}/libsm.a +LIBSM?= ${LIBSMDIR}/libsm${PIE_SUFFIX}.a LIBSMDBDIR= ${OBJTOP}/lib/libsmdb -LIBSMDB?= ${LIBSMDBDIR}/libsmdb.a +LIBSMDB?= ${LIBSMDBDIR}/libsmdb${PIE_SUFFIX}.a LIBSMUTILDIR= ${OBJTOP}/lib/libsmutil -LIBSMUTIL?= ${LIBSMUTILDIR}/libsmutil.a +LIBSMUTIL?= ${LIBSMUTILDIR}/libsmutil${PIE_SUFFIX}.a LIBNETBSDDIR?= ${OBJTOP}/lib/libnetbsd -LIBNETBSD?= ${LIBNETBSDDIR}/libnetbsd.a +LIBNETBSD?= ${LIBNETBSDDIR}/libnetbsd${PIE_SUFFIX}.a LIBVERSDIR?= ${OBJTOP}/kerberos5/lib/libvers -LIBVERS?= ${LIBVERSDIR}/libvers.a +LIBVERS?= ${LIBVERSDIR}/libvers${PIE_SUFFIX}.a LIBSLDIR= ${OBJTOP}/kerberos5/lib/libsl -LIBSL?= ${LIBSLDIR}/libsl.a +LIBSL?= ${LIBSLDIR}/libsl${PIE_SUFFIX}.a LIBIPFDIR= ${OBJTOP}/sbin/ipf/libipf -LIBIPF?= ${LIBIPFDIR}/libipf.a +LIBIPF?= ${LIBIPFDIR}/libipf${PIE_SUFFIX}.a LIBTELNETDIR= ${OBJTOP}/lib/libtelnet -LIBTELNET?= ${LIBTELNETDIR}/libtelnet.a +LIBTELNET?= ${LIBTELNETDIR}/libtelnet${PIE_SUFFIX}.a LIBCRONDIR= ${OBJTOP}/usr.sbin/cron/lib -LIBCRON?= ${LIBCRONDIR}/libcron.a +LIBCRON?= ${LIBCRONDIR}/libcron${PIE_SUFFIX}.a LIBNTPDIR= ${OBJTOP}/usr.sbin/ntp/libntp -LIBNTP?= ${LIBNTPDIR}/libntp.a +LIBNTP?= ${LIBNTPDIR}/libntp${PIE_SUFFIX}.a LIBNTPEVENTDIR= ${OBJTOP}/usr.sbin/ntp/libntpevent -LIBNTPEVENT?= ${LIBNTPEVENTDIR}/libntpevent.a +LIBNTPEVENT?= ${LIBNTPEVENTDIR}/libntpevent${PIE_SUFFIX}.a LIBOPTSDIR= ${OBJTOP}/usr.sbin/ntp/libopts -LIBOPTS?= ${LIBOPTSDIR}/libopts.a +LIBOPTS?= ${LIBOPTSDIR}/libopts${PIE_SUFFIX}.a LIBPARSEDIR= ${OBJTOP}/usr.sbin/ntp/libparse -LIBPARSE?= ${LIBPARSEDIR}/libparse.a +LIBPARSE?= ${LIBPARSEDIR}/libparse${PIE_SUFFIX}.a LIBLPRDIR= ${OBJTOP}/usr.sbin/lpr/common_source -LIBLPR?= ${LIBLPRDIR}/liblpr.a +LIBLPR?= ${LIBLPRDIR}/liblpr${PIE_SUFFIX}.a LIBFIFOLOGDIR= ${OBJTOP}/usr.sbin/fifolog/lib -LIBFIFOLOG?= ${LIBFIFOLOGDIR}/libfifolog.a +LIBFIFOLOG?= ${LIBFIFOLOGDIR}/libfifolog${PIE_SUFFIX}.a LIBBSNMPTOOLSDIR= ${OBJTOP}/usr.sbin/bsnmpd/tools/libbsnmptools -LIBBSNMPTOOLS?= ${LIBBSNMPTOOLSDIR}/libbsnmptools.a +LIBBSNMPTOOLS?= ${LIBBSNMPTOOLSDIR}/libbsnmptools${PIE_SUFFIX}.a LIBAMUDIR= ${OBJTOP}/usr.sbin/amd/libamu -LIBAMU?= ${LIBAMUDIR}/libamu.a +LIBAMU?= ${LIBAMUDIR}/libamu${PIE_SUFFIX}.a -LIBBE?= ${LIBBEDIR}/libbe.a +LIBBE?= ${LIBBEDIR}/libbe${PIE_SUFFIX}.a LIBPMCSTATDIR= ${OBJTOP}/lib/libpmcstat -LIBPMCSTAT?= ${LIBPMCSTATDIR}/libpmcstat.a +LIBPMCSTAT?= ${LIBPMCSTATDIR}/libpmcstat${PIE_SUFFIX}.a LIBC_NOSSP_PICDIR= ${OBJTOP}/lib/libc LIBC_NOSSP_PIC?= ${LIBC_NOSSP_PICDIR}/libc_nossp_pic.a Modified: stable/12/stand/i386/Makefile.inc ============================================================================== --- stable/12/stand/i386/Makefile.inc Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/stand/i386/Makefile.inc Thu Sep 26 16:05:57 2019 (r352754) @@ -5,6 +5,7 @@ LOADER_ADDRESS?=0x200000 LDFLAGS+= -nostdlib LDFLAGS.lld+= -Wl,--no-rosegment +MK_PIE:= no # BTX components BTXDIR= ${BOOTOBJ}/i386/btx Copied: stable/12/tools/build/options/WITHOUT_PIE (from r344179, head/tools/build/options/WITHOUT_PIE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITHOUT_PIE Thu Sep 26 16:05:57 2019 (r352754, copy of r344179, head/tools/build/options/WITHOUT_PIE) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Do not build dynamically linked binaries as +Position-Independent Executable (PIE). Copied: stable/12/tools/build/options/WITH_PIE (from r344179, head/tools/build/options/WITH_PIE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITH_PIE Thu Sep 26 16:05:57 2019 (r352754, copy of r344179, head/tools/build/options/WITH_PIE) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Build dynamically linked binaries as +Position-Independent Executable (PIE). Modified: stable/12/usr.bin/clang/Makefile.inc ============================================================================== --- stable/12/usr.bin/clang/Makefile.inc Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/usr.bin/clang/Makefile.inc Thu Sep 26 16:05:57 2019 (r352754) @@ -4,6 +4,8 @@ WARNS?= 0 .include +MK_PIE:= no # Explicit libXXX.a references + .if ${COMPILER_TYPE} == "clang" DEBUG_FILES_CFLAGS= -gline-tables-only .else Modified: stable/12/usr.bin/svn/Makefile.inc ============================================================================== --- stable/12/usr.bin/svn/Makefile.inc Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/usr.bin/svn/Makefile.inc Thu Sep 26 16:05:57 2019 (r352754) @@ -2,6 +2,8 @@ .include +MK_PIE:= no # Explicit libXXX.a references + .if ${MK_SVN} == "yes" SVNLITE?= .else Modified: stable/12/usr.sbin/wlandebug/Makefile ============================================================================== --- stable/12/usr.sbin/wlandebug/Makefile Thu Sep 26 15:52:42 2019 (r352753) +++ stable/12/usr.sbin/wlandebug/Makefile Thu Sep 26 16:05:57 2019 (r352754) @@ -2,6 +2,7 @@ PROG= wlandebug MAN= wlandebug.8 +MK_PIE:= no LIBADD+= ifconfig From owner-svn-src-stable@freebsd.org Thu Sep 26 16:09:29 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C07712BBDA; Thu, 26 Sep 2019 16:09:29 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fKcn0x5lz4SXW; Thu, 26 Sep 2019 16:09:29 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0361D2A07; Thu, 26 Sep 2019 16:09:29 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QG9SmX068889; Thu, 26 Sep 2019 16:09:28 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QG9SsK068888; Thu, 26 Sep 2019 16:09:28 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909261609.x8QG9SsK068888@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 26 Sep 2019 16:09:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352755 - stable/12/share/man/man5 X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/share/man/man5 X-SVN-Commit-Revision: 352755 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 16:09:29 -0000 Author: emaste Date: Thu Sep 26 16:09:28 2019 New Revision: 352755 URL: https://svnweb.freebsd.org/changeset/base/352755 Log: src.conf.5: regen after r352754, WITH_PIE Sponsored by: The FreeBSD Foundation Modified: stable/12/share/man/man5/src.conf.5 Modified: stable/12/share/man/man5/src.conf.5 ============================================================================== --- stable/12/share/man/man5/src.conf.5 Thu Sep 26 16:05:57 2019 (r352754) +++ stable/12/share/man/man5/src.conf.5 Thu Sep 26 16:09:28 2019 (r352755) @@ -1573,6 +1573,9 @@ When set, it enforces these options: .It .Va WITHOUT_AUTHPF .El +.It Va WITH_PIE +Build dynamically linked binaries as +Position-Independent Executable (PIE). .It Va WITHOUT_PKGBOOTSTRAP Set to not build .Xr pkg 7 From owner-svn-src-stable@freebsd.org Thu Sep 26 16:33:21 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B23612C7F1; Thu, 26 Sep 2019 16:33:21 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fL8K3d1gz4Vcv; Thu, 26 Sep 2019 16:33:21 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FB872F40; Thu, 26 Sep 2019 16:33:21 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QGXLQ5086820; Thu, 26 Sep 2019 16:33:21 GMT (envelope-from grembo@FreeBSD.org) Received: (from grembo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QGXLTj086818; Thu, 26 Sep 2019 16:33:21 GMT (envelope-from grembo@FreeBSD.org) Message-Id: <201909261633.x8QGXLTj086818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grembo set sender to grembo@FreeBSD.org using -f From: Michael Gmelin Date: Thu, 26 Sep 2019 16:33:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352758 - stable/11/usr.sbin/freebsd-update X-SVN-Group: stable-11 X-SVN-Commit-Author: grembo X-SVN-Commit-Paths: stable/11/usr.sbin/freebsd-update X-SVN-Commit-Revision: 352758 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 16:33:21 -0000 Author: grembo (ports committer) Date: Thu Sep 26 16:33:20 2019 New Revision: 352758 URL: https://svnweb.freebsd.org/changeset/base/352758 Log: MFC r352513, r352514, r352662: As suggested by koobs, MFC recent freebsd-update changes to have a consistent user experience on all supported versions. r352513: freebsd-update.8: appease igor igor follows American style guides in the belief that abbreviations i.e. and e.g. are always followed by a comma. Make that change now so that future updates to freebsd-update.8 do not complain about this. r352514: freebsd-update: make usage output consistent Drop trailing . which appeared only on description of IDS. r352662: freebsd-update: Add `updatesready' and `showconfig' commands `freebsd-update updatesready' can be used to check if there are any pending fetched updates that can be installed. `freebsd-update showconfig' writes freebsd-update's configuration to stdout. This also changes the exit code of `freebsd-update install' to 2 in case there are no updates pending to be installed and there wasn't a fetch phase in the same invocation. This allows scripts to tell apart these error conditions without breaking existing jail managers. PR: 240757, 240177, 229346 Reviewed by: manpages (bcr), secteam (emaste), yuripv Differential Revision: https://reviews.freebsd.org/D21473 Modified: stable/11/usr.sbin/freebsd-update/freebsd-update.8 stable/11/usr.sbin/freebsd-update/freebsd-update.sh Modified: stable/11/usr.sbin/freebsd-update/freebsd-update.8 ============================================================================== --- stable/11/usr.sbin/freebsd-update/freebsd-update.8 Thu Sep 26 16:19:22 2019 (r352757) +++ stable/11/usr.sbin/freebsd-update/freebsd-update.8 Thu Sep 26 16:33:20 2019 (r352758) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 14, 2017 +.Dd September 24, 2019 .Dt FREEBSD-UPDATE 8 .Os .Sh NAME @@ -95,7 +95,7 @@ Trust an RSA key with SHA256 of .Ar KEY . (default: read value from configuration file.) .It Fl r Ar newrelease -Specify the new release (e.g. 11.2-RELEASE) to which +Specify the new release (e.g., 11.2-RELEASE) to which .Nm should upgrade (upgrade command only). .It Fl s Ar server @@ -155,13 +155,24 @@ Note that this command may require up to 500 MB of spa depending on which components of the .Fx base system are installed. +.It Cm updatesready +Check if there are fetched updates ready to install. +Returns exit code 2 if there are no updates to install. .It Cm install Install the most recently fetched updates or upgrade. +Returns exit code 2 if there are no updates to install +and the +.Cm fetch +command wasn't passed as an earlier argument in the same +invocation. .It Cm rollback Uninstall the most recently installed updates. .It Cm IDS Compare the system against a "known good" index of the installed release. +.It Cm showconfig +Show configuration options after parsing conffile and command +line options. .El .Sh TIPS .Bl -bullet Modified: stable/11/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- stable/11/usr.sbin/freebsd-update/freebsd-update.sh Thu Sep 26 16:19:22 2019 (r352757) +++ stable/11/usr.sbin/freebsd-update/freebsd-update.sh Thu Sep 26 16:33:20 2019 (r352758) @@ -62,9 +62,11 @@ Commands: cron -- Sleep rand(3600) seconds, fetch updates, and send an email if updates were found upgrade -- Fetch upgrades to FreeBSD version specified via -r option + updatesready -- Check if there are fetched updates ready to install install -- Install downloaded updates or upgrades rollback -- Uninstall most recently installed updates - IDS -- Compare the system against an index of "known good" files. + IDS -- Compare the system against an index of "known good" files + showconfig -- Show configuration EOF exit 0 } @@ -503,7 +505,8 @@ parse_cmdline () { ;; # Commands - cron | fetch | upgrade | install | rollback | IDS) + cron | fetch | upgrade | updatesready | install | rollback |\ + IDS | showconfig) COMMANDS="${COMMANDS} $1" ;; @@ -827,7 +830,7 @@ install_check_params () { echo "No updates are available to install." if [ $ISFETCHED -eq 0 ]; then echo "Run '$0 fetch' first." - exit 1 + exit 2 fi exit 0 fi @@ -3333,6 +3336,21 @@ cmd_upgrade () { upgrade_run || exit 1 } +# Check if there are fetched updates ready to install +cmd_updatesready () { + # Construct a unique name from ${BASEDIR} + BDHASH=`echo ${BASEDIR} | sha256 -q` + + # Check that we have updates ready to install + if ! [ -L ${BDHASH}-install ]; then + echo "No updates are available to install." + exit 2 + fi + + echo "There are updates available to install." + echo "Run '$0 install' to proceed." +} + # Install downloaded updates. cmd_install () { install_check_params @@ -3349,6 +3367,13 @@ cmd_rollback () { cmd_IDS () { IDS_check_params IDS_run || exit 1 +} + +# Output configuration. +cmd_showconfig () { + for X in ${CONFIGOPTIONS}; do + echo $X=$(eval echo \$${X}) + done } #### Entry point From owner-svn-src-stable@freebsd.org Thu Sep 26 16:34:44 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1F82C12C890; Thu, 26 Sep 2019 16:34:44 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fL9v74sfz4VmG; Thu, 26 Sep 2019 16:34:43 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D634D2F54; Thu, 26 Sep 2019 16:34:43 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QGYhsV086962; Thu, 26 Sep 2019 16:34:43 GMT (envelope-from grembo@FreeBSD.org) Received: (from grembo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QGYhn7086960; Thu, 26 Sep 2019 16:34:43 GMT (envelope-from grembo@FreeBSD.org) Message-Id: <201909261634.x8QGYhn7086960@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grembo set sender to grembo@FreeBSD.org using -f From: Michael Gmelin Date: Thu, 26 Sep 2019 16:34:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352759 - stable/12/usr.sbin/freebsd-update X-SVN-Group: stable-12 X-SVN-Commit-Author: grembo X-SVN-Commit-Paths: stable/12/usr.sbin/freebsd-update X-SVN-Commit-Revision: 352759 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 16:34:44 -0000 Author: grembo (ports committer) Date: Thu Sep 26 16:34:43 2019 New Revision: 352759 URL: https://svnweb.freebsd.org/changeset/base/352759 Log: MFC r352513, r352514, r352662: As suggested by koobs, MFC recent freebsd-update changes to have a consistent user experience on all supported versions. r352513: freebsd-update.8: appease igor igor follows American style guides in the belief that abbreviations i.e. and e.g. are always followed by a comma. Make that change now so that future updates to freebsd-update.8 do not complain about this. r352514: freebsd-update: make usage output consistent Drop trailing . which appeared only on description of IDS. r352662: freebsd-update: Add `updatesready' and `showconfig' commands `freebsd-update updatesready' can be used to check if there are any pending fetched updates that can be installed. `freebsd-update showconfig' writes freebsd-update's configuration to stdout. This also changes the exit code of `freebsd-update install' to 2 in case there are no updates pending to be installed and there wasn't a fetch phase in the same invocation. This allows scripts to tell apart these error conditions without breaking existing jail managers. PR: 240757, 240177, 229346 Reviewed by: manpages (bcr), secteam (emaste), yuripv Differential Revision: https://reviews.freebsd.org/D21473 Modified: stable/12/usr.sbin/freebsd-update/freebsd-update.8 stable/12/usr.sbin/freebsd-update/freebsd-update.sh Modified: stable/12/usr.sbin/freebsd-update/freebsd-update.8 ============================================================================== --- stable/12/usr.sbin/freebsd-update/freebsd-update.8 Thu Sep 26 16:33:20 2019 (r352758) +++ stable/12/usr.sbin/freebsd-update/freebsd-update.8 Thu Sep 26 16:34:43 2019 (r352759) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 14, 2017 +.Dd September 24, 2019 .Dt FREEBSD-UPDATE 8 .Os .Sh NAME @@ -95,7 +95,7 @@ Trust an RSA key with SHA256 of .Ar KEY . (default: read value from configuration file.) .It Fl r Ar newrelease -Specify the new release (e.g. 11.2-RELEASE) to which +Specify the new release (e.g., 11.2-RELEASE) to which .Nm should upgrade (upgrade command only). .It Fl s Ar server @@ -155,13 +155,24 @@ Note that this command may require up to 500 MB of spa depending on which components of the .Fx base system are installed. +.It Cm updatesready +Check if there are fetched updates ready to install. +Returns exit code 2 if there are no updates to install. .It Cm install Install the most recently fetched updates or upgrade. +Returns exit code 2 if there are no updates to install +and the +.Cm fetch +command wasn't passed as an earlier argument in the same +invocation. .It Cm rollback Uninstall the most recently installed updates. .It Cm IDS Compare the system against a "known good" index of the installed release. +.It Cm showconfig +Show configuration options after parsing conffile and command +line options. .El .Sh TIPS .Bl -bullet Modified: stable/12/usr.sbin/freebsd-update/freebsd-update.sh ============================================================================== --- stable/12/usr.sbin/freebsd-update/freebsd-update.sh Thu Sep 26 16:33:20 2019 (r352758) +++ stable/12/usr.sbin/freebsd-update/freebsd-update.sh Thu Sep 26 16:34:43 2019 (r352759) @@ -62,9 +62,11 @@ Commands: cron -- Sleep rand(3600) seconds, fetch updates, and send an email if updates were found upgrade -- Fetch upgrades to FreeBSD version specified via -r option + updatesready -- Check if there are fetched updates ready to install install -- Install downloaded updates or upgrades rollback -- Uninstall most recently installed updates - IDS -- Compare the system against an index of "known good" files. + IDS -- Compare the system against an index of "known good" files + showconfig -- Show configuration EOF exit 0 } @@ -503,7 +505,8 @@ parse_cmdline () { ;; # Commands - cron | fetch | upgrade | install | rollback | IDS) + cron | fetch | upgrade | updatesready | install | rollback |\ + IDS | showconfig) COMMANDS="${COMMANDS} $1" ;; @@ -827,7 +830,7 @@ install_check_params () { echo "No updates are available to install." if [ $ISFETCHED -eq 0 ]; then echo "Run '$0 fetch' first." - exit 1 + exit 2 fi exit 0 fi @@ -3333,6 +3336,21 @@ cmd_upgrade () { upgrade_run || exit 1 } +# Check if there are fetched updates ready to install +cmd_updatesready () { + # Construct a unique name from ${BASEDIR} + BDHASH=`echo ${BASEDIR} | sha256 -q` + + # Check that we have updates ready to install + if ! [ -L ${BDHASH}-install ]; then + echo "No updates are available to install." + exit 2 + fi + + echo "There are updates available to install." + echo "Run '$0 install' to proceed." +} + # Install downloaded updates. cmd_install () { install_check_params @@ -3349,6 +3367,13 @@ cmd_rollback () { cmd_IDS () { IDS_check_params IDS_run || exit 1 +} + +# Output configuration. +cmd_showconfig () { + for X in ${CONFIGOPTIONS}; do + echo $X=$(eval echo \$${X}) + done } #### Entry point From owner-svn-src-stable@freebsd.org Thu Sep 26 16:39:34 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3565A12C9E9; Thu, 26 Sep 2019 16:39:34 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fLHV0dfCz4W04; Thu, 26 Sep 2019 16:39:34 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE9AB2F73; Thu, 26 Sep 2019 16:39:33 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QGdX2R087312; Thu, 26 Sep 2019 16:39:33 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QGdXa6087311; Thu, 26 Sep 2019 16:39:33 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201909261639.x8QGdXa6087311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 26 Sep 2019 16:39:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352760 - stable/12/sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/sys/sys X-SVN-Commit-Revision: 352760 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 16:39:34 -0000 Author: emaste Date: Thu Sep 26 16:39:33 2019 New Revision: 352760 URL: https://svnweb.freebsd.org/changeset/base/352760 Log: MFC r352551: elf_common: add ELF note names r348628 added a definition of NT_GNU_BUILD_ID. Some software (Valgrind) also expects a #define for the note name (ELF_NOTE_GNU) in the case that NT_GNU_BUILD_ID is defined. PR: 239669 Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/sys/elf_common.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/sys/elf_common.h ============================================================================== --- stable/12/sys/sys/elf_common.h Thu Sep 26 16:34:43 2019 (r352759) +++ stable/12/sys/sys/elf_common.h Thu Sep 26 16:39:33 2019 (r352760) @@ -764,6 +764,12 @@ typedef struct { #define LL_DELAY_LOAD 0x10 #define LL_DELTA 0x20 +/* Note section names */ +#define ELF_NOTE_FREEBSD "FreeBSD" +#define ELF_NOTE_NETBSD "NetBSD" +#define ELF_NOTE_SOLARIS "SUNW Solaris" +#define ELF_NOTE_GNU "GNU" + /* Values for n_type used in executables. */ #define NT_FREEBSD_ABI_TAG 1 #define NT_FREEBSD_NOINIT_TAG 2 From owner-svn-src-stable@freebsd.org Thu Sep 26 17:07:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C65E12D7F7; Thu, 26 Sep 2019 17:07:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fLvl0pwvz4Y39; Thu, 26 Sep 2019 17:07:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4A8134E0; Thu, 26 Sep 2019 17:07:30 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QH7U34004670; Thu, 26 Sep 2019 17:07:30 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QH7UTY004669; Thu, 26 Sep 2019 17:07:30 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201909261707.x8QH7UTY004669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 26 Sep 2019 17:07:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352762 - stable/12/sys/arm/freescale/imx X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/sys/arm/freescale/imx X-SVN-Commit-Revision: 352762 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 17:07:31 -0000 Author: ian Date: Thu Sep 26 17:07:30 2019 New Revision: 352762 URL: https://svnweb.freebsd.org/changeset/base/352762 Log: MFC r352363: Apply a runtime patch to the FDT data for imx6 to fix iomuxc problems. The latest imported FDT data defines a node for an iomuxc-gpr device, which we don't support (or need, right now) in addition to the usual iomuxc device. Unfortunately, the dts improperly assigns overlapping ranges of mmio space to both devices. The -gpr device is also a syscon and simple_mfd device. At runtime the simple_mfd driver attaches for the iomuxc-gpr node, then when the real iomuxc driver comes along later, it fails to attach because it tries to allocate its register space, and it's already partially in use by the bogus instance of simple_mfd. This change works around the problem by simply disabling the node for the iomuxc-gpr device, since we don't need it for anything. Modified: stable/12/sys/arm/freescale/imx/imx6_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/freescale/imx/imx6_machdep.c ============================================================================== --- stable/12/sys/arm/freescale/imx/imx6_machdep.c Thu Sep 26 16:51:51 2019 (r352761) +++ stable/12/sys/arm/freescale/imx/imx6_machdep.c Thu Sep 26 17:07:30 2019 (r352762) @@ -148,12 +148,43 @@ fix_fdt_interrupt_data(void) OF_setprop(socnode, "interrupt-parent", &gicxref, sizeof(gicxref)); } +static void +fix_fdt_iomuxc_data(void) +{ + phandle_t node; + + /* + * The linux dts defines two nodes with the same mmio address range, + * iomuxc-gpr and the regular iomuxc. The -grp node is a simple_mfd and + * a syscon, but it only has access to a small subset of the iomuxc + * registers, so it can't serve as the accessor for the iomuxc driver's + * register IO. But right now, the simple_mfd driver attaches first, + * preventing the real iomuxc driver from allocating its mmio register + * range because it partially overlaps with the -gpr range. + * + * For now, by far the easiest thing to do to keep imx6 working is to + * just disable the iomuxc-gpr node because we don't have a driver for + * it anyway, we just need to prevent attachment of simple_mfd. + * + * If we ever write a -gpr driver, this code should probably switch to + * modifying the reg property so that the range covers all the iomuxc + * regs, then the -gpr driver can be a regular syscon driver that iomuxc + * uses for register access. + */ + node = OF_finddevice("/soc/aips-bus@2000000/iomuxc-gpr@20e0000"); + if (node != -1) + OF_setprop(node, "status", "disabled", sizeof("disabled")); +} + static int imx6_attach(platform_t plat) { /* Fix soc interrupt-parent property. */ fix_fdt_interrupt_data(); + + /* Fix iomuxc-gpr and iomuxc nodes both using the same mmio range. */ + fix_fdt_iomuxc_data(); /* Inform the MPCore timer driver that its clock is variable. */ arm_tmr_change_frequency(ARM_TMR_FREQUENCY_VARIES); From owner-svn-src-stable@freebsd.org Thu Sep 26 19:08:54 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 199B7131B26; Thu, 26 Sep 2019 19:08:54 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fPbn6w1Qz3LhY; Thu, 26 Sep 2019 19:08:53 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B62B34E21; Thu, 26 Sep 2019 19:08:53 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QJ8r4i084755; Thu, 26 Sep 2019 19:08:53 GMT (envelope-from grembo@FreeBSD.org) Received: (from grembo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QJ8r30084754; Thu, 26 Sep 2019 19:08:53 GMT (envelope-from grembo@FreeBSD.org) Message-Id: <201909261908.x8QJ8r30084754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grembo set sender to grembo@FreeBSD.org using -f From: Michael Gmelin Date: Thu, 26 Sep 2019 19:08:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352770 - stable/11 X-SVN-Group: stable-11 X-SVN-Commit-Author: grembo X-SVN-Commit-Paths: stable/11 X-SVN-Commit-Revision: 352770 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 19:08:54 -0000 Author: grembo (ports committer) Date: Thu Sep 26 19:08:53 2019 New Revision: 352770 URL: https://svnweb.freebsd.org/changeset/base/352770 Log: Add mergeinfo missing in r352758 Modified: Directory Properties: stable/11/ (props changed) From owner-svn-src-stable@freebsd.org Thu Sep 26 19:10:23 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C4D5131BDF; Thu, 26 Sep 2019 19:10:23 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fPdV6WqFz3Lqc; Thu, 26 Sep 2019 19:10:22 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ABE224E27; Thu, 26 Sep 2019 19:10:22 +0000 (UTC) (envelope-from grembo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QJAMSU084924; Thu, 26 Sep 2019 19:10:22 GMT (envelope-from grembo@FreeBSD.org) Received: (from grembo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QJAMtZ084923; Thu, 26 Sep 2019 19:10:22 GMT (envelope-from grembo@FreeBSD.org) Message-Id: <201909261910.x8QJAMtZ084923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grembo set sender to grembo@FreeBSD.org using -f From: Michael Gmelin Date: Thu, 26 Sep 2019 19:10:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352771 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: grembo X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 352771 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 19:10:23 -0000 Author: grembo (ports committer) Date: Thu Sep 26 19:10:22 2019 New Revision: 352771 URL: https://svnweb.freebsd.org/changeset/base/352771 Log: Add mergeinfo missing in r352759 Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-stable@freebsd.org Thu Sep 26 19:47:54 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D34161328B6; Thu, 26 Sep 2019 19:47:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fQSp58dNz3NjZ; Thu, 26 Sep 2019 19:47:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 942105584; Thu, 26 Sep 2019 19:47:54 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QJlsvh008536; Thu, 26 Sep 2019 19:47:54 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QJls4o008535; Thu, 26 Sep 2019 19:47:54 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909261947.x8QJls4o008535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Sep 2019 19:47:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352772 - stable/12/sys/cam/scsi X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/cam/scsi X-SVN-Commit-Revision: 352772 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 19:47:54 -0000 Author: mav Date: Thu Sep 26 19:47:54 2019 New Revision: 352772 URL: https://svnweb.freebsd.org/changeset/base/352772 Log: MFC r349342 (by imp): Use the cam_ed copy of ata_params rather than malloc and freeing memory for it. This reaches into internal bits of xpt a little, and I'll clean that up later. Modified: stable/12/sys/cam/scsi/scsi_da.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/12/sys/cam/scsi/scsi_da.c Thu Sep 26 19:10:22 2019 (r352771) +++ stable/12/sys/cam/scsi/scsi_da.c Thu Sep 26 19:47:54 2019 (r352772) @@ -64,6 +64,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef _KERNEL +#include +#endif /* _KERNEL */ #include #include @@ -3598,16 +3601,8 @@ out: break; } - ata_params = (struct ata_params*) - malloc(sizeof(*ata_params), M_SCSIDA,M_NOWAIT|M_ZERO); + ata_params = &periph->path->device->ident_data; - if (ata_params == NULL) { - xpt_print(periph->path, "Couldn't malloc ata_params " - "data\n"); - /* da_free_periph??? */ - break; - } - scsi_ata_identify(&start_ccb->csio, /*retries*/da_retry_count, /*cbfcnp*/dadone_probeata, @@ -5276,7 +5271,6 @@ dadone_probeata(struct cam_periph *periph, union ccb * } } - free(ata_params, M_SCSIDA); if ((softc->zone_mode == DA_ZONE_HOST_AWARE) || (softc->zone_mode == DA_ZONE_HOST_MANAGED)) { /* From owner-svn-src-stable@freebsd.org Thu Sep 26 19:48:37 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F7B313292C; Thu, 26 Sep 2019 19:48:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fQTd0PBhz3Nqq; Thu, 26 Sep 2019 19:48:37 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E5C105585; Thu, 26 Sep 2019 19:48:36 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8QJmaPA008619; Thu, 26 Sep 2019 19:48:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8QJma1w008618; Thu, 26 Sep 2019 19:48:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909261948.x8QJma1w008618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 26 Sep 2019 19:48:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352773 - stable/11/sys/cam/scsi X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam/scsi X-SVN-Commit-Revision: 352773 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Sep 2019 19:48:37 -0000 Author: mav Date: Thu Sep 26 19:48:36 2019 New Revision: 352773 URL: https://svnweb.freebsd.org/changeset/base/352773 Log: MFC r349342 (by imp): Use the cam_ed copy of ata_params rather than malloc and freeing memory for it. This reaches into internal bits of xpt a little, and I'll clean that up later. Modified: stable/11/sys/cam/scsi/scsi_da.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/11/sys/cam/scsi/scsi_da.c Thu Sep 26 19:47:54 2019 (r352772) +++ stable/11/sys/cam/scsi/scsi_da.c Thu Sep 26 19:48:36 2019 (r352773) @@ -60,6 +60,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef _KERNEL +#include +#endif /* _KERNEL */ #include #include @@ -3373,16 +3376,8 @@ out: break; } - ata_params = (struct ata_params*) - malloc(sizeof(*ata_params), M_SCSIDA,M_NOWAIT|M_ZERO); + ata_params = &periph->path->device->ident_data; - if (ata_params == NULL) { - xpt_print(periph->path, "Couldn't malloc ata_params " - "data\n"); - /* da_free_periph??? */ - break; - } - scsi_ata_identify(&start_ccb->csio, /*retries*/da_retry_count, /*cbfcnp*/dadone, @@ -4961,7 +4956,6 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) } } - free(ata_params, M_SCSIDA); if ((softc->zone_mode == DA_ZONE_HOST_AWARE) || (softc->zone_mode == DA_ZONE_HOST_MANAGED)) { /* From owner-svn-src-stable@freebsd.org Fri Sep 27 00:08:41 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69966137DB1; Fri, 27 Sep 2019 00:08:41 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fXFj1nzmz47cB; Fri, 27 Sep 2019 00:08:41 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DE5C85A7; Fri, 27 Sep 2019 00:08:41 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8R08eQu062383; Fri, 27 Sep 2019 00:08:40 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8R08eCR062382; Fri, 27 Sep 2019 00:08:40 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201909270008.x8R08eCR062382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 27 Sep 2019 00:08:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352781 - stable/12/share/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: stable/12/share/mk X-SVN-Commit-Revision: 352781 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Sep 2019 00:08:41 -0000 Author: sjg Date: Fri Sep 27 00:08:40 2019 New Revision: 352781 URL: https://svnweb.freebsd.org/changeset/base/352781 Log: Use .undef per variable Attempting to expand a variable to a list of vars to .undef does not actually work. MFC of r343066 Reviewed by: bdrewery Differential Revision: D17251 Modified: stable/12/share/mk/dirdeps-options.mk Modified: stable/12/share/mk/dirdeps-options.mk ============================================================================== --- stable/12/share/mk/dirdeps-options.mk Fri Sep 27 00:00:21 2019 (r352780) +++ stable/12/share/mk/dirdeps-options.mk Fri Sep 27 00:08:40 2019 (r352781) @@ -1,5 +1,5 @@ # $FreeBSD$ -# $Id: dirdeps-options.mk,v 1.8 2018/05/29 22:31:21 sjg Exp $ +# $Id: dirdeps-options.mk,v 1.9 2018/09/20 00:07:19 sjg Exp $ # # @(#) Copyright (c) 2018, Simon J. Gerraty # @@ -54,7 +54,8 @@ DIRDEPS += ${DIRDEPS.$o.${MK_$o:U}:U} DIRDEPS := ${DIRDEPS:O:u} # avoid cross contamination .for o in ${DIRDEPS_OPTIONS:tu} -.undef DIRDEPS.$o.yes DIRDEPS.$o.no +.undef DIRDEPS.$o.yes +.undef DIRDEPS.$o.no .endfor .else # whether options are enabled or not, From owner-svn-src-stable@freebsd.org Fri Sep 27 00:11:10 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67BAE137F26; Fri, 27 Sep 2019 00:11:10 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fXJZ1x01z47w7; Fri, 27 Sep 2019 00:11:10 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 23FDB85ED; Fri, 27 Sep 2019 00:11:10 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8R0BAvN064653; Fri, 27 Sep 2019 00:11:10 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8R0BA7J064652; Fri, 27 Sep 2019 00:11:10 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201909270011.x8R0BA7J064652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Fri, 27 Sep 2019 00:11:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352782 - stable/12/share/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: stable/12/share/mk X-SVN-Commit-Revision: 352782 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Sep 2019 00:11:10 -0000 Author: sjg Date: Fri Sep 27 00:11:09 2019 New Revision: 352782 URL: https://svnweb.freebsd.org/changeset/base/352782 Log: Document logic for __DEFAULT_DEPENDENT_OPTIONS MFC of r352370 Reviewed by: stevek Differential Revision: https://reviews.freebsd.org/D21640 Modified: stable/12/share/mk/bsd.mkopt.mk Modified: stable/12/share/mk/bsd.mkopt.mk ============================================================================== --- stable/12/share/mk/bsd.mkopt.mk Fri Sep 27 00:08:40 2019 (r352781) +++ stable/12/share/mk/bsd.mkopt.mk Fri Sep 27 00:11:09 2019 (r352782) @@ -11,12 +11,16 @@ # For each option FOO in __DEFAULT_NO_OPTIONS, MK_FOO is set to "no", # unless WITH_FOO is defined, in which case it is set to "yes". # +# For each entry FOO/BAR in __DEFAULT_DEPENDENT_OPTIONS, +# MK_FOO is set to "no" if WITHOUT_FOO is defined, +# "yes" if WITH_FOO is defined, otherwise the value of MK_BAR. +# # If both WITH_FOO and WITHOUT_FOO are defined, WITHOUT_FOO wins and # MK_FOO is set to "no" regardless of which list it was in. # -# Both __DEFAULT_YES_OPTIONS and __DEFAULT_NO_OPTIONS are undef'd -# after all this processing, allowing this file to be included -# multiple times with different lists. +# All of __DEFAULT_YES_OPTIONS, __DEFAULT_NO_OPTIONS and +# __DEFAULT_DEPENDENT_OPTIONS are undef'd after all this processing, +# allowing this file to be included multiple times with different lists. # # Other parts of the build system will set BROKEN_OPTIONS to a list # of options that are broken on this platform. This will not be unset From owner-svn-src-stable@freebsd.org Fri Sep 27 05:12:29 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 930C4F64DD; Fri, 27 Sep 2019 05:12:29 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fg0F3R6Sz4MsH; Fri, 27 Sep 2019 05:12:29 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59074BEDE; Fri, 27 Sep 2019 05:12:29 +0000 (UTC) (envelope-from bcran@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8R5CTgB045419; Fri, 27 Sep 2019 05:12:29 GMT (envelope-from bcran@FreeBSD.org) Received: (from bcran@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8R5CT35045417; Fri, 27 Sep 2019 05:12:29 GMT (envelope-from bcran@FreeBSD.org) Message-Id: <201909270512.x8R5CT35045417@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcran set sender to bcran@FreeBSD.org using -f From: Rebecca Cran Date: Fri, 27 Sep 2019 05:12:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352788 - stable/12/stand/efi/loader X-SVN-Group: stable-12 X-SVN-Commit-Author: bcran X-SVN-Commit-Paths: stable/12/stand/efi/loader X-SVN-Commit-Revision: 352788 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Sep 2019 05:12:29 -0000 Author: bcran Date: Fri Sep 27 05:12:28 2019 New Revision: 352788 URL: https://svnweb.freebsd.org/changeset/base/352788 Log: MFC r344839: Add retry loop around GetMemoryMap call to fix fragmentation bug The call to BS->AllocatePages can cause the memory map to become framented, causing BS->GetMemoryMap to return EFI_BUFFER_TOO_SMALL more than once. For example this can happen on the MinnowBoard Turbot, causing the boot to stop with an error. Avoid this by calling GetMemoryMap in a loop. Modified: stable/12/stand/efi/loader/bootinfo.c stable/12/stand/efi/loader/copy.c Modified: stable/12/stand/efi/loader/bootinfo.c ============================================================================== --- stable/12/stand/efi/loader/bootinfo.c Fri Sep 27 02:09:20 2019 (r352787) +++ stable/12/stand/efi/loader/bootinfo.c Fri Sep 27 05:12:28 2019 (r352788) @@ -287,12 +287,12 @@ static int bi_load_efi_data(struct preloaded_file *kfp) { EFI_MEMORY_DESCRIPTOR *mm; - EFI_PHYSICAL_ADDRESS addr; + EFI_PHYSICAL_ADDRESS addr = 0; EFI_STATUS status; const char *efi_novmap; size_t efisz; UINTN efi_mapkey; - UINTN mmsz, pages, retry, sz; + UINTN dsz, pages, retry, sz; UINT32 mmver; struct efi_map_header *efihdr; bool do_vmap; @@ -323,76 +323,94 @@ bi_load_efi_data(struct preloaded_file *kfp) efisz = (sizeof(struct efi_map_header) + 0xf) & ~0xf; /* - * Assgin size of EFI_MEMORY_DESCRIPTOR to keep compatible with + * Assign size of EFI_MEMORY_DESCRIPTOR to keep compatible with * u-boot which doesn't fill this value when buffer for memory * descriptors is too small (eg. 0 to obtain memory map size) */ - mmsz = sizeof(EFI_MEMORY_DESCRIPTOR); + dsz = sizeof(EFI_MEMORY_DESCRIPTOR); /* - * It is possible that the first call to ExitBootServices may change - * the map key. Fetch a new map key and retry ExitBootServices in that - * case. + * Allocate enough pages to hold the bootinfo block and the + * memory map EFI will return to us. The memory map has an + * unknown size, so we have to determine that first. Note that + * the AllocatePages call can itself modify the memory map, so + * we have to take that into account as well. The changes to + * the memory map are caused by splitting a range of free + * memory into two, so that one is marked as being loader + * data. */ + + sz = 0; + + /* + * Matthew Garrett has observed at least one system changing the + * memory map when calling ExitBootServices, causing it to return an + * error, probably because callbacks are allocating memory. + * So we need to retry calling it at least once. + */ for (retry = 2; retry > 0; retry--) { - /* - * Allocate enough pages to hold the bootinfo block and the - * memory map EFI will return to us. The memory map has an - * unknown size, so we have to determine that first. Note that - * the AllocatePages call can itself modify the memory map, so - * we have to take that into account as well. The changes to - * the memory map are caused by splitting a range of free - * memory into two (AFAICT), so that one is marked as being - * loader data. - */ - sz = 0; - BS->GetMemoryMap(&sz, NULL, &efi_mapkey, &mmsz, &mmver); - sz += mmsz; - sz = (sz + 0xf) & ~0xf; - pages = EFI_SIZE_TO_PAGES(sz + efisz); - status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, - pages, &addr); - if (EFI_ERROR(status)) { - printf("%s: AllocatePages error %lu\n", __func__, - EFI_ERROR_CODE(status)); - return (ENOMEM); - } + for (;;) { + status = BS->GetMemoryMap(&sz, mm, &efi_mapkey, &dsz, &mmver); + if (!EFI_ERROR(status)) + break; - /* - * Read the memory map and stash it after bootinfo. Align the - * memory map on a 16-byte boundary (the bootinfo block is page - * aligned). - */ - efihdr = (struct efi_map_header *)(uintptr_t)addr; - mm = (void *)((uint8_t *)efihdr + efisz); - sz = (EFI_PAGE_SIZE * pages) - efisz; + if (status != EFI_BUFFER_TOO_SMALL) { + printf("%s: GetMemoryMap error %lu\n", __func__, + EFI_ERROR_CODE(status)); + return (EINVAL); + } - status = BS->GetMemoryMap(&sz, mm, &efi_mapkey, &mmsz, &mmver); - if (EFI_ERROR(status)) { - printf("%s: GetMemoryMap error %lu\n", __func__, - EFI_ERROR_CODE(status)); - return (EINVAL); - } - status = BS->ExitBootServices(IH, efi_mapkey); - if (EFI_ERROR(status) == 0) { + if (addr != 0) + BS->FreePages(addr, pages); + + /* Add 10 descriptors to the size to allow for + * fragmentation caused by calling AllocatePages */ + sz += (10 * dsz); + pages = EFI_SIZE_TO_PAGES(sz + efisz); + status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData, + pages, &addr); + if (EFI_ERROR(status)) { + printf("%s: AllocatePages error %lu\n", __func__, + EFI_ERROR_CODE(status)); + return (ENOMEM); + } + /* - * This may be disabled by setting efi_disable_vmap in - * loader.conf(5). By default we will setup the virtual - * map entries. + * Read the memory map and stash it after bootinfo. Align the + * memory map on a 16-byte boundary (the bootinfo block is page + * aligned). */ - if (do_vmap) - efi_do_vmap(mm, sz, mmsz, mmver); - efihdr->memory_size = sz; - efihdr->descriptor_size = mmsz; - efihdr->descriptor_version = mmver; - file_addmetadata(kfp, MODINFOMD_EFI_MAP, efisz + sz, - efihdr); - return (0); + efihdr = (struct efi_map_header *)(uintptr_t)addr; + mm = (void *)((uint8_t *)efihdr + efisz); + sz = (EFI_PAGE_SIZE * pages) - efisz; } + + status = BS->ExitBootServices(IH, efi_mapkey); + if (!EFI_ERROR(status)) + break; + } + + if (retry == 0) { BS->FreePages(addr, pages); + printf("ExitBootServices error %lu\n", EFI_ERROR_CODE(status)); + return (EINVAL); } - printf("ExitBootServices error %lu\n", EFI_ERROR_CODE(status)); - return (EINVAL); + + /* + * This may be disabled by setting efi_disable_vmap in + * loader.conf(5). By default we will setup the virtual + * map entries. + */ + + if (do_vmap) + efi_do_vmap(mm, sz, dsz, mmver); + efihdr->memory_size = sz; + efihdr->descriptor_size = dsz; + efihdr->descriptor_version = mmver; + file_addmetadata(kfp, MODINFOMD_EFI_MAP, efisz + sz, + efihdr); + + return (0); } /* Modified: stable/12/stand/efi/loader/copy.c ============================================================================== --- stable/12/stand/efi/loader/copy.c Fri Sep 27 02:09:20 2019 (r352787) +++ stable/12/stand/efi/loader/copy.c Fri Sep 27 05:12:28 2019 (r352788) @@ -95,7 +95,7 @@ static void efi_verify_staging_size(unsigned long *nr_pages) { UINTN sz; - EFI_MEMORY_DESCRIPTOR *map, *p; + EFI_MEMORY_DESCRIPTOR *map = NULL, *p; EFI_PHYSICAL_ADDRESS start, end; UINTN key, dsz; UINT32 dver; @@ -104,17 +104,28 @@ efi_verify_staging_size(unsigned long *nr_pages) unsigned long available_pages = 0; sz = 0; - status = BS->GetMemoryMap(&sz, 0, &key, &dsz, &dver); - if (status != EFI_BUFFER_TOO_SMALL) { - printf("Can't determine memory map size\n"); - return; - } - map = malloc(sz); - status = BS->GetMemoryMap(&sz, map, &key, &dsz, &dver); - if (EFI_ERROR(status)) { - printf("Can't read memory map\n"); - goto out; + for (;;) { + status = BS->GetMemoryMap(&sz, map, &key, &dsz, &dver); + if (!EFI_ERROR(status)) + break; + + if (status != EFI_BUFFER_TOO_SMALL) { + printf("Can't read memory map: %lu\n", + EFI_ERROR_CODE(status)); + goto out; + } + + free(map); + + /* Allocate 10 descriptors more than the size reported, + * to allow for any fragmentation caused by calling + * malloc */ + map = malloc(sz + (10 * dsz)); + if (map == NULL) { + printf("Unable to allocate memory\n"); + goto out; + } } ndesc = sz / dsz; From owner-svn-src-stable@freebsd.org Fri Sep 27 15:28:02 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44CDA125C2D; Fri, 27 Sep 2019 15:28:02 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fwfV13qXz3x3R; Fri, 27 Sep 2019 15:28:02 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 049B71ADDC; Fri, 27 Sep 2019 15:28:02 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8RFS1jH007431; Fri, 27 Sep 2019 15:28:01 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8RFS1as007430; Fri, 27 Sep 2019 15:28:01 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201909271528.x8RFS1as007430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Fri, 27 Sep 2019 15:28:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352793 - stable/12/lib/libc/locale X-SVN-Group: stable-12 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/12/lib/libc/locale X-SVN-Commit-Revision: 352793 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Sep 2019 15:28:02 -0000 Author: lwhsu Date: Fri Sep 27 15:28:01 2019 New Revision: 352793 URL: https://svnweb.freebsd.org/changeset/base/352793 Log: MFC r352315: Improve the description of big5(5) - Fix the statement that big5 is a de facto standard of Traditional Chinese text [1] - Add a BUGS section describes the problem of big5 and suggests use utf8 PR: 189095 Submitted by: Brennan Vincent [1] Reviewed by: Ting-Wei Lan Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21622 Modified: stable/12/lib/libc/locale/big5.5 Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libc/locale/big5.5 ============================================================================== --- stable/12/lib/libc/locale/big5.5 Fri Sep 27 13:14:36 2019 (r352792) +++ stable/12/lib/libc/locale/big5.5 Fri Sep 27 15:28:01 2019 (r352793) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 7, 2003 +.Dd September 12, 2019 .Dt BIG5 5 .Os .Sh NAME @@ -37,7 +37,7 @@ encoding for Traditional Chinese text .Qq BIG5 .Sh DESCRIPTION .Dq Big Five -is the de facto standard for encoding Traditional Chinese text. +is a standard for encoding Traditional Chinese text. Each character is represented by either one or two bytes. Characters from the .Tn ASCII @@ -49,3 +49,10 @@ the first in the range 0xA1 - 0xFE, the second in the .Xr euc 5 , .Xr gb18030 5 , .Xr utf8 5 +.Sh BUGS +The range of the second byte overlaps some ASCII characters, including +0x5C (`\\') and 0x7C (`|') which may cause problems in program execution or +display. +Big5 is considered a legacy standard and only preserved for backward +compatibility reason. +New documents and systems are suggested using UTF-8 directly. From owner-svn-src-stable@freebsd.org Fri Sep 27 15:28:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 59E39125C9B; Fri, 27 Sep 2019 15:28:31 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46fwg31lwNz3x9b; Fri, 27 Sep 2019 15:28:31 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1EE081ADDE; Fri, 27 Sep 2019 15:28:31 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8RFSVMg007508; Fri, 27 Sep 2019 15:28:31 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8RFSUAB007507; Fri, 27 Sep 2019 15:28:31 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201909271528.x8RFSUAB007507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Fri, 27 Sep 2019 15:28:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352794 - stable/11/lib/libc/locale X-SVN-Group: stable-11 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/11/lib/libc/locale X-SVN-Commit-Revision: 352794 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Sep 2019 15:28:31 -0000 Author: lwhsu Date: Fri Sep 27 15:28:30 2019 New Revision: 352794 URL: https://svnweb.freebsd.org/changeset/base/352794 Log: MFC r352315: Improve the description of big5(5) - Fix the statement that big5 is a de facto standard of Traditional Chinese text [1] - Add a BUGS section describes the problem of big5 and suggests use utf8 PR: 189095 Submitted by: Brennan Vincent [1] Reviewed by: Ting-Wei Lan Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21622 Modified: stable/11/lib/libc/locale/big5.5 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/locale/big5.5 ============================================================================== --- stable/11/lib/libc/locale/big5.5 Fri Sep 27 15:28:01 2019 (r352793) +++ stable/11/lib/libc/locale/big5.5 Fri Sep 27 15:28:30 2019 (r352794) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 7, 2003 +.Dd September 12, 2019 .Dt BIG5 5 .Os .Sh NAME @@ -37,7 +37,7 @@ encoding for Traditional Chinese text .Qq BIG5 .Sh DESCRIPTION .Dq Big Five -is the de facto standard for encoding Traditional Chinese text. +is a standard for encoding Traditional Chinese text. Each character is represented by either one or two bytes. Characters from the .Tn ASCII @@ -49,3 +49,10 @@ the first in the range 0xA1 - 0xFE, the second in the .Xr euc 5 , .Xr gb18030 5 , .Xr utf8 5 +.Sh BUGS +The range of the second byte overlaps some ASCII characters, including +0x5C (`\\') and 0x7C (`|') which may cause problems in program execution or +display. +Big5 is considered a legacy standard and only preserved for backward +compatibility reason. +New documents and systems are suggested using UTF-8 directly. From owner-svn-src-stable@freebsd.org Fri Sep 27 22:11:50 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B41AB12ED92; Fri, 27 Sep 2019 22:11:50 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46g5cQ4DkWz4RKn; Fri, 27 Sep 2019 22:11:50 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 749161F90E; Fri, 27 Sep 2019 22:11:50 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8RMBorY057615; Fri, 27 Sep 2019 22:11:50 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8RMBoQs057614; Fri, 27 Sep 2019 22:11:50 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201909272211.x8RMBoQs057614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Fri, 27 Sep 2019 22:11:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352824 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 352824 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Sep 2019 22:11:50 -0000 Author: lwhsu Date: Fri Sep 27 22:11:50 2019 New Revision: 352824 URL: https://svnweb.freebsd.org/changeset/base/352824 Log: MFC r352635: Clean LINT* kernel configurations for arm* Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/conf/makeLINT.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/makeLINT.mk ============================================================================== --- stable/12/sys/conf/makeLINT.mk Fri Sep 27 21:04:33 2019 (r352823) +++ stable/12/sys/conf/makeLINT.mk Fri Sep 27 22:11:50 2019 (r352824) @@ -11,6 +11,9 @@ clean: .if ${TARGET} == "amd64" || ${TARGET} == "i386" rm -f LINT-NOINET LINT-NOINET6 LINT-NOIP .endif +.if ${TARGET} == "arm" + rm -f LINT-V5 LINT-V7 +.endif NOTES= ${.CURDIR}/../../conf/NOTES ${.CURDIR}/NOTES MAKELINT_SED= ${.CURDIR}/../../conf/makeLINT.sed From owner-svn-src-stable@freebsd.org Sat Sep 28 00:59:40 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78624F1EB0; Sat, 28 Sep 2019 00:59:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46g9L42h18z4YVT; Sat, 28 Sep 2019 00:59:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F26B215D5; Sat, 28 Sep 2019 00:59:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8S0xeDK052906; Sat, 28 Sep 2019 00:59:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8S0xdV8052904; Sat, 28 Sep 2019 00:59:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909280059.x8S0xdV8052904@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 28 Sep 2019 00:59:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352827 - stable/12/sys/dev/ioat X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/ioat X-SVN-Commit-Revision: 352827 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2019 00:59:40 -0000 Author: mav Date: Sat Sep 28 00:59:39 2019 New Revision: 352827 URL: https://svnweb.freebsd.org/changeset/base/352827 Log: MFC r352544: Improve ioat(4) NUMA-awareness. Allocate ioat->ring memory from the device domain. Schedule ioat->poll_timer to the first CPU of the device domain. According to pcm-numa tool from intel-pcm port, this reduces number of remote DRAM accesses while copying data by 75%. And unless it is a noise, I've noticed some speed improvement when copying data to other domain. Modified: stable/12/sys/dev/ioat/ioat.c stable/12/sys/dev/ioat/ioat_internal.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/ioat/ioat.c ============================================================================== --- stable/12/sys/dev/ioat/ioat.c Fri Sep 27 23:37:01 2019 (r352826) +++ stable/12/sys/dev/ioat/ioat.c Sat Sep 28 00:59:39 2019 (r352827) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -43,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -265,6 +267,11 @@ ioat_attach(device_t device) ioat = DEVICE2SOFTC(device); ioat->device = device; + if (bus_get_domain(device, &ioat->domain) != 0) + ioat->domain = 0; + ioat->cpu = CPU_FFS(&cpuset_domain[ioat->domain]) - 1; + if (ioat->cpu < 0) + ioat->cpu = CPU_FIRST(); error = ioat_map_pci_bar(ioat); if (error != 0) @@ -523,8 +530,8 @@ ioat3_attach(device_t device) ioat->hw_desc_ring = hw_desc; - ioat->ring = malloc(num_descriptors * sizeof(*ring), M_IOAT, - M_ZERO | M_WAITOK); + ioat->ring = malloc_domainset(num_descriptors * sizeof(*ring), M_IOAT, + DOMAINSET_PREF(ioat->domain), M_ZERO | M_WAITOK); ring = ioat->ring; for (i = 0; i < num_descriptors; i++) { @@ -984,8 +991,8 @@ ioat_release(bus_dmaengine_t dmaengine) (uint16_t)ioat->head); if (!callout_pending(&ioat->poll_timer)) { - callout_reset(&ioat->poll_timer, 1, - ioat_poll_timer_callback, ioat); + callout_reset_on(&ioat->poll_timer, 1, + ioat_poll_timer_callback, ioat, ioat->cpu); } } mtx_unlock(&ioat->submit_lock); @@ -1434,7 +1441,7 @@ ioat_free_ring(struct ioat_softc *ioat, uint32_t size, struct ioat_descriptor *ring) { - free(ring, M_IOAT); + free_domain(ring, M_IOAT); } static struct ioat_descriptor * Modified: stable/12/sys/dev/ioat/ioat_internal.h ============================================================================== --- stable/12/sys/dev/ioat/ioat_internal.h Fri Sep 27 23:37:01 2019 (r352826) +++ stable/12/sys/dev/ioat/ioat_internal.h Sat Sep 28 00:59:39 2019 (r352827) @@ -437,6 +437,8 @@ struct ioat_softc { }) device_t device; + int domain; + int cpu; int version; unsigned chan_idx; From owner-svn-src-stable@freebsd.org Sat Sep 28 01:31:34 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61056F4A71; Sat, 28 Sep 2019 01:31:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46gB2t20pPz4c65; Sat, 28 Sep 2019 01:31:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2948321CED; Sat, 28 Sep 2019 01:31:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8S1VYEs075034; Sat, 28 Sep 2019 01:31:34 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8S1VY5G075033; Sat, 28 Sep 2019 01:31:34 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909280131.x8S1VY5G075033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 28 Sep 2019 01:31:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352828 - stable/12/usr.sbin/pciconf X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/usr.sbin/pciconf X-SVN-Commit-Revision: 352828 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2019 01:31:34 -0000 Author: mav Date: Sat Sep 28 01:31:33 2019 New Revision: 352828 URL: https://svnweb.freebsd.org/changeset/base/352828 Log: MFC r351422: Report Clock Power Management support and status. Since we already report ASPM, why not to go further. Modified: stable/12/usr.sbin/pciconf/cap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/pciconf/cap.c ============================================================================== --- stable/12/usr.sbin/pciconf/cap.c Sat Sep 28 00:59:39 2019 (r352827) +++ stable/12/usr.sbin/pciconf/cap.c Sat Sep 28 01:31:33 2019 (r352828) @@ -515,6 +515,11 @@ cap_express(int fd, struct pci_conf *p, uint8_t ptr) printf(" ASPM %s(%s)", aspm_string(ctl & PCIEM_LINK_CTL_ASPMC), aspm_string((cap & PCIEM_LINK_CAP_ASPM) >> 10)); } + if ((cap & PCIEM_LINK_CAP_CLOCK_PM) != 0) { + ctl = read_config(fd, &p->pc_sel, ptr + PCIER_LINK_CTL, 2); + printf(" ClockPM %s", (ctl & PCIEM_LINK_CTL_ECPM) ? + "enabled" : "disabled"); + } if (!(flags & PCIEM_FLAGS_SLOT)) return; cap = read_config(fd, &p->pc_sel, ptr + PCIER_SLOT_CAP, 4); From owner-svn-src-stable@freebsd.org Sat Sep 28 02:15:23 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C23BAF7D00; Sat, 28 Sep 2019 02:15:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46gC1R4rvHz4fts; Sat, 28 Sep 2019 02:15:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B1CB2262B; Sat, 28 Sep 2019 02:15:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8S2FN2V099641; Sat, 28 Sep 2019 02:15:23 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8S2FN0o099640; Sat, 28 Sep 2019 02:15:23 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201909280215.x8S2FN0o099640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 28 Sep 2019 02:15:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352830 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 352830 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2019 02:15:23 -0000 Author: mav Date: Sat Sep 28 02:15:23 2019 New Revision: 352830 URL: https://svnweb.freebsd.org/changeset/base/352830 Log: MFC r352579: Allocate callout wheel from the respective memory domain. Modified: stable/12/sys/kern/kern_timeout.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_timeout.c ============================================================================== --- stable/12/sys/kern/kern_timeout.c Sat Sep 28 01:42:59 2019 (r352829) +++ stable/12/sys/kern/kern_timeout.c Sat Sep 28 02:15:23 2019 (r352830) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -320,8 +321,9 @@ callout_cpu_init(struct callout_cpu *cc, int cpu) mtx_init(&cc->cc_lock, "callout", NULL, MTX_SPIN | MTX_RECURSE); SLIST_INIT(&cc->cc_callfree); cc->cc_inited = 1; - cc->cc_callwheel = malloc(sizeof(struct callout_list) * callwheelsize, - M_CALLOUT, M_WAITOK); + cc->cc_callwheel = malloc_domainset(sizeof(struct callout_list) * + callwheelsize, M_CALLOUT, + DOMAINSET_PREF(pcpu_find(cpu)->pc_domain), M_WAITOK); for (i = 0; i < callwheelsize; i++) LIST_INIT(&cc->cc_callwheel[i]); TAILQ_INIT(&cc->cc_expireq); From owner-svn-src-stable@freebsd.org Sat Sep 28 07:33:09 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5FBE3FDA70; Sat, 28 Sep 2019 07:33:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46gL451cSBz3Qbf; Sat, 28 Sep 2019 07:33:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A8A7260F0; Sat, 28 Sep 2019 07:33:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8S7X8WO089836; Sat, 28 Sep 2019 07:33:08 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8S7X8I8089835; Sat, 28 Sep 2019 07:33:08 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201909280733.x8S7X8I8089835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 28 Sep 2019 07:33:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352833 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 352833 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2019 07:33:09 -0000 Author: kib Date: Sat Sep 28 07:33:08 2019 New Revision: 352833 URL: https://svnweb.freebsd.org/changeset/base/352833 Log: MFC r352582, r352585: Make non-ASLR pie base tunable. Modified: stable/12/sys/kern/imgact_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Sat Sep 28 03:33:07 2019 (r352832) +++ stable/12/sys/kern/imgact_elf.c Sat Sep 28 07:33:08 2019 (r352833) @@ -136,6 +136,27 @@ SYSCTL_INT(_kern_elf32, OID_AUTO, read_exec, CTLFLAG_R #endif #endif +static u_long __elfN(pie_base) = ET_DYN_LOAD_ADDR; +static int +sysctl_pie_base(SYSCTL_HANDLER_ARGS) +{ + u_long val; + int error; + + val = __elfN(pie_base); + error = sysctl_handle_long(oidp, &val, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if ((val & PAGE_MASK) != 0) + return (EINVAL); + __elfN(pie_base) = val; + return (0); +} +SYSCTL_PROC(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, pie_base, + CTLTYPE_ULONG | CTLFLAG_MPSAFE | CTLFLAG_RW, NULL, 0, + sysctl_pie_base, "LU", + "PIE load base without randomization"); + SYSCTL_NODE(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, aslr, CTLFLAG_RW, 0, ""); #define ASLR_NODE_OID __CONCAT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), _aslr) @@ -1148,13 +1169,13 @@ __CONCAT(exec_, __elfN(imgact))(struct image_params *i if (baddr == 0) { if ((sv->sv_flags & SV_ASLR) == 0 || (fctl0 & NT_FREEBSD_FCTL_ASLR_DISABLE) != 0) - et_dyn_addr = ET_DYN_LOAD_ADDR; + et_dyn_addr = __elfN(pie_base); else if ((__elfN(pie_aslr_enabled) && (imgp->proc->p_flag2 & P2_ASLR_DISABLE) == 0) || (imgp->proc->p_flag2 & P2_ASLR_ENABLE) != 0) et_dyn_addr = ET_DYN_ADDR_RAND; else - et_dyn_addr = ET_DYN_LOAD_ADDR; + et_dyn_addr = __elfN(pie_base); } } From owner-svn-src-stable@freebsd.org Sat Sep 28 08:54:33 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E27FFF9E1; Sat, 28 Sep 2019 08:54:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46gMt073G3z3yTK; Sat, 28 Sep 2019 08:54:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D1BE526F3D; Sat, 28 Sep 2019 08:54:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8S8sWJM036884; Sat, 28 Sep 2019 08:54:32 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8S8sWQQ036883; Sat, 28 Sep 2019 08:54:32 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909280854.x8S8sWQQ036883@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 28 Sep 2019 08:54:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352834 - stable/12/share/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: stable/12/share/mk X-SVN-Commit-Revision: 352834 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2019 08:54:33 -0000 Author: dim Date: Sat Sep 28 08:54:32 2019 New Revision: 352834 URL: https://svnweb.freebsd.org/changeset/base/352834 Log: MFC r352699: In suite.test.mk, test if ${DESTDIR} exists before attempting to run chflags -R on it, otherwise the command will error out. (Note that adding -f to the chflags invocation does not help, unlike with rm.) Modified: stable/12/share/mk/suite.test.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/share/mk/suite.test.mk ============================================================================== --- stable/12/share/mk/suite.test.mk Sat Sep 28 07:33:08 2019 (r352833) +++ stable/12/share/mk/suite.test.mk Sat Sep 28 08:54:32 2019 (r352834) @@ -120,7 +120,7 @@ beforecheck: # etc. aftercheck: @cd ${.CURDIR} && ${MAKE} clean - @chflags -R 0 "${DESTDIR}" + @test ! -e ${DESTDIR} || chflags -R 0 "${DESTDIR}" @rm -Rf "${DESTDIR}" .endif From owner-svn-src-stable@freebsd.org Sat Sep 28 08:57:30 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4050FFAC7; Sat, 28 Sep 2019 08:57:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46gMxQ2RcWz3ybr; Sat, 28 Sep 2019 08:57:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 366A326F3F; Sat, 28 Sep 2019 08:57:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8S8vUNv037145; Sat, 28 Sep 2019 08:57:30 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8S8vTaG037141; Sat, 28 Sep 2019 08:57:29 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909280857.x8S8vTaG037141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 28 Sep 2019 08:57:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r352835 - in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src 8/lib/msun/src 9/lib/msun/src X-SVN-Group: stable-9 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src 8/lib/msun/src 9/lib/msun/src X-SVN-Commit-Revision: 352835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2019 08:57:31 -0000 Author: dim Date: Sat Sep 28 08:57:29 2019 New Revision: 352835 URL: https://svnweb.freebsd.org/changeset/base/352835 Log: MFC r352710: Do not left-shift a negative number (inducing undefined behavior in C/C++) in exp(3), expf(3), expm1(3) and expm1f(3) during intermediate computations that compute the IEEE-754 bit pattern for |2**k| for integer |k|. The implementations of exp(3), expf(3), expm1(3) and expm1f(3) need to compute IEEE-754 bit patterns for 2**k in certain places. (k is an integer and 2**k is exactly representable in IEEE-754.) Currently they do things like 0x3FF0'0000+(k<<20), which is to say they take the bit pattern representing 1 and then add directly to the exponent field to get the desired power of two. This is fine when k is non-negative. But when k<0 (and certain classes of input trigger this), this left-shifts a negative number -- an operation with undefined behavior in C and C++. The desired semantics can be achieved by instead adding the possibly-negative k to the IEEE-754 exponent bias to get the desired exponent field, _then_ shifting that into its proper overall position. (Note that in case of s_expm1.c and s_expm1f.c, there are SET_HIGH_WORD and SET_FLOAT_WORD uses further down in each of these files that perform shift operations involving k, but by these points k's range has been restricted to 2 < k <= 56, and the shift operations under those circumstances can't do anything that would be UB.) Submitted by: Jeff Walden, https://github.com/jswalden Obtained from: https://github.com/freebsd/freebsd/pull/411 Obtained from: https://github.com/freebsd/freebsd/pull/412 Modified: stable/9/lib/msun/src/e_exp.c stable/9/lib/msun/src/e_expf.c stable/9/lib/msun/src/s_expm1.c stable/9/lib/msun/src/s_expm1f.c Directory Properties: stable/9/ (props changed) stable/9/lib/ (props changed) stable/9/lib/msun/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/msun/src/e_exp.c stable/10/lib/msun/src/e_expf.c stable/10/lib/msun/src/s_expm1.c stable/10/lib/msun/src/s_expm1f.c stable/11/lib/msun/src/e_exp.c stable/11/lib/msun/src/e_expf.c stable/11/lib/msun/src/s_expm1.c stable/11/lib/msun/src/s_expm1f.c stable/12/lib/msun/src/e_exp.c stable/12/lib/msun/src/e_expf.c stable/12/lib/msun/src/s_expm1.c stable/12/lib/msun/src/s_expm1f.c stable/8/lib/msun/src/e_exp.c stable/8/lib/msun/src/e_expf.c stable/8/lib/msun/src/s_expm1.c stable/8/lib/msun/src/s_expm1f.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) stable/12/ (props changed) stable/8/ (props changed) stable/8/lib/ (props changed) stable/8/lib/msun/ (props changed) Modified: stable/9/lib/msun/src/e_exp.c ============================================================================== --- stable/9/lib/msun/src/e_exp.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/9/lib/msun/src/e_exp.c Sat Sep 28 08:57:29 2019 (r352835) @@ -143,9 +143,9 @@ __ieee754_exp(double x) /* default IEEE double exp */ /* x is now in primary range */ t = x*x; if(k >= -1021) - INSERT_WORDS(twopk,0x3ff00000+(k<<20), 0); + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20, 0); else - INSERT_WORDS(twopk,0x3ff00000+((k+1000)<<20), 0); + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+(k+1000)))<<20, 0); c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); if(k==0) return one-((x*c)/(c-2.0)-x); else y = one-((lo-(x*c)/(2.0-c))-hi); Modified: stable/9/lib/msun/src/e_expf.c ============================================================================== --- stable/9/lib/msun/src/e_expf.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/9/lib/msun/src/e_expf.c Sat Sep 28 08:57:29 2019 (r352835) @@ -80,9 +80,9 @@ __ieee754_expf(float x) /* default IEEE double exp */ /* x is now in primary range */ t = x*x; if(k >= -125) - SET_FLOAT_WORD(twopk,0x3f800000+(k<<23)); + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+k))<<23); else - SET_FLOAT_WORD(twopk,0x3f800000+((k+100)<<23)); + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+(k+100)))<<23); c = x - t*(P1+t*P2); if(k==0) return one-((x*c)/(c-(float)2.0)-x); else y = one-((lo-(x*c)/((float)2.0-c))-hi); Modified: stable/9/lib/msun/src/s_expm1.c ============================================================================== --- stable/9/lib/msun/src/s_expm1.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/9/lib/msun/src/s_expm1.c Sat Sep 28 08:57:29 2019 (r352835) @@ -186,7 +186,7 @@ expm1(double x) e = hxs*((r1-t)/(6.0 - x*t)); if(k==0) return x - (x*e-hxs); /* c is 0 */ else { - INSERT_WORDS(twopk,0x3ff00000+(k<<20),0); /* 2^k */ + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20,0); /* 2^k */ e = (x*(e-c)-c); e -= hxs; if(k== -1) return 0.5*(x-e)-0.5; Modified: stable/9/lib/msun/src/s_expm1f.c ============================================================================== --- stable/9/lib/msun/src/s_expm1f.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/9/lib/msun/src/s_expm1f.c Sat Sep 28 08:57:29 2019 (r352835) @@ -92,7 +92,7 @@ expm1f(float x) e = hxs*((r1-t)/((float)6.0 - x*t)); if(k==0) return x - (x*e-hxs); /* c is 0 */ else { - SET_FLOAT_WORD(twopk,0x3f800000+(k<<23)); /* 2^k */ + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+k))<<23); /* 2^k */ e = (x*(e-c)-c); e -= hxs; if(k== -1) return (float)0.5*(x-e)-(float)0.5; From owner-svn-src-stable@freebsd.org Sat Sep 28 08:57:32 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 824BEFFAFD; Sat, 28 Sep 2019 08:57:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46gMxS2n4Pz3yc8; Sat, 28 Sep 2019 08:57:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4391626F41; Sat, 28 Sep 2019 08:57:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8S8vWoW037168; Sat, 28 Sep 2019 08:57:32 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8S8vVMm037159; Sat, 28 Sep 2019 08:57:31 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909280857.x8S8vVMm037159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 28 Sep 2019 08:57:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352835 - in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src 8/lib/msun/src 9/lib/msun/src X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src 8/lib/msun/src 9/lib/msun/src X-SVN-Commit-Revision: 352835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2019 08:57:32 -0000 Author: dim Date: Sat Sep 28 08:57:29 2019 New Revision: 352835 URL: https://svnweb.freebsd.org/changeset/base/352835 Log: MFC r352710: Do not left-shift a negative number (inducing undefined behavior in C/C++) in exp(3), expf(3), expm1(3) and expm1f(3) during intermediate computations that compute the IEEE-754 bit pattern for |2**k| for integer |k|. The implementations of exp(3), expf(3), expm1(3) and expm1f(3) need to compute IEEE-754 bit patterns for 2**k in certain places. (k is an integer and 2**k is exactly representable in IEEE-754.) Currently they do things like 0x3FF0'0000+(k<<20), which is to say they take the bit pattern representing 1 and then add directly to the exponent field to get the desired power of two. This is fine when k is non-negative. But when k<0 (and certain classes of input trigger this), this left-shifts a negative number -- an operation with undefined behavior in C and C++. The desired semantics can be achieved by instead adding the possibly-negative k to the IEEE-754 exponent bias to get the desired exponent field, _then_ shifting that into its proper overall position. (Note that in case of s_expm1.c and s_expm1f.c, there are SET_HIGH_WORD and SET_FLOAT_WORD uses further down in each of these files that perform shift operations involving k, but by these points k's range has been restricted to 2 < k <= 56, and the shift operations under those circumstances can't do anything that would be UB.) Submitted by: Jeff Walden, https://github.com/jswalden Obtained from: https://github.com/freebsd/freebsd/pull/411 Obtained from: https://github.com/freebsd/freebsd/pull/412 Modified: stable/11/lib/msun/src/e_exp.c stable/11/lib/msun/src/e_expf.c stable/11/lib/msun/src/s_expm1.c stable/11/lib/msun/src/s_expm1f.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/msun/src/e_exp.c stable/10/lib/msun/src/e_expf.c stable/10/lib/msun/src/s_expm1.c stable/10/lib/msun/src/s_expm1f.c stable/12/lib/msun/src/e_exp.c stable/12/lib/msun/src/e_expf.c stable/12/lib/msun/src/s_expm1.c stable/12/lib/msun/src/s_expm1f.c stable/8/lib/msun/src/e_exp.c stable/8/lib/msun/src/e_expf.c stable/8/lib/msun/src/s_expm1.c stable/8/lib/msun/src/s_expm1f.c stable/9/lib/msun/src/e_exp.c stable/9/lib/msun/src/e_expf.c stable/9/lib/msun/src/s_expm1.c stable/9/lib/msun/src/s_expm1f.c Directory Properties: stable/10/ (props changed) stable/12/ (props changed) stable/8/ (props changed) stable/8/lib/ (props changed) stable/8/lib/msun/ (props changed) stable/9/ (props changed) stable/9/lib/ (props changed) stable/9/lib/msun/ (props changed) Modified: stable/11/lib/msun/src/e_exp.c ============================================================================== --- stable/11/lib/msun/src/e_exp.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/11/lib/msun/src/e_exp.c Sat Sep 28 08:57:29 2019 (r352835) @@ -145,9 +145,9 @@ __ieee754_exp(double x) /* default IEEE double exp */ /* x is now in primary range */ t = x*x; if(k >= -1021) - INSERT_WORDS(twopk,0x3ff00000+(k<<20), 0); + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20, 0); else - INSERT_WORDS(twopk,0x3ff00000+((k+1000)<<20), 0); + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+(k+1000)))<<20, 0); c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); if(k==0) return one-((x*c)/(c-2.0)-x); else y = one-((lo-(x*c)/(2.0-c))-hi); Modified: stable/11/lib/msun/src/e_expf.c ============================================================================== --- stable/11/lib/msun/src/e_expf.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/11/lib/msun/src/e_expf.c Sat Sep 28 08:57:29 2019 (r352835) @@ -83,9 +83,9 @@ __ieee754_expf(float x) /* x is now in primary range */ t = x*x; if(k >= -125) - SET_FLOAT_WORD(twopk,0x3f800000+(k<<23)); + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+k))<<23); else - SET_FLOAT_WORD(twopk,0x3f800000+((k+100)<<23)); + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+(k+100)))<<23); c = x - t*(P1+t*P2); if(k==0) return one-((x*c)/(c-(float)2.0)-x); else y = one-((lo-(x*c)/((float)2.0-c))-hi); Modified: stable/11/lib/msun/src/s_expm1.c ============================================================================== --- stable/11/lib/msun/src/s_expm1.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/11/lib/msun/src/s_expm1.c Sat Sep 28 08:57:29 2019 (r352835) @@ -188,7 +188,7 @@ expm1(double x) e = hxs*((r1-t)/(6.0 - x*t)); if(k==0) return x - (x*e-hxs); /* c is 0 */ else { - INSERT_WORDS(twopk,0x3ff00000+(k<<20),0); /* 2^k */ + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20,0); /* 2^k */ e = (x*(e-c)-c); e -= hxs; if(k== -1) return 0.5*(x-e)-0.5; Modified: stable/11/lib/msun/src/s_expm1f.c ============================================================================== --- stable/11/lib/msun/src/s_expm1f.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/11/lib/msun/src/s_expm1f.c Sat Sep 28 08:57:29 2019 (r352835) @@ -94,7 +94,7 @@ expm1f(float x) e = hxs*((r1-t)/((float)6.0 - x*t)); if(k==0) return x - (x*e-hxs); /* c is 0 */ else { - SET_FLOAT_WORD(twopk,0x3f800000+(k<<23)); /* 2^k */ + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+k))<<23); /* 2^k */ e = (x*(e-c)-c); e -= hxs; if(k== -1) return (float)0.5*(x-e)-(float)0.5; From owner-svn-src-stable@freebsd.org Sat Sep 28 08:57:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C015FFACC; Sat, 28 Sep 2019 08:57:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46gMxR2V4Tz3ybs; Sat, 28 Sep 2019 08:57:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38E9F26F40; Sat, 28 Sep 2019 08:57:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8S8vVum037154; Sat, 28 Sep 2019 08:57:31 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8S8vUd8037150; Sat, 28 Sep 2019 08:57:30 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909280857.x8S8vUd8037150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 28 Sep 2019 08:57:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r352835 - in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src 8/lib/msun/src 9/lib/msun/src X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src 8/lib/msun/src 9/lib/msun/src X-SVN-Commit-Revision: 352835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2019 08:57:31 -0000 Author: dim Date: Sat Sep 28 08:57:29 2019 New Revision: 352835 URL: https://svnweb.freebsd.org/changeset/base/352835 Log: MFC r352710: Do not left-shift a negative number (inducing undefined behavior in C/C++) in exp(3), expf(3), expm1(3) and expm1f(3) during intermediate computations that compute the IEEE-754 bit pattern for |2**k| for integer |k|. The implementations of exp(3), expf(3), expm1(3) and expm1f(3) need to compute IEEE-754 bit patterns for 2**k in certain places. (k is an integer and 2**k is exactly representable in IEEE-754.) Currently they do things like 0x3FF0'0000+(k<<20), which is to say they take the bit pattern representing 1 and then add directly to the exponent field to get the desired power of two. This is fine when k is non-negative. But when k<0 (and certain classes of input trigger this), this left-shifts a negative number -- an operation with undefined behavior in C and C++. The desired semantics can be achieved by instead adding the possibly-negative k to the IEEE-754 exponent bias to get the desired exponent field, _then_ shifting that into its proper overall position. (Note that in case of s_expm1.c and s_expm1f.c, there are SET_HIGH_WORD and SET_FLOAT_WORD uses further down in each of these files that perform shift operations involving k, but by these points k's range has been restricted to 2 < k <= 56, and the shift operations under those circumstances can't do anything that would be UB.) Submitted by: Jeff Walden, https://github.com/jswalden Obtained from: https://github.com/freebsd/freebsd/pull/411 Obtained from: https://github.com/freebsd/freebsd/pull/412 Modified: stable/12/lib/msun/src/e_exp.c stable/12/lib/msun/src/e_expf.c stable/12/lib/msun/src/s_expm1.c stable/12/lib/msun/src/s_expm1f.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/msun/src/e_exp.c stable/10/lib/msun/src/e_expf.c stable/10/lib/msun/src/s_expm1.c stable/10/lib/msun/src/s_expm1f.c stable/11/lib/msun/src/e_exp.c stable/11/lib/msun/src/e_expf.c stable/11/lib/msun/src/s_expm1.c stable/11/lib/msun/src/s_expm1f.c stable/8/lib/msun/src/e_exp.c stable/8/lib/msun/src/e_expf.c stable/8/lib/msun/src/s_expm1.c stable/8/lib/msun/src/s_expm1f.c stable/9/lib/msun/src/e_exp.c stable/9/lib/msun/src/e_expf.c stable/9/lib/msun/src/s_expm1.c stable/9/lib/msun/src/s_expm1f.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) stable/8/ (props changed) stable/8/lib/ (props changed) stable/8/lib/msun/ (props changed) stable/9/ (props changed) stable/9/lib/ (props changed) stable/9/lib/msun/ (props changed) Modified: stable/12/lib/msun/src/e_exp.c ============================================================================== --- stable/12/lib/msun/src/e_exp.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/12/lib/msun/src/e_exp.c Sat Sep 28 08:57:29 2019 (r352835) @@ -145,9 +145,9 @@ __ieee754_exp(double x) /* default IEEE double exp */ /* x is now in primary range */ t = x*x; if(k >= -1021) - INSERT_WORDS(twopk,0x3ff00000+(k<<20), 0); + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20, 0); else - INSERT_WORDS(twopk,0x3ff00000+((k+1000)<<20), 0); + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+(k+1000)))<<20, 0); c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); if(k==0) return one-((x*c)/(c-2.0)-x); else y = one-((lo-(x*c)/(2.0-c))-hi); Modified: stable/12/lib/msun/src/e_expf.c ============================================================================== --- stable/12/lib/msun/src/e_expf.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/12/lib/msun/src/e_expf.c Sat Sep 28 08:57:29 2019 (r352835) @@ -83,9 +83,9 @@ __ieee754_expf(float x) /* x is now in primary range */ t = x*x; if(k >= -125) - SET_FLOAT_WORD(twopk,0x3f800000+(k<<23)); + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+k))<<23); else - SET_FLOAT_WORD(twopk,0x3f800000+((k+100)<<23)); + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+(k+100)))<<23); c = x - t*(P1+t*P2); if(k==0) return one-((x*c)/(c-(float)2.0)-x); else y = one-((lo-(x*c)/((float)2.0-c))-hi); Modified: stable/12/lib/msun/src/s_expm1.c ============================================================================== --- stable/12/lib/msun/src/s_expm1.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/12/lib/msun/src/s_expm1.c Sat Sep 28 08:57:29 2019 (r352835) @@ -188,7 +188,7 @@ expm1(double x) e = hxs*((r1-t)/(6.0 - x*t)); if(k==0) return x - (x*e-hxs); /* c is 0 */ else { - INSERT_WORDS(twopk,0x3ff00000+(k<<20),0); /* 2^k */ + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20,0); /* 2^k */ e = (x*(e-c)-c); e -= hxs; if(k== -1) return 0.5*(x-e)-0.5; Modified: stable/12/lib/msun/src/s_expm1f.c ============================================================================== --- stable/12/lib/msun/src/s_expm1f.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/12/lib/msun/src/s_expm1f.c Sat Sep 28 08:57:29 2019 (r352835) @@ -94,7 +94,7 @@ expm1f(float x) e = hxs*((r1-t)/((float)6.0 - x*t)); if(k==0) return x - (x*e-hxs); /* c is 0 */ else { - SET_FLOAT_WORD(twopk,0x3f800000+(k<<23)); /* 2^k */ + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+k))<<23); /* 2^k */ e = (x*(e-c)-c); e -= hxs; if(k== -1) return (float)0.5*(x-e)-(float)0.5; From owner-svn-src-stable@freebsd.org Sat Sep 28 08:57:34 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1F6CFFB29; Sat, 28 Sep 2019 08:57:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46gMxV4Fg5z3yjZ; Sat, 28 Sep 2019 08:57:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4241D26F43; Sat, 28 Sep 2019 08:57:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8S8vYPJ037186; Sat, 28 Sep 2019 08:57:34 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8S8vXDe037182; Sat, 28 Sep 2019 08:57:33 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909280857.x8S8vXDe037182@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 28 Sep 2019 08:57:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r352835 - in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src 8/lib/msun/src 9/lib/msun/src X-SVN-Group: stable-8 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src 8/lib/msun/src 9/lib/msun/src X-SVN-Commit-Revision: 352835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2019 08:57:34 -0000 Author: dim Date: Sat Sep 28 08:57:29 2019 New Revision: 352835 URL: https://svnweb.freebsd.org/changeset/base/352835 Log: MFC r352710: Do not left-shift a negative number (inducing undefined behavior in C/C++) in exp(3), expf(3), expm1(3) and expm1f(3) during intermediate computations that compute the IEEE-754 bit pattern for |2**k| for integer |k|. The implementations of exp(3), expf(3), expm1(3) and expm1f(3) need to compute IEEE-754 bit patterns for 2**k in certain places. (k is an integer and 2**k is exactly representable in IEEE-754.) Currently they do things like 0x3FF0'0000+(k<<20), which is to say they take the bit pattern representing 1 and then add directly to the exponent field to get the desired power of two. This is fine when k is non-negative. But when k<0 (and certain classes of input trigger this), this left-shifts a negative number -- an operation with undefined behavior in C and C++. The desired semantics can be achieved by instead adding the possibly-negative k to the IEEE-754 exponent bias to get the desired exponent field, _then_ shifting that into its proper overall position. (Note that in case of s_expm1.c and s_expm1f.c, there are SET_HIGH_WORD and SET_FLOAT_WORD uses further down in each of these files that perform shift operations involving k, but by these points k's range has been restricted to 2 < k <= 56, and the shift operations under those circumstances can't do anything that would be UB.) Submitted by: Jeff Walden, https://github.com/jswalden Obtained from: https://github.com/freebsd/freebsd/pull/411 Obtained from: https://github.com/freebsd/freebsd/pull/412 Modified: stable/8/lib/msun/src/e_exp.c stable/8/lib/msun/src/e_expf.c stable/8/lib/msun/src/s_expm1.c stable/8/lib/msun/src/s_expm1f.c Directory Properties: stable/8/ (props changed) stable/8/lib/ (props changed) stable/8/lib/msun/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/msun/src/e_exp.c stable/10/lib/msun/src/e_expf.c stable/10/lib/msun/src/s_expm1.c stable/10/lib/msun/src/s_expm1f.c stable/11/lib/msun/src/e_exp.c stable/11/lib/msun/src/e_expf.c stable/11/lib/msun/src/s_expm1.c stable/11/lib/msun/src/s_expm1f.c stable/12/lib/msun/src/e_exp.c stable/12/lib/msun/src/e_expf.c stable/12/lib/msun/src/s_expm1.c stable/12/lib/msun/src/s_expm1f.c stable/9/lib/msun/src/e_exp.c stable/9/lib/msun/src/e_expf.c stable/9/lib/msun/src/s_expm1.c stable/9/lib/msun/src/s_expm1f.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) stable/12/ (props changed) stable/9/ (props changed) stable/9/lib/ (props changed) stable/9/lib/msun/ (props changed) Modified: stable/8/lib/msun/src/e_exp.c ============================================================================== --- stable/8/lib/msun/src/e_exp.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/8/lib/msun/src/e_exp.c Sat Sep 28 08:57:29 2019 (r352835) @@ -143,9 +143,9 @@ __ieee754_exp(double x) /* default IEEE double exp */ /* x is now in primary range */ t = x*x; if(k >= -1021) - INSERT_WORDS(twopk,0x3ff00000+(k<<20), 0); + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20, 0); else - INSERT_WORDS(twopk,0x3ff00000+((k+1000)<<20), 0); + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+(k+1000)))<<20, 0); c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); if(k==0) return one-((x*c)/(c-2.0)-x); else y = one-((lo-(x*c)/(2.0-c))-hi); Modified: stable/8/lib/msun/src/e_expf.c ============================================================================== --- stable/8/lib/msun/src/e_expf.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/8/lib/msun/src/e_expf.c Sat Sep 28 08:57:29 2019 (r352835) @@ -80,9 +80,9 @@ __ieee754_expf(float x) /* default IEEE double exp */ /* x is now in primary range */ t = x*x; if(k >= -125) - SET_FLOAT_WORD(twopk,0x3f800000+(k<<23)); + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+k))<<23); else - SET_FLOAT_WORD(twopk,0x3f800000+((k+100)<<23)); + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+(k+100)))<<23); c = x - t*(P1+t*P2); if(k==0) return one-((x*c)/(c-(float)2.0)-x); else y = one-((lo-(x*c)/((float)2.0-c))-hi); Modified: stable/8/lib/msun/src/s_expm1.c ============================================================================== --- stable/8/lib/msun/src/s_expm1.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/8/lib/msun/src/s_expm1.c Sat Sep 28 08:57:29 2019 (r352835) @@ -186,7 +186,7 @@ expm1(double x) e = hxs*((r1-t)/(6.0 - x*t)); if(k==0) return x - (x*e-hxs); /* c is 0 */ else { - INSERT_WORDS(twopk,0x3ff00000+(k<<20),0); /* 2^k */ + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20,0); /* 2^k */ e = (x*(e-c)-c); e -= hxs; if(k== -1) return 0.5*(x-e)-0.5; Modified: stable/8/lib/msun/src/s_expm1f.c ============================================================================== --- stable/8/lib/msun/src/s_expm1f.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/8/lib/msun/src/s_expm1f.c Sat Sep 28 08:57:29 2019 (r352835) @@ -92,7 +92,7 @@ expm1f(float x) e = hxs*((r1-t)/((float)6.0 - x*t)); if(k==0) return x - (x*e-hxs); /* c is 0 */ else { - SET_FLOAT_WORD(twopk,0x3f800000+(k<<23)); /* 2^k */ + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+k))<<23); /* 2^k */ e = (x*(e-c)-c); e -= hxs; if(k== -1) return (float)0.5*(x-e)-(float)0.5; From owner-svn-src-stable@freebsd.org Sat Sep 28 08:57:34 2019 Return-Path: Delivered-To: svn-src-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 062B8FFB14; Sat, 28 Sep 2019 08:57:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46gMxT3Z47z3yfY; Sat, 28 Sep 2019 08:57:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4DD2326F42; Sat, 28 Sep 2019 08:57:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x8S8vXeW037177; Sat, 28 Sep 2019 08:57:33 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x8S8vWW6037173; Sat, 28 Sep 2019 08:57:32 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201909280857.x8S8vWW6037173@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 28 Sep 2019 08:57:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r352835 - in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src 8/lib/msun/src 9/lib/msun/src X-SVN-Group: stable-10 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable: 10/lib/msun/src 11/lib/msun/src 12/lib/msun/src 8/lib/msun/src 9/lib/msun/src X-SVN-Commit-Revision: 352835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Sep 2019 08:57:34 -0000 Author: dim Date: Sat Sep 28 08:57:29 2019 New Revision: 352835 URL: https://svnweb.freebsd.org/changeset/base/352835 Log: MFC r352710: Do not left-shift a negative number (inducing undefined behavior in C/C++) in exp(3), expf(3), expm1(3) and expm1f(3) during intermediate computations that compute the IEEE-754 bit pattern for |2**k| for integer |k|. The implementations of exp(3), expf(3), expm1(3) and expm1f(3) need to compute IEEE-754 bit patterns for 2**k in certain places. (k is an integer and 2**k is exactly representable in IEEE-754.) Currently they do things like 0x3FF0'0000+(k<<20), which is to say they take the bit pattern representing 1 and then add directly to the exponent field to get the desired power of two. This is fine when k is non-negative. But when k<0 (and certain classes of input trigger this), this left-shifts a negative number -- an operation with undefined behavior in C and C++. The desired semantics can be achieved by instead adding the possibly-negative k to the IEEE-754 exponent bias to get the desired exponent field, _then_ shifting that into its proper overall position. (Note that in case of s_expm1.c and s_expm1f.c, there are SET_HIGH_WORD and SET_FLOAT_WORD uses further down in each of these files that perform shift operations involving k, but by these points k's range has been restricted to 2 < k <= 56, and the shift operations under those circumstances can't do anything that would be UB.) Submitted by: Jeff Walden, https://github.com/jswalden Obtained from: https://github.com/freebsd/freebsd/pull/411 Obtained from: https://github.com/freebsd/freebsd/pull/412 Modified: stable/10/lib/msun/src/e_exp.c stable/10/lib/msun/src/e_expf.c stable/10/lib/msun/src/s_expm1.c stable/10/lib/msun/src/s_expm1f.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/msun/src/e_exp.c stable/11/lib/msun/src/e_expf.c stable/11/lib/msun/src/s_expm1.c stable/11/lib/msun/src/s_expm1f.c stable/12/lib/msun/src/e_exp.c stable/12/lib/msun/src/e_expf.c stable/12/lib/msun/src/s_expm1.c stable/12/lib/msun/src/s_expm1f.c stable/8/lib/msun/src/e_exp.c stable/8/lib/msun/src/e_expf.c stable/8/lib/msun/src/s_expm1.c stable/8/lib/msun/src/s_expm1f.c stable/9/lib/msun/src/e_exp.c stable/9/lib/msun/src/e_expf.c stable/9/lib/msun/src/s_expm1.c stable/9/lib/msun/src/s_expm1f.c Directory Properties: stable/11/ (props changed) stable/12/ (props changed) stable/8/ (props changed) stable/8/lib/ (props changed) stable/8/lib/msun/ (props changed) stable/9/ (props changed) stable/9/lib/ (props changed) stable/9/lib/msun/ (props changed) Modified: stable/10/lib/msun/src/e_exp.c ============================================================================== --- stable/10/lib/msun/src/e_exp.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/10/lib/msun/src/e_exp.c Sat Sep 28 08:57:29 2019 (r352835) @@ -145,9 +145,9 @@ __ieee754_exp(double x) /* default IEEE double exp */ /* x is now in primary range */ t = x*x; if(k >= -1021) - INSERT_WORDS(twopk,0x3ff00000+(k<<20), 0); + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20, 0); else - INSERT_WORDS(twopk,0x3ff00000+((k+1000)<<20), 0); + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+(k+1000)))<<20, 0); c = x - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); if(k==0) return one-((x*c)/(c-2.0)-x); else y = one-((lo-(x*c)/(2.0-c))-hi); Modified: stable/10/lib/msun/src/e_expf.c ============================================================================== --- stable/10/lib/msun/src/e_expf.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/10/lib/msun/src/e_expf.c Sat Sep 28 08:57:29 2019 (r352835) @@ -83,9 +83,9 @@ __ieee754_expf(float x) /* x is now in primary range */ t = x*x; if(k >= -125) - SET_FLOAT_WORD(twopk,0x3f800000+(k<<23)); + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+k))<<23); else - SET_FLOAT_WORD(twopk,0x3f800000+((k+100)<<23)); + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+(k+100)))<<23); c = x - t*(P1+t*P2); if(k==0) return one-((x*c)/(c-(float)2.0)-x); else y = one-((lo-(x*c)/((float)2.0-c))-hi); Modified: stable/10/lib/msun/src/s_expm1.c ============================================================================== --- stable/10/lib/msun/src/s_expm1.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/10/lib/msun/src/s_expm1.c Sat Sep 28 08:57:29 2019 (r352835) @@ -188,7 +188,7 @@ expm1(double x) e = hxs*((r1-t)/(6.0 - x*t)); if(k==0) return x - (x*e-hxs); /* c is 0 */ else { - INSERT_WORDS(twopk,0x3ff00000+(k<<20),0); /* 2^k */ + INSERT_WORDS(twopk,((u_int32_t)(0x3ff+k))<<20,0); /* 2^k */ e = (x*(e-c)-c); e -= hxs; if(k== -1) return 0.5*(x-e)-0.5; Modified: stable/10/lib/msun/src/s_expm1f.c ============================================================================== --- stable/10/lib/msun/src/s_expm1f.c Sat Sep 28 08:54:32 2019 (r352834) +++ stable/10/lib/msun/src/s_expm1f.c Sat Sep 28 08:57:29 2019 (r352835) @@ -94,7 +94,7 @@ expm1f(float x) e = hxs*((r1-t)/((float)6.0 - x*t)); if(k==0) return x - (x*e-hxs); /* c is 0 */ else { - SET_FLOAT_WORD(twopk,0x3f800000+(k<<23)); /* 2^k */ + SET_FLOAT_WORD(twopk,((u_int32_t)(0x7f+k))<<23); /* 2^k */ e = (x*(e-c)-c); e -= hxs; if(k== -1) return (float)0.5*(x-e)-(float)0.5;